From cvs w lms.org.pl Fri Apr 1 08:55:42 2011 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 1 Apr 2011 08:55:42 +0200 (CEST) Subject: [lms-commits] CVS update of lms/daemon/modules/payments (payments.c) Message-ID: <20110401065542.B39153231E7C@eftep.altec.pl> Date: Friday, April 1, 2011 @ 08:55:42 Author: alec Path: /cvsroot/lms/daemon/modules/payments Modified: payments.c - Fixed queries broken when sdate support was added Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/daemon/modules/payments/payments.c.diff?&r1=1.97&r2=1.98 Index: lms/daemon/modules/payments/payments.c diff -u lms/daemon/modules/payments/payments.c:1.97 lms/daemon/modules/payments/payments.c:1.98 --- lms/daemon/modules/payments/payments.c:1.97 Fri Mar 25 11:39:40 2011 +++ lms/daemon/modules/payments/payments.c Fri Apr 1 08:55:42 2011 @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: payments.c,v 1.97 2011/03/25 10:39:40 chilek Exp $ + * $Id: payments.c,v 1.98 2011/04/01 06:55:42 alec Exp $ */ #include #include @@ -731,7 +731,7 @@ // prepare insert to 'invoices' table g->db_pexec(g->conn, "INSERT INTO documents (number, numberplanid, type, countryid, divisionid, " "customerid, name, address, zip, city, ten, ssn, cdate, sdate, paytime, paytype) " - "VALUES (?, ?, 1, ?, ?, ?, '? ?', '?', '?', '?', '?', '?', ?, ?, ?)", + "VALUES (?, ?, 1, ?, ?, ?, '? ?', '?', '?', '?', '?', '?', ?, ?, ?, ?)", itoa(number), numberplanid, countryid, From cvs w lms.org.pl Fri Apr 1 08:55:42 2011 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 1 Apr 2011 08:55:42 +0200 (CEST) Subject: [lms-commits] CVS update of lms/bin (lms-payments) Message-ID: <20110401065542.94CFE3231E7A@eftep.altec.pl> Date: Friday, April 1, 2011 @ 08:55:42 Author: alec Path: /cvsroot/lms/bin Modified: lms-payments - Fixed queries broken when sdate support was added Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/bin/lms-payments.diff?&r1=1.130&r2=1.131 Index: lms/bin/lms-payments diff -u lms/bin/lms-payments:1.130 lms/bin/lms-payments:1.131 --- lms/bin/lms-payments:1.130 Fri Mar 25 11:32:16 2011 +++ lms/bin/lms-payments Fri Apr 1 08:55:42 2011 @@ -20,7 +20,7 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. # -# $Id: lms-payments,v 1.130 2011/03/25 10:32:16 chilek Exp $ +# $Id: lms-payments,v 1.131 2011/04/01 06:55:42 alec Exp $ use strict; use DBI; @@ -540,7 +540,7 @@ my $idbq = $dbase->prepare("INSERT INTO documents (number, numberplanid, type, countryid, divisionid, customerid, name, address, zip, city, ten, ssn, cdate, sdate, paytime, paytype) - VALUES (?, ?, 1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); + VALUES (?, ?, 1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); $idbq->execute($numbers{$plan}, $plan, $urow->{'countryid'}, $urow->{'divisionid'}, $uid, $urow->{'lastname'}.' '.$urow->{'name'}, $urow->{'address'}, $urow->{'zip'}, $urow->{'city'}, $urow->{'ten'}, $urow->{'ssn'}, $currtime, $currtime, $paytime, $inv_paytype); From cvs w lms.org.pl Fri Apr 1 10:13:45 2011 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 1 Apr 2011 10:13:45 +0200 (CEST) Subject: [lms-commits] CVS update of lms/daemon/modules/payments (payments.c) Message-ID: <20110401081345.F25DC3011AC1@eftep.altec.pl> Date: Friday, April 1, 2011 @ 10:13:45 Author: alec Path: /cvsroot/lms/daemon/modules/payments Modified: payments.c - Make sure records to invoicecontents/cash aren't added when insert into documents fails Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/daemon/modules/payments/payments.c.diff?&r1=1.98&r2=1.99 Index: lms/daemon/modules/payments/payments.c diff -u lms/daemon/modules/payments/payments.c:1.98 lms/daemon/modules/payments/payments.c:1.99 --- lms/daemon/modules/payments/payments.c:1.98 Fri Apr 1 08:55:42 2011 +++ lms/daemon/modules/payments/payments.c Fri Apr 1 10:13:45 2011 @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: payments.c,v 1.98 2011/04/01 06:55:42 alec Exp $ + * $Id: payments.c,v 1.99 2011/04/01 08:13:45 alec Exp $ */ #include #include @@ -774,7 +774,7 @@ "WHERE docid = ? AND itemid = ?", value, invoiceid, g->db_get_data(result,0,"itemid")); } - else + else if (docid) { itemid++; @@ -865,7 +865,7 @@ "WHERE docid = ? AND itemid = ?", value, invoiceid, g->db_get_data(result,0,"itemid")); } - else + else if (docid) { itemid++; From cvs w lms.org.pl Fri Apr 1 12:35:11 2011 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 1 Apr 2011 12:35:11 +0200 (CEST) Subject: [lms-commits] CVS update of lms/lib (LMS.class.php) Message-ID: <20110401103512.06DBB3000A88@eftep.altec.pl> Date: Friday, April 1, 2011 @ 12:35:11 Author: alec Path: /cvsroot/lms/lib Modified: LMS.class.php - SQL Injection fixes, performance fixes, code cleanup Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/lib/LMS.class.php.diff?&r1=1.1065&r2=1.1066 Index: lms/lib/LMS.class.php diff -u lms/lib/LMS.class.php:1.1065 lms/lib/LMS.class.php:1.1066 --- lms/lib/LMS.class.php:1.1065 Wed Mar 30 14:42:23 2011 +++ lms/lib/LMS.class.php Fri Apr 1 12:35:11 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: LMS.class.php,v 1.1065 2011/03/30 12:42:23 alec Exp $ + * $Id: LMS.class.php,v 1.1066 2011/04/01 10:35:11 alec Exp $ */ // LMS Class - contains internal LMS database functions used @@ -35,7 +35,7 @@ var $cache = array(); // internal cache var $hooks = array(); // registered plugin hooks var $_version = '1.11-cvs'; // class version - var $_revision = '$Revision: 1.1065 $'; + var $_revision = '$Revision: 1.1066 $'; function LMS(&$DB, &$AUTH, &$CONFIG) // class variables setting { @@ -766,7 +766,6 @@ if(sizeof($search)) foreach($search as $key => $value) { - $value = str_replace(' ','%',trim($value)); if($value!='') { switch($key) @@ -787,31 +786,32 @@ $searchargs[] = $this->DB->Concat('UPPER(c.lastname)',"' '",'UPPER(c.name)').' ?LIKE? UPPER('.$this->DB->Escape("%$value%").')'; break; case 'createdfrom': - if($search['createdto']) - { - $searchargs['createdfrom'] = "(creationdate >= $value AND creationdate <= ".$search['createdto'].')'; + if($search['createdto']) { + $searchargs['createdfrom'] = '(creationdate >= '.intval($value) + .' AND creationdate <= '.intval($search['createdto']).')'; unset($search['createdto']); } else - $searchargs[] = "creationdate >= $value"; + $searchargs[] = 'creationdate >= '.intval($value); break; case 'createdto': if(!isset($searchargs['createdfrom'])) - $searchargs[] = "creationdate <= $value"; + $searchargs[] = 'creationdate <= '.intval($value); break; case 'deletedfrom': if($search['deletedto']) { - $searchargs['deletedfrom'] = "(moddate >= $value AND moddate <= ".$search['deletedto'].')'; + $searchargs['deletedfrom'] = '(moddate >= '.intval($value) + .' AND moddate <= '.intval($search['deletedto']).')'; unset($search['deletedto']); } else - $searchargs[] = "moddate >= $value"; + $searchargs[] = 'moddate >= '.intval($value); $deleted = 1; break; case 'deletedto': if(!isset($searchargs['deletedfrom'])) - $searchargs[] = "moddate <= $value"; + $searchargs[] = 'moddate <= '.intval($value); $deleted = 1; break; case 'type': @@ -843,7 +843,7 @@ if(isset($searchargs)) $sqlsarg = implode(' '.$sqlskey.' ',$searchargs); - $suspension_percentage = $this->CONFIG['finances']['suspension_percentage']; + $suspension_percentage = f_round($this->CONFIG['finances']['suspension_percentage']); if($customerlist = $this->DB->GetAll( 'SELECT c.id AS id, '.$this->DB->Concat('UPPER(lastname)',"' '",'c.name').' AS customername, @@ -906,7 +906,7 @@ .($network ? ' AND EXISTS (SELECT 1 FROM nodes WHERE ownerid = c.id AND ((ipaddr > '.$net['address'].' AND ipaddr < '.$net['broadcast'].') OR (ipaddr_pub > '.$net['address'].' AND ipaddr_pub < '.$net['broadcast'].')))' : '') - .($customergroup ? ' AND customergroupid='.$customergroup : '') + .($customergroup ? ' AND customergroupid='.intval($customergroup) : '') .($nodegroup ? ' AND EXISTS (SELECT 1 FROM nodegroupassignments na JOIN nodes n ON (n.id = na.nodeid) WHERE n.ownerid = c.id AND na.nodegroupid = '.intval($nodegroup).')' : '') @@ -1020,7 +1020,7 @@ ($direction == 'ASC' || $direction == 'asc') ? $direction == 'ASC' : $direction == 'DESC'; $saldolist = array(); - + if($tslist = $this->DB->GetAll('SELECT cash.id AS id, time, cash.type AS type, cash.value AS value, taxes.label AS tax, cash.customerid AS customerid, comment, docid, users.name AS username, @@ -1029,8 +1029,8 @@ LEFT JOIN users ON users.id = cash.userid LEFT JOIN documents ON documents.id = docid LEFT JOIN taxes ON cash.taxid = taxes.id - WHERE cash.customerid=? ' - .($totime ? ' AND time <= '.$totime : '') + WHERE cash.customerid = ?' + .($totime ? ' AND time <= '.intval($totime) : '') .' ORDER BY time ' . $direction, array($id))) { $saldolist['balance'] = 0; @@ -1042,14 +1042,14 @@ // old format wrapper foreach($row as $column => $value) $saldolist[$column][$i] = $value; - + $saldolist['after'][$i] = round($saldolist['balance'] + $row['value'], 2); $saldolist['balance'] += $row['value']; $saldolist['date'][$i] = date('Y/m/d H:i', $row['time']); - + $i++; } - + $saldolist['total'] = sizeof($tslist); } @@ -1472,9 +1472,9 @@ OR (n.ipaddr_pub > '.$net['address'].' AND n.ipaddr_pub < '.$net['broadcast'].'))' : '') .($status==1 ? ' AND n.access = 1' : '') //connected .($status==2 ? ' AND n.access = 0' : '') //disconnected - .($status==3 ? ' AND n.lastonline > ?NOW? - '.$this->CONFIG['phpui']['lastonline_limit'] : '') //online - .($customergroup ? ' AND customergroupid = '.$customergroup : '') - .($nodegroup ? ' AND nodegroupid = '.$nodegroup : '') + .($status==3 ? ' AND n.lastonline > ?NOW? - '.intval($this->CONFIG['phpui']['lastonline_limit']) : '') //online + .($customergroup ? ' AND customergroupid = '.intval($customergroup) : '') + .($nodegroup ? ' AND nodegroupid = '.intval($nodegroup) : '') .(isset($searchargs) ? $searchargs : '') .($sqlord != '' ? $sqlord.' '.$direction : ''))) { @@ -3009,7 +3009,7 @@ $assigned += $row['assigned']; $online += $row['online']; } - + $networks['size'] = $size; $networks['assigned'] = $assigned; $networks['online'] = $online; @@ -3626,10 +3626,10 @@ if(!($queue = $this->GetCache('rttickets', $ticket, 'queueid'))) $queue = $this->DB->GetOne('SELECT queueid FROM rttickets WHERE id=?', array($ticket)); } - + if (!$queue) return 0; - + $rights = $this->DB->GetOne('SELECT rights FROM rtrights WHERE userid=? AND queueid=?', array($user, $queue)); @@ -3785,7 +3785,7 @@ // $ticket['requestor'] = str_replace(' <'.$ticket['requestoremail'].'>','',$ticket['requestor']); $ticket['status'] = $RT_STATES[$ticket['state']]; $ticket['uptime'] = uptimef($ticket['resolvetime'] ? $ticket['resolvetime'] - $ticket['createtime'] : time() - $ticket['createtime']); - + return $ticket; } @@ -3878,10 +3878,10 @@ 'mail_limit' => 0, 'sql_limit' => 0, 'quota_sh_limit' => 0, - 'quota_www_limit' => 0, - 'quota_ftp_limit' => 0, + 'quota_www_limit' => 0, + 'quota_ftp_limit' => 0, 'quota_mail_limit' => 0, - 'quota_sql_limit' => 0, + 'quota_sql_limit' => 0, ); if($limits = $this->DB->GetAll('SELECT alias_limit, domain_limit, sh_limit, @@ -4032,11 +4032,11 @@ $content = unserialize((string)$content); $content['regdata'] = unserialize((string)$content['regdata']); - + if(is_array($content['regdata'])) { $this->DB->Execute('DELETE FROM dbinfo WHERE keytype LIKE ?', array('regdata_%')); - + foreach(array('id', 'name', 'url', 'hidden') as $key) $this->DB->Execute('INSERT INTO dbinfo (keytype, keyvalue) VALUES (?, ?)', array('regdata_'.$key, $content['regdata'][$key])); @@ -4491,20 +4491,20 @@ else $list[$idx]['next'] = 1; } - + return $list; } - + function GetNewDocumentNumber($doctype=NULL, $planid=NULL, $cdate=NULL) { if($planid) $period = $this->DB->GetOne('SELECT period FROM numberplans WHERE id=?', array($planid)); else $planid = 0; - + $period = isset($period) ? $period : YEARLY; $cdate = $cdate ? $cdate : time(); - + switch($period) { case DAILY: @@ -4749,14 +4749,13 @@ } if(isset($searchargs)) - $searchargs = ' AND ('.implode(' '.$sqlskey.' ',$searchargs).')'; + $searchargs = ' WHERE '.implode(' '.$sqlskey.' ',$searchargs); $voipaccountlist = $this->DB->GetAll('SELECT v.id, v.login, v.passwd, v.phone, v.ownerid, ' .$this->DB->Concat('c.lastname',"' '",'c.name').' AS owner FROM voipaccounts v JOIN customersview c ON (v.ownerid = c.id) ' - .' WHERE 1=1 ' .(isset($searchargs) ? $searchargs : '') .($sqlord != '' ? $sqlord.' '.$direction : '')); From cvs w lms.org.pl Fri Apr 1 12:35:12 2011 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 1 Apr 2011 12:35:12 +0200 (CEST) Subject: [lms-commits] CVS update of lms/modules (32 files) Message-ID: <20110401103513.15FEC300023F@eftep.altec.pl> Date: Friday, April 1, 2011 @ 12:35:12 Author: alec Path: /cvsroot/lms/modules Modified: balancelist.php cashregedit.php cashreglogadd.php cashreglogdel.php cashreglogedit.php cashregloginfo.php cashreglogview.php choosecustomer.php customerprint.php divisionlist.php documentlist.php documenttypes.php documentview.php domainlist.php eventlist.php eventprint.php export.php invoice.php invoice_pdf.php invoicelist.php invoicereport.php numberplanlist.php print.php quicksearch.php receipt.php receipt_pdf.php receiptlist.php rtsearch.php rtticketview.php statelist.php taxratelist.php traffic.php - SQL Injection fixes, performance fixes, code cleanup Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/modules/balancelist.php.diff?&r1=1.64&r2=1.65 http://cvs.lms.org.pl/viewvc/Development/lms/modules/cashregedit.php.diff?&r1=1.11&r2=1.12 http://cvs.lms.org.pl/viewvc/Development/lms/modules/cashreglogadd.php.diff?&r1=1.11&r2=1.12 http://cvs.lms.org.pl/viewvc/Development/lms/modules/cashreglogdel.php.diff?&r1=1.9&r2=1.10 http://cvs.lms.org.pl/viewvc/Development/lms/modules/cashreglogedit.php.diff?&r1=1.10&r2=1.11 http://cvs.lms.org.pl/viewvc/Development/lms/modules/cashregloginfo.php.diff?&r1=1.8&r2=1.9 http://cvs.lms.org.pl/viewvc/Development/lms/modules/cashreglogview.php.diff?&r1=1.7&r2=1.8 http://cvs.lms.org.pl/viewvc/Development/lms/modules/choosecustomer.php.diff?&r1=1.22&r2=1.23 http://cvs.lms.org.pl/viewvc/Development/lms/modules/customerprint.php.diff?&r1=1.21&r2=1.22 http://cvs.lms.org.pl/viewvc/Development/lms/modules/divisionlist.php.diff?&r1=1.4&r2=1.5 http://cvs.lms.org.pl/viewvc/Development/lms/modules/documentlist.php.diff?&r1=1.26&r2=1.27 http://cvs.lms.org.pl/viewvc/Development/lms/modules/documenttypes.php.diff?&r1=1.3&r2=1.4 http://cvs.lms.org.pl/viewvc/Development/lms/modules/documentview.php.diff?&r1=1.16&r2=1.17 http://cvs.lms.org.pl/viewvc/Development/lms/modules/domainlist.php.diff?&r1=1.32&r2=1.33 http://cvs.lms.org.pl/viewvc/Development/lms/modules/eventlist.php.diff?&r1=1.25&r2=1.26 http://cvs.lms.org.pl/viewvc/Development/lms/modules/eventprint.php.diff?&r1=1.21&r2=1.22 http://cvs.lms.org.pl/viewvc/Development/lms/modules/export.php.diff?&r1=1.16&r2=1.17 http://cvs.lms.org.pl/viewvc/Development/lms/modules/invoice.php.diff?&r1=1.84&r2=1.85 http://cvs.lms.org.pl/viewvc/Development/lms/modules/invoice_pdf.php.diff?&r1=1.96&r2=1.97 http://cvs.lms.org.pl/viewvc/Development/lms/modules/invoicelist.php.diff?&r1=1.65&r2=1.66 http://cvs.lms.org.pl/viewvc/Development/lms/modules/invoicereport.php.diff?&r1=1.47&r2=1.48 http://cvs.lms.org.pl/viewvc/Development/lms/modules/numberplanlist.php.diff?&r1=1.15&r2=1.16 http://cvs.lms.org.pl/viewvc/Development/lms/modules/print.php.diff?&r1=1.140&r2=1.141 http://cvs.lms.org.pl/viewvc/Development/lms/modules/quicksearch.php.diff?&r1=1.73&r2=1.74 http://cvs.lms.org.pl/viewvc/Development/lms/modules/receipt.php.diff?&r1=1.25&r2=1.26 http://cvs.lms.org.pl/viewvc/Development/lms/modules/receipt_pdf.php.diff?&r1=1.15&r2=1.16 http://cvs.lms.org.pl/viewvc/Development/lms/modules/receiptlist.php.diff?&r1=1.28&r2=1.29 http://cvs.lms.org.pl/viewvc/Development/lms/modules/rtsearch.php.diff?&r1=1.48&r2=1.49 http://cvs.lms.org.pl/viewvc/Development/lms/modules/rtticketview.php.diff?&r1=1.42&r2=1.43 http://cvs.lms.org.pl/viewvc/Development/lms/modules/statelist.php.diff?&r1=1.4&r2=1.5 http://cvs.lms.org.pl/viewvc/Development/lms/modules/taxratelist.php.diff?&r1=1.12&r2=1.13 http://cvs.lms.org.pl/viewvc/Development/lms/modules/traffic.php.diff?&r1=1.57&r2=1.58 Index: lms/modules/balancelist.php diff -u lms/modules/balancelist.php:1.64 lms/modules/balancelist.php:1.65 --- lms/modules/balancelist.php:1.64 Tue Jan 18 09:12:20 2011 +++ lms/modules/balancelist.php Fri Apr 1 12:35:12 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: balancelist.php,v 1.64 2011/01/18 08:12:20 alec Exp $ + * $Id: balancelist.php,v 1.65 2011/04/01 10:35:12 alec Exp $ */ function GetBalanceList($search=NULL, $cat=NULL, $group=NULL, $pagelimit=100, $page=NULL, $from, $to) @@ -42,7 +42,7 @@ $where = ' AND documents.number = '.intval($search); break; case 'cdate': - $where = ' AND cash.time >= '.$search.' AND cash.time < '.($search+86400); + $where = ' AND cash.time >= '.intval($search).' AND cash.time < '.(intval($search)+86400); break; case 'ten': $where = ' AND c.ten = '.$DB->Escape($search); @@ -68,9 +68,9 @@ } if($from) - $where .= ' AND cash.time >= '.$from; + $where .= ' AND cash.time >= '.intval($from); if($to) - $where .= ' AND cash.time <= '.$to; + $where .= ' AND cash.time <= '.intval($to); if($res = $DB->Exec('SELECT cash.id AS id, time, cash.userid AS userid, cash.value AS value, cash.customerid AS customerid, comment, docid, cash.type AS type, Index: lms/modules/cashregedit.php diff -u lms/modules/cashregedit.php:1.11 lms/modules/cashregedit.php:1.12 --- lms/modules/cashregedit.php:1.11 Tue Jan 18 09:12:20 2011 +++ lms/modules/cashregedit.php Fri Apr 1 12:35:12 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: cashregedit.php,v 1.11 2011/01/18 08:12:20 alec Exp $ + * $Id: cashregedit.php,v 1.12 2011/04/01 10:35:12 alec Exp $ */ $id = intval($_GET['id']); @@ -59,13 +59,14 @@ isset($registry['disabled']) ? 1 : 0, $registry['id'] )); - + $DB->Execute('DELETE FROM cashrights WHERE regid=?', array($registry['id'])); if($registry['rights']) foreach($registry['rights'] as $right) - if($right['rights']) - $DB->Execute('INSERT INTO cashrights (regid, userid, rights) VALUES(?, ?, ?)', array($id, $right['id'], $right['rights'])); - + if($right['rights']) + $DB->Execute('INSERT INTO cashrights (regid, userid, rights) VALUES(?, ?, ?)', + array($id, $right['id'], $right['rights'])); + $DB->CommitTrans(); $SESSION->redirect('?m=cashreginfo&id='.$id); } Index: lms/modules/cashreglogadd.php diff -u lms/modules/cashreglogadd.php:1.11 lms/modules/cashreglogadd.php:1.12 --- lms/modules/cashreglogadd.php:1.11 Tue Jan 18 09:12:20 2011 +++ lms/modules/cashreglogadd.php Fri Apr 1 12:35:12 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: cashreglogadd.php,v 1.11 2011/01/18 08:12:20 alec Exp $ + * $Id: cashreglogadd.php,v 1.12 2011/04/01 10:35:12 alec Exp $ */ $regid = isset($_GET['regid']) ? $_GET['regid'] : 0; @@ -64,7 +64,7 @@ // date format 'yyyy/mm/dd hh:mm' $date = explode('/', $matches[1]); $time = explode(':', $matches[2]); - + if(checkdate($date[1],$date[2],(int)$date[0])) { if (!strlen($time[0]) || !strlen($time[1])) @@ -72,10 +72,10 @@ $time = mktime($time[0],$time[1],0,$date[1],$date[2],$date[0]); } else - $error['time'] = trans('Wrong datetime format!'); + $error['time'] = trans('Wrong datetime format!'); } else - $error['time'] = trans('Wrong datetime format!'); + $error['time'] = trans('Wrong datetime format!'); } else $time = time(); @@ -86,7 +86,7 @@ LEFT JOIN documents ON (docid = documents.id) WHERE cdate <= ? AND regid = ?', array($time, $regid)); - + $DB->Execute('INSERT INTO cashreglog (time, description, value, regid, userid, snapshot) VALUES(?, ?, ?, ?, ?, ?)', array($time, Index: lms/modules/cashreglogdel.php diff -u lms/modules/cashreglogdel.php:1.9 lms/modules/cashreglogdel.php:1.10 --- lms/modules/cashreglogdel.php:1.9 Tue Jan 18 09:12:20 2011 +++ lms/modules/cashreglogdel.php Fri Apr 1 12:35:12 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: cashreglogdel.php,v 1.9 2011/01/18 08:12:20 alec Exp $ + * $Id: cashreglogdel.php,v 1.10 2011/04/01 10:35:12 alec Exp $ */ if(isset($_GET['is_sure'])) @@ -32,14 +32,14 @@ { $SESSION->redirect('?m=cashreglist'); } - + if($DB->GetOne('SELECT rights FROM cashrights WHERE userid=? AND regid=?', array($AUTH->id, $regid))<256) { $SMARTY->display('noaccess.html'); $SESSION->close(); die; } - + $DB->Execute('DELETE FROM cashreglog WHERE id = ?', array(intval($_GET['id']))); } Index: lms/modules/cashreglogedit.php diff -u lms/modules/cashreglogedit.php:1.10 lms/modules/cashreglogedit.php:1.11 --- lms/modules/cashreglogedit.php:1.10 Tue Jan 18 09:12:20 2011 +++ lms/modules/cashreglogedit.php Fri Apr 1 12:35:12 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: cashreglogedit.php,v 1.10 2011/01/18 08:12:20 alec Exp $ + * $Id: cashreglogedit.php,v 1.11 2011/04/01 10:35:12 alec Exp $ */ $reglog = $DB->GetRow('SELECT * FROM cashreglog WHERE id = ?', array(intval($_GET['id']))); @@ -62,7 +62,7 @@ // date format 'yyyy/mm/dd hh:mm' $date = explode('/', $matches[1]); $time = explode(':', $matches[2]); - + if(checkdate($date[1],$date[2],(int)$date[0])) { if (!strlen($time[0]) || !strlen($time[1])) @@ -70,7 +70,7 @@ $time = mktime($time[0],$time[1],0,$date[1],$date[2],$date[0]); } else - $error['time'] = trans('Wrong datetime format!'); + $error['time'] = trans('Wrong datetime format!'); } else $error['time'] = trans('Wrong datetime format!'); Index: lms/modules/cashregloginfo.php diff -u lms/modules/cashregloginfo.php:1.8 lms/modules/cashregloginfo.php:1.9 --- lms/modules/cashregloginfo.php:1.8 Tue Jan 18 09:12:20 2011 +++ lms/modules/cashregloginfo.php Fri Apr 1 12:35:12 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: cashregloginfo.php,v 1.8 2011/01/18 08:12:20 alec Exp $ + * $Id: cashregloginfo.php,v 1.9 2011/04/01 10:35:12 alec Exp $ */ $reglog = $DB->GetRow('SELECT l.*, users.name AS username @@ -34,7 +34,7 @@ { $SESSION->redirect('?m=cashreglist'); } - + if(!$DB->GetOne('SELECT rights FROM cashrights WHERE userid=? AND regid=?', array($AUTH->id, $reglog['regid']))) { $SMARTY->display('noaccess.html'); Index: lms/modules/cashreglogview.php diff -u lms/modules/cashreglogview.php:1.7 lms/modules/cashreglogview.php:1.8 --- lms/modules/cashreglogview.php:1.7 Tue Jan 18 09:12:20 2011 +++ lms/modules/cashreglogview.php Fri Apr 1 12:35:12 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: cashreglogview.php,v 1.7 2011/01/18 08:12:20 alec Exp $ + * $Id: cashreglogview.php,v 1.8 2011/04/01 10:35:12 alec Exp $ */ function GetCashLog($order='time,asc', $regid=0) @@ -103,7 +103,7 @@ if ($SESSION->is_set('crlp') && !isset($_GET['page'])) $SESSION->restore('crlp', $_GET['page']); - + $page = (!isset($_GET['page']) ? 1 : $_GET['page']); $pagelimit = (!isset($CONFIG['phpui']['cashreglog_pagelimit']) ? $listdata['total'] : $CONFIG['phpui']['cashreglog_pagelimit']); $start = ($page - 1) * $pagelimit; Index: lms/modules/choosecustomer.php diff -u lms/modules/choosecustomer.php:1.22 lms/modules/choosecustomer.php:1.23 --- lms/modules/choosecustomer.php:1.22 Tue Jan 18 09:12:20 2011 +++ lms/modules/choosecustomer.php Fri Apr 1 12:35:12 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: choosecustomer.php,v 1.22 2011/01/18 08:12:20 alec Exp $ + * $Id: choosecustomer.php,v 1.23 2011/04/01 10:35:12 alec Exp $ */ $layout['pagetitle'] = trans('Select customer'); @@ -44,7 +44,7 @@ .' OR UPPER(email) LIKE UPPER('.$DB->Escape('%'.$search.'%').')' .' OR UPPER('.$DB->Concat('lastname',"' '",'c.name').') LIKE UPPER('.$DB->Escape('%'.$search.'%').')' .' OR UPPER(address) LIKE UPPER('.$DB->Escape('%'.$search.'%').')) '; - + $SMARTY->assign('searchcustomer', $search); } @@ -58,7 +58,7 @@ .' OR UPPER(mac) LIKE UPPER('.$DB->Escape('%'.$search.'%').')' .' OR UPPER(location) LIKE UPPER('.$DB->Escape('%'.$search.'%').')' .' OR UPPER(nodes.name) LIKE UPPER('.$DB->Escape('%'.$search.'%').')) '; - + $SMARTY->assign('searchnode', $search); } Index: lms/modules/customerprint.php diff -u lms/modules/customerprint.php:1.21 lms/modules/customerprint.php:1.22 --- lms/modules/customerprint.php:1.21 Tue Jan 18 09:12:21 2011 +++ lms/modules/customerprint.php Fri Apr 1 12:35:12 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: customerprint.php,v 1.21 2011/01/18 08:12:21 alec Exp $ + * $Id: customerprint.php,v 1.22 2011/04/01 10:35:12 alec Exp $ */ $type = isset($_GET['type']) ? $_GET['type'] : ''; @@ -133,11 +133,13 @@ $date['to'] = mktime(23,59,59); //koniec dnia dzisiejszego } - $layout['pagetitle'] = trans('Customer $0 Balance Sheet ($1 to $2)',$LMS->GetCustomerName($_POST['customer']), ($from ? $from : ''), $to); - + $layout['pagetitle'] = trans('Customer $0 Balance Sheet ($1 to $2)', + $LMS->GetCustomerName($_POST['customer']), ($from ? $from : ''), $to); + $id = $_POST['customer']; - if($tslist = $DB->GetAll('SELECT cash.id AS id, time, cash.value AS value, taxes.label AS taxlabel, customerid, comment, name AS username + if($tslist = $DB->GetAll('SELECT cash.id AS id, time, cash.value AS value, + taxes.label AS taxlabel, customerid, comment, name AS username FROM cash LEFT JOIN taxes ON (taxid = taxes.id) LEFT JOIN users ON users.id=userid Index: lms/modules/divisionlist.php diff -u lms/modules/divisionlist.php:1.4 lms/modules/divisionlist.php:1.5 --- lms/modules/divisionlist.php:1.4 Tue Jan 18 09:12:22 2011 +++ lms/modules/divisionlist.php Fri Apr 1 12:35:12 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: divisionlist.php,v 1.4 2011/01/18 08:12:22 alec Exp $ + * $Id: divisionlist.php,v 1.5 2011/04/01 10:35:12 alec Exp $ */ $divisionlist = $DB->GetAll('SELECT d.id, d.name, d.shortname, d.status, @@ -32,7 +32,7 @@ if ($SESSION->is_set('cdlp') && !isset($_GET['page'])) $SESSION->restore('cdlp', $_GET['page']); - + $page = (!isset($_GET['page']) ? 1 : $_GET['page']); $pagelimit = (!isset($CONFIG['phpui']['divisionlist_pagelimit']) ? $listdata['total'] : $CONFIG['phpui']['divisionlist_pagelimit']); $start = ($page - 1) * $pagelimit; Index: lms/modules/documentlist.php diff -u lms/modules/documentlist.php:1.26 lms/modules/documentlist.php:1.27 --- lms/modules/documentlist.php:1.26 Tue Jan 18 09:12:22 2011 +++ lms/modules/documentlist.php Fri Apr 1 12:35:12 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: documentlist.php,v 1.26 2011/01/18 08:12:22 alec Exp $ + * $Id: documentlist.php,v 1.27 2011/04/01 10:35:12 alec Exp $ */ function GetDocumentList($order='cdate,asc', $type=NULL, $customer=NULL, $from=0, $to=0) @@ -30,10 +30,10 @@ if($order=='') $order='cdate,asc'; - + list($order,$direction) = sscanf($order, '%[^,],%s'); ($direction=='desc') ? $direction = 'desc' : $direction = 'asc'; - + switch($order) { case 'type': Index: lms/modules/documenttypes.php diff -u lms/modules/documenttypes.php:1.3 lms/modules/documenttypes.php:1.4 --- lms/modules/documenttypes.php:1.3 Tue Jan 18 09:12:22 2011 +++ lms/modules/documenttypes.php Fri Apr 1 12:35:12 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: documenttypes.php,v 1.3 2011/01/18 08:12:22 alec Exp $ + * $Id: documenttypes.php,v 1.4 2011/04/01 10:35:12 alec Exp $ */ $typelist = $DOCTYPES; @@ -34,7 +34,7 @@ $SESSION->restore('dtlp', $_GET['page']); $listdata['total'] = sizeof($typelist); - + $page = (!isset($_GET['page']) ? 1 : $_GET['page']); $pagelimit = (!isset($CONFIG['phpui']['documenttypes_pagelimit']) ? $listdata['total'] : $CONFIG['phpui']['documenttypes_pagelimit']); $start = ($page - 1) * $pagelimit; Index: lms/modules/documentview.php diff -u lms/modules/documentview.php:1.16 lms/modules/documentview.php:1.17 --- lms/modules/documentview.php:1.16 Tue Jan 18 09:12:22 2011 +++ lms/modules/documentview.php Fri Apr 1 12:35:12 2011 @@ -21,14 +21,14 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: documentview.php,v 1.16 2011/01/18 08:12:22 alec Exp $ + * $Id: documentview.php,v 1.17 2011/04/01 10:35:12 alec Exp $ */ if(!empty($_POST['marks'])) { $marks = array(); foreach($_POST['marks'] as $id => $mark) - $marks[] = intval($mark); + $marks[] = intval($mark); if ($list = $DB->GetAll('SELECT c.filename, c.md5sum, c.contenttype FROM documentcontents c @@ -38,7 +38,7 @@ AND r.userid = ? AND (r.rights & 1) = 1', array($AUTH->id))) { $ctype = $list[0]['contenttype']; - + if (!preg_match('/^text/i', $ctype)) { if (sizeof($list)) Index: lms/modules/domainlist.php diff -u lms/modules/domainlist.php:1.32 lms/modules/domainlist.php:1.33 --- lms/modules/domainlist.php:1.32 Tue Jan 18 09:12:22 2011 +++ lms/modules/domainlist.php Fri Apr 1 12:35:12 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: domainlist.php,v 1.32 2011/01/18 08:12:22 alec Exp $ + * $Id: domainlist.php,v 1.33 2011/04/01 10:35:12 alec Exp $ */ function GetDomainList($order='name,asc', $customer='', $filtr='') @@ -49,8 +49,7 @@ default: $sqlord = " ORDER BY d.name $direction"; break; - - } + } if ($filtr == '0-9') { if ($CONFIG['database']['type'] == 'postgres') @@ -62,7 +61,7 @@ $where[] = 'd.name LIKE '.$DB->Escape("$filtr%"); } if ($customer!='') - $where[] = 'd.ownerid = '.intval($customer); + $where[] = 'd.ownerid = '.intval($customer); $where = !empty($where) ? ' WHERE '.implode(' AND ', $where) : ''; @@ -73,7 +72,7 @@ LEFT JOIN customers c ON (d.ownerid = c.id)' .$where .($sqlord != '' ? $sqlord : '')); - + $list['total'] = sizeof($list); $list['order'] = $order; $list['direction'] = $direction; @@ -86,9 +85,6 @@ { global $DB; - if ($customer!='') - 'WHERE ownerid = '.intval($customer); - if ($list = $DB->GetAllByKey('SELECT DISTINCT UPPER(SUBSTR(name, 1, 1)) AS idx FROM domains' .($customer!='' ? ' WHERE ownerid = '.intval($customer) : '') @@ -101,7 +97,7 @@ unset($list[$idx]); } } - + return $list; } Index: lms/modules/eventlist.php diff -u lms/modules/eventlist.php:1.25 lms/modules/eventlist.php:1.26 --- lms/modules/eventlist.php:1.25 Tue Jan 18 09:12:22 2011 +++ lms/modules/eventlist.php Fri Apr 1 12:35:12 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: eventlist.php,v 1.25 2011/01/18 08:12:22 alec Exp $ + * $Id: eventlist.php,v 1.26 2011/04/01 10:35:12 alec Exp $ */ function GetEventList($year=NULL, $month=NULL, $day=NULL, $forward=0, $customerid=0, $userid=0) @@ -31,10 +31,10 @@ if(!$year) $year = date('Y',time()); if(!$month) $month = date('n',time()); if(!$day) $day = date('j',time()); - + $startdate = mktime(0,0,0, $month, $day, $year); $enddate = mktime(0,0,0, $month, $day+$forward, $year); - + $list = $DB->GetAll( 'SELECT events.id AS id, title, description, date, begintime, endtime, customerid, closed, ' .$DB->Concat('UPPER(customers.lastname)',"' '",'customers.name').' AS customername, Index: lms/modules/eventprint.php diff -u lms/modules/eventprint.php:1.21 lms/modules/eventprint.php:1.22 --- lms/modules/eventprint.php:1.21 Tue Jan 18 09:12:22 2011 +++ lms/modules/eventprint.php Fri Apr 1 12:35:12 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: eventprint.php,v 1.21 2011/01/18 08:12:22 alec Exp $ + * $Id: eventprint.php,v 1.22 2011/04/01 10:35:12 alec Exp $ */ function GetEvents($date=NULL, $userid=0, $customerid=0) @@ -35,7 +35,7 @@ (SELECT phone FROM customercontacts WHERE customerid = customers.id ORDER BY id LIMIT 1) AS customerphone FROM events LEFT JOIN customers ON (customerid = customers.id) WHERE date = ? AND (private = 0 OR (private = 1 AND userid = ?)) ' - .($customerid ? 'AND customerid = '.$customerid : '') + .($customerid ? 'AND customerid = '.intval($customerid) : '') .' ORDER BY begintime', array($date, $AUTH->id)); @@ -57,8 +57,8 @@ } if($userid) - return $list2; - else + return $list2; + else return $list; } Index: lms/modules/export.php diff -u lms/modules/export.php:1.16 lms/modules/export.php:1.17 --- lms/modules/export.php:1.16 Sat Mar 12 19:31:39 2011 +++ lms/modules/export.php Fri Apr 1 12:35:12 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: export.php,v 1.16 2011/03/12 18:31:39 alec Exp $ + * $Id: export.php,v 1.17 2011/04/01 10:35:12 alec Exp $ */ include(isset($CONFIG['phpui']['export_config']) && $CONFIG['phpui']['export_config'] ? $CONFIG['phpui']['export_config'] : 'exportcfg.php'); @@ -51,15 +51,15 @@ $registry = intval($_POST['registry']); $user = intval($_POST['user']); $where = ''; - + if($registry) - $where .= ' AND regid = '.$registry; + $where .= ' AND regid = '.intval($registry); if($from) $where .= ' AND cdate >= '.$from; if($to) $where .= ' AND cdate <= '.$to; if($user) - $where .= ' AND userid = '.$user; + $where .= ' AND userid = '.intval($user); // wysyłamy ... header('Content-Type: application/octetstream'); @@ -96,7 +96,7 @@ { $line = $record ? $record : $cash_record; $i++; - + $clariondate = intval($row['cdate']/86400)+61731; $date = date($date_format, $row['cdate']); $number = docnumber($row['number'], $row['template'], $row['cdate'], $row['extnumber']); Index: lms/modules/invoice.php diff -u lms/modules/invoice.php:1.84 lms/modules/invoice.php:1.85 --- lms/modules/invoice.php:1.84 Tue Jan 18 09:12:23 2011 +++ lms/modules/invoice.php Fri Apr 1 12:35:12 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: invoice.php,v 1.84 2011/01/18 08:12:23 alec Exp $ + * $Id: invoice.php,v 1.85 2011/04/01 10:35:12 alec Exp $ */ if(strtolower($CONFIG['invoices']['type']) == 'pdf') @@ -47,7 +47,7 @@ $ilm[$id] = $mark; if(sizeof($ilm)) foreach($ilm as $mark) - $ids[] = $mark; + $ids[] = intval($mark); if(empty($ids)) { Index: lms/modules/invoice_pdf.php diff -u lms/modules/invoice_pdf.php:1.96 lms/modules/invoice_pdf.php:1.97 --- lms/modules/invoice_pdf.php:1.96 Tue Jan 18 09:12:23 2011 +++ lms/modules/invoice_pdf.php Fri Apr 1 12:35:12 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: invoice_pdf.php,v 1.96 2011/01/18 08:12:23 alec Exp $ + * $Id: invoice_pdf.php,v 1.97 2011/04/01 10:35:12 alec Exp $ */ function invoice_body() @@ -60,7 +60,7 @@ if(isset($_POST['marks'])) foreach($_POST['marks'] as $idx => $mark) - $ilm[$idx] = $mark; + $ilm[$idx] = intval($mark); if(sizeof($ilm)) foreach($ilm as $mark) Index: lms/modules/invoicelist.php diff -u lms/modules/invoicelist.php:1.65 lms/modules/invoicelist.php:1.66 --- lms/modules/invoicelist.php:1.65 Tue Jan 18 09:12:23 2011 +++ lms/modules/invoicelist.php Fri Apr 1 12:35:12 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: invoicelist.php,v 1.65 2011/01/18 08:12:23 alec Exp $ + * $Id: invoicelist.php,v 1.66 2011/04/01 10:35:12 alec Exp $ */ function GetInvoicesList($search=NULL, $cat=NULL, $group=NULL, $hideclosed=NULL, $order, $pagelimit=100, $page=NULL) @@ -93,7 +93,7 @@ break; } } - + if($hideclosed) $where .= ' AND closed = 0'; @@ -153,7 +153,7 @@ $result['order'] = $order; $result['direction'] = $direction; - + return $result; } Index: lms/modules/invoicereport.php diff -u lms/modules/invoicereport.php:1.47 lms/modules/invoicereport.php:1.48 --- lms/modules/invoicereport.php:1.47 Tue Jan 18 09:12:23 2011 +++ lms/modules/invoicereport.php Fri Apr 1 12:35:12 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: invoicereport.php,v 1.47 2011/01/18 08:12:23 alec Exp $ + * $Id: invoicereport.php,v 1.48 2011/04/01 10:35:12 alec Exp $ */ function set_taxes($taxid) @@ -61,8 +61,10 @@ if(!empty($_POST['group'])) { - if(is_array($_POST['group'])) - $groups = implode(',', $_POST['group']); + if(is_array($_POST['group'])) { + $groups = array_map('intval', $_POST['group']); + $groups = implode(',', $groups); + } else $groups = intval($_POST['group']); Index: lms/modules/numberplanlist.php diff -u lms/modules/numberplanlist.php:1.15 lms/modules/numberplanlist.php:1.16 --- lms/modules/numberplanlist.php:1.15 Tue Jan 18 09:12:24 2011 +++ lms/modules/numberplanlist.php Fri Apr 1 12:35:12 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: numberplanlist.php,v 1.15 2011/01/18 08:12:24 alec Exp $ + * $Id: numberplanlist.php,v 1.16 2011/04/01 10:35:12 alec Exp $ */ function GetNumberPlanList() @@ -48,7 +48,7 @@ $count = $DB->GetAllByKey('SELECT numberplanid AS id, COUNT(numberplanid) AS count FROM documents GROUP BY numberplanid','id'); - + $max = $DB->GetAllByKey('SELECT numberplanid AS id, MAX(number) AS max FROM documents LEFT JOIN numberplans ON (numberplanid = numberplans.id) WHERE cdate >= (CASE period @@ -58,7 +58,7 @@ WHEN '.WEEKLY.' THEN '.$weekstart.' WHEN '.DAILY.' THEN '.$daystart.' ELSE 0 END) GROUP BY numberplanid','id'); - + foreach ($list as $idx => $item) { $list[$idx]['next'] = isset($max[$item['id']]['max']) ? $max[$item['id']]['max']+1 : 1; @@ -71,7 +71,7 @@ if ($SESSION->is_set('nplp') && !isset($_GET['page'])) $SESSION->restore('nplp', $_GET['page']); - + $page = (!isset($_GET['page']) ? 1 : $_GET['page']); $pagelimit = (!isset($CONFIG['phpui']['numberplanlist_pagelimit']) ? $listdata['total'] : $CONFIG['phpui']['numberplanlist_pagelimit']); $start = ($page - 1) * $pagelimit; Index: lms/modules/print.php diff -u lms/modules/print.php:1.140 lms/modules/print.php:1.141 --- lms/modules/print.php:1.140 Sun Feb 6 10:41:37 2011 +++ lms/modules/print.php Fri Apr 1 12:35:12 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: print.php,v 1.140 2011/02/06 09:41:37 alec Exp $ + * $Id: print.php,v 1.141 2011/04/01 10:35:12 alec Exp $ */ $type = isset($_GET['type']) ? $_GET['type'] : ''; @@ -78,7 +78,7 @@ foreach($tslist as $row) foreach($row as $column => $value) $saldolist[$column][] = $value; - + $saldolist['balance'] = 0; foreach($saldolist['id'] as $i => $v) @@ -86,7 +86,7 @@ $saldolist['after'][$i] = $saldolist['balance'] + $saldolist['value'][$i]; $saldolist['balance'] += $saldolist['value'][$i]; $saldolist['date'][$i] = date('Y/m/d H:i', $saldolist['time'][$i]); - + if($saldolist['time'][$i]>=$date['from'] && $saldolist['time'][$i]<=$date['to']) { $list['id'][] = $saldolist['id'][$i]; @@ -280,7 +280,7 @@ $SMARTY->assign('division', $DB->GetOne('SELECT name FROM divisions WHERE id = ?', array($division))); if($source) $SMARTY->assign('source', $DB->GetOne('SELECT name FROM cashsources WHERE id = ?', array($source))); - + $SMARTY->display('printbalancelist.html'); break; @@ -330,7 +330,7 @@ } else { $date['from'] = 0; } - + if($to) { list($year, $month, $day) = explode('/',$to); $date['to'] = mktime(23,59,59,$month,$day,$year); @@ -338,9 +338,9 @@ $to = date("Y/m/d",time()); $date['to'] = mktime(23,59,59); // end of today } - + $layout['pagetitle'] = trans('Cash Import History ($0 to $1)', $from, $to); - + $importlist = $DB->GetAll('SELECT c.time, c.value, c.customerid, ' .$DB->Concat('upper(v.lastname)',"' '",'v.name').' AS customername FROM cash c @@ -357,11 +357,11 @@ break; case 'invoices': /********************************************/ - + $from = $_POST['invoicefrom']; $to = $_POST['invoiceto']; - // date format 'yyyy/mm/dd' + // date format 'yyyy/mm/dd' if($to) { list($year, $month, $day) = explode('/',$to); $date['to'] = mktime(23,59,59,$month,$day,$year); @@ -452,7 +452,7 @@ $order = $_POST['order']; $direction = $_POST['direction']; - $customerid = (isset($_POST['customer']) ? $_POST['customer'] : 0); + $customerid = (isset($_POST['customer']) ? intval($_POST['customer']) : 0); $year = date('Y', $reportday); $yearday = date('z', $reportday) + 1; @@ -667,7 +667,7 @@ AND a.customerid = d.customerid)'; $where .= $groupwhere; } - + if($from > 0) $listdata['startbalance'] = $DB->GetOne('SELECT SUM(value) FROM receiptcontents LEFT JOIN documents d ON (docid = d.id AND type = ?) @@ -708,18 +708,18 @@ if($row['posnumber'] > 1) $list[$idx]['title'] = $DB->GetCol('SELECT description FROM receiptcontents WHERE docid=? ORDER BY itemid', array($list[$idx]['id'])); - + // summary if($row['value'] > 0) $listdata['totalincome'] += $row['value']; else $listdata['totalexpense'] += -$row['value']; - + if($idx==0) $list[$idx]['after'] = $listdata['startbalance'] + $row['value']; else $list[$idx]['after'] = $list[$idx-1]['after'] + $row['value']; - + if(!$row['closed']) $listdata['advances'] -= $row['value']; } @@ -757,7 +757,7 @@ { $pages = array(); $totals = array(); - + // hidden option: max records count for one page of printout // I think 20 records is fine, but someone needs 19. $rows = isset($CONFIG['phpui']['printout_pagelimit']) ? $CONFIG['phpui']['printout_pagelimit'] : 20; @@ -785,24 +785,24 @@ $rows++; $page = $x; - + if($row['value']>0) $totals[$page]['income'] += $row['value']; else $totals[$page]['expense'] += -$row['value']; - + $totals[$page]['rows'] = $rows; } foreach($totals as $page => $t) { $pages[] = $page; - + $totals[$page]['totalincome'] = $totals[$page-1]['totalincome'] + $t['income']; $totals[$page]['totalexpense'] = $totals[$page-1]['totalexpense'] + $t['expense']; $totals[$page]['rowstart'] = $totals[$page-1]['rowstart'] + $totals[$page-1]['rows']; } - + $SMARTY->assign('pages', $pages); $SMARTY->assign('totals', $totals); $SMARTY->assign('pagescount', sizeof($pages)); @@ -810,7 +810,7 @@ $SMARTY->display('printreceiptlist-ext.html'); } else - { + { $SMARTY->display('printreceiptlist.html'); } break; Index: lms/modules/quicksearch.php diff -u lms/modules/quicksearch.php:1.73 lms/modules/quicksearch.php:1.74 --- lms/modules/quicksearch.php:1.73 Tue Mar 29 10:23:22 2011 +++ lms/modules/quicksearch.php Fri Apr 1 12:35:12 2011 @@ -21,12 +21,15 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: quicksearch.php,v 1.73 2011/03/29 08:23:22 alec Exp $ + * $Id: quicksearch.php,v 1.74 2011/04/01 10:35:12 alec Exp $ */ -function macformat($mac) +function macformat($mac, $escape=false) { + global $DB; + $res = str_replace('-', ':', $mac); + // allow eg. format "::ab:3::12", only whole addresses if(preg_match('/^([0-9a-f]{0,2}):([0-9a-f]{0,2}):([0-9a-f]{0,2}):([0-9a-f]{0,2}):([0-9a-f]{0,2}):([0-9a-f]{0,2})$/i', $mac, $arr)) { @@ -45,8 +48,11 @@ $tmp = preg_replace('/[^0-9a-f]/i', '', $mac); if(strlen($tmp) == 12) // we've the whole address - if(check_mac($tmp)) + if(check_mac($tmp)) $res = $tmp; + + if ($escape) + $res = $DB->Escape("%$res%"); } return $res; } @@ -70,22 +76,24 @@ $mode = $_GET['mode']; } +$sql_search = $DB->Escape("%$search%"); + switch($mode) { case 'customer': if(isset($_GET['ajax'])) // support for AutoSuggest { - $candidates = $DB->GetAll('SELECT id, email, address, post_name, post_address, deleted, - '.$DB->Concat('UPPER(lastname)',"' '",'name').' AS username + $candidates = $DB->GetAll("SELECT id, email, address, post_name, post_address, deleted, + ".$DB->Concat('UPPER(lastname)',"' '",'name')." AS username FROM customersview - WHERE '.(preg_match('/^[0-9]+$/', $search) ? 'id = '.intval($search).' OR ' : '').' - LOWER('.$DB->Concat('lastname',"' '",'name').') ?LIKE? LOWER(\'%'.$search.'%\') - OR LOWER(address) ?LIKE? LOWER(\'%'.$search.'%\') - OR LOWER(post_name) ?LIKE? LOWER(\'%'.$search.'%\') - OR LOWER(post_address) ?LIKE? LOWER(\'%'.$search.'%\') - OR LOWER(email) ?LIKE? LOWER(\'%'.$search.'%\') + WHERE ".(preg_match('/^[0-9]+$/', $search) ? 'id = '.intval($search).' OR ' : '')." + LOWER(".$DB->Concat('lastname',"' '",'name').") ?LIKE? LOWER($sql_search) + OR LOWER(address) ?LIKE? LOWER($sql_search) + OR LOWER(post_name) ?LIKE? LOWER($sql_search) + OR LOWER(post_address) ?LIKE? LOWER($sql_search) + OR LOWER(email) ?LIKE? LOWER($sql_search) ORDER by deleted, username, email, address - LIMIT 15'); + LIMIT 15"); $eglible=array(); $actions=array(); $descriptions=array(); if ($candidates) @@ -181,15 +189,15 @@ WHERE %where ORDER BY n.name LIMIT 15'; - $sql_where = '('.(preg_match('/^[0-9]+$/',$search) ? 'n.id = '.intval($search).' OR ' : '').' - LOWER(n.name) ?LIKE? LOWER(\'%'.$search.'%\') - OR INET_NTOA(ipaddr) ?LIKE? \'%'.$search.'%\' - OR INET_NTOA(ipaddr_pub) ?LIKE? \'%'.$search.'%\' - OR LOWER(mac) ?LIKE? LOWER(\'%'.macformat($search).'%\')) + $sql_where = '('.(preg_match('/^[0-9]+$/',$search) ? "n.id = $search OR " : '')." + LOWER(n.name) ?LIKE? LOWER($sql_search) + OR INET_NTOA(ipaddr) ?LIKE? $sql_search + OR INET_NTOA(ipaddr_pub) ?LIKE? $sql_search + OR LOWER(mac) ?LIKE? LOWER(".macformat($search, true).")) AND NOT EXISTS ( SELECT 1 FROM customerassignments a JOIN excludedgroups e ON (a.customergroupid = e.customergroupid) - WHERE e.userid = lms_current_user() AND a.customerid = n.ownerid)'; + WHERE e.userid = lms_current_user() AND a.customerid = n.ownerid)"; $candidates = $DB->GetAll(str_replace('%where', $sql_where, $sql_query)); @@ -253,7 +261,7 @@ $s['name'] = $search; $s['mac'] = $search; $s['ipaddr'] = $search; - + $SESSION->save('nodesearch', $s); $SESSION->save('nslk', 'OR'); @@ -261,21 +269,21 @@ $target = '?m=nodesearch&search'; break; - + case 'ticket': if(isset($_GET['ajax'])) // support for AutoSuggest { - $candidates = $DB->GetAll('SELECT t.id, t.subject, t.requestor, c.name, c.lastname + $candidates = $DB->GetAll("SELECT t.id, t.subject, t.requestor, c.name, c.lastname FROM rttickets t LEFT JOIN customersview c on (t.customerid = c.id) - WHERE '.(preg_match('/^[0-9]+$/',$search) ? 't.id = '.intval($search).' OR ' : '').' - lower(t.subject) ?LIKE? lower(\'%'.$search.'%\') - OR lower(t.requestor) ?LIKE? lower(\'%'.$search.'%\') - OR lower(c.name) ?LIKE? lower(\''.$search.'%\') - OR lower(c.lastname) ?LIKE? lower(\''.$search.'%\') + WHERE ".(preg_match('/^[0-9]+$/',$search) ? 't.id = '.intval($search).' OR ' : '')." + LOWER(t.subject) ?LIKE? LOWER($sql_search) + OR LOWER(t.requestor) ?LIKE? LOWER($sql_search) + OR LOWER(c.name) ?LIKE? LOWER($sql_search) + OR LOWER(c.lastname) ?LIKE? LOWER($sql_search) ORDER BY t.subject, t.id, c.lastname, c.name, t.requestor - LIMIT 15'); - + LIMIT 15"); + $eglible=array(); $actions=array(); $descriptions=array(); if ($candidates) foreach($candidates as $idx => $row) { @@ -306,7 +314,7 @@ $SESSION->save('rtsearch', array('name' => $search, 'subject' => $search, 'operator' => 'OR')); - + $target = '?m=rtsearch&s=1'; } break; @@ -316,29 +324,32 @@ if(isset($_GET['ajax'])) // support for AutoSuggest { - $candidates = $DB->GetAll('(SELECT p.id, p.login, d.name AS domain, 0 AS type + $username = $DB->Escape('%'.$ac[0].'%'); + $domain = $DB->Escape('%'.$ac[1].'%'); + + $candidates = $DB->GetAll("(SELECT p.id, p.login, d.name AS domain, 0 AS type FROM passwd p JOIN domains d ON (p.domainid = d.id) - WHERE p.login ?LIKE? LOWER(\'%'.$ac[0].'%\') - '.(!empty($ac[1]) ? 'AND d.name ?LIKE? LOWER(\''.$ac[1].'%\')' : '').') + WHERE p.login ?LIKE? LOWER($username) + ".($domain ? "AND d.name ?LIKE? LOWER($domain)" : '').") UNION (SELECT a.id, a.login, d.name AS domain, 1 AS type FROM aliases a JOIN domains d ON (a.domainid = d.id) - WHERE a.login ?LIKE? LOWER(\'%'.$ac[0].'%\') - '.(!empty($ac[1]) ? 'AND d.name ?LIKE? LOWER(\''.$ac[1].'%\')' : '').') + WHERE a.login ?LIKE? LOWER($username) + ".($domain ? "AND d.name ?LIKE? LOWER($domain)" : '').") ORDER BY login, domain - LIMIT 15'); - + LIMIT 15"); + $eglible=array(); $actions=array(); $descriptions=array(); - + if ($candidates) foreach($candidates as $idx => $row) { if($row['type']) $actions[$row['id']] = '?m=aliasinfo&id='.$row['id']; else - $actions[$row['id']] = '?m=accountinfo&id='.$row['id']; - + $actions[$row['id']] = '?m=accountinfo&id='.$row['id']; + $eglible[$row['id']] = escape_js($row['login'].'@'.$row['domain']); $descriptions[$row['id']] = ''; } @@ -352,7 +363,7 @@ } exit; } - + $search = array(); $search['login'] = $ac[0]; if(!empty($ac[1])) $search['domain'] = $ac[1]; Index: lms/modules/receipt.php diff -u lms/modules/receipt.php:1.25 lms/modules/receipt.php:1.26 --- lms/modules/receipt.php:1.25 Thu Mar 24 23:18:16 2011 +++ lms/modules/receipt.php Fri Apr 1 12:35:12 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: receipt.php,v 1.25 2011/03/24 22:18:16 chilek Exp $ + * $Id: receipt.php,v 1.26 2011/04/01 10:35:12 alec Exp $ */ function GetReceipt($id) @@ -78,26 +78,25 @@ { $SESSION->restore('rlm', $rlm); $SESSION->remove('rlm'); - + if(sizeof($_POST['marks'])) foreach($_POST['marks'] as $id => $mark) $rlm[$id] = $mark; if(sizeof($rlm)) foreach($rlm as $mark) - $ids[] = $mark; + $ids[] = intval($mark); - if(!$ids) + if(empty($ids)) { $SESSION->close(); die; } - + if(!empty($_GET['cash'])) { - foreach($ids as $cashid) - if($rid = $DB->GetOne('SELECT docid FROM cash, documents WHERE docid = documents.id AND documents.type = 2 AND cash.id = ?', array($cashid))) - $idsx[] = $rid; - $ids = array_unique((array)$idsx); + $ids = $DB->GetCol('SELECT DISTINCT docid FROM cash, documents + WHERE docid = documents.id AND documents.type = 2 + AND cash.id IN ('.implode(',', $ids).')'); } sort($ids); Index: lms/modules/receipt_pdf.php diff -u lms/modules/receipt_pdf.php:1.15 lms/modules/receipt_pdf.php:1.16 --- lms/modules/receipt_pdf.php:1.15 Thu Mar 24 23:18:16 2011 +++ lms/modules/receipt_pdf.php Fri Apr 1 12:35:12 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: receipt_pdf.php,v 1.15 2011/03/24 22:18:16 chilek Exp $ + * $Id: receipt_pdf.php,v 1.16 2011/04/01 10:35:12 alec Exp $ */ function receipt_header($x, $y) @@ -261,22 +261,21 @@ $rlm[$idx] = $mark; if(sizeof($rlm)) foreach($rlm as $mark) - $ids[] = $mark; - - if(!$ids) + $ids[] = intval($mark); + + if(empty($ids)) { $SESSION->close(); die; } - + if(!empty($_GET['cash'])) { - foreach($ids as $cashid) - if($rid = $DB->GetOne('SELECT docid FROM cash, documents WHERE docid = documents.id AND documents.type = 2 AND cash.id = ?', array($cashid))) - $idsx[] = $rid; - $ids = array_unique((array)$idsx); + $ids = $DB->GetCol('SELECT DISTINCT docid FROM cash, documents + WHERE docid = documents.id AND documents.type = 2 + AND cash.id IN ('.implode(',', $ids).')'); } - + sort($ids); $i = 0; @@ -304,7 +303,7 @@ { $SESSION->redirect('?m=receiptlist'); } - + close_pdf($pdf); ?> Index: lms/modules/receiptlist.php diff -u lms/modules/receiptlist.php:1.28 lms/modules/receiptlist.php:1.29 --- lms/modules/receiptlist.php:1.28 Tue Jan 18 09:12:25 2011 +++ lms/modules/receiptlist.php Fri Apr 1 12:35:12 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: receiptlist.php,v 1.28 2011/01/18 08:12:25 alec Exp $ + * $Id: receiptlist.php,v 1.29 2011/04/01 10:35:12 alec Exp $ */ function GetReceiptList($registry, $order='', $search=NULL, $cat=NULL, $from=0, $to=0, $advances=0) @@ -102,23 +102,23 @@ { $totalincome = 0; $totalexpense = 0; - + foreach($list as $idx => $row) { $list[$idx]['number'] = docnumber($row['number'], $row['template'], $row['cdate'], $row['extnumber']); $list[$idx]['customer'] = $row['customer'].' '.$row['address'].' '.$row['zip'].' '.$row['city']; - + // don't retrive descriptions of all items to not decrease speed // but we want to know that there is something hidden ;) if($row['posnumber'] > 1) $list[$idx]['title'] .= ' ...'; - + // summary if($row['value'] > 0) $totalincome += $row['value']; else $totalexpense += -$row['value']; } - + $list['totalincome'] = $totalincome; $list['totalexpense'] = $totalexpense; $list['order'] = $order; Index: lms/modules/rtsearch.php diff -u lms/modules/rtsearch.php:1.48 lms/modules/rtsearch.php:1.49 --- lms/modules/rtsearch.php:1.48 Tue Jan 18 09:12:25 2011 +++ lms/modules/rtsearch.php Fri Apr 1 12:35:12 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: rtsearch.php,v 1.48 2011/01/18 08:12:25 alec Exp $ + * $Id: rtsearch.php,v 1.49 2011/04/01 10:35:12 alec Exp $ */ function RTSearch($search, $order='createtime,desc') @@ -168,14 +168,14 @@ if(!$error) { $queue = RTSearch($search, $o); - + $queuedata['total'] = $queue['total']; - $queuedata['order'] = $queue['order']; - $queuedata['direction'] = $queue['direction']; + $queuedata['order'] = $queue['order']; + $queuedata['direction'] = $queue['direction']; $queuedata['queue'] = isset($search['queue']) ? $search['queue'] : 0; - + unset($queue['total']); - unset($queue['order']); + unset($queue['order']); unset($queue['direction']); $page = (! isset($_GET['page']) ? 1 : $_GET['page']); Index: lms/modules/rtticketview.php diff -u lms/modules/rtticketview.php:1.42 lms/modules/rtticketview.php:1.43 --- lms/modules/rtticketview.php:1.42 Tue Jan 18 09:12:25 2011 +++ lms/modules/rtticketview.php Fri Apr 1 12:35:12 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: rtticketview.php,v 1.42 2011/01/18 08:12:25 alec Exp $ + * $Id: rtticketview.php,v 1.43 2011/04/01 10:35:12 alec Exp $ */ if(! $LMS->TicketExists($_GET['id'])) @@ -74,7 +74,7 @@ $prev_ticketid = isset($iteration[$idx-1]) ? $iteration[$idx-1]['id'] : 0; break; } -} +} $ticket['next_ticketid'] = $next_ticketid; $ticket['prev_ticketid'] = $prev_ticketid; Index: lms/modules/statelist.php diff -u lms/modules/statelist.php:1.4 lms/modules/statelist.php:1.5 --- lms/modules/statelist.php:1.4 Tue Jan 18 09:12:25 2011 +++ lms/modules/statelist.php Fri Apr 1 12:35:12 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: statelist.php,v 1.4 2011/01/18 08:12:25 alec Exp $ + * $Id: statelist.php,v 1.5 2011/04/01 10:35:12 alec Exp $ */ $statelist = $DB->GetAll('SELECT * FROM states ORDER BY name'); @@ -29,7 +29,7 @@ if ($SESSION->is_set('cslp') && !isset($_GET['page'])) $SESSION->restore('cslp', $_GET['page']); - + $page = (!isset($_GET['page']) ? 1 : $_GET['page']); $pagelimit = (!isset($CONFIG['phpui']['statelist_pagelimit']) ? $listdata['total'] : $CONFIG['phpui']['statelist_pagelimit']); $start = ($page - 1) * $pagelimit; Index: lms/modules/taxratelist.php diff -u lms/modules/taxratelist.php:1.12 lms/modules/taxratelist.php:1.13 --- lms/modules/taxratelist.php:1.12 Tue Jan 18 09:12:26 2011 +++ lms/modules/taxratelist.php Fri Apr 1 12:35:12 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: taxratelist.php,v 1.12 2011/01/18 08:12:26 alec Exp $ + * $Id: taxratelist.php,v 1.13 2011/04/01 10:35:12 alec Exp $ */ function GetTaxRateList($order='name,asc') @@ -62,7 +62,7 @@ if ($SESSION->is_set('trlp') && !isset($_GET['page'])) $SESSION->restore('trlp', $_GET['page']); - + $page = (!isset($_GET['page']) ? 1 : $_GET['page']); $pagelimit = (!isset($CONFIG['phpui']['taxratelist_pagelimit']) ? $listdata['total'] : $CONFIG['phpui']['taxratelist_pagelimit']); $start = ($page - 1) * $pagelimit; Index: lms/modules/traffic.php diff -u lms/modules/traffic.php:1.57 lms/modules/traffic.php:1.58 --- lms/modules/traffic.php:1.57 Tue Jan 18 09:12:26 2011 +++ lms/modules/traffic.php Fri Apr 1 12:35:12 2011 @@ -20,7 +20,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: traffic.php,v 1.57 2011/01/18 08:12:26 alec Exp $ + * $Id: traffic.php,v 1.58 2011/04/01 10:35:12 alec Exp $ */ function Traffic($from = 0, $to = 0, $net = 0, $customerid = 0, $order = '', $limit = 0) @@ -68,10 +68,10 @@ // limits if($limit > 0) - $limit = ' LIMIT '.$limit; + $limit = ' LIMIT '.intval($limit); else $limit = ''; - + // join query from parts $query = 'SELECT nodeid, name, inet_ntoa(ipaddr) AS ip, sum(upload) as upload, sum(download) as download From cvs w lms.org.pl Fri Apr 1 13:46:53 2011 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 1 Apr 2011 13:46:53 +0200 (CEST) Subject: [lms-commits] CVS update of lms/bin (lms-payments) Message-ID: <20110401114653.09172300023F@eftep.altec.pl> Date: Friday, April 1, 2011 @ 13:46:53 Author: alec Path: /cvsroot/lms/bin Modified: lms-payments - lms-payments: Added option for setting sale date to the 1st day of next month (saledate_next_month) Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/bin/lms-payments.diff?&r1=1.131&r2=1.132 Index: lms/bin/lms-payments diff -u lms/bin/lms-payments:1.131 lms/bin/lms-payments:1.132 --- lms/bin/lms-payments:1.131 Fri Apr 1 08:55:42 2011 +++ lms/bin/lms-payments Fri Apr 1 13:46:52 2011 @@ -20,7 +20,7 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. # -# $Id: lms-payments,v 1.131 2011/04/01 06:55:42 alec Exp $ +# $Id: lms-payments,v 1.132 2011/04/01 11:46:52 alec Exp $ use strict; use DBI; @@ -100,6 +100,7 @@ my $customergroups = $ini->val('payments', 'customergroups') || ''; my $deadline = $ini->val('payments', 'deadline') || '14'; my $paytype = $ini->val('payments', 'paytype') || 2; # TRANSFER +my $sdate_next = $ini->val('payments', 'saledate_next_month') || 0; my $comment = $ini->val('payments', 'comment') || 'Tariff %tariff subscription for period %period'; my $s_comment = $ini->val('payments', 'settlement_comment') || $comment; my $suspension_description = $ini->val('payments', 'suspension_description') || ''; @@ -223,6 +224,12 @@ my $current_period = strftime("%m/%Y", 0, 0, 12, 1, $month - 1, $year - 1900); my $next_period = strftime("%m/%Y", 0, 0, 12, 1, $month, $year - 1900); +# sale date setting +my $saledate = $currtime; +if ($sdate_next) { + $saledate = strftime("%s", 0, 0, 12, 1, $month, $year - 1900); +} + # calculate start and end of numbering period sub get_period($) { @@ -543,7 +550,7 @@ VALUES (?, ?, 1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); $idbq->execute($numbers{$plan}, $plan, $urow->{'countryid'}, $urow->{'divisionid'}, $uid, $urow->{'lastname'}.' '.$urow->{'name'}, $urow->{'address'}, $urow->{'zip'}, - $urow->{'city'}, $urow->{'ten'}, $urow->{'ssn'}, $currtime, $currtime, $paytime, $inv_paytype); + $urow->{'city'}, $urow->{'ten'}, $urow->{'ssn'}, $currtime, $saledate, $paytime, $inv_paytype); $idbq = $dbase->prepare("SELECT id FROM documents WHERE cdate = ? AND number = ? AND type = 1 AND customerid = ?"); From cvs w lms.org.pl Fri Apr 1 13:46:53 2011 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 1 Apr 2011 13:46:53 +0200 (CEST) Subject: [lms-commits] CVS update of lms/doc/sgml/pl (scripts.sgml) Message-ID: <20110401114653.77CCA3011AC1@eftep.altec.pl> Date: Friday, April 1, 2011 @ 13:46:53 Author: alec Path: /cvsroot/lms/doc/sgml/pl Modified: scripts.sgml - lms-payments: Added option for setting sale date to the 1st day of next month (saledate_next_month) Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/sgml/pl/scripts.sgml.diff?&r1=1.46&r2=1.47 Index: lms/doc/sgml/pl/scripts.sgml diff -u lms/doc/sgml/pl/scripts.sgml:1.46 lms/doc/sgml/pl/scripts.sgml:1.47 --- lms/doc/sgml/pl/scripts.sgml:1.46 Mon Jun 21 10:58:16 2010 +++ lms/doc/sgml/pl/scripts.sgml Fri Apr 1 13:46:53 2011 @@ -1,4 +1,4 @@ - + Skrypty @@ -436,6 +436,13 @@ Domyślnie: '' Przykład: suspension_description = (zawieszenie) + + saledate_next_month (opcjonalny) + Włączenie tej opcji spowoduje, że data sprzedaży na fakturze zostanie ustawiona + na pierwszy dzień następnego miesiąca. + Domyślnie: 0 + Przykład: saledate_next_month = 1 + Ponadto mamy do dyspozycji jeden przydatny parametr wiersza poleceń From cvs w lms.org.pl Fri Apr 1 13:46:53 2011 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 1 Apr 2011 13:46:53 +0200 (CEST) Subject: [lms-commits] CVS update of lms/doc (ChangeLog, README.pl) Message-ID: <20110401114653.385483011AC0@eftep.altec.pl> Date: Friday, April 1, 2011 @ 13:46:53 Author: alec Path: /cvsroot/lms/doc Modified: ChangeLog README.pl - lms-payments: Added option for setting sale date to the 1st day of next month (saledate_next_month) Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/ChangeLog.diff?&r1=1.1567&r2=1.1568 http://cvs.lms.org.pl/viewvc/Development/lms/doc/README.pl.diff?&r1=1.66&r2=1.67 Index: lms/doc/ChangeLog diff -u lms/doc/ChangeLog:1.1567 lms/doc/ChangeLog:1.1568 --- lms/doc/ChangeLog:1.1567 Thu Mar 31 20:19:16 2011 +++ lms/doc/ChangeLog Fri Apr 1 13:46:53 2011 @@ -1,4 +1,4 @@ -$Id: ChangeLog,v 1.1567 2011/03/31 18:19:16 alec Exp $ +$Id: ChangeLog,v 1.1568 2011/04/01 11:46:53 alec Exp $ version ? (????-??-??) @@ -13,6 +13,7 @@ - Added searching by option name in configuration options list [alec] - Fixed popups height on Internet Explorer [alec] - Added possibility to select invoices paytime from calendar popup [alec] + - lms-payments: Added option for setting sale date to the 1st day of next month [alec] version 1.11.12 Aris (2011-03-18) Index: lms/doc/README.pl diff -u lms/doc/README.pl:1.66 lms/doc/README.pl:1.67 --- lms/doc/README.pl:1.66 Thu Mar 17 14:12:14 2011 +++ lms/doc/README.pl Fri Apr 1 13:46:53 2011 @@ -3160,6 +3160,11 @@ Tekst dodawany na końcu opisu operacji dla obciążeń zawieszonych. Domyślnie: '' Przykład: suspension_description = (zawieszenie) + * saledate_next_month (opcjonalny) + Włączenie tej opcji spowoduje, że data sprzedaży na fakturze + zostanie ustawiona na pierwszy dzień następnego miesiąca. + Domyślnie: 0 + Przykład: saledate_next_month = 1 Ponadto mamy do dyspozycji jeden przydatny parametr wiersza poleceń --fakedate (-f). Przy jego użyciu można sprawić, aby skrypt działał z From cvs w lms.org.pl Fri Apr 1 13:46:53 2011 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 1 Apr 2011 13:46:53 +0200 (CEST) Subject: [lms-commits] CVS update of lms/doc/html/pl (scripts-config.html) Message-ID: <20110401114653.55E3430136B6@eftep.altec.pl> Date: Friday, April 1, 2011 @ 13:46:53 Author: alec Path: /cvsroot/lms/doc/html/pl Modified: scripts-config.html - lms-payments: Added option for setting sale date to the 1st day of next month (saledate_next_month) Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/html/pl/scripts-config.html.diff?&r1=1.40&r2=1.41 Index: lms/doc/html/pl/scripts-config.html diff -u lms/doc/html/pl/scripts-config.html:1.40 lms/doc/html/pl/scripts-config.html:1.41 --- lms/doc/html/pl/scripts-config.html:1.40 Mon Jun 21 10:58:15 2010 +++ lms/doc/html/pl/scripts-config.html Fri Apr 1 13:46:53 2011 @@ -697,6 +697,19 @@ >suspension_description = (zawieszenie)

  • saledate_next_month (opcjonalny)

    Włączenie tej opcji spowoduje, że data sprzedaży na fakturze zostanie ustawiona + na pierwszy dzień następnego miesiąca. + Domyślnie: 0

    Przykład: saledate_next_month = 1

  • Date: Friday, April 1, 2011 @ 14:45:43 Author: alec Path: /cvsroot/lms/modules Modified: invoicereport.php - Hide tax-value columns for zero-value taxes on invoicereport Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/modules/invoicereport.php.diff?&r1=1.48&r2=1.49 Index: lms/modules/invoicereport.php diff -u lms/modules/invoicereport.php:1.48 lms/modules/invoicereport.php:1.49 --- lms/modules/invoicereport.php:1.48 Fri Apr 1 12:35:12 2011 +++ lms/modules/invoicereport.php Fri Apr 1 14:45:43 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: invoicereport.php,v 1.48 2011/04/01 10:35:12 alec Exp $ + * $Id: invoicereport.php,v 1.49 2011/04/01 12:45:43 alec Exp $ */ function set_taxes($taxid) @@ -58,6 +58,7 @@ $invoicelist = array(); $taxeslist = array(); $taxes = array(); +$taxescount = 0; if(!empty($_POST['group'])) { @@ -199,13 +200,17 @@ // get used tax rates for building report table foreach($listdata as $idx => $val) - if(is_int($idx)) - $taxeslist[$idx] = $taxes[$idx]; + if(is_int($idx)) { + $tax = $taxes[$idx]; + $tax['value'] = f_round($tax['value']); + $taxeslist[$idx] = $tax; + $taxescount += $tax['value'] ? 2 : 1; + } } $SMARTY->assign('listdata', $listdata); $SMARTY->assign('taxes', $taxeslist); -$SMARTY->assign('taxescount', sizeof($taxeslist)); +$SMARTY->assign('taxescount', $taxescount); $SMARTY->assign('layout', $layout); $SMARTY->assign('invoicelist', $invoicelist); From cvs w lms.org.pl Fri Apr 1 14:45:43 2011 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 1 Apr 2011 14:45:43 +0200 (CEST) Subject: [lms-commits] CVS update of lms/templates (invoicereport-ext.html, invoicereport.html) Message-ID: <20110401124543.7F8173000A88@eftep.altec.pl> Date: Friday, April 1, 2011 @ 14:45:43 Author: alec Path: /cvsroot/lms/templates Modified: invoicereport-ext.html invoicereport.html - Hide tax-value columns for zero-value taxes on invoicereport Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/templates/invoicereport-ext.html.diff?&r1=1.4&r2=1.5 http://cvs.lms.org.pl/viewvc/Development/lms/templates/invoicereport.html.diff?&r1=1.20&r2=1.21 Index: lms/templates/invoicereport-ext.html diff -u lms/templates/invoicereport-ext.html:1.4 lms/templates/invoicereport-ext.html:1.5 --- lms/templates/invoicereport-ext.html:1.4 Fri Nov 17 19:01:38 2006 +++ lms/templates/invoicereport-ext.html Fri Apr 1 14:45:43 2011 @@ -1,5 +1,5 @@ {include file="clearheader.html" landscape=true} - + {foreach from=$pages item=item}{assign var=previtem value=$item-1} 1} style="page-break-before: always; border-style: none;"{/if}> @@ -22,7 +22,7 @@ {t}Invoice No.{/t}
    {t}Draw-up date{/t} -
    + {if $tax.value} + {/if} {/foreach} + {if $tax.value} + {/if} {/foreach} + {if $tax.value} + {/if} {/foreach} + {if $tax.value} + {/if} {/foreach} + {if $tax.value} + {/if} {/foreach} - + {if $tax.value} + {/if} {/foreach} -
    + {t}Contractor{/t} @@ -32,9 +32,11 @@ {t}Net value{/t}
    {$tax.label}
    {t}Tax value{/t}
    {$tax.label}
    {t}Total Tax{/t} @@ -64,9 +66,11 @@ {$invoicelist[invoicelist].$taxid.val|string_format:"%01.2f"} - {$invoicelist[invoicelist].$taxid.tax|string_format:"%01.2f"} + {$invoicelist[invoicelist].$taxid.tax|string_format:"%01.2f"} {$invoicelist[invoicelist].tax|string_format:"%01.2f"} @@ -85,9 +89,11 @@ {$totals.$item.val.$taxid|string_format:"%01.2f"} {$totals.$item.tax.$taxid|string_format:"%01.2f"} {$totals.$item.sumtax|string_format:"%01.2f"} @@ -105,9 +111,11 @@ {$totals.$previtem.allval.$taxid|string_format:"%01.2f"} {$totals.$previtem.alltax.$taxid|string_format:"%01.2f"} {$totals.$previtem.allsumtax|string_format:"%01.2f"} @@ -125,9 +133,11 @@ {$totals.$item.allval.$taxid|string_format:"%01.2f"} {$totals.$item.alltax.$taxid|string_format:"%01.2f"} {$totals.$item.allsumtax|string_format:"%01.2f"} @@ -156,7 +166,7 @@ {t}Invoice No.{/t}
    {t}Draw-up date{/t}
    + {t}Contractor{/t} @@ -166,16 +176,18 @@ {t}Net value{/t}
    {$tax.label}
    {t}Tax value{/t}
    {$tax.label}
    {t}Total Tax{/t}
    +

     

    {t}No such invoices in selected time period.{/t}

     

    Index: lms/templates/invoicereport.html diff -u lms/templates/invoicereport.html:1.20 lms/templates/invoicereport.html:1.21 --- lms/templates/invoicereport.html:1.20 Sun Dec 28 20:03:27 2008 +++ lms/templates/invoicereport.html Fri Apr 1 14:45:43 2011 @@ -1,4 +1,4 @@ - + {include file="clearheader.html"} @@ -24,7 +24,7 @@ {t}Invoice No.{/t}
    {t}Draw-up date{/t} - + {if $tax.value} + {/if} {/foreach} + {if $tax.value} + {/if} {/foreach} {foreachelse} - + {if $tax.value} + {/if} {/foreach}
    + {t}Contractor{/t} @@ -34,9 +34,11 @@ {t}Net value{/t}
    {$tax.label}
    {t}Tax value{/t}
    {$tax.label}
    {t}Total Tax{/t} @@ -65,9 +67,11 @@ {$invoice.$taxid.val|string_format:"%01.2f"} - {$invoice.$taxid.tax|string_format:"%01.2f"} + {$invoice.$taxid.tax|string_format:"%01.2f"} {$invoice.tax|string_format:"%01.2f"} @@ -75,7 +79,7 @@
    +

     

    {t}No such invoices in selected time period.{/t}

     

    @@ -94,9 +98,11 @@
    {$listdata.$taxid.val|string_format:"%01.2f"} {$listdata.$taxid.tax|string_format:"%01.2f"} {$listdata.tax|string_format:"%01.2f"} From cvs w lms.org.pl Fri Apr 1 20:40:41 2011 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 1 Apr 2011 20:40:41 +0200 (CEST) Subject: [lms-commits] CVS update of lms/modules (invoicereport.php) Message-ID: <20110401184042.00B3A3010A76@eftep.altec.pl> Date: Friday, April 1, 2011 @ 20:40:41 Author: alec Path: /cvsroot/lms/modules Modified: invoicereport.php - Added sale date on Sale Registry printouts Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/modules/invoicereport.php.diff?&r1=1.49&r2=1.50 Index: lms/modules/invoicereport.php diff -u lms/modules/invoicereport.php:1.49 lms/modules/invoicereport.php:1.50 --- lms/modules/invoicereport.php:1.49 Fri Apr 1 14:45:43 2011 +++ lms/modules/invoicereport.php Fri Apr 1 20:40:41 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: invoicereport.php,v 1.49 2011/04/01 12:45:43 alec Exp $ + * $Id: invoicereport.php,v 1.50 2011/04/01 18:40:41 alec Exp $ */ function set_taxes($taxid) @@ -114,7 +114,8 @@ ORDER BY CEIL(cdate/86400), d.id', array(DOC_INVOICE, DOC_CNOTE, $unixfrom, $unixto)); // get documents data -$docs = $DB->GetAllByKey('SELECT d.id AS id, number, cdate, customerid, name, address, zip, city, ten, ssn, template, reference +$docs = $DB->GetAllByKey('SELECT d.id AS id, number, cdate, sdate, customerid, + name, address, zip, city, ten, ssn, template, reference FROM documents d LEFT JOIN numberplans ON d.numberplanid = numberplans.id WHERE (d.type = ? OR d.type = ?) AND (d.cdate BETWEEN ? AND ?) ' From cvs w lms.org.pl Fri Apr 1 20:40:42 2011 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 1 Apr 2011 20:40:42 +0200 (CEST) Subject: [lms-commits] CVS update of lms/templates (invoicereport-ext.html, invoicereport.html) Message-ID: <20110401184042.288DA3011AC1@eftep.altec.pl> Date: Friday, April 1, 2011 @ 20:40:42 Author: alec Path: /cvsroot/lms/templates Modified: invoicereport-ext.html invoicereport.html - Added sale date on Sale Registry printouts Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/templates/invoicereport-ext.html.diff?&r1=1.5&r2=1.6 http://cvs.lms.org.pl/viewvc/Development/lms/templates/invoicereport.html.diff?&r1=1.21&r2=1.22 Index: lms/templates/invoicereport-ext.html diff -u lms/templates/invoicereport-ext.html:1.5 lms/templates/invoicereport-ext.html:1.6 --- lms/templates/invoicereport-ext.html:1.5 Fri Apr 1 14:45:43 2011 +++ lms/templates/invoicereport-ext.html Fri Apr 1 20:40:42 2011 @@ -1,5 +1,5 @@ {include file="clearheader.html" landscape=true} - + {foreach from=$pages item=item}{assign var=previtem value=$item-1} 1} style="page-break-before: always; border-style: none;"{/if}> @@ -19,10 +19,13 @@ {t}No.{/t} - + + {/section} - - - + - -
    - {t}Invoice No.{/t}
    - {t}Draw-up date{/t} + {t}Invoice No.{/t}
    + + {t}Draw-up date{/t}
    + {t}Sale date{/t} +
    {t}Contractor{/t} @@ -50,8 +53,11 @@ {counter} - {$invoicelist[invoicelist].number}
    - {$invoicelist[invoicelist].cdate|date_format:"%Y/%m/%d"} + {$invoicelist[invoicelist].number} +
    + {$invoicelist[invoicelist].cdate|date_format:"%Y/%m/%d"}
    + {if $invoicelist[invoicelist].sdate}{$invoicelist[invoicelist].sdate|date_format:"%Y/%m/%d"}{else}{$invoicelist[invoicelist].cdate|date_format:"%Y/%m/%d"}{/if}
    {$invoicelist[invoicelist].custname} ({$invoicelist[invoicelist].customerid|string_format:"%04d"}) @@ -78,7 +84,7 @@
    + {t}Page total:{/t} @@ -100,7 +106,7 @@
    + {t}Transfered from previous page:{/t} @@ -122,7 +128,7 @@
    + {t}Total from start of period:{/t} @@ -163,10 +169,13 @@ {t}No.{/t} - {t}Invoice No.{/t}
    - {t}Draw-up date{/t} + {t}Invoice No.{/t} +
    + {t}Draw-up date{/t}
    + {t}Sale date{/t}
    + {t}Contractor{/t} @@ -187,7 +196,7 @@
    +

     

    {t}No such invoices in selected time period.{/t}

     

    Index: lms/templates/invoicereport.html diff -u lms/templates/invoicereport.html:1.21 lms/templates/invoicereport.html:1.22 --- lms/templates/invoicereport.html:1.21 Fri Apr 1 14:45:43 2011 +++ lms/templates/invoicereport.html Fri Apr 1 20:40:42 2011 @@ -1,4 +1,4 @@ - + {include file="clearheader.html"} @@ -22,7 +22,8 @@
    {t}Invoice No.{/t}
    - {t}Draw-up date{/t} + {t}Draw-up date{/t}
    + {t}Sale date{/t}
    {t}Contractor{/t} @@ -53,6 +54,7 @@ {$invoice.number}
    {$invoice.cdate|date_format:"%Y/%m/%d"} + {if $invoice.sdate}{$invoice.sdate|date_format:"%Y/%m/%d"}{else}{$invoice.cdate|date_format:"%Y/%m/%d"}{/if}
    {$invoice.custname} ({$invoice.customerid|string_format:"%04d"})
    From cvs w lms.org.pl Fri Apr 1 20:40:41 2011 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 1 Apr 2011 20:40:41 +0200 (CEST) Subject: [lms-commits] CVS update of lms/doc (ChangeLog) Message-ID: <20110401184041.ADEBE300023F@eftep.altec.pl> Date: Friday, April 1, 2011 @ 20:40:41 Author: alec Path: /cvsroot/lms/doc Modified: ChangeLog - Added sale date on Sale Registry printouts Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/ChangeLog.diff?&r1=1.1568&r2=1.1569 Index: lms/doc/ChangeLog diff -u lms/doc/ChangeLog:1.1568 lms/doc/ChangeLog:1.1569 --- lms/doc/ChangeLog:1.1568 Fri Apr 1 13:46:53 2011 +++ lms/doc/ChangeLog Fri Apr 1 20:40:41 2011 @@ -1,4 +1,4 @@ -$Id: ChangeLog,v 1.1568 2011/04/01 11:46:53 alec Exp $ +$Id: ChangeLog,v 1.1569 2011/04/01 18:40:41 alec Exp $ version ? (????-??-??) @@ -14,6 +14,7 @@ - Fixed popups height on Internet Explorer [alec] - Added possibility to select invoices paytime from calendar popup [alec] - lms-payments: Added option for setting sale date to the 1st day of next month [alec] + - Added sale date on Sale Registry printouts [alec] version 1.11.12 Aris (2011-03-18) From cvs w lms.org.pl Fri Apr 1 20:40:41 2011 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 1 Apr 2011 20:40:41 +0200 (CEST) Subject: [lms-commits] CVS update of lms/lib/locale/pl (strings.php) Message-ID: <20110401184041.D46133011AC0@eftep.altec.pl> Date: Friday, April 1, 2011 @ 20:40:41 Author: alec Path: /cvsroot/lms/lib/locale/pl Modified: strings.php - Added sale date on Sale Registry printouts Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/lib/locale/pl/strings.php.diff?&r1=1.386&r2=1.387 Index: lms/lib/locale/pl/strings.php diff -u lms/lib/locale/pl/strings.php:1.386 lms/lib/locale/pl/strings.php:1.387 --- lms/lib/locale/pl/strings.php:1.386 Thu Mar 31 13:53:13 2011 +++ lms/lib/locale/pl/strings.php Fri Apr 1 20:40:41 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: strings.php,v 1.386 2011/03/31 11:53:13 alec Exp $ + * $Id: strings.php,v 1.387 2011/04/01 18:40:41 alec Exp $ */ $_LANG['$0 ($1 addresses)'] = '$0 ($1 adresów)'; @@ -1105,6 +1105,7 @@ $_LANG['Restore'] = 'Odtwórz'; $_LANG['Romania'] = 'Rumunia'; $_LANG['Sale date:'] = 'Data sprzedaży:'; +$_LANG['Sale date'] = 'Data sprzedaży'; $_LANG['Sale Registry'] = 'Rejestr sprzedaży'; $_LANG['Sale Registry for period $0 - $1'] = 'Rejestr sprzedaży za okres $0 - $1'; $_LANG['Save'] = 'Zapisz'; From cvs w lms.org.pl Mon Apr 4 11:24:16 2011 From: cvs w lms.org.pl (LMS CVS) Date: Mon, 4 Apr 2011 11:24:16 +0200 (CEST) Subject: [lms-commits] CVS update of lms/templates (invoicereport-ext.html, invoicereport.html) Message-ID: <20110404092416.BF6B63010A76@eftep.altec.pl> Date: Monday, April 4, 2011 @ 11:24:16 Author: alec Path: /cvsroot/lms/templates Modified: invoicereport-ext.html invoicereport.html - Added deadline date on Sale Registry printouts Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/templates/invoicereport-ext.html.diff?&r1=1.6&r2=1.7 http://cvs.lms.org.pl/viewvc/Development/lms/templates/invoicereport.html.diff?&r1=1.22&r2=1.23 Index: lms/templates/invoicereport-ext.html diff -u lms/templates/invoicereport-ext.html:1.6 lms/templates/invoicereport-ext.html:1.7 --- lms/templates/invoicereport-ext.html:1.6 Fri Apr 1 20:40:42 2011 +++ lms/templates/invoicereport-ext.html Mon Apr 4 11:24:16 2011 @@ -1,5 +1,5 @@ {include file="clearheader.html" landscape=true} - + {foreach from=$pages item=item}{assign var=previtem value=$item-1} 1} style="page-break-before: always; border-style: none;"{/if}> @@ -19,11 +19,12 @@ {t}No.{/t} - - - - From cvs w lms.org.pl Thu Apr 7 12:01:41 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 7 Apr 2011 12:01:41 +0200 (CEST) Subject: [lms-commits] CVS update of lms/lib/locale/pl (strings.php) Message-ID: <20110407100141.71B203231E83@eftep.altec.pl> Date: Thursday, April 7, 2011 @ 12:01:41 Author: alec Path: /cvsroot/lms/lib/locale/pl Modified: strings.php - Added possibility to choose which date will be used to sort Sale Registry Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/lib/locale/pl/strings.php.diff?&r1=1.388&r2=1.389 Index: lms/lib/locale/pl/strings.php diff -u lms/lib/locale/pl/strings.php:1.388 lms/lib/locale/pl/strings.php:1.389 --- lms/lib/locale/pl/strings.php:1.388 Mon Apr 4 11:24:16 2011 +++ lms/lib/locale/pl/strings.php Thu Apr 7 12:01:41 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: strings.php,v 1.388 2011/04/04 09:24:16 alec Exp $ + * $Id: strings.php,v 1.389 2011/04/07 10:01:41 alec Exp $ */ $_LANG['$0 ($1 addresses)'] = '$0 ($1 adresów)'; @@ -2459,5 +2459,7 @@ $_LANG['RBE'] = 'EDG/KRS'; $_LANG['ICN'] = 'Dow. os.'; $_LANG['Option'] = 'Opcja'; +$_LANG['by date'] = 'wg daty'; +$_LANG['Select date type'] = 'Wybierz typ daty'; ?> From cvs w lms.org.pl Thu Apr 7 12:01:41 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 7 Apr 2011 12:01:41 +0200 (CEST) Subject: [lms-commits] CVS update of lms/doc (ChangeLog) Message-ID: <20110407100141.456393231E81@eftep.altec.pl> Date: Thursday, April 7, 2011 @ 12:01:41 Author: alec Path: /cvsroot/lms/doc Modified: ChangeLog - Added possibility to choose which date will be used to sort Sale Registry Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/ChangeLog.diff?&r1=1.1571&r2=1.1572 Index: lms/doc/ChangeLog diff -u lms/doc/ChangeLog:1.1571 lms/doc/ChangeLog:1.1572 --- lms/doc/ChangeLog:1.1571 Mon Apr 4 13:52:02 2011 +++ lms/doc/ChangeLog Thu Apr 7 12:01:41 2011 @@ -1,4 +1,4 @@ -$Id: ChangeLog,v 1.1571 2011/04/04 11:52:02 alec Exp $ +$Id: ChangeLog,v 1.1572 2011/04/07 10:01:41 alec Exp $ version ? (????-??-??) @@ -14,7 +14,8 @@ - Fixed popups height on Internet Explorer [alec] - Added possibility to select invoices paytime from calendar popup [alec] - lms-payments: Added option for setting sale date to the 1st day of next month [alec] - - Added sale date and deadline date on Sale Registry printouts [alec] + - Added sale date and deadline date on Sale Registry printouts with possibility + to choose which date will be used to sort the list [alec] - Enable possibility to edit/note of accounted invoices [alec] version 1.11.12 Aris (2011-03-18) From cvs w lms.org.pl Thu Apr 7 12:01:41 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 7 Apr 2011 12:01:41 +0200 (CEST) Subject: [lms-commits] CVS update of lms/modules (invoicereport.php) Message-ID: <20110407100141.9256A300009E@eftep.altec.pl> Date: Thursday, April 7, 2011 @ 12:01:41 Author: alec Path: /cvsroot/lms/modules Modified: invoicereport.php - Added possibility to choose which date will be used to sort Sale Registry Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/modules/invoicereport.php.diff?&r1=1.52&r2=1.53 Index: lms/modules/invoicereport.php diff -u lms/modules/invoicereport.php:1.52 lms/modules/invoicereport.php:1.53 --- lms/modules/invoicereport.php:1.52 Thu Apr 7 09:50:19 2011 +++ lms/modules/invoicereport.php Thu Apr 7 12:01:41 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: invoicereport.php,v 1.52 2011/04/07 07:50:19 alec Exp $ + * $Id: invoicereport.php,v 1.53 2011/04/07 10:01:41 alec Exp $ */ function set_taxes($taxid) @@ -96,14 +96,30 @@ $layout['division'] = $divname; } +// Sorting +switch ($_POST['datetype']) { + case 'sdate': + $sortcol = 'COALESCE(d.sdate, d.cdate)'; + break; + case 'pdate': + $sortcol = '(d.cdate + (d.paytime * 86400))'; + break; + case 'cdate': + default: + $sortcol = 'd.cdate'; +} + // we can't simply get documents with SUM(value*count) // because we need here incoices-like round-off // get documents items numeric values for calculations -$items = $DB->GetAll('SELECT docid, itemid, taxid, value, count +$items = $DB->GetAll('SELECT c.docid, c.itemid, c.taxid, c.value, c.count, + d.number, d.cdate, d.sdate, d.paytime, d.customerid, d.reference, + d.name, d.address, d.zip, d.city, d.ten, d.ssn, n.template FROM documents d - LEFT JOIN invoicecontents ON docid = d.id - WHERE (type = ? OR type = ?) AND (cdate BETWEEN ? AND ?) ' + LEFT JOIN invoicecontents c ON c.docid = d.id + LEFT JOIN numberplans n ON d.numberplanid = n.id + WHERE (d.type = ? OR d.type = ?) AND ('.$sortcol.' BETWEEN ? AND ?) ' .($_POST['numberplanid'] ? 'AND d.numberplanid = '.intval($_POST['numberplanid']) : '') .(isset($divwhere) ? $divwhere : '') .(isset($groupwhere) ? $groupwhere : '') @@ -111,36 +127,27 @@ SELECT 1 FROM customerassignments a JOIN excludedgroups e ON (a.customergroupid = e.customergroupid) WHERE e.userid = lms_current_user() AND a.customerid = d.customerid) - ORDER BY CEIL(cdate/86400), d.id', array(DOC_INVOICE, DOC_CNOTE, $unixfrom, $unixto)); - -// get documents data -$docs = $DB->GetAllByKey('SELECT d.id AS id, number, cdate, sdate, paytime, customerid, - name, address, zip, city, ten, ssn, template, reference - FROM documents d - LEFT JOIN numberplans ON d.numberplanid = numberplans.id - WHERE (d.type = ? OR d.type = ?) AND (d.cdate BETWEEN ? AND ?) ' - .($_POST['numberplanid'] ? 'AND d.numberplanid = '.intval($_POST['numberplanid']) : '') - .(isset($groupwhere) ? $groupwhere : '') - , 'id', array(DOC_INVOICE, DOC_CNOTE, $unixfrom, $unixto)); + ORDER BY CEIL('.$sortcol.'/86400), d.id', + array(DOC_INVOICE, DOC_CNOTE, $unixfrom, $unixto)); +print_r($DB); if($items) { foreach($items as $row) { $idx = $row['docid']; - $doc = $docs[$idx]; $taxid = $row['taxid']; set_taxes($taxid); - $invoicelist[$idx]['custname'] = $doc['name']; - $invoicelist[$idx]['custaddress'] = $doc['zip'].' '.$doc['city'].', '.$doc['address']; - $invoicelist[$idx]['ten'] = ($doc['ten'] ? trans('TEN').' '.$doc['ten'] : ($doc['ssn'] ? trans('SSN').' '.$doc['ssn'] : '')); - $invoicelist[$idx]['number'] = docnumber($doc['number'], $doc['template'], $doc['cdate']); - $invoicelist[$idx]['cdate'] = $doc['cdate']; - $invoicelist[$idx]['sdate'] = $doc['sdate']; - $invoicelist[$idx]['pdate'] = $doc['cdate'] + ($doc['paytime'] * 86400); - $invoicelist[$idx]['customerid'] = $doc['customerid']; + $invoicelist[$idx]['custname'] = $row['name']; + $invoicelist[$idx]['custaddress'] = $row['zip'].' '.$row['city'].', '.$row['address']; + $invoicelist[$idx]['ten'] = ($row['ten'] ? trans('TEN').' '.$row['ten'] : ($row['ssn'] ? trans('SSN').' '.$row['ssn'] : '')); + $invoicelist[$idx]['number'] = docnumber($row['number'], $row['template'], $row['cdate']); + $invoicelist[$idx]['cdate'] = $row['cdate']; + $invoicelist[$idx]['sdate'] = $row['sdate']; + $invoicelist[$idx]['pdate'] = $row['cdate'] + ($row['paytime'] * 86400); + $invoicelist[$idx]['customerid'] = $row['customerid']; if(!isset($invoicelist[$idx][$taxid])) { @@ -151,14 +158,14 @@ if(!isset($invoicelist[$idx]['tax'])) $invoicelist[$idx]['tax'] = 0; if(!isset($invoicelist[$idx]['brutto'])) $invoicelist[$idx]['brutto'] = 0; - if($doc['reference']) + if($row['reference']) { // I think we can simply do query here instead of building // big sql join in $items query, we've got so many credit notes? $item = $DB->GetRow('SELECT taxid, value, count FROM invoicecontents WHERE docid=? AND itemid=?', - array($doc['reference'], $row['itemid'])); + array($row['reference'], $row['itemid'])); $row['value'] += $item['value']; $row['count'] += $item['count']; From cvs w lms.org.pl Thu Apr 7 12:04:22 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 7 Apr 2011 12:04:22 +0200 (CEST) Subject: [lms-commits] CVS update of lms/modules (invoicereport.php) Message-ID: <20110407100422.201533011AE3@eftep.altec.pl> Date: Thursday, April 7, 2011 @ 12:04:22 Author: alec Path: /cvsroot/lms/modules Modified: invoicereport.php - Removed debug code Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/modules/invoicereport.php.diff?&r1=1.53&r2=1.54 Index: lms/modules/invoicereport.php diff -u lms/modules/invoicereport.php:1.53 lms/modules/invoicereport.php:1.54 --- lms/modules/invoicereport.php:1.53 Thu Apr 7 12:01:41 2011 +++ lms/modules/invoicereport.php Thu Apr 7 12:04:22 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: invoicereport.php,v 1.53 2011/04/07 10:01:41 alec Exp $ + * $Id: invoicereport.php,v 1.54 2011/04/07 10:04:22 alec Exp $ */ function set_taxes($taxid) @@ -129,7 +129,6 @@ WHERE e.userid = lms_current_user() AND a.customerid = d.customerid) ORDER BY CEIL('.$sortcol.'/86400), d.id', array(DOC_INVOICE, DOC_CNOTE, $unixfrom, $unixto)); -print_r($DB); if($items) { From cvs w lms.org.pl Thu Apr 7 12:28:16 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 7 Apr 2011 12:28:16 +0200 (CEST) Subject: [lms-commits] CVS update of lms/lib (LMS.class.php) Message-ID: <20110407102816.C96C23231E82@eftep.altec.pl> Date: Thursday, April 7, 2011 @ 12:28:16 Author: alec Path: /cvsroot/lms/lib Modified: LMS.class.php - Added 'in debt above 100%' filter on customer list Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/lib/LMS.class.php.diff?&r1=1.1068&r2=1.1069 Index: lms/lib/LMS.class.php diff -u lms/lib/LMS.class.php:1.1068 lms/lib/LMS.class.php:1.1069 --- lms/lib/LMS.class.php:1.1068 Tue Apr 5 15:56:19 2011 +++ lms/lib/LMS.class.php Thu Apr 7 12:28:16 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: LMS.class.php,v 1.1068 2011/04/05 13:56:19 chilek Exp $ + * $Id: LMS.class.php,v 1.1069 2011/04/07 10:28:16 alec Exp $ */ // LMS Class - contains internal LMS database functions used @@ -35,7 +35,7 @@ var $cache = array(); // internal cache var $hooks = array(); // registered plugin hooks var $_version = '1.11-cvs'; // class version - var $_revision = '$Revision: 1.1068 $'; + var $_revision = '$Revision: 1.1069 $'; function LMS(&$DB, &$AUTH, &$CONFIG) // class variables setting { @@ -756,6 +756,7 @@ case 8: $groupless = 1; break; case 9: $tariffless = 1; break; case 10: $suspended = 1; break; + case 11: $indebted2 = 1; break; } if ($network) @@ -902,6 +903,7 @@ .($division ? ' AND c.divisionid = '.intval($division) : '') .($online ? ' AND s.online = 1' : '') .($indebted ? ' AND b.value < 0' : '') + .($indebted2 ? ' AND b.value < t.value*-2' : '') .($disabled ? ' AND s.ownerid IS NOT NULL AND s.account > s.acsum' : '') .($network ? ' AND EXISTS (SELECT 1 FROM nodes WHERE ownerid = c.id AND ((ipaddr > '.$net['address'].' AND ipaddr < '.$net['broadcast'].') @@ -3621,7 +3623,7 @@ } $stats['lastticket'] = $this->DB->GetOne('SELECT createtime FROM rttickets WHERE queueid = ? ORDER BY createtime DESC', array($id)); - + return $stats; } @@ -3664,9 +3666,9 @@ isset($ticket['cause']) ? $ticket['cause'] : 0, isset($this->AUTH->id) ? $this->AUTH->id : 0 )); - + $id = $this->DB->GetLastInsertID('rttickets'); - + $this->DB->Execute('INSERT INTO rtmessages (ticketid, customerid, createtime, subject, body, mailfrom) VALUES (?, ?, ?, ?, ?, ?)', @@ -3676,14 +3678,14 @@ $ticket['subject'], preg_replace("/\r/", "", $ticket['body']), $ticket['mailfrom'])); - + return $id; } function GetTicketContents($id) { global $RT_STATES; - + $ticket = $this->DB->GetRow('SELECT t.id AS ticketid, t.queueid, rtqueues.name AS queuename, t.requestor, t.state, t.owner, t.customerid, t.cause, t.creatorid, c.name AS creator, ' .$this->DB->Concat('customers.lastname',"' '",'customers.name').' AS customername, @@ -3694,7 +3696,7 @@ LEFT JOIN users c ON (t.creatorid = c.id) LEFT JOIN customers ON (customers.id = t.customerid) WHERE t.id = ?', array($id)); - + $ticket['messages'] = $this->DB->GetAll( '(SELECT rtmessages.id AS id, mailfrom, subject, body, createtime, ' .$this->DB->Concat('customers.lastname',"' '",'customers.name').' AS customername, From cvs w lms.org.pl Thu Apr 7 12:28:16 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 7 Apr 2011 12:28:16 +0200 (CEST) Subject: [lms-commits] CVS update of lms/doc (ChangeLog) Message-ID: <20110407102816.9E9D53231E81@eftep.altec.pl> Date: Thursday, April 7, 2011 @ 12:28:16 Author: alec Path: /cvsroot/lms/doc Modified: ChangeLog - Added 'in debt above 100%' filter on customer list Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/ChangeLog.diff?&r1=1.1572&r2=1.1573 Index: lms/doc/ChangeLog diff -u lms/doc/ChangeLog:1.1572 lms/doc/ChangeLog:1.1573 --- lms/doc/ChangeLog:1.1572 Thu Apr 7 12:01:41 2011 +++ lms/doc/ChangeLog Thu Apr 7 12:28:16 2011 @@ -1,4 +1,4 @@ -$Id: ChangeLog,v 1.1572 2011/04/07 10:01:41 alec Exp $ +$Id: ChangeLog,v 1.1573 2011/04/07 10:28:16 alec Exp $ version ? (????-??-??) @@ -17,6 +17,7 @@ - Added sale date and deadline date on Sale Registry printouts with possibility to choose which date will be used to sort the list [alec] - Enable possibility to edit/note of accounted invoices [alec] + - Added 'in debt above 100%' filter on customer list [alec] version 1.11.12 Aris (2011-03-18) From cvs w lms.org.pl Thu Apr 7 12:28:16 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 7 Apr 2011 12:28:16 +0200 (CEST) Subject: [lms-commits] CVS update of lms/lib/locale/pl (strings.php) Message-ID: <20110407102816.F2AB43231E83@eftep.altec.pl> Date: Thursday, April 7, 2011 @ 12:28:16 Author: alec Path: /cvsroot/lms/lib/locale/pl Modified: strings.php - Added 'in debt above 100%' filter on customer list Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/lib/locale/pl/strings.php.diff?&r1=1.389&r2=1.390 Index: lms/lib/locale/pl/strings.php diff -u lms/lib/locale/pl/strings.php:1.389 lms/lib/locale/pl/strings.php:1.390 --- lms/lib/locale/pl/strings.php:1.389 Thu Apr 7 12:01:41 2011 +++ lms/lib/locale/pl/strings.php Thu Apr 7 12:28:16 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: strings.php,v 1.389 2011/04/07 10:01:41 alec Exp $ + * $Id: strings.php,v 1.390 2011/04/07 10:28:16 alec Exp $ */ $_LANG['$0 ($1 addresses)'] = '$0 ($1 adresów)'; @@ -2461,5 +2461,6 @@ $_LANG['Option'] = 'Opcja'; $_LANG['by date'] = 'wg daty'; $_LANG['Select date type'] = 'Wybierz typ daty'; +$_LANG['in debt above 100%'] = 'zadłużeni ponad 100%'; ?> From cvs w lms.org.pl Thu Apr 7 12:28:17 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 7 Apr 2011 12:28:17 +0200 (CEST) Subject: [lms-commits] CVS update of lms/templates (3 files) Message-ID: <20110407102817.559F43011AE6@eftep.altec.pl> Date: Thursday, April 7, 2011 @ 12:28:17 Author: alec Path: /cvsroot/lms/templates Modified: customerlist.html customersearch.html printindex.html - Added 'in debt above 100%' filter on customer list Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/templates/customerlist.html.diff?&r1=1.16&r2=1.17 http://cvs.lms.org.pl/viewvc/Development/lms/templates/customersearch.html.diff?&r1=1.23&r2=1.24 http://cvs.lms.org.pl/viewvc/Development/lms/templates/printindex.html.diff?&r1=1.99&r2=1.100 Index: lms/templates/customerlist.html diff -u lms/templates/customerlist.html:1.16 lms/templates/customerlist.html:1.17 --- lms/templates/customerlist.html:1.16 Wed Mar 3 16:38:27 2010 +++ lms/templates/customerlist.html Thu Apr 7 12:28:17 2011 @@ -1,5 +1,5 @@ {include file="header.html"} - +

    {$layout.pagetitle}

    - {t}Invoice No.{/t} + {t}Invoice No.{/t}
    + {t}Draw-up date{/t}
    - {t}Draw-up date{/t}
    - {t}Sale date{/t} + {t}Sale date{/t}
    + {t}Deadline{/t}
    {t}Contractor{/t} @@ -53,11 +54,12 @@ {counter} - {$invoicelist[invoicelist].number} + {$invoicelist[invoicelist].number}
    + {$invoicelist[invoicelist].cdate|date_format:"%Y/%m/%d"}
    - {$invoicelist[invoicelist].cdate|date_format:"%Y/%m/%d"}
    - {if $invoicelist[invoicelist].sdate}{$invoicelist[invoicelist].sdate|date_format:"%Y/%m/%d"}{else}{$invoicelist[invoicelist].cdate|date_format:"%Y/%m/%d"}{/if} + {if $invoicelist[invoicelist].sdate}{$invoicelist[invoicelist].sdate|date_format:"%Y/%m/%d"}{else}{$invoicelist[invoicelist].cdate|date_format:"%Y/%m/%d"}{/if}
    + {$invoicelist[invoicelist].pdate|date_format:"%Y/%m/%d"}
    {$invoicelist[invoicelist].custname} ({$invoicelist[invoicelist].customerid|string_format:"%04d"}) @@ -169,11 +171,12 @@ {t}No.{/t} - {t}Invoice No.{/t} + {t}Invoice No.{/t}
    + {t}Draw-up date{/t}
    - {t}Draw-up date{/t}
    - {t}Sale date{/t} + {t}Sale date{/t}
    + {t}Deadline{/t}
    {t}Contractor{/t} Index: lms/templates/invoicereport.html diff -u lms/templates/invoicereport.html:1.22 lms/templates/invoicereport.html:1.23 --- lms/templates/invoicereport.html:1.22 Fri Apr 1 20:40:42 2011 +++ lms/templates/invoicereport.html Mon Apr 4 11:24:16 2011 @@ -1,4 +1,4 @@ - + {include file="clearheader.html"} @@ -22,15 +22,20 @@ + +{* +*} {foreach item=tax from=$taxes} + +{* +*} {foreach item=tax from=$taxes} {assign var=taxid value=$tax.id} {/foreach} - +{* +*} {foreach item=tax from=$taxes} {assign var=taxid value=$tax.id} @@ -481,18 +481,35 @@
    {t}Invoice No.{/t}
    - {t}Draw-up date{/t}
    - {t}Sale date{/t} + {t}Draw-up date{/t} +
    + {t}Sale date{/t}
    + {t}Deadline{/t}
    {t}Contractor{/t} {t}Gross value{/t} {t}Net value{/t}
    {$tax.label} @@ -54,16 +59,21 @@
    {$invoice.number}
    {$invoice.cdate|date_format:"%Y/%m/%d"} - {if $invoice.sdate}{$invoice.sdate|date_format:"%Y/%m/%d"}{else}{$invoice.cdate|date_format:"%Y/%m/%d"}{/if} +
    + {if $invoice.sdate}{$invoice.sdate|date_format:"%Y/%m/%d"}{else}{$invoice.cdate|date_format:"%Y/%m/%d"}{/if}
    + {$invoice.pdate|date_format:"%Y/%m/%d"}
    {$invoice.custname} ({$invoice.customerid|string_format:"%04d"})
    {$invoice.custaddress}
    {$invoice.ten}
    {$invoice.brutto|string_format:"%01.2f"} @@ -89,12 +99,14 @@
    + {t}Total:{/t} {$listdata.brutto|string_format:"%01.2f"} From cvs w lms.org.pl Mon Apr 4 11:24:16 2011 From: cvs w lms.org.pl (LMS CVS) Date: Mon, 4 Apr 2011 11:24:16 +0200 (CEST) Subject: [lms-commits] CVS update of lms/modules (invoicereport.php) Message-ID: <20110404092416.9618E3010A6C@eftep.altec.pl> Date: Monday, April 4, 2011 @ 11:24:16 Author: alec Path: /cvsroot/lms/modules Modified: invoicereport.php - Added deadline date on Sale Registry printouts Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/modules/invoicereport.php.diff?&r1=1.50&r2=1.51 Index: lms/modules/invoicereport.php diff -u lms/modules/invoicereport.php:1.50 lms/modules/invoicereport.php:1.51 --- lms/modules/invoicereport.php:1.50 Fri Apr 1 20:40:41 2011 +++ lms/modules/invoicereport.php Mon Apr 4 11:24:16 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: invoicereport.php,v 1.50 2011/04/01 18:40:41 alec Exp $ + * $Id: invoicereport.php,v 1.51 2011/04/04 09:24:16 alec Exp $ */ function set_taxes($taxid) @@ -114,7 +114,7 @@ ORDER BY CEIL(cdate/86400), d.id', array(DOC_INVOICE, DOC_CNOTE, $unixfrom, $unixto)); // get documents data -$docs = $DB->GetAllByKey('SELECT d.id AS id, number, cdate, sdate, customerid, +$docs = $DB->GetAllByKey('SELECT d.id AS id, number, cdate, sdate, paytime, customerid, name, address, zip, city, ten, ssn, template, reference FROM documents d LEFT JOIN numberplans ON d.numberplanid = numberplans.id @@ -187,6 +187,9 @@ $invoicelist[$idx]['tax'] += $tax; $invoicelist[$idx]['brutto'] += $sum; + // deadline + $invoicelist[$idx]['pdate'] = $doc['cdate'] + ($doc['paytime'] * 86400); + if(!isset($listdata[$taxid])) { $listdata[$taxid]['tax'] = 0; From cvs w lms.org.pl Mon Apr 4 11:24:16 2011 From: cvs w lms.org.pl (LMS CVS) Date: Mon, 4 Apr 2011 11:24:16 +0200 (CEST) Subject: [lms-commits] CVS update of lms/doc (ChangeLog) Message-ID: <20110404092416.35DCE3011AC0@eftep.altec.pl> Date: Monday, April 4, 2011 @ 11:24:16 Author: alec Path: /cvsroot/lms/doc Modified: ChangeLog - Added deadline date on Sale Registry printouts Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/ChangeLog.diff?&r1=1.1569&r2=1.1570 Index: lms/doc/ChangeLog diff -u lms/doc/ChangeLog:1.1569 lms/doc/ChangeLog:1.1570 --- lms/doc/ChangeLog:1.1569 Fri Apr 1 20:40:41 2011 +++ lms/doc/ChangeLog Mon Apr 4 11:24:15 2011 @@ -1,4 +1,4 @@ -$Id: ChangeLog,v 1.1569 2011/04/01 18:40:41 alec Exp $ +$Id: ChangeLog,v 1.1570 2011/04/04 09:24:15 alec Exp $ version ? (????-??-??) @@ -14,7 +14,7 @@ - Fixed popups height on Internet Explorer [alec] - Added possibility to select invoices paytime from calendar popup [alec] - lms-payments: Added option for setting sale date to the 1st day of next month [alec] - - Added sale date on Sale Registry printouts [alec] + - Added sale date and deadline date on Sale Registry printouts [alec] version 1.11.12 Aris (2011-03-18) From cvs w lms.org.pl Mon Apr 4 11:24:16 2011 From: cvs w lms.org.pl (LMS CVS) Date: Mon, 4 Apr 2011 11:24:16 +0200 (CEST) Subject: [lms-commits] CVS update of lms/lib/locale/pl (strings.php) Message-ID: <20110404092416.7422C3011AC1@eftep.altec.pl> Date: Monday, April 4, 2011 @ 11:24:16 Author: alec Path: /cvsroot/lms/lib/locale/pl Modified: strings.php - Added deadline date on Sale Registry printouts Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/lib/locale/pl/strings.php.diff?&r1=1.387&r2=1.388 Index: lms/lib/locale/pl/strings.php diff -u lms/lib/locale/pl/strings.php:1.387 lms/lib/locale/pl/strings.php:1.388 --- lms/lib/locale/pl/strings.php:1.387 Fri Apr 1 20:40:41 2011 +++ lms/lib/locale/pl/strings.php Mon Apr 4 11:24:16 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: strings.php,v 1.387 2011/04/01 18:40:41 alec Exp $ + * $Id: strings.php,v 1.388 2011/04/04 09:24:16 alec Exp $ */ $_LANG['$0 ($1 addresses)'] = '$0 ($1 adresów)'; @@ -325,6 +325,7 @@ $_LANG['Day:'] = 'Dzień:'; $_LANG['dead'] = 'martwy'; $_LANG['Dead:'] = 'Martwe:'; +$_LANG['Deadline'] = 'Termin płatności'; $_LANG['Deadline:'] = 'Termin płatności:'; $_LANG['Default invoice issuer'] = 'Domyślna osoba tworząca fakturę'; $_LANG['Default zip code, city, street, used while inserting new customer. Useful if you add majority of customers with the same street.'] = 'Domyślny kod pocztowy, miasto, ulica pod czas dodawania nowego klienta. Przydatne kiedy mamy wielu klientów na tej samej ulicy.'; From cvs w lms.org.pl Mon Apr 4 13:52:02 2011 From: cvs w lms.org.pl (LMS CVS) Date: Mon, 4 Apr 2011 13:52:02 +0200 (CEST) Subject: [lms-commits] CVS update of lms/doc (ChangeLog) Message-ID: <20110404115202.D91103011AC0@eftep.altec.pl> Date: Monday, April 4, 2011 @ 13:52:02 Author: alec Path: /cvsroot/lms/doc Modified: ChangeLog - Enable possibility to edit/note of accounted invoices Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/ChangeLog.diff?&r1=1.1570&r2=1.1571 Index: lms/doc/ChangeLog diff -u lms/doc/ChangeLog:1.1570 lms/doc/ChangeLog:1.1571 --- lms/doc/ChangeLog:1.1570 Mon Apr 4 11:24:15 2011 +++ lms/doc/ChangeLog Mon Apr 4 13:52:02 2011 @@ -1,4 +1,4 @@ -$Id: ChangeLog,v 1.1570 2011/04/04 09:24:15 alec Exp $ +$Id: ChangeLog,v 1.1571 2011/04/04 11:52:02 alec Exp $ version ? (????-??-??) @@ -15,6 +15,7 @@ - Added possibility to select invoices paytime from calendar popup [alec] - lms-payments: Added option for setting sale date to the 1st day of next month [alec] - Added sale date and deadline date on Sale Registry printouts [alec] + - Enable possibility to edit/note of accounted invoices [alec] version 1.11.12 Aris (2011-03-18) From cvs w lms.org.pl Mon Apr 4 13:52:03 2011 From: cvs w lms.org.pl (LMS CVS) Date: Mon, 4 Apr 2011 13:52:03 +0200 (CEST) Subject: [lms-commits] CVS update of lms/lib (LMS.class.php) Message-ID: <20110404115203.13F953011AC1@eftep.altec.pl> Date: Monday, April 4, 2011 @ 13:52:03 Author: alec Path: /cvsroot/lms/lib Modified: LMS.class.php - Enable possibility to edit/note of accounted invoices Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/lib/LMS.class.php.diff?&r1=1.1066&r2=1.1067 Index: lms/lib/LMS.class.php diff -u lms/lib/LMS.class.php:1.1066 lms/lib/LMS.class.php:1.1067 --- lms/lib/LMS.class.php:1.1066 Fri Apr 1 12:35:11 2011 +++ lms/lib/LMS.class.php Mon Apr 4 13:52:02 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: LMS.class.php,v 1.1066 2011/04/01 10:35:11 alec Exp $ + * $Id: LMS.class.php,v 1.1067 2011/04/04 11:52:02 alec Exp $ */ // LMS Class - contains internal LMS database functions used @@ -35,7 +35,7 @@ var $cache = array(); // internal cache var $hooks = array(); // registered plugin hooks var $_version = '1.11-cvs'; // class version - var $_revision = '$Revision: 1.1066 $'; + var $_revision = '$Revision: 1.1067 $'; function LMS(&$DB, &$AUTH, &$CONFIG) // class variables setting { @@ -2146,71 +2146,6 @@ return $iid; } - function InvoiceUpdate($invoice) - { - $currtime = time(); - $cdate = $invoice['invoice']['cdate'] ? $invoice['invoice']['cdate'] : $currtime; - $sdate = $invoice['invoice']['sdate'] ? $invoice['invoice']['sdate'] : $currtime; - $iid = $invoice['invoice']['id']; - - $this->DB->BeginTrans(); - - $this->DB->Execute('UPDATE documents SET cdate = ?, sdate = ?, paytime = ?, paytype = ?, customerid = ?, - name = ?, address = ?, ten = ?, ssn = ?, zip = ?, city = ?, divisionid = ? - WHERE id = ?', - array($cdate, - $sdate, - $invoice['invoice']['paytime'], - $invoice['invoice']['paytype'], - $invoice['customer']['id'], - $invoice['customer']['customername'], - $invoice['customer']['address'], - $invoice['customer']['ten'], - $invoice['customer']['ssn'], - $invoice['customer']['zip'], - $invoice['customer']['city'], - $invoice['customer']['divisionid'], - $iid - )); - - $this->DB->Execute('DELETE FROM invoicecontents WHERE docid = ?', array($iid)); - $this->DB->Execute('DELETE FROM cash WHERE docid = ?', array($iid)); - - $itemid=0; - foreach($invoice['contents'] as $idx => $item) - { - $itemid++; - - $this->DB->Execute('INSERT INTO invoicecontents (docid, itemid, value, - taxid, prodid, content, count, discount, description, tariffid) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', - array( - $iid, - $itemid, - $item['valuebrutto'], - $item['taxid'], - $item['prodid'], - $item['jm'], - $item['count'], - $item['discount'], - $item['name'], - $item['tariffid'] - )); - - $this->AddBalance(array( - 'time' => $cdate, - 'value' => $item['valuebrutto']*$item['count']*-1, - 'taxid' => $item['taxid'], - 'customerid' => $invoice['customer']['id'], - 'comment' => $item['name'], - 'docid' => $iid, - 'itemid'=>$itemid - )); - } - - $this->DB->CommitTrans(); - } - function InvoiceDelete($invoiceid) { $this->DB->BeginTrans(); From cvs w lms.org.pl Mon Apr 4 13:52:03 2011 From: cvs w lms.org.pl (LMS CVS) Date: Mon, 4 Apr 2011 13:52:03 +0200 (CEST) Subject: [lms-commits] CVS update of lms/modules (3 files) Message-ID: <20110404115203.4375630136B6@eftep.altec.pl> Date: Monday, April 4, 2011 @ 13:52:03 Author: alec Path: /cvsroot/lms/modules Modified: invoiceedit.php invoicenew.php invoicenote.php - Enable possibility to edit/note of accounted invoices Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/modules/invoiceedit.php.diff?&r1=1.38&r2=1.39 http://cvs.lms.org.pl/viewvc/Development/lms/modules/invoicenew.php.diff?&r1=1.86&r2=1.87 http://cvs.lms.org.pl/viewvc/Development/lms/modules/invoicenote.php.diff?&r1=1.47&r2=1.48 Index: lms/modules/invoiceedit.php diff -u lms/modules/invoiceedit.php:1.38 lms/modules/invoiceedit.php:1.39 --- lms/modules/invoiceedit.php:1.38 Fri Mar 25 09:14:40 2011 +++ lms/modules/invoiceedit.php Mon Apr 4 13:52:03 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: invoiceedit.php,v 1.38 2011/03/25 08:14:40 chilek Exp $ + * $Id: invoiceedit.php,v 1.39 2011/04/04 11:52:03 alec Exp $ */ $taxeslist = $LMS->GetTaxes(); @@ -76,9 +76,13 @@ switch($action) { case 'additem': + if ($invoice['closed']) + break; + $itemdata = r_trim($_POST); foreach(array('count', 'discount', 'valuenetto', 'valuebrutto') as $key) $itemdata[$key] = round((float) str_replace(',','.',$itemdata[$key]),2); + if($itemdata['count'] > 0 && $itemdata['name'] != '') { $taxvalue = $taxeslist[$itemdata['taxid']]['value']; @@ -92,7 +96,7 @@ $itemdata['valuebrutto'] = f_round($itemdata['valuebrutto'] - $itemdata['valuebrutto'] * f_round($itemdata['discount'])/100); $itemdata['valuenetto'] = round($itemdata['valuebrutto'] / ($taxvalue / 100 + 1),2); } - + // str_replace here is needed because of bug in some PHP versions (4.3.10) $itemdata['s_valuebrutto'] = str_replace(',','.',$itemdata['valuebrutto'] * $itemdata['count']); $itemdata['s_valuenetto'] = str_replace(',','.',$itemdata['s_valuebrutto'] / ($taxvalue / 100 + 1)); @@ -107,6 +111,9 @@ break; case 'deletepos': + if ($invoice['closed']) + break; + if(sizeof($contents)) foreach($contents as $idx => $row) if($row['posuid'] == $_GET['posuid']) @@ -117,8 +124,9 @@ $oldcdate = $invoice['oldcdate']; $oldsdate = $invoice['oldsdate']; + $closed = $invoice['closed']; - unset($invoice); + unset($invoice); unset($customer); unset($error); $error = NULL; @@ -175,6 +183,7 @@ } $invoice['customerid'] = $_POST['customerid']; + $invoice['closed'] = $closed; if(!$error) if($LMS->CustomerExists($invoice['customerid'])) @@ -182,21 +191,82 @@ break; case 'save': + if (empty($contents) || empty($customer)) + break; - if($contents && $customer) - { - $SESSION->restore('invoiceid', $invoice['id']); - $invoice['type'] = DOC_INVOICE; - $LMS->InvoiceUpdate(array('customer' => $customer, 'contents' => $contents, 'invoice' => $invoice)); - - if(isset($_GET['print'])) - $SESSION->save('invoiceprint', array('invoice' => $invoice['id'], - 'original' => !empty($_GET['original']) ? 1 : 0, - 'copy' => !empty($_GET['copy']) ? 1 : 0, - 'duplicate' => !empty($_GET['duplicate']) ? 1 : 0)); + $SESSION->restore('invoiceid', $invoice['id']); + $invoice['type'] = DOC_INVOICE; - $SESSION->redirect('?m=invoicelist'); - } + $currtime = time(); + $cdate = $invoice['cdate'] ? $invoice['cdate'] : $currtime; + $sdate = $invoice['sdate'] ? $invoice['sdate'] : $currtime; + $iid = $invoice['id']; + + $DB->BeginTrans(); + + $DB->Execute('UPDATE documents SET cdate = ?, sdate = ?, paytime = ?, paytype = ?, customerid = ?, + name = ?, address = ?, ten = ?, ssn = ?, zip = ?, city = ?, divisionid = ? + WHERE id = ?', + array($cdate, + $sdate, + $invoice['paytime'], + $invoice['paytype'], + $customer['id'], + $customer['customername'], + $customer['address'], + $customer['ten'], + $customer['ssn'], + $customer['zip'], + $customer['city'], + $customer['divisionid'], + $iid + )); + + if (!$invoice['closed']) { + $DB->Execute('DELETE FROM invoicecontents WHERE docid = ?', array($iid)); + $DB->Execute('DELETE FROM cash WHERE docid = ?', array($iid)); + + $itemid=0; + foreach ($contents as $idx => $item) { + $itemid++; + + $DB->Execute('INSERT INTO invoicecontents (docid, itemid, value, + taxid, prodid, content, count, discount, description, tariffid) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', + array( + $iid, + $itemid, + $item['valuebrutto'], + $item['taxid'], + $item['prodid'], + $item['jm'], + $item['count'], + $item['discount'], + $item['name'], + $item['tariffid'] + )); + + $LMS->AddBalance(array( + 'time' => $cdate, + 'value' => $item['valuebrutto']*$item['count']*-1, + 'taxid' => $item['taxid'], + 'customerid' => $customer['id'], + 'comment' => $item['name'], + 'docid' => $iid, + 'itemid' => $itemid + )); + } + } + + $DB->CommitTrans(); + + if (isset($_GET['print'])) + $SESSION->save('invoiceprint', array('invoice' => $invoice['id'], + 'original' => !empty($_GET['original']) ? 1 : 0, + 'copy' => !empty($_GET['copy']) ? 1 : 0, + 'duplicate' => !empty($_GET['duplicate']) ? 1 : 0)); + + $SESSION->redirect('?m=invoicelist'); break; } Index: lms/modules/invoicenew.php diff -u lms/modules/invoicenew.php:1.86 lms/modules/invoicenew.php:1.87 --- lms/modules/invoicenew.php:1.86 Fri Mar 25 13:30:49 2011 +++ lms/modules/invoicenew.php Mon Apr 4 13:52:03 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: invoicenew.php,v 1.86 2011/03/25 12:30:49 chilek Exp $ + * $Id: invoicenew.php,v 1.87 2011/04/04 11:52:03 alec Exp $ */ // Invoiceless liabilities: Zobowiazania/obciazenia na ktore nie zostala wystawiona faktura @@ -69,7 +69,7 @@ $invoice['paytime'] = $CONFIG['invoices']['paytime']; // $invoice['paytype'] = $CONFIG['invoices']['paytype']; - if(isset($_GET['customerid']) && $_GET['customerid'] != '' && $LMS->CustomerExists($_GET['customerid'])) + if(!empty($_GET['customerid']) && $LMS->CustomerExists($_GET['customerid'])) { $customer = $LMS->GetCustomer($_GET['customerid'], true); @@ -117,7 +117,7 @@ break; case 'additemlist': - + if($marks = $_POST['marks']) { foreach($marks as $id) @@ -156,7 +156,7 @@ unset($invoice); unset($customer); unset($error); - + if($invoice = $_POST['invoice']) foreach($invoice as $key => $val) $invoice[$key] = $val; @@ -247,80 +247,81 @@ case 'save': - if($contents && $customer) - { - unset($error); - - // set paytime - if(!empty($invoice['paytime_default'])) - { - if($customer['paytime'] != -1) - $invoice['paytime'] = $customer['paytime']; - elseif(($paytime = $DB->GetOne('SELECT inv_paytime FROM divisions - WHERE id = ?', array($customer['divisionid']))) !== NULL) - $invoice['paytime'] = $paytime; - else - $invoice['paytime'] = $CONFIG['invoices']['paytime']; - } - // set paytype - if(empty($invoice['paytype'])) - { - if($customer['paytype']) - $invoice['paytype'] = $customer['paytype']; - elseif($paytype = $DB->GetOne('SELECT inv_paytype FROM divisions - WHERE id = ?', array($customer['divisionid']))) - $invoice['paytype'] = $paytype; - else if (($paytype = intval($CONFIG['invoices']['paytype'])) && isset($PAYTYPES[$paytype])) - $invoice['paytype'] = $paytype; - else - $error['paytype'] = trans('Default payment type not defined!'); - } + if (empty($contents) || empty($customer)) + break; - if ($error) - break; + unset($error); - $DB->BeginTrans(); - $DB->LockTables(array('documents', 'cash', 'invoicecontents', 'numberplans', 'divisions')); + // set paytime + if(!empty($invoice['paytime_default'])) + { + if($customer['paytime'] != -1) + $invoice['paytime'] = $customer['paytime']; + elseif(($paytime = $DB->GetOne('SELECT inv_paytime FROM divisions + WHERE id = ?', array($customer['divisionid']))) !== NULL) + $invoice['paytime'] = $paytime; + else + $invoice['paytime'] = $CONFIG['invoices']['paytime']; + } + // set paytype + if(empty($invoice['paytype'])) + { + if($customer['paytype']) + $invoice['paytype'] = $customer['paytype']; + elseif($paytype = $DB->GetOne('SELECT inv_paytype FROM divisions + WHERE id = ?', array($customer['divisionid']))) + $invoice['paytype'] = $paytype; + else if (($paytype = intval($CONFIG['invoices']['paytype'])) && isset($PAYTYPES[$paytype])) + $invoice['paytype'] = $paytype; + else + $error['paytype'] = trans('Default payment type not defined!'); + } + + if ($error) + break; + + $DB->BeginTrans(); + $DB->LockTables(array('documents', 'cash', 'invoicecontents', 'numberplans', 'divisions')); + + if(!$invoice['number']) + $invoice['number'] = $LMS->GetNewDocumentNumber(DOC_INVOICE, $invoice['numberplanid'], $invoice['cdate']); + else { + if(!preg_match('/^[0-9]+$/', $invoice['number'])) + $error['number'] = trans('Invoice number must be integer!'); + elseif($LMS->DocumentExists($invoice['number'], DOC_INVOICE, $invoice['numberplanid'], $invoice['cdate'])) + $error['number'] = trans('Invoice number $0 already exists!', $invoice['number']); - if(!$invoice['number']) + if($error) { $invoice['number'] = $LMS->GetNewDocumentNumber(DOC_INVOICE, $invoice['numberplanid'], $invoice['cdate']); - else - { - if(!preg_match('/^[0-9]+$/', $invoice['number'])) - $error['number'] = trans('Invoice number must be integer!'); - elseif($LMS->DocumentExists($invoice['number'], DOC_INVOICE, $invoice['numberplanid'], $invoice['cdate'])) - $error['number'] = trans('Invoice number $0 already exists!', $invoice['number']); - - if($error) { - $invoice['number'] = $LMS->GetNewDocumentNumber(DOC_INVOICE, $invoice['numberplanid'], $invoice['cdate']); - $error = null; - } + $error = null; } + } - $invoice['type'] = DOC_INVOICE; - $iid = $LMS->AddInvoice(array('customer' => $customer, 'contents' => $contents, 'invoice' => $invoice)); + $invoice['type'] = DOC_INVOICE; + $iid = $LMS->AddInvoice(array('customer' => $customer, 'contents' => $contents, 'invoice' => $invoice)); - // usuwamy wczesniejsze zobowiazania bez faktury - // @todo: moĹźna to zrobić jednym zapytaniem - foreach($contents as $item) - if(isset($item['cashid'])) - $DB->Execute('DELETE FROM cash WHERE id = ?', array($item['cashid'])); + // usuwamy wczesniejsze zobowiazania bez faktury + foreach ($contents as $item) + if (!empty($item['cashid'])) + $ids[] = intval($item['cashid']); - $DB->UnLockTables(); - $DB->CommitTrans(); + if (!empty($ids)) + $DB->Execute('DELETE FROM cash WHERE id IN ('.implode(',', $ids).')'); - $SESSION->remove('invoicecontents'); - $SESSION->remove('invoicecustomer'); - $SESSION->remove('invoice'); - $SESSION->remove('invoicenewerror'); - - if(isset($_GET['print'])) - $SESSION->save('invoiceprint', array('invoice' => $iid, - 'original' => !empty($_GET['original']) ? 1 : 0, - 'copy' => !empty($_GET['copy']) ? 1 : 0)); + $DB->UnLockTables(); + $DB->CommitTrans(); - $SESSION->redirect('?m=invoicenew&action=init'); - } + $SESSION->remove('invoicecontents'); + $SESSION->remove('invoicecustomer'); + $SESSION->remove('invoice'); + $SESSION->remove('invoicenewerror'); + + if(isset($_GET['print'])) + $SESSION->save('invoiceprint', array('invoice' => $iid, + 'original' => !empty($_GET['original']) ? 1 : 0, + 'copy' => !empty($_GET['copy']) ? 1 : 0)); + + $SESSION->redirect('?m=invoicenew&action=init'); break; } Index: lms/modules/invoicenote.php diff -u lms/modules/invoicenote.php:1.47 lms/modules/invoicenote.php:1.48 --- lms/modules/invoicenote.php:1.47 Fri Mar 25 13:30:49 2011 +++ lms/modules/invoicenote.php Mon Apr 4 13:52:03 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: invoicenote.php,v 1.47 2011/03/25 12:30:49 chilek Exp $ + * $Id: invoicenote.php,v 1.48 2011/04/04 11:52:03 alec Exp $ */ $taxeslist = $LMS->GetTaxes(); @@ -85,24 +85,28 @@ switch($action) { case 'deletepos': + if ($invoice['closed']) + break; $contents[$_GET['itemid']]['deleted'] = true; break; case 'recoverpos': + if ($invoice['closed']) + break; $contents[$_GET['itemid']]['deleted'] = false; break; case 'setheader': - - $cnote = NULL; + + $cnote = NULL; $error = NULL; - + if($cnote = $_POST['cnote']) foreach($cnote as $key => $val) $cnote[$key] = $val; - + $cnote['paytime'] = sprintf('%d', $cnote['paytime']); - + if($cnote['paytime'] < 0) $cnote['paytime'] = 14; @@ -169,76 +173,71 @@ case 'save': - if($contents && $cnote) - { - $DB->BeginTrans(); - - $SESSION->restore('invoiceid', $invoice['id']); - $newcontents = r_trim($_POST); + if (empty($contents) || empty($cnote)) + break; - foreach($contents as $item) - { - $idx = $item['itemid']; - $contents[$idx]['taxid'] = isset($newcontents['taxid'][$idx]) ? $newcontents['taxid'][$idx] : $item['taxid']; - $contents[$idx]['prodid'] = isset($newcontents['prodid'][$idx]) ? $newcontents['prodid'][$idx] : $item['prodid']; - $contents[$idx]['jm'] = isset($newcontents['jm'][$idx]) ? $newcontents['jm'][$idx] : $item['jm']; - $contents[$idx]['count'] = isset($newcontents['count'][$idx]) ? $newcontents['count'][$idx] : $item['count']; - $contents[$idx]['discount'] = isset($newcontents['discount'][$idx]) ? $newcontents['discount'][$idx] : $item['discount']; - $contents[$idx]['name'] = isset($newcontents['name'][$idx]) ? $newcontents['name'][$idx] : $item['name']; - $contents[$idx]['tariffid'] = isset($newcontents['tariffid'][$idx]) ? $newcontents['tariffid'][$idx] : $item['tariffid']; - $contents[$idx]['valuebrutto'] = $newcontents['valuebrutto'][$idx]!='' ? $newcontents['valuebrutto'][$idx] : $item['valuebrutto']; - $contents[$idx]['valuenetto'] = $newcontents['valuenetto'][$idx]!='' ? $newcontents['valuenetto'][$idx] : $item['valuenetto']; - $contents[$idx]['valuebrutto'] = f_round($contents[$idx]['valuebrutto']); - $contents[$idx]['valuenetto'] = f_round($contents[$idx]['valuenetto']); - $contents[$idx]['count'] = f_round($contents[$idx]['count']); - $contents[$idx]['discount'] = f_round($contents[$idx]['discount']); - - $taxvalue = $taxeslist[$contents[$idx]['taxid']]['value']; - - if($contents[$idx]['valuenetto'] != $item['valuenetto']) - { - $contents[$idx]['valuebrutto'] = round($contents[$idx]['valuenetto'] * ($taxvalue / 100 + 1),2); - } - - if(isset($item['deleted']) && $item['deleted']) - { - $contents[$idx]['valuebrutto'] = 0; - $contents[$idx]['cash'] = round($item['valuebrutto'] * $item['count'],2); - $contents[$idx]['count'] = 0; - } - elseif($contents[$idx]['count'] != $item['count'] || - $contents[$idx]['valuebrutto'] != $item['valuebrutto']) - { - $contents[$idx]['cash'] = round($item['valuebrutto'] * $item['count'],2) - round($contents[$idx]['valuebrutto'] * $contents[$idx]['count'],2); - } + $SESSION->restore('invoiceid', $invoice['id']); + $newcontents = r_trim($_POST); - $contents[$idx]['valuebrutto'] = $contents[$idx]['valuebrutto'] - $item['valuebrutto']; - $contents[$idx]['count'] = $contents[$idx]['count'] - $item['count']; + foreach ($contents as $item) { + $idx = $item['itemid']; + $contents[$idx]['taxid'] = isset($newcontents['taxid'][$idx]) ? $newcontents['taxid'][$idx] : $item['taxid']; + $contents[$idx]['prodid'] = isset($newcontents['prodid'][$idx]) ? $newcontents['prodid'][$idx] : $item['prodid']; + $contents[$idx]['jm'] = isset($newcontents['jm'][$idx]) ? $newcontents['jm'][$idx] : $item['jm']; + $contents[$idx]['count'] = isset($newcontents['count'][$idx]) ? $newcontents['count'][$idx] : $item['count']; + $contents[$idx]['discount'] = isset($newcontents['discount'][$idx]) ? $newcontents['discount'][$idx] : $item['discount']; + $contents[$idx]['name'] = isset($newcontents['name'][$idx]) ? $newcontents['name'][$idx] : $item['name']; + $contents[$idx]['tariffid'] = isset($newcontents['tariffid'][$idx]) ? $newcontents['tariffid'][$idx] : $item['tariffid']; + $contents[$idx]['valuebrutto'] = $newcontents['valuebrutto'][$idx]!='' ? $newcontents['valuebrutto'][$idx] : $item['valuebrutto']; + $contents[$idx]['valuenetto'] = $newcontents['valuenetto'][$idx]!='' ? $newcontents['valuenetto'][$idx] : $item['valuenetto']; + $contents[$idx]['valuebrutto'] = f_round($contents[$idx]['valuebrutto']); + $contents[$idx]['valuenetto'] = f_round($contents[$idx]['valuenetto']); + $contents[$idx]['count'] = f_round($contents[$idx]['count']); + $contents[$idx]['discount'] = f_round($contents[$idx]['discount']); + $taxvalue = $taxeslist[$contents[$idx]['taxid']]['value']; + + if($contents[$idx]['valuenetto'] != $item['valuenetto']) { + $contents[$idx]['valuebrutto'] = round($contents[$idx]['valuenetto'] * ($taxvalue / 100 + 1),2); } - - $DB->LockTables(array('documents', 'numberplans')); - - if(!isset($cnote['number']) || !$cnote['number']) - $cnote['number'] = $LMS->GetNewDocumentNumber(DOC_CNOTE, $cnote['numberplanid'], $cnote['cdate']); - else - { - if(!preg_match('/^[0-9]+$/', $cnote['number'])) - $error['number'] = trans('Credit note number must be integer!'); - elseif($LMS->DocumentExists($cnote['number'], DOC_CNOTE, $cnote['numberplanid'], $cnote['cdate'])) - $error['number'] = trans('Credit note number $0 already exists!', $cnote['number']); - - if($error) - $cnote['number'] = $LMS->GetNewDocumentNumber(DOC_CNOTE, $cnote['numberplanid'], $cnote['cdate']); + + if(isset($item['deleted']) && $item['deleted']) { + $contents[$idx]['valuebrutto'] = 0; + $contents[$idx]['cash'] = round($item['valuebrutto'] * $item['count'],2); + $contents[$idx]['count'] = 0; + } + elseif($contents[$idx]['count'] != $item['count'] || + $contents[$idx]['valuebrutto'] != $item['valuebrutto'] + ) { + $contents[$idx]['cash'] = round($item['valuebrutto'] * $item['count'],2) - round($contents[$idx]['valuebrutto'] * $contents[$idx]['count'],2); } - - $DB->Execute('INSERT INTO documents (number, numberplanid, type, cdate, paytime, paytype, + + $contents[$idx]['valuebrutto'] = $contents[$idx]['valuebrutto'] - $item['valuebrutto']; + $contents[$idx]['count'] = $contents[$idx]['count'] - $item['count']; + } + + $DB->BeginTrans(); + $DB->LockTables(array('documents', 'numberplans')); + + if(!isset($cnote['number']) || !$cnote['number']) + $cnote['number'] = $LMS->GetNewDocumentNumber(DOC_CNOTE, $cnote['numberplanid'], $cnote['cdate']); + else { + if(!preg_match('/^[0-9]+$/', $cnote['number'])) + $error['number'] = trans('Credit note number must be integer!'); + elseif($LMS->DocumentExists($cnote['number'], DOC_CNOTE, $cnote['numberplanid'], $cnote['cdate'])) + $error['number'] = trans('Credit note number $0 already exists!', $cnote['number']); + + if($error) + $cnote['number'] = $LMS->GetNewDocumentNumber(DOC_CNOTE, $cnote['numberplanid'], $cnote['cdate']); + } + + $DB->Execute('INSERT INTO documents (number, numberplanid, type, cdate, paytime, paytype, userid, customerid, name, address, ten, ssn, zip, city, countryid, reference, reason, divisionid) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', - array($cnote['number'], - $cnote['numberplanid'] ? $cnote['numberplanid'] : 0, + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', + array($cnote['number'], + $cnote['numberplanid'] ? $cnote['numberplanid'] : 0, DOC_CNOTE, - $cnote['cdate'], - $cnote['paytime'], + $cnote['cdate'], + $cnote['paytime'], $cnote['paytype'], $AUTH->id, $invoice['customerid'], @@ -252,37 +251,37 @@ $invoice['id'], $cnote['reason'], !empty($cnote['use_current_division']) ? $invoice['current_divisionid'] : $invoice['divisionid'], - )); + )); - $id = $DB->GetOne('SELECT id FROM documents WHERE number = ? AND cdate = ? AND type = ?', - array($cnote['number'],$cnote['cdate'],DOC_CNOTE)); + $id = $DB->GetOne('SELECT id FROM documents WHERE number = ? AND cdate = ? AND type = ?', + array($cnote['number'], $cnote['cdate'], DOC_CNOTE)); - $DB->UnLockTables(); + $DB->UnLockTables(); - foreach($contents as $idx => $item) - { - $item['valuebrutto'] = str_replace(',','.', $item['valuebrutto']); - $item['count'] = str_replace(',','.', $item['count']); - $item['discount'] = str_replace(',','.', $item['discount']); - - $DB->Execute('INSERT INTO invoicecontents (docid, itemid, value, taxid, prodid, content, count, discount, description, tariffid) - VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', - array($id, - $idx, - $item['valuebrutto'], - $item['taxid'], + foreach($contents as $idx => $item) + { + $item['valuebrutto'] = str_replace(',','.', $item['valuebrutto']); + $item['count'] = str_replace(',','.', $item['count']); + $item['discount'] = str_replace(',','.', $item['discount']); + + $DB->Execute('INSERT INTO invoicecontents (docid, itemid, value, taxid, prodid, content, count, discount, description, tariffid) + VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', + array($id, + $idx, + $item['valuebrutto'], + $item['taxid'], $item['prodid'], $item['jm'], $item['count'], $item['discount'], $item['name'], $item['tariffid'] - )); + )); - if(isset($item['cash']) && $item['cash'] != 0) - $DB->Execute('INSERT INTO cash (time, userid, value, taxid, customerid, comment, docid, itemid) - VALUES (?, ?, ?, ?, ?, ?, ?, ?)', - array($cnote['cdate'], + if(isset($item['cash']) && $item['cash'] != 0) + $DB->Execute('INSERT INTO cash (time, userid, value, taxid, customerid, comment, docid, itemid) + VALUES (?, ?, ?, ?, ?, ?, ?, ?)', + array($cnote['cdate'], $AUTH->id, str_replace(',','.',$item['cash']), $item['taxid'], @@ -290,24 +289,23 @@ $item['name'], $id, $idx - )); - } + )); + } - $DB->CommitTrans(); - - $SESSION->remove('invoice'); - $SESSION->remove('invoiceid'); - $SESSION->remove('cnote'); - $SESSION->remove('invoicecontents'); - $SESSION->remove('cnoteerror'); - - if(isset($_GET['print'])) - $SESSION->save('invoiceprint', array('invoice' => $id, - 'original' => !empty($_GET['original']) ? 1 : 0, - 'copy' => !empty($_GET['copy']) ? 1 : 0)); + $DB->CommitTrans(); - $SESSION->redirect('?m=invoicelist'); - } + $SESSION->remove('invoice'); + $SESSION->remove('invoiceid'); + $SESSION->remove('cnote'); + $SESSION->remove('invoicecontents'); + $SESSION->remove('cnoteerror'); + + if(isset($_GET['print'])) + $SESSION->save('invoiceprint', array('invoice' => $id, + 'original' => !empty($_GET['original']) ? 1 : 0, + 'copy' => !empty($_GET['copy']) ? 1 : 0)); + + $SESSION->redirect('?m=invoicelist'); break; } @@ -318,7 +316,7 @@ if($action != '') { - // redirect, żeby refreshem nie spierdolić faktury + // redirect, to not prevent from invoice break with the refresh $SESSION->redirect('?m=invoicenote'); } From cvs w lms.org.pl Mon Apr 4 13:52:03 2011 From: cvs w lms.org.pl (LMS CVS) Date: Mon, 4 Apr 2011 13:52:03 +0200 (CEST) Subject: [lms-commits] CVS update of lms/templates (3 files) Message-ID: <20110404115203.7B8683011AC0@eftep.altec.pl> Date: Monday, April 4, 2011 @ 13:52:03 Author: alec Path: /cvsroot/lms/templates Modified: invoiceedit.html invoicelist.html invoicenote.html - Enable possibility to edit/note of accounted invoices Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/templates/invoiceedit.html.diff?&r1=1.43&r2=1.44 http://cvs.lms.org.pl/viewvc/Development/lms/templates/invoicelist.html.diff?&r1=1.82&r2=1.83 http://cvs.lms.org.pl/viewvc/Development/lms/templates/invoicenote.html.diff?&r1=1.27&r2=1.28 Index: lms/templates/invoiceedit.html diff -u lms/templates/invoiceedit.html:1.43 lms/templates/invoiceedit.html:1.44 --- lms/templates/invoiceedit.html:1.43 Thu Mar 31 20:19:17 2011 +++ lms/templates/invoiceedit.html Mon Apr 4 13:52:03 2011 @@ -1,5 +1,5 @@ {include file="header.html"} - +

    {$layout.pagetitle}

    {include file="calendar_js.html"} {include file="footer.html"} - From cvs w lms.org.pl Mon Apr 4 14:08:31 2011 From: cvs w lms.org.pl (LMS CVS) Date: Mon, 4 Apr 2011 14:08:31 +0200 (CEST) Subject: [lms-commits] CVS update of lms/modules (receipt.php, receipt_pdf.php) Message-ID: <20110404120831.925333011AC1@eftep.altec.pl> Date: Monday, April 4, 2011 @ 14:08:31 Author: alec Path: /cvsroot/lms/modules Modified: receipt.php receipt_pdf.php - Fixed SQL query in receipt module (it looks that in MySQL 'div' word has special meaning) Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/modules/receipt.php.diff?&r1=1.26&r2=1.27 http://cvs.lms.org.pl/viewvc/Development/lms/modules/receipt_pdf.php.diff?&r1=1.16&r2=1.17 Index: lms/modules/receipt.php diff -u lms/modules/receipt.php:1.26 lms/modules/receipt.php:1.27 --- lms/modules/receipt.php:1.26 Fri Apr 1 12:35:12 2011 +++ lms/modules/receipt.php Mon Apr 4 14:08:31 2011 @@ -21,31 +21,31 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: receipt.php,v 1.26 2011/04/01 10:35:12 alec Exp $ + * $Id: receipt.php,v 1.27 2011/04/04 12:08:31 alec Exp $ */ function GetReceipt($id) { global $CONFIG, $DB; - - if($receipt = $DB->GetRow('SELECT documents.*, users.name AS user, template, - div.name AS d_name, div.address AS d_address, - div.zip AS d_zip, div.city AS d_city - FROM documents - LEFT JOIN users ON (userid = users.id) - LEFT JOIN numberplans ON (numberplanid = numberplans.id) - LEFT JOIN customers c ON (documents.customerid = c.id) - LEFT JOIN divisions div ON (div.id = c.divisionid) - WHERE documents.type = 2 AND documents.id = ?', array($id))) + + if ($receipt = $DB->GetRow('SELECT d.*, u.name AS user, n.template, + ds.name AS d_name, ds.address AS d_address, + ds.zip AS d_zip, ds.city AS d_city + FROM documents d + LEFT JOIN users u ON (d.userid = u.id) + LEFT JOIN numberplans n ON (d.numberplanid = n.id) + LEFT JOIN customers c ON (d.customerid = c.id) + LEFT JOIN divisions ds ON (ds.id = c.divisionid) + WHERE d.type = 2 AND d.id = ?', array($id))) { $receipt['contents'] = $DB->GetAll('SELECT * FROM receiptcontents WHERE docid = ? ORDER BY itemid', array($id)); $receipt['total'] = 0; - + foreach($receipt['contents'] as $row) $receipt['total'] += $row['value']; - + $receipt['number'] = docnumber($receipt['number'], $receipt['template'], $receipt['cdate'], $receipt['extnumber']); - + if($receipt['total'] < 0) { $receipt['type'] = 'out'; @@ -58,7 +58,7 @@ $receipt['type'] = 'in'; $receipt['totalg'] = round($receipt['total']*100 - ((int) $receipt['total'])*100); - + return $receipt; } } @@ -104,7 +104,7 @@ $layout['pagetitle'] = trans('Cash Receipts'); $SMARTY->display('receiptheader.html'); $SMARTY->assign('type', !empty($_GET['which']) ? $_GET['which'] : ''); - + $i = 0; $count = sizeof($ids); foreach($ids as $idx => $receiptid) @@ -129,10 +129,10 @@ $SMARTY->display('noaccess.html'); $SESSION->close(); die; - } + } $layout['pagetitle'] = trans('Cash Receipt No. $0', $receipt['number']); - + $receipt['last'] = TRUE; $receipt['first'] = TRUE; $SMARTY->assign('type', isset($_GET['which']) ? $_GET['which'] : NULL); Index: lms/modules/receipt_pdf.php diff -u lms/modules/receipt_pdf.php:1.16 lms/modules/receipt_pdf.php:1.17 --- lms/modules/receipt_pdf.php:1.16 Fri Apr 1 12:35:12 2011 +++ lms/modules/receipt_pdf.php Mon Apr 4 14:08:31 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: receipt_pdf.php,v 1.16 2011/04/01 10:35:12 alec Exp $ + * $Id: receipt_pdf.php,v 1.17 2011/04/04 12:08:31 alec Exp $ */ function receipt_header($x, $y) @@ -66,13 +66,13 @@ function receipt_buyer($x,$y) { global $receipt,$pdf; - + $font_size=12; $yy = $y; $xmax = $x + 420; $pdf->line($x, $y, $xmax, $y); $y -= $font_size; - + if($receipt['type'] == 'out') { text_align_center($x+315,$y-4,$font_size+4,''.iconv("UTF-8","ISO-8859-2",trans('Has')).''); @@ -100,7 +100,7 @@ $pdf->line($x+350, $yy, $x+350, $y); $pdf->line($xmax, $yy, $xmax, $y); $pdf->line($x, $y, $xmax, $y); - + return $y; } @@ -120,13 +120,13 @@ text_align_center($x+245,$y,$font_size,iconv("UTF-8","ISO-8859-2",trans('Cash Report'))); if($receipt['type'] == 'out') text_align_center($x+350,$y,$font_size,iconv("UTF-8","ISO-8859-2",trans('Above amount'))); - + else text_align_center($x+350,$y,$font_size,iconv("UTF-8","ISO-8859-2",trans('I confirm receipt of above amount'))); - + $y -= 2; $pdf->line($x, $y, $xmax, $y); - + if($receipt['type'] == 'out') { text_align_center($x+315,$y-8,$font_size,iconv("UTF-8","ISO-8859-2",trans('payed out'))); @@ -139,7 +139,7 @@ $pdf->line($x+300, $y, $xmax-20, $y); $y -= text_align_center($x+350,$y-8,$font_size,iconv("UTF-8","ISO-8859-2",trans('Signature of cashier'))); } - + $pdf->line($x, $yy, $x, $y); $pdf->line($x+70, $yy, $x+70, $y); $pdf->line($x+140, $yy, $x+140, $y); @@ -148,7 +148,7 @@ if($receipt['type'] == 'out') $pdf->line($x+350, $yy-8, $x+350, $y); $pdf->line($xmax, $yy, $xmax, $y); $pdf->line($x, $y, $xmax, $y); - + $y -= text_align_right($xmax,$y-6,$font_size/2,iconv("UTF-8","ISO-8859-2",'Copyright (C) 2001-2011 LMS Developers')); $y -= 15; $pdf->setLineStyle(0.5, NULL, NULL, array(2,2)); @@ -167,7 +167,7 @@ $xmax = $x + 420; $pdf->line($x, $y, $xmax, $y); $y -= 8; - + text_align_center($x+140,$y,8,iconv("UTF-8","ISO-8859-2",trans('For what'))); text_align_center($x+315,$y,8,iconv("UTF-8","ISO-8859-2",trans('Value'))); text_align_center($x+385,$y,8,iconv("UTF-8","ISO-8859-2",trans('Number'))); @@ -184,7 +184,7 @@ text_align_left($x+2,$y,$font_size-2,''.$i.'.'); $y = text_wrap($x+15,$y,270,$font_size-2,iconv("UTF-8","ISO-8859-2",$item['description']),''); text_align_right($x+345,$y+$font_size,$font_size-2,iconv("UTF-8","ISO-8859-2",moneyf($item['value']))); - } + } $y += $font_size/2; $pdf->line($x, $y, $xmax, $y); @@ -215,10 +215,10 @@ return $y; } -function receipt_body() +function receipt_body() { global $receipt,$pdf,$id,$CONFIG, $type; - + $template = $CONFIG['receipts']['template_file']; switch ($template) From cvs w lms.org.pl Tue Apr 5 15:56:19 2011 From: cvs w lms.org.pl (LMS CVS) Date: Tue, 5 Apr 2011 15:56:19 +0200 (CEST) Subject: [lms-commits] CVS update of lms/lib (LMS.class.php) Message-ID: <20110405135619.A9F8030CB579@eftep.altec.pl> Date: Tuesday, April 5, 2011 @ 15:56:19 Author: chilek Path: /cvsroot/lms/lib Modified: LMS.class.php - removing unneeded \r chars in ticket messages and sms messages Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/lib/LMS.class.php.diff?&r1=1.1067&r2=1.1068 Index: lms/lib/LMS.class.php diff -u lms/lib/LMS.class.php:1.1067 lms/lib/LMS.class.php:1.1068 --- lms/lib/LMS.class.php:1.1067 Mon Apr 4 13:52:02 2011 +++ lms/lib/LMS.class.php Tue Apr 5 15:56:19 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: LMS.class.php,v 1.1067 2011/04/04 11:52:02 alec Exp $ + * $Id: LMS.class.php,v 1.1068 2011/04/05 13:56:19 chilek Exp $ */ // LMS Class - contains internal LMS database functions used @@ -35,7 +35,7 @@ var $cache = array(); // internal cache var $hooks = array(); // registered plugin hooks var $_version = '1.11-cvs'; // class version - var $_revision = '$Revision: 1.1067 $'; + var $_revision = '$Revision: 1.1068 $'; function LMS(&$DB, &$AUTH, &$CONFIG) // class variables setting { @@ -3674,7 +3674,7 @@ $ticket['customerid'], $ts, $ticket['subject'], - $ticket['body'], + preg_replace("/\r/", "", $ticket['body']), $ticket['mailfrom'])); return $id; @@ -4086,45 +4086,47 @@ function SendSMS($number, $message, $messageid=0) { - $msg_len = mb_strlen($message); + $msg_len = mb_strlen($message); - if (!$msg_len) { - return trans('SMS message is empty!'); - } + if (!$msg_len) { + return trans('SMS message is empty!'); + } - if (!empty($this->CONFIG['sms']['debug_phone'])) { - $number = $this->CONFIG['sms']['debug_phone']; - } + if (!empty($this->CONFIG['sms']['debug_phone'])) { + $number = $this->CONFIG['sms']['debug_phone']; + } $prefix = !empty($this->CONFIG['sms']['prefix']) ? $this->CONFIG['sms']['prefix'] : ''; $number = preg_replace('/[^0-9]/', '', $number); $number = preg_replace('/^0+/', '', $number); - // add prefix to the number if needed + // add prefix to the number if needed if ($prefix && substr($number, 0, strlen($prefix)) != $prefix) $number = $prefix . $number; - // message ID must be unique - if (!$messageid) { - $messageid = '0.'.time(); - } + // message ID must be unique + if (!$messageid) { + $messageid = '0.'.time(); + } - $data = array( - 'number' => $number, - 'message' => $message, - 'messageid' => $messageid - ); + $message = preg_replace("/\r/", "", $message); - // call external SMS handler(s) - $data = $this->ExecHook('send_sms_before', $data); + $data = array( + 'number' => $number, + 'message' => $message, + 'messageid' => $messageid + ); - if ($data['abort']) { - return $data['result']; - } + // call external SMS handler(s) + $data = $this->ExecHook('send_sms_before', $data); - $number = $data['number']; - $message = $data['message']; - $messageid = $data['messageid']; + if ($data['abort']) { + return $data['result']; + } + + $number = $data['number']; + $message = $data['message']; + $messageid = $data['messageid']; if(empty($this->CONFIG['sms']['service'])) return trans('SMS "service" not set!'); @@ -4146,10 +4148,10 @@ $from = $this->CONFIG['sms']['from']; if ($msg_len < 160) - $type_sms = 'sms'; - else if ($msg_len <= 459) - $type_sms = 'concat'; - else + $type_sms = 'sms'; + else if ($msg_len <= 459) + $type_sms = 'concat'; + else return trans('SMS Message too long!'); if(strlen($number) > 16 || strlen($number) < 4) @@ -4169,11 +4171,11 @@ $encodedargs = array(); foreach (array_keys($args) as $thiskey) - array_push($encodedargs, urlencode($thiskey) ."=". urlencode($args[$thiskey])); + array_push($encodedargs, urlencode($thiskey) ."=". urlencode($args[$thiskey])); $encodedargs = implode('&', $encodedargs); - $curl = curl_init(); - curl_setopt($curl, CURLOPT_URL, 'http://api.statsms.net/send.php'); + $curl = curl_init(); + curl_setopt($curl, CURLOPT_URL, 'http://api.statsms.net/send.php'); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, $encodedargs); From cvs w lms.org.pl Tue Apr 5 15:56:19 2011 From: cvs w lms.org.pl (LMS CVS) Date: Tue, 5 Apr 2011 15:56:19 +0200 (CEST) Subject: [lms-commits] CVS update of lms/modules (rtmessageadd.php) Message-ID: <20110405135619.C727230009BB@eftep.altec.pl> Date: Tuesday, April 5, 2011 @ 15:56:19 Author: chilek Path: /cvsroot/lms/modules Modified: rtmessageadd.php - removing unneeded \r chars in ticket messages and sms messages Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/modules/rtmessageadd.php.diff?&r1=1.73&r2=1.74 Index: lms/modules/rtmessageadd.php diff -u lms/modules/rtmessageadd.php:1.73 lms/modules/rtmessageadd.php:1.74 --- lms/modules/rtmessageadd.php:1.73 Fri Mar 18 13:37:54 2011 +++ lms/modules/rtmessageadd.php Tue Apr 5 15:56:19 2011 @@ -21,26 +21,26 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: rtmessageadd.php,v 1.73 2011/03/18 12:37:54 alec Exp $ + * $Id: rtmessageadd.php,v 1.74 2011/04/05 13:56:19 chilek Exp $ */ function MessageAdd($msg, $headers, $file=NULL) { global $DB, $LMS, $CONFIG; $time = time(); - + $head = ''; if($headers) foreach($headers as $idx => $header) $head .= $idx.": ".$header."\n"; - + $DB->Execute('INSERT INTO rtmessages (ticketid, createtime, subject, body, userid, customerid, mailfrom, inreplyto, messageid, replyto, headers) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', - array( + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', + array( $msg['ticketid'], $time, $msg['subject'], - $msg['body'], + preg_replace("/\r/", "", $msg['body']), $msg['userid'], $msg['customerid'], $msg['mailfrom'], From cvs w lms.org.pl Tue Apr 5 20:20:27 2011 From: cvs w lms.org.pl (LMS CVS) Date: Tue, 5 Apr 2011 20:20:27 +0200 (CEST) Subject: [lms-commits] CVS update of lms/lib/locale/lt (ui.php) Message-ID: <20110405182027.9D4C130009BB@eftep.altec.pl> Date: Tuesday, April 5, 2011 @ 20:20:27 Author: chilek Path: /cvsroot/lms/lib/locale/lt Modified: ui.php - fixed to_words function name in lt locale Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/lib/locale/lt/ui.php.diff?&r1=1.2&r2=1.3 Index: lms/lib/locale/lt/ui.php diff -u lms/lib/locale/lt/ui.php:1.2 lms/lib/locale/lt/ui.php:1.3 --- lms/lib/locale/lt/ui.php:1.2 Tue Jan 18 09:12:06 2011 +++ lms/lib/locale/lt/ui.php Tue Apr 5 20:20:27 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: ui.php,v 1.2 2011/01/18 08:12:06 alec Exp $ + * $Id: ui.php,v 1.3 2011/04/05 18:20:27 chilek Exp $ */ function uptimef($ts) @@ -110,7 +110,7 @@ $cursuffix = $_exponent[$power][count($_exponent[$power])-1]; if ($powsuffix != '') $cursuffix .= $_sep . $powsuffix; - $ret .= toWords($snum, $p, $cursuffix); + $ret .= to_words($snum, $p, $cursuffix); } $curp = $p - 1; continue; From cvs w lms.org.pl Thu Apr 7 09:50:19 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 7 Apr 2011 09:50:19 +0200 (CEST) Subject: [lms-commits] CVS update of lms/modules (invoicereport.php) Message-ID: <20110407075019.D5C8E300023F@eftep.altec.pl> Date: Thursday, April 7, 2011 @ 09:50:19 Author: alec Path: /cvsroot/lms/modules Modified: invoicereport.php - Fixed sale date on invoice report Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/modules/invoicereport.php.diff?&r1=1.51&r2=1.52 Index: lms/modules/invoicereport.php diff -u lms/modules/invoicereport.php:1.51 lms/modules/invoicereport.php:1.52 --- lms/modules/invoicereport.php:1.51 Mon Apr 4 11:24:16 2011 +++ lms/modules/invoicereport.php Thu Apr 7 09:50:19 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: invoicereport.php,v 1.51 2011/04/04 09:24:16 alec Exp $ + * $Id: invoicereport.php,v 1.52 2011/04/07 07:50:19 alec Exp $ */ function set_taxes($taxid) @@ -138,6 +138,8 @@ $invoicelist[$idx]['ten'] = ($doc['ten'] ? trans('TEN').' '.$doc['ten'] : ($doc['ssn'] ? trans('SSN').' '.$doc['ssn'] : '')); $invoicelist[$idx]['number'] = docnumber($doc['number'], $doc['template'], $doc['cdate']); $invoicelist[$idx]['cdate'] = $doc['cdate']; + $invoicelist[$idx]['sdate'] = $doc['sdate']; + $invoicelist[$idx]['pdate'] = $doc['cdate'] + ($doc['paytime'] * 86400); $invoicelist[$idx]['customerid'] = $doc['customerid']; if(!isset($invoicelist[$idx][$taxid])) @@ -187,9 +189,6 @@ $invoicelist[$idx]['tax'] += $tax; $invoicelist[$idx]['brutto'] += $sum; - // deadline - $invoicelist[$idx]['pdate'] = $doc['cdate'] + ($doc['paytime'] * 86400); - if(!isset($listdata[$taxid])) { $listdata[$taxid]['tax'] = 0; From cvs w lms.org.pl Thu Apr 7 12:01:41 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 7 Apr 2011 12:01:41 +0200 (CEST) Subject: [lms-commits] CVS update of lms/templates (printindex.html) Message-ID: <20110407100141.B5B2D300023F@eftep.altec.pl> Date: Thursday, April 7, 2011 @ 12:01:41 Author: alec Path: /cvsroot/lms/templates Modified: printindex.html - Added possibility to choose which date will be used to sort Sale Registry Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/templates/printindex.html.diff?&r1=1.98&r2=1.99 Index: lms/templates/printindex.html diff -u lms/templates/printindex.html:1.98 lms/templates/printindex.html:1.99 --- lms/templates/printindex.html:1.98 Wed Dec 15 13:10:15 2010 +++ lms/templates/printindex.html Thu Apr 7 12:01:41 2011 @@ -1,5 +1,5 @@ {include file="header.html"} - +

    {$layout.pagetitle}

    {include file="calendar_js.html"} {if $printmenu=="customer"} @@ -440,7 +440,7 @@ {foreach from=$divisions item=item} {/foreach} - +
    - - - {t}Period:{/t}  - - {t}From{/t}  - - {t}To{/t}  + + + + + + + + + + + +
    + + + {t}Period:{/t} + + {t}From{/t}  + + {t}To{/t}  +
    + {t}by date{/t}: + +
    + {t}extended format{/t}
    @@ -35,6 +35,7 @@ + Index: lms/templates/customersearch.html diff -u lms/templates/customersearch.html:1.23 lms/templates/customersearch.html:1.24 --- lms/templates/customersearch.html:1.23 Thu Mar 17 13:50:46 2011 +++ lms/templates/customersearch.html Thu Apr 7 12:28:17 2011 @@ -1,5 +1,5 @@ {include file="header.html"} - +

    {$layout.pagetitle}

    {include file="calendar_js.html"}