From cvs w lms.org.pl Mon Jan 3 11:05:40 2011 From: cvs w lms.org.pl (LMS CVS) Date: Mon, 3 Jan 2011 11:05:40 +0100 (CET) Subject: [lms-commits] CVS update of lms/modules (print.php) Message-ID: <20110103100540.E0BD33027B21@hydra.altec.pl> Date: Monday, January 3, 2011 @ 11:05:40 Author: alec Path: /cvsroot/lms/modules Modified: print.php - liabilityreport: fixed yearly assignments, added support for halfyearly assignments Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/modules/print.php.diff?&r1=1.136&r2=1.137 Index: lms/modules/print.php diff -u lms/modules/print.php:1.136 lms/modules/print.php:1.137 --- lms/modules/print.php:1.136 Fri Dec 31 11:13:05 2010 +++ lms/modules/print.php Mon Jan 3 11:05:40 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: print.php,v 1.136 2010/12/31 10:13:05 alec Exp $ + * $Id: print.php,v 1.137 2011/01/03 10:05:40 alec Exp $ */ $type = isset($_GET['type']) ? $_GET['type'] : ''; @@ -454,12 +454,13 @@ $direction = $_POST['direction']; $customerid = (isset($_POST['customer']) ? $_POST['customer'] : 0); - $yearday = date('z', $reportday); + $year = date('Y', $reportday); + $yearday = date('z', $reportday) + 1; $month = date('n', $reportday); $monthday = date('j', $reportday); $weekday = date('w', $reportday); - - switch($month) + + switch($month) { case 1: case 4: @@ -472,6 +473,14 @@ default: $quarterday = $monthday + 200; break; } + if ($month > 6) + $halfyear = $monthday + ($month - 7) * 100; + else + $halfyear = $monthday + ($month - 1) * 100; + + if (is_leap_year($year) && $yearday > 31+28) + $yearday -= 1; + $suspension_percentage = $CONFIG['finances']['suspension_percentage']; if($taxes = $LMS->GetTaxes($reportday, $reportday)) @@ -514,10 +523,11 @@ OR (a.period='.WEEKLY.'. AND a.at=?) OR (a.period='.MONTHLY.' AND a.at=?) OR (a.period='.QUARTERLY.' AND a.at=?) + OR (a.period='.HALFYEARLY.' AND a.at=?) OR (a.period='.YEARLY.' AND a.at=?)) ' .($customerid ? 'AND a.customerid='.$customerid : ''). ' GROUP BY a.customerid, lastname, c.name, city, address, ten ', 'id', - array($tax['id'], $reportday, $reportday, $today, $weekday, $monthday, $quarterday, $yearday)); + array($tax['id'], $reportday, $reportday, $today, $weekday, $monthday, $quarterday, $halfyear, $yearday)); $list2 = $DB->GetAllByKey('SELECT a.customerid AS id, '.$DB->Concat('UPPER(lastname)',"' '",'c.name').' AS customername, ' .$DB->Concat('city',"' '",'address').' AS address, ten, @@ -542,10 +552,11 @@ OR (a.period='.WEEKLY.'. AND a.at=?) OR (a.period='.MONTHLY.' AND a.at=?) OR (a.period='.QUARTERLY.' AND a.at=?) + OR (a.period='.HALFYEARLY.' AND a.at=?) OR (a.period='.YEARLY.' AND a.at=?)) ' .($customerid ? 'AND a.customerid='.$customerid : ''). ' GROUP BY a.customerid, lastname, c.name, city, address, ten ', 'id', - array($tax['id'], $reportday, $reportday, $today, $weekday, $monthday, $quarterday, $yearday)); + array($tax['id'], $reportday, $reportday, $today, $weekday, $monthday, $quarterday, $halfyear, $yearday)); $list = array_merge((array) $list1, (array) $list2); From cvs w lms.org.pl Mon Jan 3 11:05:40 2011 From: cvs w lms.org.pl (LMS CVS) Date: Mon, 3 Jan 2011 11:05:40 +0100 (CET) Subject: [lms-commits] CVS update of lms/lib (common.php) Message-ID: <20110103100540.BBB783027B20@hydra.altec.pl> Date: Monday, January 3, 2011 @ 11:05:40 Author: alec Path: /cvsroot/lms/lib Modified: common.php - liabilityreport: fixed yearly assignments, added support for halfyearly assignments Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/lib/common.php.diff?&r1=1.123&r2=1.124 Index: lms/lib/common.php diff -u lms/lib/common.php:1.123 lms/lib/common.php:1.124 --- lms/lib/common.php:1.123 Fri Jul 9 10:45:51 2010 +++ lms/lib/common.php Mon Jan 3 11:05:40 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: common.php,v 1.123 2010/07/09 08:45:51 alec Exp $ + * $Id: common.php,v 1.124 2011/01/03 10:05:40 alec Exp $ */ // Common functions, that making it in class would be nonsense :) @@ -667,6 +667,14 @@ return trans('online'); } +function is_leap_year($year) +{ + if ($year % 4) return false; + if ($year % 100) return true; + if ($year % 400) return false; + return true; +} + /* Functions for modularized LMS */ function plugin_handle($name) { From cvs w lms.org.pl Mon Jan 3 11:43:30 2011 From: cvs w lms.org.pl (LMS CVS) Date: Mon, 3 Jan 2011 11:43:30 +0100 (CET) Subject: [lms-commits] CVS update of lms/modules (invoice_pdf.inc.php) Message-ID: <20110103104330.08E643027B20@hydra.altec.pl> Date: Monday, January 3, 2011 @ 11:43:29 Author: alec Path: /cvsroot/lms/modules Modified: invoice_pdf.inc.php - Invoices: don't print "Expositor:" text when expositor name is empty Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/modules/invoice_pdf.inc.php.diff?&r1=1.4&r2=1.5 Index: lms/modules/invoice_pdf.inc.php diff -u lms/modules/invoice_pdf.inc.php:1.4 lms/modules/invoice_pdf.inc.php:1.5 --- lms/modules/invoice_pdf.inc.php:1.4 Fri Dec 17 09:39:08 2010 +++ lms/modules/invoice_pdf.inc.php Mon Jan 3 11:43:29 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: invoice_pdf.inc.php,v 1.4 2010/12/17 08:39:08 alec Exp $ + * $Id: invoice_pdf.inc.php,v 1.5 2011/01/03 10:43:29 alec Exp $ */ // Faktury w PDF, do użycia z formularzami FT-0100 (c) Polarnet // w razie pytań mailto:lexx w polarnet.org @@ -754,13 +754,15 @@ return $y; } -function invoice_expositor ($x,$y) +function invoice_expositor ($x,$y) { global $pdf, $invoice; - + $expositor = isset($invoice['user']) ? $invoice['user'] : $invoice['division_author']; - - $y = $y - text_align_left($x,$y,10,iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Expositor:')).' '.iconv("UTF-8","ISO-8859-2//TRANSLIT",$expositor)); + + if ($expositor) { + $y = $y - text_align_left($x,$y,10,iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Expositor:')).' '.iconv("UTF-8","ISO-8859-2//TRANSLIT",$expositor)); + } return $y; } From cvs w lms.org.pl Mon Jan 3 11:43:30 2011 From: cvs w lms.org.pl (LMS CVS) Date: Mon, 3 Jan 2011 11:43:30 +0100 (CET) Subject: [lms-commits] CVS update of lms/templates (invoice.html) Message-ID: <20110103104330.2F4823027B21@hydra.altec.pl> Date: Monday, January 3, 2011 @ 11:43:30 Author: alec Path: /cvsroot/lms/templates Modified: invoice.html - Invoices: don't print "Expositor:" text when expositor name is empty Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/templates/invoice.html.diff?&r1=1.68&r2=1.69 Index: lms/templates/invoice.html diff -u lms/templates/invoice.html:1.68 lms/templates/invoice.html:1.69 --- lms/templates/invoice.html:1.68 Fri Dec 17 09:39:08 2010 +++ lms/templates/invoice.html Mon Jan 3 11:43:30 2011 @@ -1,4 +1,4 @@ - +
| + {if $invoice.user || $invoice.division_author} {t}Expositor:{/t} {if $invoice.user}{$invoice.user}{else}{$invoice.division_author}{/if} + {/if} |
{if $invoice.rebate}
From cvs w lms.org.pl Tue Jan 4 11:30:12 2011
From: cvs w lms.org.pl (LMS CVS)
Date: Tue, 4 Jan 2011 11:30:12 +0100 (CET)
Subject: [lms-commits] CVS update of lms/modules (documentadd.php)
Message-ID: <20110104103012.875D43027B20@hydra.altec.pl>
Date: Tuesday, January 4, 2011 @ 11:30:12
Author: alec
Path: /cvsroot/lms/modules
Modified: documentadd.php
- Fix: When customer document is generated and DB error occurs, the file
is saved on disk, but the record is not added to the DB. In this case,
when we generate such document again, we've got "document exists" error.
To prevent this, we can just overwrite document with a md5sum that
doesn't have a reference in database (table documentcontents).
Diff URLs:
http://cvs.lms.org.pl/viewvc/Development/lms/modules/documentadd.php.diff?&r1=1.44&r2=1.45
Index: lms/modules/documentadd.php
diff -u lms/modules/documentadd.php:1.44 lms/modules/documentadd.php:1.45
--- lms/modules/documentadd.php:1.44 Fri May 14 15:00:39 2010
+++ lms/modules/documentadd.php Tue Jan 4 11:30:12 2011
@@ -21,7 +21,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*
- * $Id: documentadd.php,v 1.44 2010/05/14 13:00:39 alec Exp $
+ * $Id: documentadd.php,v 1.45 2011/01/04 10:30:12 alec Exp $
*/
$_DOC_DIR = DOC_DIR;
@@ -184,16 +184,25 @@
if(!$error)
{
- $path = DOC_DIR.'/'.substr($document['md5sum'],0,2);
- @mkdir($path, 0700);
- $newfile = $path.'/'.$document['md5sum'];
- if(!file_exists($newfile))
- {
+ if ($DB->GetOne('SELECT id FROM documentcontents WHERE md5sum = ?',
+ array($document['md5sum']))
+ ) {
+ $error['file'] = trans('Specified file exists in database!');
+ }
+ else {
+ $path = DOC_DIR.'/'.substr($document['md5sum'],0,2);
+ @mkdir($path, 0700);
+ $newfile = $path.'/'.$document['md5sum'];
+
+ // If we have a file with specified md5sum, we assume
+ // it's here because of some error. We can replace it with
+ // the new document file
+ if (file_exists($newfile)) {
+ @unlink($newfile);
+ }
if(!@rename($file, $newfile))
$error['file'] = trans('Can\'t save file in "$0" directory!', $path);
}
- else
- $error['file'] = trans('Specified file exists in database!');
}
if(!$error)
From cvs w lms.org.pl Tue Jan 4 14:07:44 2011
From: cvs w lms.org.pl (LMS CVS)
Date: Tue, 4 Jan 2011 14:07:44 +0100 (CET)
Subject: [lms-commits] CVS update of lms/lib (LMS.class.php)
Message-ID: <20110104130744.7A4E83027B20@hydra.altec.pl>
Date: Tuesday, January 4, 2011 @ 14:07:44
Author: alec
Path: /cvsroot/lms/lib
Modified: LMS.class.php
- Make first argument of GetUserName() optional
Diff URLs:
http://cvs.lms.org.pl/viewvc/Development/lms/lib/LMS.class.php.diff?&r1=1.1045&r2=1.1046
Index: lms/lib/LMS.class.php
diff -u lms/lib/LMS.class.php:1.1045 lms/lib/LMS.class.php:1.1046
--- lms/lib/LMS.class.php:1.1045 Fri Dec 31 13:50:47 2010
+++ lms/lib/LMS.class.php Tue Jan 4 14:07:44 2011
@@ -21,7 +21,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*
- * $Id: LMS.class.php,v 1.1045 2010/12/31 12:50:47 alec Exp $
+ * $Id: LMS.class.php,v 1.1046 2011/01/04 13:07:44 alec Exp $
*/
// LMS Class - contains internal LMS database functions used
@@ -34,7 +34,7 @@
var $CONFIG; // table including lms.ini options
var $cache = array(); // internal cache
var $_version = '1.11-cvs'; // class version
- var $_revision = '$Revision: 1.1045 $';
+ var $_revision = '$Revision: 1.1046 $';
function LMS(&$DB, &$AUTH, &$CONFIG) // class variables setting
{
@@ -167,7 +167,7 @@
}
/*
- * Users (Useristrators)
+ * Users
*/
function SetUserPassword($id, $passwd)
@@ -175,10 +175,10 @@
$this->DB->Execute('UPDATE users SET passwd=? WHERE id=?', array(crypt($passwd), $id));
}
- function GetUserName($id) // returns user name
+ function GetUserName($id=NULL) // returns user name
{
if (!$id)
- return NULL;
+ $id = $this->AUTH->id;
if(!($name = $this->GetCache('users', $id, 'name')))
{
From cvs w lms.org.pl Wed Jan 5 21:40:30 2011
From: cvs w lms.org.pl (LMS CVS)
Date: Wed, 5 Jan 2011 21:40:30 +0100 (CET)
Subject: [lms-commits] CVS update of lms/modules (3 files)
Message-ID: <20110105204030.A740C3027B22@hydra.altec.pl>
Date: Wednesday, January 5, 2011 @ 21:40:30
Author: alec
Path: /cvsroot/lms/modules
Modified: choosecustomer.php chooseip.php choosemac.php
- choose(ip|mac|customer) popups doesn't use a new window
Diff URLs:
http://cvs.lms.org.pl/viewvc/Development/lms/modules/choosecustomer.php.diff?&r1=1.20&r2=1.21
http://cvs.lms.org.pl/viewvc/Development/lms/modules/chooseip.php.diff?&r1=1.52&r2=1.53
http://cvs.lms.org.pl/viewvc/Development/lms/modules/choosemac.php.diff?&r1=1.31&r2=1.32
Index: lms/modules/choosecustomer.php
diff -u lms/modules/choosecustomer.php:1.20 lms/modules/choosecustomer.php:1.21
--- lms/modules/choosecustomer.php:1.20 Fri May 14 10:03:23 2010
+++ lms/modules/choosecustomer.php Wed Jan 5 21:40:30 2011
@@ -21,17 +21,15 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*
- * $Id: choosecustomer.php,v 1.20 2010/05/14 08:03:23 chilek Exp $
+ * $Id: choosecustomer.php,v 1.21 2011/01/05 20:40:30 alec Exp $
*/
$layout['pagetitle'] = trans('Select customer');
$p = isset($_GET['p']) ? $_GET['p'] : '';
-if(!$p)
- $SMARTY->assign('js', 'var targetfield = window.opener.targetfield;');
-elseif($p == 'main')
- $SMARTY->assign('js', 'var targetfield = parent.targetfield;');
+if(!$p || $p == 'main')
+ $SMARTY->assign('js', 'var targetfield = window.parent.targetfield;');
if(isset($_POST['searchcustomer']) && $_POST['searchcustomer'])
{
Index: lms/modules/chooseip.php
diff -u lms/modules/chooseip.php:1.52 lms/modules/chooseip.php:1.53
--- lms/modules/chooseip.php:1.52 Thu Mar 11 14:07:44 2010
+++ lms/modules/chooseip.php Wed Jan 5 21:40:30 2011
@@ -21,7 +21,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*
- * $Id: chooseip.php,v 1.52 2010/03/11 13:07:44 alec Exp $
+ * $Id: chooseip.php,v 1.53 2011/01/05 20:40:30 alec Exp $
*/
$layout['pagetitle'] = trans('Select IP address');
@@ -30,10 +30,8 @@
$p = isset($_GET['p']) ? $_GET['p'] : '';
-if($p=='')
- $js = 'var targetfield = window.opener.targetfield;';
-elseif($p == 'main')
- $js = 'var targetfield = parent.targetfield;';
+if(!$p || $p == 'main')
+ $js = 'var targetfield = window.parent.targetfield;';
else
$js = '';
Index: lms/modules/choosemac.php
diff -u lms/modules/choosemac.php:1.31 lms/modules/choosemac.php:1.32
--- lms/modules/choosemac.php:1.31 Thu Mar 11 14:07:44 2010
+++ lms/modules/choosemac.php Wed Jan 5 21:40:30 2011
@@ -21,7 +21,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*
- * $Id: choosemac.php,v 1.31 2010/03/11 13:07:44 alec Exp $
+ * $Id: choosemac.php,v 1.32 2011/01/05 20:40:30 alec Exp $
*/
$layout['pagetitle'] = trans('Select MAC address');
@@ -30,10 +30,10 @@
$js = '';
if(!$p)
- $js = 'var targetfield = window.opener.targetfield;';
+ $js = 'var targetfield = window.parent.targetfield;';
elseif($p == 'main')
{
- $js = 'var targetfield = parent.targetfield;';
+ $js = 'var targetfield = window.parent.targetfield;';
$maclist = $LMS->GetMACs();
@@ -45,15 +45,15 @@
$res = explode(':', $server);
if(!isset($res[1]) || $res[1] == '')
$res[1] = 1029;
-
+
$remote = $LMS->GetRemoteMACs($res[0], $res[1]);
$maclist = array_merge($maclist, $remote);
}
}
-
+
if(sizeof($maclist))
array_multisort($maclist['longip'],$maclist['mac'],$maclist['ip'],$maclist['nodename']);
-
+
$SMARTY->assign('maclist',$maclist);
}
From cvs w lms.org.pl Wed Jan 5 21:40:30 2011
From: cvs w lms.org.pl (LMS CVS)
Date: Wed, 5 Jan 2011 21:40:30 +0100 (CET)
Subject: [lms-commits] CVS update of lms/doc (ChangeLog)
Message-ID: <20110105204030.4785F3027B20@hydra.altec.pl>
Date: Wednesday, January 5, 2011 @ 21:40:30
Author: alec
Path: /cvsroot/lms/doc
Modified: ChangeLog
- choose(ip|mac|customer) popups doesn't use a new window
Diff URLs:
http://cvs.lms.org.pl/viewvc/Development/lms/doc/ChangeLog.diff?&r1=1.1525&r2=1.1526
Index: lms/doc/ChangeLog
diff -u lms/doc/ChangeLog:1.1525 lms/doc/ChangeLog:1.1526
--- lms/doc/ChangeLog:1.1525 Thu Dec 30 15:32:00 2010
+++ lms/doc/ChangeLog Wed Jan 5 21:40:29 2011
@@ -1,4 +1,4 @@
-$Id: ChangeLog,v 1.1525 2010/12/30 14:32:00 alec Exp $
+$Id: ChangeLog,v 1.1526 2011/01/05 20:40:29 alec Exp $
version ? (????-??-??)
@@ -55,6 +55,7 @@
- added more foreign key constraints in DB structure (alec)
- improved style of popups (alec)
- calendar popups doesn't use a new window (alec)
+ - choose(ip|mac|customer) popups doesn't use a new window (alec)
- added payment period setting for tariffs, so now when mmonthly tariff is assigned
to a customer with yearly period, payment will be accounted once a year with tariff
value multiplied by 12 (alec)
From cvs w lms.org.pl Wed Jan 5 21:40:30 2011
From: cvs w lms.org.pl (LMS CVS)
Date: Wed, 5 Jan 2011 21:40:30 +0100 (CET)
Subject: [lms-commits] CVS update of lms/templates (8 files)
Message-ID: <20110105204031.0D0E53027B20@hydra.altec.pl>
Date: Wednesday, January 5, 2011 @ 21:40:30
Author: alec
Path: /cvsroot/lms/templates
Modified: calendar.html choosecustomer.html choosemac.html
customerinfoshort.html dynpopup.html noaccess.html
rtticketinfoshort.html trafficgraph.html
- choose(ip|mac|customer) popups doesn't use a new window
Diff URLs:
http://cvs.lms.org.pl/viewvc/Development/lms/templates/calendar.html.diff?&r1=1.10&r2=1.11
http://cvs.lms.org.pl/viewvc/Development/lms/templates/choosecustomer.html.diff?&r1=1.7&r2=1.8
http://cvs.lms.org.pl/viewvc/Development/lms/templates/choosemac.html.diff?&r1=1.19&r2=1.20
http://cvs.lms.org.pl/viewvc/Development/lms/templates/customerinfoshort.html.diff?&r1=1.22&r2=1.23
http://cvs.lms.org.pl/viewvc/Development/lms/templates/dynpopup.html.diff?&r1=1.7&r2=1.8
http://cvs.lms.org.pl/viewvc/Development/lms/templates/noaccess.html.diff?&r1=1.14&r2=1.15
http://cvs.lms.org.pl/viewvc/Development/lms/templates/rtticketinfoshort.html.diff?&r1=1.3&r2=1.4
http://cvs.lms.org.pl/viewvc/Development/lms/templates/trafficgraph.html.diff?&r1=1.5&r2=1.6
Index: lms/templates/calendar.html
diff -u lms/templates/calendar.html:1.10 lms/templates/calendar.html:1.11
--- lms/templates/calendar.html:1.10 Thu Dec 23 13:35:13 2010
+++ lms/templates/calendar.html Wed Jan 5 21:40:30 2011
@@ -1,5 +1,5 @@
-
+
@@ -8,6 +8,7 @@
{literal}
+
+
|