From cvs w lms.org.pl Tue Mar 1 11:39:36 2011 From: cvs w lms.org.pl (LMS CVS) Date: Tue, 1 Mar 2011 11:39:36 +0100 (CET) Subject: [lms-commits] CVS update of lms/daemon/modules/payments (payments.c) Message-ID: <20110301103936.D29F2302B611@eftep.altec.pl> Date: Tuesday, March 1, 2011 @ 11:39:36 Author: alec Path: /cvsroot/lms/daemon/modules/payments Modified: payments.c - lmsd/payments: Fixed error "Unknown column 'ats.customerid' in 'where clause'" Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/daemon/modules/payments/payments.c.diff?&r1=1.93&r2=1.94 Index: lms/daemon/modules/payments/payments.c diff -u lms/daemon/modules/payments/payments.c:1.93 lms/daemon/modules/payments/payments.c:1.94 --- lms/daemon/modules/payments/payments.c:1.93 Tue Jan 18 09:12:03 2011 +++ lms/daemon/modules/payments/payments.c Tue Mar 1 11:39:36 2011 @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: payments.c,v 1.93 2011/01/18 08:12:03 alec Exp $ + * $Id: payments.c,v 1.94 2011/03/01 10:39:36 alec Exp $ */ #include #include @@ -268,9 +268,9 @@ char monthname[20], nextmon[8]; char *nets = strdup(" AND EXISTS (SELECT 1 FROM nodes, networks n " - "WHERE ownerid = ats.customerid " + "WHERE ownerid = a.customerid " "AND (%nets) " - "AND ((ipaddr > address AND ipaddr < ("BROADCAST")) " + "AND ((ipaddr > address AND ipaddr < ("BROADCAST")) " "OR (ipaddr_pub > address AND ipaddr_pub < ("BROADCAST"))) )"); char *netnames = strdup(p->networks); @@ -278,7 +278,7 @@ char *netsql = strdup(""); char *enets = strdup(" AND NOT EXISTS (SELECT 1 FROM nodes, networks n " - "WHERE ownerid = ats.customerid " + "WHERE ownerid = a.customerid " "AND (%enets) " "AND ((ipaddr > address AND ipaddr < ("BROADCAST")) " "OR (ipaddr_pub > address AND ipaddr_pub < ("BROADCAST"))) )"); @@ -287,19 +287,19 @@ char *enetname = strdup(enetnames); char *enetsql = strdup(""); - char *groups = strdup(" AND EXISTS (SELECT 1 FROM customergroups g, customerassignments a " - "WHERE a.customerid = ats.customerid " - "AND g.id = a.customergroupid " - "AND (%groups)) "); + char *groups = strdup(" AND EXISTS (SELECT 1 FROM customergroups g, customerassignments ca " + "WHERE ca.customerid = a.customerid " + "AND g.id = ca.customergroupid " + "AND (%groups)) "); char *groupnames = strdup(p->customergroups); char *groupname = strdup(groupnames); char *groupsql = strdup(""); - char *egroups = strdup(" AND NOT EXISTS (SELECT 1 FROM customergroups g, customerassignments a " - "WHERE a.customerid = ats.customerid " - "AND g.id = a.customergroupid " - "AND (%egroups)) "); + char *egroups = strdup(" AND NOT EXISTS (SELECT 1 FROM customergroups g, customerassignments ca " + "WHERE ca.customerid = a.customerid " + "AND g.id = ca.customergroupid " + "AND (%egroups)) "); char *egroupnames = strdup(p->excluded_customergroups); char *egroupname = strdup(egroupnames); @@ -935,12 +935,12 @@ char *query = strdup( "UPDATE documents SET closed = 1 " "WHERE customerid IN ( " - "SELECT ats.customerid " - "FROM cash ats " - "WHERE ats.time <= %NOW% " + "SELECT a.customerid " + "FROM cash a " + "WHERE a.time <= %NOW% " " %nets%enets%groups%egroups " - "GROUP BY ats.customerid " - "HAVING SUM(ats.value) >= 0) " + "GROUP BY a.customerid " + "HAVING SUM(a.value) >= 0) " "AND type IN (1, 3, 5) " "AND cdate <= %NOW% " "AND closed = 0"); From cvs w lms.org.pl Wed Mar 2 11:31:04 2011 From: cvs w lms.org.pl (LMS CVS) Date: Wed, 2 Mar 2011 11:31:04 +0100 (CET) Subject: [lms-commits] CVS update of lms/doc/sgml (advanced.sgml, install.sgml) Message-ID: <20110302103104.8C0C8302B612@eftep.altec.pl> Date: Wednesday, March 2, 2011 @ 11:31:04 Author: alec Path: /cvsroot/lms/doc/sgml Modified: advanced.sgml install.sgml - Added Promotions with assignments shedule schemas - Use tariff name+value+period as a unique key instead of just a name - Now PostgreSQL 8.2 is required because of multi-value INSERT usage - Changed money.gif icon Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/sgml/advanced.sgml.diff?&r1=1.119&r2=1.120 http://cvs.lms.org.pl/viewvc/Development/lms/doc/sgml/install.sgml.diff?&r1=1.153&r2=1.154 Index: lms/doc/sgml/advanced.sgml diff -u lms/doc/sgml/advanced.sgml:1.119 lms/doc/sgml/advanced.sgml:1.120 --- lms/doc/sgml/advanced.sgml:1.119 Mon Dec 27 13:35:16 2010 +++ lms/doc/sgml/advanced.sgml Wed Mar 2 11:31:04 2011 @@ -1,4 +1,4 @@ - + For curious @@ -354,6 +354,35 @@ description - description for subscription + + Promotions ('promotions') + + id - serial number + name - promotion name + description - additional information + disabled - status + + + + Promotion Schemas ('promotionschemas') + + id - serial number + name - schema name + description - additional information + promotionid - promotion identifier + data - schema periods definition + disabled - status + + + + Schema-To-Tariff assignments ('promotionassignments') + + id - serial number + promotionschemaid - schema identifier + tariffid - subscription identifier + data - schema values definition + + Custom liabilities ('liabilities') Index: lms/doc/sgml/install.sgml diff -u lms/doc/sgml/install.sgml:1.153 lms/doc/sgml/install.sgml:1.154 --- lms/doc/sgml/install.sgml:1.153 Tue Sep 29 11:18:39 2009 +++ lms/doc/sgml/install.sgml Wed Mar 2 11:31:04 2011 @@ -1,4 +1,4 @@ - + Installation and configuration @@ -57,7 +57,7 @@ Database Server MySQL server in version 5.x is supported. Probably LMS won't work correctly with older versions. - PostgreSQL in version 8.1.x or higher is supported. + PostgreSQL in version 8.2.x or higher is supported. Smarty Library @@ -223,7 +223,7 @@ PostgreSQL Intro - LMS require PostgreSQL 8.1 or higher. If you have not installed PostgreSQL server, + LMS require PostgreSQL 8.2 or higher. If you have not installed PostgreSQL server, you can compile it yourself from sources available on www.postgresql.org. @@ -268,7 +268,7 @@ The need for password actually depends on Postgres users authentication configuration found in /usr/local/pgsql/data/pg_hba.conf (refer to + url="http://www.postgresql.org/docs/current/interactive/auth-pg-hba-conf.html"> Postgresql documentation). By default password is not required and you can comment it with semicolon. After this step you should be able to enter your system without any problems. From cvs w lms.org.pl Wed Mar 2 11:31:04 2011 From: cvs w lms.org.pl (LMS CVS) Date: Wed, 2 Mar 2011 11:31:04 +0100 (CET) Subject: [lms-commits] CVS update of lms/doc/sgml/pl (advanced.sgml, install.sgml) Message-ID: <20110302103104.BCA9E302B613@eftep.altec.pl> Date: Wednesday, March 2, 2011 @ 11:31:04 Author: alec Path: /cvsroot/lms/doc/sgml/pl Modified: advanced.sgml install.sgml - Added Promotions with assignments shedule schemas - Use tariff name+value+period as a unique key instead of just a name - Now PostgreSQL 8.2 is required because of multi-value INSERT usage - Changed money.gif icon Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/sgml/pl/advanced.sgml.diff?&r1=1.81&r2=1.82 http://cvs.lms.org.pl/viewvc/Development/lms/doc/sgml/pl/install.sgml.diff?&r1=1.100&r2=1.101 Index: lms/doc/sgml/pl/advanced.sgml diff -u lms/doc/sgml/pl/advanced.sgml:1.81 lms/doc/sgml/pl/advanced.sgml:1.82 --- lms/doc/sgml/pl/advanced.sgml:1.81 Mon Dec 27 13:35:16 2010 +++ lms/doc/sgml/pl/advanced.sgml Wed Mar 2 11:31:04 2011 @@ -1,4 +1,4 @@ - + Dla dociekliwych @@ -368,6 +368,35 @@ description - opis + + Promocje ('promotions') + + id - identyfikator + name - nazwa promocji + description - opis + disabled - status + + + + Schematy promocji ('promotionschemas') + + id - identyfikator + name - nazwa schematu + description - opis + promotionid - identyfikator promocji + data - definicja okresów schematu + disabled - status + + + + Powiązania schematów z taryfami ('promotionassignments') + + id - identyfikator + promotionschemaid - identyfikator schematu + tariffid - identyfikator taryfy + data - definicje kwot abonamentu + + Zobowiązania ('liabilities') Index: lms/doc/sgml/pl/install.sgml diff -u lms/doc/sgml/pl/install.sgml:1.100 lms/doc/sgml/pl/install.sgml:1.101 --- lms/doc/sgml/pl/install.sgml:1.100 Fri Feb 5 13:40:13 2010 +++ lms/doc/sgml/pl/install.sgml Wed Mar 2 11:31:04 2011 @@ -1,4 +1,4 @@ - + Instalacja i konfiguracja @@ -59,7 +59,7 @@ Serwer baz danych LMS nie będzie działał prawidłowo na wersjach MySQL starszych od 5.0. - LMS współpracuje także z PostgreSQL w wersji 8.1.x lub nowszych. + LMS współpracuje także z PostgreSQL w wersji 8.2.x lub nowszych. Biblioteka Smarty @@ -255,7 +255,7 @@ PostgreSQL Wstęp - LMS jest testowany na PostgreSQL 8.1.x i nowszych, możesz mieć + LMS jest testowany na PostgreSQL 8.2.x i nowszych, możesz mieć problemy korzystając ze starszych wersji. Jeżeli nie masz zainstalowanego serwera PostgreSQL, możesz np. własnoręcznie skompilować go ze źródeł dostępnych na stronie From cvs w lms.org.pl Wed Mar 2 11:31:04 2011 From: cvs w lms.org.pl (LMS CVS) Date: Wed, 2 Mar 2011 11:31:04 +0100 (CET) Subject: [lms-commits] CVS update of lms/img (common.js, money.gif, promo.gif, promoschema.gif) Message-ID: <20110302103104.E0560302B614@eftep.altec.pl> Date: Wednesday, March 2, 2011 @ 11:31:04 Author: alec Path: /cvsroot/lms/img Added: promo.gif promoschema.gif Modified: common.js money.gif - Added Promotions with assignments shedule schemas - Use tariff name+value+period as a unique key instead of just a name - Now PostgreSQL 8.2 is required because of multi-value INSERT usage - Changed money.gif icon Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/img/common.js.diff?&r1=1.30&r2=1.31 http://cvs.lms.org.pl/viewvc/Development/lms/img/money.gif.diff?&r1=1.8&r2=1.9 http://cvs.lms.org.pl/viewvc/Development/lms/img/promo.gif?rev=1.1 http://cvs.lms.org.pl/viewvc/Development/lms/img/promoschema.gif?rev=1.1 Index: lms/img/common.js diff -u lms/img/common.js:1.30 lms/img/common.js:1.31 --- lms/img/common.js:1.30 Wed Jan 5 21:40:30 2011 +++ lms/img/common.js Wed Mar 2 11:31:04 2011 @@ -140,7 +140,7 @@ document.cookie = name + '=' + escape(value); } -if (typeof String.prototype.trim == 'undefined') +if (typeof String.prototype.trim == 'undefined') { String.prototype.trim = function() { @@ -149,6 +149,19 @@ }; } +if (typeof Array.prototype.inArray == 'undefined') +{ + Array.prototype.inArray = function(v) + { + for (var i in this) { + if (this[i] == v) { + return true; + } + } + return false; + } +} + function checkElement(id) { var elem = document.getElementById(id); Index: lms/img/money.gif <> Index: lms/img/promo.gif <> Index: lms/img/promoschema.gif <> From cvs w lms.org.pl Wed Mar 2 11:31:04 2011 From: cvs w lms.org.pl (LMS CVS) Date: Wed, 2 Mar 2011 11:31:04 +0100 (CET) Subject: [lms-commits] CVS update of lms/doc (ChangeLog, lms.mysql, lms.pgsql) Message-ID: <20110302103104.4CB92302B611@eftep.altec.pl> Date: Wednesday, March 2, 2011 @ 11:31:04 Author: alec Path: /cvsroot/lms/doc Modified: ChangeLog lms.mysql lms.pgsql - Added Promotions with assignments shedule schemas - Use tariff name+value+period as a unique key instead of just a name - Now PostgreSQL 8.2 is required because of multi-value INSERT usage - Changed money.gif icon Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/ChangeLog.diff?&r1=1.1541&r2=1.1542 http://cvs.lms.org.pl/viewvc/Development/lms/doc/lms.mysql.diff?&r1=1.181&r2=1.182 http://cvs.lms.org.pl/viewvc/Development/lms/doc/lms.pgsql.diff?&r1=1.177&r2=1.178 Index: lms/doc/ChangeLog diff -u lms/doc/ChangeLog:1.1541 lms/doc/ChangeLog:1.1542 --- lms/doc/ChangeLog:1.1541 Fri Feb 18 15:32:45 2011 +++ lms/doc/ChangeLog Wed Mar 2 11:31:03 2011 @@ -1,4 +1,4 @@ -$Id: ChangeLog,v 1.1541 2011/02/18 14:32:45 alec Exp $ +$Id: ChangeLog,v 1.1542 2011/03/02 10:31:03 alec Exp $ version ? (????-??-??) @@ -11,8 +11,12 @@ - Fixed SQL query in lms-makewarnings (alec) - Fixed order of tables in database backup (alec) - Fixed printing of DB errors while recovering database backup (alec) - - Use tariff name+value as a unique key instead of just a name (alec) - Added simple plugin API with some hooks on node actions (alec) + - BTS#0000856: Fixed "Hide/Show expired" link on node* pages (alec) + - lmsd/payments: Fixed error "Unknown column 'ats.customerid' in 'where clause'" (alec) + - Added Promotions with assignments shedule schemas (alec) + - Use tariff name+value+period as a unique key instead of just a name (alec) + - Now PostgreSQL 8.2 is required because of multi-value INSERT usage (alec) version 1.11.11 Bray (2011-01-17) Index: lms/doc/lms.mysql diff -u lms/doc/lms.mysql:1.181 lms/doc/lms.mysql:1.182 --- lms/doc/lms.mysql:1.181 Thu Feb 17 13:08:42 2011 +++ lms/doc/lms.mysql Wed Mar 2 11:31:03 2011 @@ -1,5 +1,5 @@ # -------------------------------------------------------- -# $Id: lms.mysql,v 1.181 2011/02/17 12:08:42 alec Exp $ +# $Id: lms.mysql,v 1.182 2011/03/02 10:31:03 alec Exp $ # -------------------------------------------------------- # -- Drop tables first, MySQL doesn't support CASCADE @@ -44,6 +44,9 @@ DROP TABLE IF EXISTS rtrights; DROP TABLE IF EXISTS stats; DROP TABLE IF EXISTS tariffs; +DROP TABLE IF EXISTS promotions; +DROP TABLE IF EXISTS promotionschemas; +DROP TABLE IF EXISTS promotionassignments; DROP TABLE IF EXISTS liabilities; DROP TABLE IF EXISTS customergroups; DROP TABLE IF EXISTS customerassignments; @@ -728,12 +731,57 @@ quota_sql_limit int(11) DEFAULT NULL, description text NOT NULL, PRIMARY KEY (id), - UNIQUE KEY name (name, value), + UNIQUE KEY name (name, value, period), INDEX type (type) ) ENGINE=InnoDB; # -------------------------------------------------------- # +# Structure of table promotions +# +CREATE TABLE promotions ( + id int(11) NOT NULL auto_increment, + name varchar(255) NOT NULL, + description text DEFAULT NULL, + disabled tinyint(1) DEFAULT '0' NOT NULL, + PRIMARY KEY (id), + UNIQUE KEY name (name) +) ENGINE=InnoDB; + +# -------------------------------------------------------- +# +# Structure of table promotionschemas +# +CREATE TABLE promotionschemas ( + id int(11) NOT NULL auto_increment, + name varchar(255) NOT NULL, + description text DEFAULT NULL, + data text DEFAULT NULL, + promotionid int(11) DEFAULT NULL + REFERENCES promotions (id) ON DELETE CASCADE ON UPDATE CASCADE, + disabled tinyint(1) DEFAULT '0' NOT NULL, + PRIMARY KEY (id), + UNIQUE KEY promotionid (promotionid, name) +) ENGINE=InnoDB; + +# -------------------------------------------------------- +# +# Structure of table promotionassignments +# +CREATE TABLE promotionassignments ( + id int(11) NOT NULL auto_increment, + promotionschemaid int(11) DEFAULT NULL + REFERENCES promotionschemas (id) ON DELETE CASCADE ON UPDATE CASCADE, + tariffid int(11) DEFAULT NULL + REFERENCES tariffs (id) ON DELETE CASCADE ON UPDATE CASCADE, + data text DEFAULT NULL, + PRIMARY KEY (id), + UNIQUE KEY promotionschemaid (promotionschemaid, tariffid), + INDEX tariffid (tariffid) +) ENGINE=InnoDB; + +# -------------------------------------------------------- +# # Structure of table liabilities # CREATE TABLE liabilities ( @@ -1425,4 +1473,4 @@ # -------------------------------------------------------- -INSERT INTO dbinfo (keytype, keyvalue) VALUES ('dbversion', '2011021700'); +INSERT INTO dbinfo (keytype, keyvalue) VALUES ('dbversion', '2011022000'); Index: lms/doc/lms.pgsql diff -u lms/doc/lms.pgsql:1.177 lms/doc/lms.pgsql:1.178 --- lms/doc/lms.pgsql:1.177 Thu Feb 17 13:08:42 2011 +++ lms/doc/lms.pgsql Wed Mar 2 11:31:03 2011 @@ -1,4 +1,4 @@ -/* $Id: lms.pgsql,v 1.177 2011/02/17 12:08:42 alec Exp $ */ +/* $Id: lms.pgsql,v 1.178 2011/03/02 10:31:03 alec Exp $ */ /* -------------------------------------------------------- Structure of table "users" @@ -311,12 +311,63 @@ quota_sql_limit integer DEFAULT NULL, description text DEFAULT '' NOT NULL, PRIMARY KEY (id), - UNIQUE (name, value) + UNIQUE (name, value, period) ); CREATE INDEX tariffs_type_idx ON tariffs (type); -/* -------------------------------------------------------- - Structure of table "liabilities" +/* -------------------------------------------------------- + Structure of table "promotions" +-------------------------------------------------------- */ +DROP SEQUENCE promotions_id_seq; +CREATE SEQUENCE promotions_id_seq; +DROP TABLE promotions CASCADE +CREATE TABLE promotions ( + id integer DEFAULT nextval('promotions_id_seq'::text) NOT NULL, + name varchar(255) NOT NULL, + description text DEFAULT NULL, + disabled smallint DEFAULT 0 NOT NULL, + PRIMARY KEY (id), + UNIQUE (name) +); + +/* -------------------------------------------------------- + Structure of table "promotionschemas" +-------------------------------------------------------- */ +DROP SEQUENCE promotionschemas_id_seq; +CREATE SEQUENCE promotionschemas_id_seq; +DROP TABLE promotionschemas CASCADE; +CREATE TABLE promotionschemas ( + id integer DEFAULT nextval('promotionschemas_id_seq'::text) NOT NULL, + name varchar(255) NOT NULL, + description text DEFAULT NULL, + data text DEFAULT NULL, + promotionid integer DEFAULT NULL + REFERENCES promotions (id) ON DELETE CASCADE ON UPDATE CASCADE, + disabled smallint DEFAULT 0 NOT NULL, + PRIMARY KEY (id), + UNIQUE (promotionid, name) +); + +/* -------------------------------------------------------- + Structure of table "promotionassignments" +-------------------------------------------------------- */ +DROP SEQUENCE promotionassignments_id_seq; +CREATE SEQUENCE promotionassignments_id_seq; +DROP TABLE promotionassignments CASCADE; +CREATE TABLE promotionassignments ( + id integer DEFAULT nextval('promotionassignments_id_seq'::text) NOT NULL, + promotionschemaid integer DEFAULT NULL + REFERENCES promotionschemas (id) ON DELETE CASCADE ON UPDATE CASCADE, + tariffid integer DEFAULT NULL + REFERENCES tariffs (id) ON DELETE CASCADE ON UPDATE CASCADE, + data text DEFAULT NULL, + PRIMARY KEY (id), + UNIQUE (promotionschemaid, tariffid) +); +CREATE INDEX promotionassignments_tariffid_idx ON promotionassignments (tariffid); + +/* -------------------------------------------------------- + Structure of table "liabilities" -------------------------------------------------------- */ DROP SEQUENCE liabilities_id_seq; CREATE SEQUENCE liabilities_id_seq; @@ -1519,4 +1570,4 @@ INSERT INTO nastypes (name) VALUES ('usrhiper'); INSERT INTO nastypes (name) VALUES ('other'); -INSERT INTO dbinfo (keytype, keyvalue) VALUES ('dbversion', '2011021700'); +INSERT INTO dbinfo (keytype, keyvalue) VALUES ('dbversion', '2011022000'); From cvs w lms.org.pl Wed Mar 2 11:31:05 2011 From: cvs w lms.org.pl (LMS CVS) Date: Wed, 2 Mar 2011 11:31:05 +0100 (CET) Subject: [lms-commits] CVS update of lms/lib/upgradedb (2 files) Message-ID: <20110302103105.69D98301E598@eftep.altec.pl> Date: Wednesday, March 2, 2011 @ 11:31:05 Author: alec Path: /cvsroot/lms/lib/upgradedb Added: mysql.2011022000.php postgres.2011022000.php - Added Promotions with assignments shedule schemas - Use tariff name+value+period as a unique key instead of just a name - Now PostgreSQL 8.2 is required because of multi-value INSERT usage - Changed money.gif icon Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/lib/upgradedb/mysql.2011022000.php?rev=1.1 http://cvs.lms.org.pl/viewvc/Development/lms/lib/upgradedb/postgres.2011022000.php?rev=1.1 Index: lms/lib/upgradedb/mysql.2011022000.php diff -u /dev/null lms/lib/upgradedb/mysql.2011022000.php:1.1 --- /dev/null Wed Mar 2 11:31:05 2011 +++ lms/lib/upgradedb/mysql.2011022000.php Wed Mar 2 11:31:05 2011 @@ -0,0 +1,69 @@ +BeginTrans(); + +$DB->Execute(" +CREATE TABLE promotions ( + id int(11) NOT NULL auto_increment, + name varchar(255) NOT NULL, + description text DEFAULT NULL, + disabled tinyint(1) DEFAULT '0' NOT NULL, + PRIMARY KEY (id), + UNIQUE KEY name (name) +) ENGINE=InnoDB") + +$DB->Execute(" +CREATE TABLE promotionschemas ( + id int(11) NOT NULL auto_increment, + name varchar(255) NOT NULL, + description text DEFAULT NULL, + data text DEFAULT NULL, + promotionid int(11) DEFAULT NULL + REFERENCES promotions (id) ON DELETE CASCADE ON UPDATE CASCADE, + disabled tinyint(1) DEFAULT '0' NOT NULL, + PRIMARY KEY (id), + UNIQUE KEY promotionid (promotionid, name) +) ENGINE=InnoDB"); + +$DB->Execute(" +CREATE TABLE promotionassignments ( + id int(11) NOT NULL auto_increment, + promotionschemaid int(11) DEFAULT NULL + REFERENCES promotionschemas (id) ON DELETE CASCADE ON UPDATE CASCADE, + tariffid int(11) DEFAULT NULL + REFERENCES tariffs (id) ON DELETE CASCADE ON UPDATE CASCADE, + data text DEFAULT NULL, + PRIMARY KEY (id), + UNIQUE KEY promotionschemaid (promotionschemaid, tariffid), + INDEX tariffid (tariffid) +) ENGINE=InnoDB"); + +$DB->Execute("ALTER TABLE tariffs DROP KEY name"); +$DB->Execute("ALTER TABLE tariffs ADD UNIQUE KEY name (name, value, period)"); + +$DB->Execute("UPDATE dbinfo SET keyvalue = ? WHERE keytype = ?", array('2011022000', 'dbversion')); + +$DB->CommitTrans(); + +?> Index: lms/lib/upgradedb/postgres.2011022000.php diff -u /dev/null lms/lib/upgradedb/postgres.2011022000.php:1.1 --- /dev/null Wed Mar 2 11:31:05 2011 +++ lms/lib/upgradedb/postgres.2011022000.php Wed Mar 2 11:31:05 2011 @@ -0,0 +1,72 @@ +BeginTrans(); + +$DB->Execute(" +CREATE SEQUENCE promotions_id_seq; +CREATE TABLE promotions ( + id integer DEFAULT nextval('promotions_id_seq'::text) NOT NULL, + name varchar(255) NOT NULL, + description text DEFAULT NULL, + disabled smallint DEFAULT 0 NOT NULL, + PRIMARY KEY (id), + UNIQUE (name) +); + +CREATE SEQUENCE promotionschemas_id_seq; +CREATE TABLE promotionschemas ( + id integer DEFAULT nextval('promotionschemas_id_seq'::text) NOT NULL, + name varchar(255) NOT NULL, + description text DEFAULT NULL, + data text DEFAULT NULL, + promotionid integer DEFAULT NULL + REFERENCES promotions (id) ON DELETE CASCADE ON UPDATE CASCADE, + disabled smallint DEFAULT 0 NOT NULL, + PRIMARY KEY (id), + UNIQUE (promotionid, name) +); + +CREATE SEQUENCE promotionassignments_id_seq; +CREATE TABLE promotionassignments ( + id integer DEFAULT nextval('promotionassignments_id_seq'::text) NOT NULL, + promotionschemaid integer DEFAULT NULL + REFERENCES promotionschemas (id) ON DELETE CASCADE ON UPDATE CASCADE, + tariffid integer DEFAULT NULL + REFERENCES tariffs (id) ON DELETE CASCADE ON UPDATE CASCADE, + data text DEFAULT NULL, + PRIMARY KEY (id), + UNIQUE (promotionschemaid, tariffid) +); +CREATE INDEX promotionassignments_tariffid_idx ON promotionassignments (tariffid); + +ALTER TABLE tariffs DROP CONSTRAINT tariffs_name_key; +ALTER TABLE tariffs ADD UNIQUE(name, value, period); +"); + + +$DB->Execute("UPDATE dbinfo SET keyvalue = ? WHERE keytype = ?", array('2011022000', 'dbversion')); + +$DB->CommitTrans(); + +?> From cvs w lms.org.pl Wed Mar 2 11:31:05 2011 From: cvs w lms.org.pl (LMS CVS) Date: Wed, 2 Mar 2011 11:31:05 +0100 (CET) Subject: [lms-commits] CVS update of lms/lib/locale/pl (strings.php) Message-ID: <20110302103105.4C332302B616@eftep.altec.pl> Date: Wednesday, March 2, 2011 @ 11:31:05 Author: alec Path: /cvsroot/lms/lib/locale/pl Modified: strings.php - Added Promotions with assignments shedule schemas - Use tariff name+value+period as a unique key instead of just a name - Now PostgreSQL 8.2 is required because of multi-value INSERT usage - Changed money.gif icon Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/lib/locale/pl/strings.php.diff?&r1=1.375&r2=1.376 Index: lms/lib/locale/pl/strings.php diff -u lms/lib/locale/pl/strings.php:1.375 lms/lib/locale/pl/strings.php:1.376 --- lms/lib/locale/pl/strings.php:1.375 Thu Feb 17 13:08:43 2011 +++ lms/lib/locale/pl/strings.php Wed Mar 2 11:31:05 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: strings.php,v 1.375 2011/02/17 12:08:43 alec Exp $ + * $Id: strings.php,v 1.376 2011/03/02 10:31:05 alec Exp $ */ $_LANG['$0 ($1 addresses)'] = '$0 ($1 adresów)'; @@ -2391,5 +2391,48 @@ $_LANG['period undefined'] = 'okres niezdefiniowany'; $_LANG['Select time period of tariff accounting'] = 'Wybierz okres naliczania taryfy'; $_LANG['undefined'] = 'niezdefiniowany'; +$_LANG['Activation'] = 'Aktywacja'; +$_LANG['Add assignment'] = 'Dodaj powiązanie'; +$_LANG['Add promotion'] = 'Dodaj promocję'; +$_LANG['Are you sure, you want to delete this assignment?'] = 'Czy na pewno chcesz usunąć to powiązanie?'; +$_LANG['Are you sure, you want to delete this promotion?'] = 'Czy na pewno chcesz usunąć tą promocję?'; +$_LANG['Are you sure, you want to delete this schema?'] = 'Czy na pewno chcesz usunąć ten schemat?'; +$_LANG['Are you sure, you want to remove promotion \\\'$0\\\'?'] = 'Czy na pewno chcesz usunąć promocję \\\'$0\\\'?'; +$_LANG['Are you sure, you want to remove schema \\\'$0\\\'?'] = 'Czy na pewno chcesz usunąć schemat \\\'$0\\\'?'; +$_LANG['Display this form again, when this promotion is saved'] = 'Wyświetl formularz ponownie po dodaniu tej promocji'; +$_LANG['Display this form again, when this schema is saved'] = 'Wyświetl formularz ponownie po dodaniu tego schematu'; +$_LANG['Edit assignment'] = 'Edytuj powiązanie'; +$_LANG['Enter activation value'] = 'Wprowadź kwotę opłaty aktywacyjnej'; +$_LANG['Enter promotion name'] = 'Wprowadź nazwę promocji'; +$_LANG['Enter schema name'] = 'Wprowadź nazwę schematu'; +$_LANG['Enter subscription value for specified period'] = 'Wprowadź kwotę abonamentu w wybranym okresie'; +$_LANG['List of promotions'] = 'Lista promocji'; +$_LANG['Months $0-$1'] = 'M-ce $0-$1'; +$_LANG['Month $0'] = 'M-c $0'; +$_LANG['New Promotion'] = 'Nowa promocja'; +$_LANG['New Schema'] = 'Nowy schemat'; +$_LANG['Periods:'] = 'Okresy:'; +$_LANG['Promotion:'] = 'Promocja:'; +$_LANG['Promotions'] = 'Promocje'; +$_LANG['Promotions List'] = 'Lista promocji'; +$_LANG['Promotion\'s Schemas ($0):'] = 'Schematy promocji ($0)'; +$_LANG['Promotion\'s Tariffs ($0):'] = 'Taryfy promocji ($0)'; +$_LANG['Promotion Edit: $0'] = 'Edycja promocji: $0'; +$_LANG['Promotion Info: $0'] = 'Informacje o promocji: $0'; +$_LANG['Promotion name is required!'] = 'Nazwa promocji jest wymagana!'; +$_LANG['Schemas:'] = 'Schematy:'; +$_LANG['Schema\'s Tariffs ($0):'] = 'Taryfy schematu ($0)'; +$_LANG['Schema Edit: $0'] = 'Edycja schematu: $0'; +$_LANG['Schema Info: $0'] = 'Informacje o schemacie: $0'; +$_LANG['Schema name is required!'] = 'Nazwa schematu jest wymagana!'; +$_LANG['Select length of the period (in months)'] = 'Wybierz długość okresu (w miesiącach)'; +$_LANG['Select subscription'] = 'Wybierz taryfę'; +$_LANG['Tariffs:'] = 'Taryfy:'; +$_LANG['There are no promotions in database.'] = 'Brak promocji w bazie danych.'; +$_LANG['This promotion hasn\'t got any schemas.'] = 'Ta promocja nie posiada żadnych schematów.'; +$_LANG['This promotion has no assigned tariffs.'] = 'Ta promocja nie posiada przypisanych taryf.'; +$_LANG['This schema has no assigned tariffs.'] = 'Ten schemat nie posiada przypisanych taryf.'; +$_LANG['Unable to edit two rows at once!'] = 'Nie można edytować dwóch rekordów jednocześnie!'; +$_LANG['unlimited'] = 'nieokreślony'; ?> From cvs w lms.org.pl Wed Mar 2 11:31:05 2011 From: cvs w lms.org.pl (LMS CVS) Date: Wed, 2 Mar 2011 11:31:05 +0100 (CET) Subject: [lms-commits] CVS update of lms/lib (4 files) Message-ID: <20110302103105.25DD1302B615@eftep.altec.pl> Date: Wednesday, March 2, 2011 @ 11:31:05 Author: alec Path: /cvsroot/lms/lib Modified: LMS.class.php accesstable.php menu.php upgradedb.php - Added Promotions with assignments shedule schemas - Use tariff name+value+period as a unique key instead of just a name - Now PostgreSQL 8.2 is required because of multi-value INSERT usage - Changed money.gif icon Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/lib/LMS.class.php.diff?&r1=1.1052&r2=1.1053 http://cvs.lms.org.pl/viewvc/Development/lms/lib/accesstable.php.diff?&r1=1.138&r2=1.139 http://cvs.lms.org.pl/viewvc/Development/lms/lib/menu.php.diff?&r1=1.61&r2=1.62 http://cvs.lms.org.pl/viewvc/Development/lms/lib/upgradedb.php.diff?&r1=1.186&r2=1.187 Index: lms/lib/LMS.class.php diff -u lms/lib/LMS.class.php:1.1052 lms/lib/LMS.class.php:1.1053 --- lms/lib/LMS.class.php:1.1052 Fri Feb 18 15:32:46 2011 +++ lms/lib/LMS.class.php Wed Mar 2 11:31:04 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: LMS.class.php,v 1.1052 2011/02/18 14:32:46 alec Exp $ + * $Id: LMS.class.php,v 1.1053 2011/03/02 10:31:04 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.1052 $'; + var $_revision = '$Revision: 1.1053 $'; function LMS(&$DB, &$AUTH, &$CONFIG) // class variables setting { @@ -1855,32 +1855,155 @@ function DeleteAssignment($id) { $this->DB->BeginTrans(); - + if($lid = $this->DB->GetOne('SELECT liabilityid FROM assignments WHERE id=?', array($id))) { $this->DB->Execute('DELETE FROM liabilities WHERE id=?', array($lid)); } $this->DB->Execute('DELETE FROM assignments WHERE id=?', array($id)); - + $this->DB->CommitTrans(); } function AddAssignment($data) { - if(!empty($data['value'])) - { - $this->DB->Execute('INSERT INTO liabilities (name, value, taxid, prodid) + $result = array(); + + // Create assignments according to promotion schema + if (!empty($data['promotiontariffid']) && !empty($data['schemaid'])) { + $data['tariffid'] = $data['promotiontariffid']; + $tariff = $this->DB->GetRow('SELECT a.data, s.data AS schema, + t.name, t.value, t.period, t.id, t.prodid, t.taxid + FROM promotionassignments a + JOIN promotionschemas s ON (s.id = a.promotionschemaid) + JOIN tariffs t ON (t.id = a.tariffid) + WHERE a.promotionschemaid = ? AND a.tariffid = ?', + array($data['schemaid'], $data['promotiontariffid'])); + $data_schema = explode(';', $tariff['schema']); + $data_tariff = explode(';', $tariff['data']); + + foreach ($data_tariff as $idx => $dt) { + list($value, $period) = explode(':', $dt); + // Activation + if (!$idx) { + $start_day = date('d', $data['datefrom']); + $start_month = date('n', $data['datefrom']); + $start_year = date('Y', $data['datefrom']); + // payday is before the start of the period + // set activation payday to next month's payday + if ($start_day > $data['at']) { + $_datefrom = $data['datefrom']; + $datefrom = mktime(0,0,0, $start_month+1, $data['at'], $start_year); + } else { + $datefrom = $data['datefrom']; + } + + // if activation value specified, create disposable liability + if (f_round($value)) { + $this->DB->Execute('INSERT INTO liabilities (name, value, taxid, prodid) + VALUES (?, ?, ?, ?)', + array(trans('Activation payment'), + str_replace(',', '.', $value), + intval($tariff['taxid']), + $tariff['prodid'] + )); + $lid = $this->DB->GetLastInsertID('liabilities'); + $tariffid = 0; + $period = DISPOSABLE; + $at = $datefrom; + $datefrom = $dateto = 0; + } else { + continue; + } + } + // promotion period (or after promotion) + else { + $lid = 0; + if (!$period) + $period = $data['period']; + $datefrom = $_datefrom ? $_datefrom : $datefrom; + $_datefrom = 0; + $at = $this->CalcAt($period, $datefrom); + $length = $data_schema[$idx-1]; + if ($length) { + $month = date('n', $datefrom); + $year = date('Y', $datefrom); + // assume $data['at'] == 1, set last day of the specified month + $dateto = mktime(23,59,59, $month+$length, 0, $year); + } + else { + $dateto = 0; + } + + // Find tariff with specified name+value+period... + $tariffid = $this->DB->GetOne('SELECT id FROM tariffs + WHERE name = ? AND value = ? AND period = ? + LIMIT 1', array( + $tariff['name'], + str_replace(',', '.', $value), + $tariff['period'], + )); + + // ... if not found clone tariff + if (!$tariffid) { + $this->DB->Execute('INSERT INTO tariffs (name, value, period, + taxid, type, upceil, downceil, uprate, downrate, + prodid, plimit, climit, dlimit, upceil_n, downceil_n, uprate_n, downrate_n, + domain_limit, alias_limit, sh_limit, www_limit, ftp_limit, mail_limit, sql_limit, + quota_sh_limit, quota_www_limit, quota_ftp_limit, quota_mail_limit, quota_sql_limit) + SELECT ?, ?, ?, taxid, type, upceil, downceil, uprate, downrate, + prodid, plimit, climit, dlimit, upceil_n, downceil_n, uprate_n, downrate_n, + domain_limit, alias_limit, sh_limit, www_limit, ftp_limit, mail_limit, sql_limit, + quota_sh_limit, quota_www_limit, quota_ftp_limit, quota_mail_limit, quota_sql_limit + FROM tariffs WHERE id = ?', + array( + $tariff['name'], + str_replace(',', '.', $value), + $tariff['period'], + $tariff['id'], + )); + $tariffid = $this->DB->GetLastInsertId('tariffs'); + } + } + + // Create assignment + $this->DB->Execute('INSERT INTO assignments (tariffid, customerid, period, at, invoice, + settlement, numberplanid, paytype, datefrom, dateto, discount, liabilityid) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', + array($tariffid, + $data['customerid'], + $period, + $at, + !empty($data['invoice']) ? 1 : 0, + !empty($data['settlement']) ? 1 : 0, + !empty($data['numberplanid']) ? $data['numberplanid'] : NULL, + !empty($data['paytype']) ? $data['paytype'] : NULL, + $datefrom, + $dateto, + 0, + $lid, + )); + + $result[] = $this->DB->GetLastInsertID('assignments'); + if ($idx) + $datefrom = $dateto+1; + } + } + // Create one assignment record + else { + if(!empty($data['value'])) { + $this->DB->Execute('INSERT INTO liabilities (name, value, taxid, prodid) VALUES (?, ?, ?, ?)', array($data['name'], str_replace(',', '.', $data['value']), intval($data['taxid']), $data['prodid'] )); - $lid = $this->DB->GetLastInsertID('liabilities'); - } + $lid = $this->DB->GetLastInsertID('liabilities'); + } - $this->DB->Execute('INSERT INTO assignments (tariffid, customerid, period, at, invoice, - settlement, numberplanid, paytype, datefrom, dateto, discount, liabilityid) + $this->DB->Execute('INSERT INTO assignments (tariffid, customerid, period, at, invoice, + settlement, numberplanid, paytype, datefrom, dateto, discount, liabilityid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', array(intval($data['tariffid']), $data['customerid'], @@ -1896,12 +2019,21 @@ isset($lid) ? $lid : 0, )); - $result = $this->DB->GetLastInsertID('assignments'); + $result[] = $this->DB->GetLastInsertID('assignments'); + } - if(!empty($data['nodes'])) - foreach((array)$data['nodes'] as $node) - $this->DB->Execute('INSERT INTO nodeassignments (nodeid, assignmentid) VALUES (?,?)', - array($node, $result)); + if (!empty($data['nodes']) && !empty($result)) { + // Use multi-value INSERT query + $values = array(); + foreach ((array)$data['nodes'] as $nodeid) { + foreach ($result as $aid) { + $values[] = sprintf('(%d, %d)', $nodeid, $aid); + } + } + + $this->DB->Execute('INSERT INTO nodeassignments (nodeid, assignmentid) + VALUES ' . implode(', ', $values)); + } return $result; } @@ -2272,12 +2404,6 @@ return FALSE; } - function GetTariffIDByNameAndValue($name, $value) - { - return $this->DB->GetOne('SELECT id FROM tariffs WHERE name = ? AND value = ?', - array($name, str_replace(',', '.', $value))); - } - function TariffAdd($tariff) { $result = $this->DB->Execute('INSERT INTO tariffs (name, description, value, @@ -4453,8 +4579,40 @@ { return $this->DB->GetAllByKey('SELECT id, name FROM nastypes ORDER BY name', 'id'); } - - //VoIP functions + + function CalcAt($period, $date) + { + $m = date('n', $date); + + if ($period == YEARLY) { + if ($m) { + $ttime = mktime(12,0,0,$m,1,1990); + return date('z', $ttime) + 1; + } + else { + return 1; + } + } else if ($period == HALFYEARLY) { + if ($m > 6) + $m -= 6; + return ($m-1) * 100 + 1; + } else if ($period == QUARTERLY) { + if ($m > 9) + $m -= 9; + else if ($m > 6) + $m -= 6; + else if ($m > 3) + $m -= 3; + return ($m-1) * 100 + 1; + } else { + return 1; + } + } + + /** + * VoIP functions + */ + function GetVoipAccountList($order='login,asc', $search=NULL, $sqlskey='AND') { if($order=='') @@ -4622,6 +4780,7 @@ } return $result; } + } ?> Index: lms/lib/accesstable.php diff -u lms/lib/accesstable.php:1.138 lms/lib/accesstable.php:1.139 --- lms/lib/accesstable.php:1.138 Tue Jan 18 09:12:05 2011 +++ lms/lib/accesstable.php Wed Mar 2 11:31:04 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: accesstable.php,v 1.138 2011/01/18 08:12:05 alec Exp $ + * $Id: accesstable.php,v 1.139 2011/03/02 10:31:04 alec Exp $ */ unset($access); @@ -32,7 +32,7 @@ $access['table'][0]['allow_reg'] = '^.*$'; $access['table'][1]['name'] = trans('read only (excluding helpdesk)'); -$access['table'][1]['allow_reg'] = '^((user|balance|db|net|node|netdev|tariff|payment|invoice|note|customer|customergroup|nodegroup|account|voipaccount|alias|domain|record|config|event|taxrate|document|numberplan|state|host|division|message|ewxch)(list|info|view|search|balance|infoshort)|ewxnodelist|ewxdevlist|netdevmap|eventprint|nodelistshort|number|cashsourcelist|customerassignmentinfo)$'; +$access['table'][1]['allow_reg'] = '^(([a-z]+(list|info|view|search|balance|infoshort))|netdevmap|eventprint|nodelistshort|number)$'; $access['table'][2]['name'] = trans('nodes connection/disconnection'); $access['table'][2]['allow_reg'] = '^nodeset$'; @@ -65,7 +65,7 @@ $access['table'][11]['allow_reg'] = '^(accountpasswd|(account|domain|alias|record)(list|edit|add|del|info|search))$'; $access['table'][12]['name'] = trans('configuration'); -$access['table'][12]['allow_reg'] = '^((host|config|numberplan|taxrate|state|division|cashsource)(list|edit|add|del|load))$'; +$access['table'][12]['allow_reg'] = '^(((host|config|numberplan|taxrate|state|division|cashsource)(list|edit|add|del|load))|((promotion|promotionschema)(list|edit|add|del|set|info)))$'; $access['table'][13]['name'] = trans('networks and devices management'); $access['table'][13]['allow_reg'] = '^((net|netdev|ewxch)(info|list|edit|add|del|cmp|map|remap|search)|choose(mac|ip)|ewxnodelist|ewxdevlist)$'; Index: lms/lib/menu.php diff -u lms/lib/menu.php:1.61 lms/lib/menu.php:1.62 --- lms/lib/menu.php:1.61 Tue Jan 18 09:12:05 2011 +++ lms/lib/menu.php Wed Mar 2 11:31:04 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: menu.php,v 1.61 2011/01/18 08:12:05 alec Exp $ + * $Id: menu.php,v 1.62 2011/03/02 10:31:04 alec Exp $ */ $menu = array( @@ -232,7 +232,7 @@ 'tip' => trans('Network map display'), 'prio' => 40, ), - ), + ), ), 'networks' => array( @@ -450,7 +450,7 @@ 'tip' => trans('Allows you to search for account, alias, domain'), 'prio' => 70, ), - ), + ), ), 'messages' => array( @@ -576,7 +576,7 @@ 'tip' => trans('Lists and reports printing'), 'prio' => 50, ), - ), + ), ), 'timetable' => array( @@ -605,7 +605,7 @@ 'tip' => trans('Searching of Events in Timetable'), 'prio' => 30, ), - ), + ), ), 'password' => array( @@ -673,6 +673,12 @@ 'tip' => trans('List of Cash Import Sources'), 'prio' => 80, ), + array( + 'name' => trans('Promotions'), + 'link' => '?m=promotionlist', + 'tip' => trans('List of promotions'), + 'prio' => 90, + ), ), ), @@ -729,14 +735,14 @@ if(!function_exists('menu_cmp')) { - function menu_cmp($a, $b) + function menu_cmp($a, $b) { if(!isset($a['prio'])) $a['prio'] = 0; if(!isset($b['prio'])) $b['prio'] = 9999; - - if($a['prio'] == $b['prio']) - return 0; - return ($a['prio'] < $b['prio']) ? -1 : 1; + + if($a['prio'] == $b['prio']) + return 0; + return ($a['prio'] < $b['prio']) ? -1 : 1; } } Index: lms/lib/upgradedb.php diff -u lms/lib/upgradedb.php:1.186 lms/lib/upgradedb.php:1.187 --- lms/lib/upgradedb.php:1.186 Thu Feb 17 13:08:43 2011 +++ lms/lib/upgradedb.php Wed Mar 2 11:31:04 2011 @@ -21,10 +21,10 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: upgradedb.php,v 1.186 2011/02/17 12:08:43 alec Exp $ + * $Id: upgradedb.php,v 1.187 2011/03/02 10:31:04 alec Exp $ */ -define('DBVERSION', '2011021700'); // here should be always the newest version of database! +define('DBVERSION', '2011022000'); // here should be always the newest version of database! // it placed here to avoid read disk every time when we call this file. /* From cvs w lms.org.pl Wed Mar 2 11:31:05 2011 From: cvs w lms.org.pl (LMS CVS) Date: Wed, 2 Mar 2011 11:31:05 +0100 (CET) Subject: [lms-commits] CVS update of lms/modules (17 files) Message-ID: <20110302103106.1794630CB562@eftep.altec.pl> Date: Wednesday, March 2, 2011 @ 11:31:05 Author: alec Path: /cvsroot/lms/modules Added: promotionadd.php promotiondel.php promotionedit.php promotioninfo.php promotionlist.php promotionschemaadd.php promotionschemadel.php promotionschemaedit.php promotionschemainfo.php promotionschemaset.php promotionset.php Modified: customerassignmentadd.php tariffadd.php tariffdel.php tariffedit.php tariffinfo.php tarifflist.php - Added Promotions with assignments shedule schemas - Use tariff name+value+period as a unique key instead of just a name - Now PostgreSQL 8.2 is required because of multi-value INSERT usage - Changed money.gif icon Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/modules/customerassignmentadd.php.diff?&r1=1.6&r2=1.7 http://cvs.lms.org.pl/viewvc/Development/lms/modules/promotionadd.php?rev=1.1 http://cvs.lms.org.pl/viewvc/Development/lms/modules/promotiondel.php?rev=1.1 http://cvs.lms.org.pl/viewvc/Development/lms/modules/promotionedit.php?rev=1.1 http://cvs.lms.org.pl/viewvc/Development/lms/modules/promotioninfo.php?rev=1.1 http://cvs.lms.org.pl/viewvc/Development/lms/modules/promotionlist.php?rev=1.1 http://cvs.lms.org.pl/viewvc/Development/lms/modules/promotionschemaadd.php?rev=1.1 http://cvs.lms.org.pl/viewvc/Development/lms/modules/promotionschemadel.php?rev=1.1 http://cvs.lms.org.pl/viewvc/Development/lms/modules/promotionschemaedit.php?rev=1.1 http://cvs.lms.org.pl/viewvc/Development/lms/modules/promotionschemainfo.php?rev=1.1 http://cvs.lms.org.pl/viewvc/Development/lms/modules/promotionschemaset.php?rev=1.1 http://cvs.lms.org.pl/viewvc/Development/lms/modules/promotionset.php?rev=1.1 http://cvs.lms.org.pl/viewvc/Development/lms/modules/tariffadd.php.diff?&r1=1.68&r2=1.69 http://cvs.lms.org.pl/viewvc/Development/lms/modules/tariffdel.php.diff?&r1=1.8&r2=1.9 http://cvs.lms.org.pl/viewvc/Development/lms/modules/tariffedit.php.diff?&r1=1.54&r2=1.55 http://cvs.lms.org.pl/viewvc/Development/lms/modules/tariffinfo.php.diff?&r1=1.39&r2=1.40 http://cvs.lms.org.pl/viewvc/Development/lms/modules/tarifflist.php.diff?&r1=1.44&r2=1.45 Index: lms/modules/customerassignmentadd.php diff -u lms/modules/customerassignmentadd.php:1.6 lms/modules/customerassignmentadd.php:1.7 --- lms/modules/customerassignmentadd.php:1.6 Tue Jan 18 09:12:21 2011 +++ lms/modules/customerassignmentadd.php Wed Mar 2 11:31:05 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: customerassignmentadd.php,v 1.6 2011/01/18 08:12:21 alec Exp $ + * $Id: customerassignmentadd.php,v 1.7 2011/03/02 10:31:05 alec Exp $ */ // get customer name and check privileges using customersview @@ -218,38 +218,55 @@ elseif($a['discount']<0 || $a['discount']>99.99 || !is_numeric($a['discount'])) $error['discount'] = trans('Wrong discount value!'); - if($a['tariffid'] == -1) // suspending + // suspending + if($a['tariffid'] == -1) { + $a['tariffid'] = 0; + $a['discount'] = 0; + $a['value'] = 0; + unset($a['schemaid']); + unset($a['invoice']); + unset($a['settlement']); unset($error['at']); $at = 0; } - else if (!$a['tariffid']) { // tariffless + // promotion schema + else if ($a['tariffid'] == -2) { + if (!$from) { + $error['datefrom'] = trans('Promotion start date is required!'); + } + else { + $a['promotiontariffid'] = $a['stariffid']; + $a['value'] = 0; + $a['discount'] = 0; + // @TODO: handle other period/at values + $a['period'] = MONTHLY; + $a['at'] = 1; + } + } + // tariffless + else if (!$a['tariffid']) { if (!$a['name']) $error['name'] = trans('Liability name is required!'); if (!$a['value']) $error['value'] = trans('Liability value is required!'); else if(!preg_match('/^[-]?[0-9.,]+$/', $a['value'])) $error['value'] = trans('Incorrect value!'); + + unset($a['schemaid']); } if(!$error) { - if ($a['tariffid'] == -1) { - $a['tariffid'] = 0; - $a['discount'] = 0; - unset($a['invoice']); - unset($a['settlement']); - } - if ($a['tariffid']) - $a['value'] = 0; - $a['customerid'] = $customer['id']; $a['period'] = $period; $a['at'] = $at; $a['datefrom'] = $from; $a['dateto'] = $to; + $DB->BeginTrans(); $LMS->AddAssignment($a); + $DB->CommitTrans(); $SESSION->redirect('?'.$SESSION->get('backto')); } @@ -275,8 +292,20 @@ $customernodes = $LMS->GetCustomerNodes($customer['id']); unset($customernodes['total']); +$schemas = $DB->GetAll('SELECT p.name AS promotion, s.name, s.id, + (SELECT '.$DB->GroupConcat('tariffid', ',').' + FROM promotionassignments WHERE promotionschemaid = s.id + ) AS tariffs + FROM promotions p + JOIN promotionschemas s ON (p.id = s.promotionid) + WHERE p.disabled <> 1 AND s.disabled <> 1 + AND EXISTS (SELECT 1 FROM promotionassignments + WHERE promotionschemaid = s.id LIMIT 1) + ORDER BY p.name, s.name'); + $SMARTY->assign('assignment', $a); $SMARTY->assign('customernodes', $customernodes); +$SMARTY->assign('promotionschemas', $schemas); $SMARTY->assign('tariffs', $LMS->GetTariffs()); $SMARTY->assign('taxeslist', $LMS->GetTaxes()); $SMARTY->assign('expired', $expired); Index: lms/modules/promotionadd.php diff -u /dev/null lms/modules/promotionadd.php:1.1 --- /dev/null Wed Mar 2 11:31:05 2011 +++ lms/modules/promotionadd.php Wed Mar 2 11:31:05 2011 @@ -0,0 +1,68 @@ + $value) + $promotion[$key] = trim($value); + + if ($promotion['name']=='' && $promotion['description']=='') + { + $SESSION->redirect('?m=promotionlist'); + } + + if ($promotion['name'] == '') + $error['name'] = trans('Promotion name is required!'); + else if ($DB->GetOne('SELECT id FROM promotions WHERE name = ?', array($promotion['name']))) + $error['name'] = trans('Specified name is in use!'); + + if (!$error) + { + $DB->Execute('INSERT INTO promotions (name, description) + VALUES (?, ?)', + array($promotion['name'], $promotion['description'])); + + if (empty($promotion['reuse'])) + { + $pid = $DB->GetLastInsertId('promotions'); + + $SESSION->redirect('?m=promotioninfo&id='.$pid); + } + + unset($promotion); + $promotion['reuse'] = '1'; + } +} + +$layout['pagetitle'] = trans('New Promotion'); + +$SMARTY->assign('error', $error); +$SMARTY->assign('promotion', $promotion); +$SMARTY->display('promotionadd.html'); + +?> Index: lms/modules/promotiondel.php diff -u /dev/null lms/modules/promotiondel.php:1.1 --- /dev/null Wed Mar 2 11:31:05 2011 +++ lms/modules/promotiondel.php Wed Mar 2 11:31:05 2011 @@ -0,0 +1,34 @@ +Execute('DELETE FROM promotions WHERE id = ?', + array(intval($_GET['id']))); +} + +$SESSION->redirect('?m=promotionlist'); + +?> Index: lms/modules/promotionedit.php diff -u /dev/null lms/modules/promotionedit.php:1.1 --- /dev/null Wed Mar 2 11:31:05 2011 +++ lms/modules/promotionedit.php Wed Mar 2 11:31:05 2011 @@ -0,0 +1,83 @@ +Execute('DELETE FROM promotionassignments WHERE tariffid = ? + AND promotionschemaid IN (SELECT id FROM promotionschemas + WHERE promotionid = ?)', array($tariffid, $promotionid)); + + $SESSION->redirect('?m=promotioninfo&id='.$promotionid); +} + +if ($promotion) +{ + foreach ($promotion as $key => $value) + $promotion[$key] = trim($value); + + if ($promotion['name']=='' && $promotion['description']=='') + { + $SESSION->redirect('?m=promotionlist'); + } + + $promotion['id'] = intval($_GET['id']); + + if ($promotion['name'] == '') + $error['name'] = trans('Promotion name is required!'); + else if ($DB->GetOne('SELECT id FROM promotions WHERE name = ? AND id <> ?', + array($promotion['name'], $promotion['id'])) + ) { + $error['name'] = trans('Specified name is in use!'); + } + + if (!$error) + { + $DB->Execute('UPDATE promotions SET name = ?, description = ? + WHERE id = ?', + array($promotion['name'], $promotion['description'], + $promotion['id'])); + + $SESSION->redirect('?m=promotioninfo&id='.$promotion['id']); + } +} +else +{ + $promotion = $DB->GetRow('SELECT * FROM promotions WHERE id = ?', + array(intval($_GET['id']))); +} + +$layout['pagetitle'] = trans('Promotion Edit: $0', $promotion['name']); + +$SMARTY->assign('error', $error); +$SMARTY->assign('promotion', $promotion); +$SMARTY->display('promotionedit.html'); + +?> Index: lms/modules/promotioninfo.php diff -u /dev/null lms/modules/promotioninfo.php:1.1 --- /dev/null Wed Mar 2 11:31:05 2011 +++ lms/modules/promotioninfo.php Wed Mar 2 11:31:05 2011 @@ -0,0 +1,62 @@ +GetRow('SELECT * FROM promotions WHERE id = ?', + array(intval($_GET['id']))); + +if(!$promotion) +{ + $SESSION->redirect('?m=promotionlist'); +} + +$promotion['schemas'] = $DB->GetAllByKey('SELECT + s.name, s.disabled, s.description, s.id + FROM promotionschemas s WHERE s.promotionid = ? + ORDER BY name', 'id', + array($promotion['id'])); + +if (!empty($promotion['schemas'])) { + $schemas = implode(', ', array_keys($promotion['schemas'])); + $promotion['tariffs'] = $DB->GetAll('SELECT + t.name, t.id, t.value, t.upceil, t.downceil + FROM tariffs t + WHERE t.id IN (SELECT DISTINCT tariffid + FROM promotionassignments + WHERE promotionschemaid IN ('.$schemas.') + ) + ORDER BY t.name, t.value DESC', + array($promotion['id'])); +} + +$layout['pagetitle'] = trans('Promotion Info: $0', $promotion['name']); + +$SESSION->save('backto', $_SERVER['QUERY_STRING']); + +$SMARTY->assign('promotion', $promotion); +$SMARTY->display('promotioninfo.html'); + +?> Index: lms/modules/promotionlist.php diff -u /dev/null lms/modules/promotionlist.php:1.1 --- /dev/null Wed Mar 2 11:31:05 2011 +++ lms/modules/promotionlist.php Wed Mar 2 11:31:05 2011 @@ -0,0 +1,48 @@ +GetAll('SELECT p.id, p.name, p.description, disabled, + (SELECT COUNT(*) FROM promotionschemas + WHERE p.id = promotionid) AS schemas, + (SELECT COUNT(DISTINCT a.tariffid) + FROM promotionassignments a + JOIN promotionschemas s ON (s.id = a.promotionschemaid) + WHERE p.id = s.promotionid + ) AS tariffs + FROM promotions p + ORDER BY p.name'); + +$listdata['total'] = count($promolist); + +$SESSION->save('backto', $_SERVER['QUERY_STRING']); + +$SMARTY->assign('promotionlist', $promolist); +$SMARTY->assign('listdata', $listdata); +$SMARTY->display('promotionlist.html'); + +?> Index: lms/modules/promotionschemaadd.php diff -u /dev/null lms/modules/promotionschemaadd.php:1.1 --- /dev/null Wed Mar 2 11:31:05 2011 +++ lms/modules/promotionschemaadd.php Wed Mar 2 11:31:05 2011 @@ -0,0 +1,102 @@ + $value) + if (!is_array($value)) + $schema[$key] = trim($value); + + $schema['promotionid'] = intval($_GET['id']); + + if ($schema['name']=='' && $schema['description']=='') + { + $SESSION->redirect('?m=promotioninfo&id='.$schema['promotionid']); + } + + if ($schema['name'] == '') + $error['name'] = trans('Schema name is required!'); + else if ($DB->GetOne('SELECT id FROM promotionschemas + WHERE name = ? AND promotionid = ?', array($schema['name'], $schema['promotionid'])) + ) { + $error['name'] = trans('Specified name is in use!'); + } + + $data = array(); + foreach ($schema['periods'] as $period) { + $data[] = intval($period); + if (!$period) { + break; + } + } + $data = implode(';', $data); + + if (!$error) + { + $DB->Execute('INSERT INTO promotionschemas (promotionid, name, description, data) + VALUES (?, ?, ?, ?)', + array($schema['promotionid'], + $schema['name'], + $schema['description'], + $data + )); + + $sid = $DB->GetLastInsertId('promotionschemas'); + + // pre-fill promotionassignments with all tariffs in specified promotion + $DB->Execute('INSERT INTO promotionassignments (promotionschemaid, tariffid) + SELECT ?, tariffid + FROM promotionassignments + WHERE promotionschemaid IN (SELECT id FROM promotionschemas WHERE promotionid = ?) + GROUP BY tariffid', array($sid, $schema['promotionid'])); + + if (empty($schema['reuse'])) + { + $SESSION->redirect('?m=promotionschemainfo&id='.$sid); + } + + unset($schema['name']); + unset($schema['description']); + $schema['reuse'] = '1'; + } +} +else +{ + $schema['promotionid'] = $_GET['id']; + $schema['periods'] = array(0); +} + +$schema['selection'] = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,30,36,42,48,60); + +$layout['pagetitle'] = trans('New Schema'); + +$SMARTY->assign('error', $error); +$SMARTY->assign('schema', $schema); +$SMARTY->display('promotionschemaadd.html'); + +?> Index: lms/modules/promotionschemadel.php diff -u /dev/null lms/modules/promotionschemadel.php:1.1 --- /dev/null Wed Mar 2 11:31:05 2011 +++ lms/modules/promotionschemadel.php Wed Mar 2 11:31:05 2011 @@ -0,0 +1,37 @@ +GetOne('SELECT promotionid FROM promotionschemas + WHERE id = ?', array($id)); + +if ($_GET['is_sure'] == '1') { + $DB->Execute('DELETE FROM promotionschemas WHERE id = ?', array($id)); +} + +$SESSION->redirect('?m=promotioninfo&id='.$promotionid); + +?> Index: lms/modules/promotionschemaedit.php diff -u /dev/null lms/modules/promotionschemaedit.php:1.1 --- /dev/null Wed Mar 2 11:31:05 2011 +++ lms/modules/promotionschemaedit.php Wed Mar 2 11:31:05 2011 @@ -0,0 +1,212 @@ + 12, HALFYEARLY => 6, QUARTERLY => 3, MONTHLY => 1); + $schema = $DB->GetOne('SELECT data FROM promotionschemas WHERE id = ?', array($schemaid)); + $schema = explode(';', $schema); + + foreach ($form as $key => $value) { + $form[$key] = trim($value); + + if (preg_match($regexp, $key, $m)) { + // periods + if (strpos($m[1], 'period')) { + $val = intval($form[$key]); + $skey = $m[2]-1; + + if (empty($val)) { + $data[$m[2]]['period'] = $val; + } + else if (!array_key_exists($val, $mons)) { + $error[$key] = trans('Incorrect value!'); + } + else if ($schema[$skey] && ($schema[$skey] % $mons[$val])) { + $error[$key] = trans('Not possible to use this period here!'); + } + else { + $data[$m[2]]['period'] = $val; + } + } + // values + else { + if (empty($form[$key])) { + $data[$m[2]]['value'] = 0; + } + else if (!preg_match('/^[-]?[0-9.,]+$/', $form[$key])) { + $error[$key] = trans('Incorrect value!'); + } + else { + $data[$m[2]]['value'] = str_replace(',', '.', $form[$key]); + } + } + } + } + + if (!$error) + { + foreach ($data as $idx => $d) { + $data[$idx] = $d['value'].(!empty($d['period']) ? ':'.intval($d['period']) : ''); + } + $datastr = implode(';', $data); + + if (!empty($assignmentid)) + $DB->Execute('UPDATE promotionassignments + SET data = ? WHERE id = ?', + array($datastr, $assignmentid)); + else + $DB->Execute('INSERT INTO promotionassignments + (promotionschemaid, tariffid, data) + VALUES (?, ?, ?)', + array( + $schemaid, + intval($form['tariffid']), + $datastr, + )); + } + + $data = $_POST['form']; + $data['aid'] = $assignmentid ? $assignmentid : null; + + $SMARTY->assign('formdata', $data); + $SMARTY->assign('error', $error); + include MODULES_DIR . '/promotionschemainfo.php'; + die; +} +else if ($action == 'tariffdel') +{ + $DB->Execute('DELETE FROM promotionassignments WHERE id = ?', + array(intval($_GET['aid']))); + + $SESSION->redirect('?m=promotionschemainfo&id='.intval($_GET['id'])); +} + +$oldschema = $DB->GetRow('SELECT * FROM promotionschemas WHERE id = ?', + array(intval($_GET['id']))); + +if (isset($_POST['schema'])) +{ + $schema = $_POST['schema']; + + foreach ($schema as $key => $value) + if (!is_array($value)) + $schema[$key] = trim($value); + + if ($schema['name']=='' && $schema['description']=='') + { + $SESSION->redirect('?m=promotioninfo&id='.$oldschema['promotionid']); + } + + $schema['id'] = $oldschema['id']; + + if ($schema['name'] == '') + $error['name'] = trans('Schema name is required!'); + else if ($DB->GetOne('SELECT id FROM promotionschemas + WHERE name = ? AND promotionid = ? AND id <> ?', + array($schema['name'], $oldschema['promotionid'], $schema['id'])) + ) { + $error['name'] = trans('Specified name is in use!'); + } + + $data = array(); + foreach ($schema['periods'] as $period) { + $data[] = intval($period); + if (!$period) { + break; + } + } + + if (!$error) + { + $DB->BeginTrans(); + + $DB->Execute('UPDATE promotionschemas SET name = ?, description = ?, data = ? + WHERE id = ?', + array($schema['name'], + $schema['description'], + implode(';', $data), + $schema['id'], + )); + + // re-check promotionassignments data, check the number of periods + // and remove excessive data or add data for additional periods + $tariffs = $DB->GetAll('SELECT id, data FROM promotionassignments + WHERE promotionschemaid = ?', array($schema['id'])); + + if (!empty($tariffs)) { + $data_cnt = count($data)+1; // +1 for activation item + foreach ($tariffs as $tariff) { + $tdata = explode(';', $tariff['data']); + $tdata_cnt = count($tdata); + // nothing's changed + if ($tdata_cnt == $data_cnt) { + continue; + } + // added periods + if ($data_cnt > $tdata_cnt) { + $last = $tdata[$tdata_cnt-1]; + for ($i=0; $i<$data_cnt-$tdata_cnt; $i++) { + $tdata[] = $last; + } + } + // removed periods + else { + $tdata = array_slice($tdata, 0, $data_cnt); + } + + $DB->Execute('UPDATE promotionassignments SET data = ? + WHERE id = ?', array(implode(';', $tdata), $tariff['id'])); + } + } + + $DB->CommitTrans(); + + $SESSION->redirect('?m=promotionschemainfo&id='.$schema['id']); + } +} +else +{ + $schema = $oldschema; + $schema['periods'] = explode(';', $schema['data']); +} + +$schema['selection'] = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,30,36,42,48,60); + +$layout['pagetitle'] = trans('Schema Edit: $0', $oldschema['name']); + +$SMARTY->assign('error', $error); +$SMARTY->assign('schema', $schema); +$SMARTY->display('promotionschemaedit.html'); + +?> Index: lms/modules/promotionschemainfo.php diff -u /dev/null lms/modules/promotionschemainfo.php:1.1 --- /dev/null Wed Mar 2 11:31:05 2011 +++ lms/modules/promotionschemainfo.php Wed Mar 2 11:31:05 2011 @@ -0,0 +1,96 @@ +GetRow('SELECT s.*, p.id AS pid, p.name AS promotion + FROM promotionschemas s + JOIN promotions p ON (p.id = s.promotionid) + WHERE s.id = ?', + array(intval($_GET['id']))); + +if(!$schema) +{ + $SESSION->redirect('?m=promotionlist'); +} + +$schema['data'] = explode(';', $schema['data']); +$schema['periods'] = array(0 => trans('Activation')); + +$mon = 1; +foreach ($schema['data'] as $idx => $data) { + $period = ''; + if (!$data) { + $schema['data'][$idx] = trans('unlimited'); + $period = trans('Months $0-$1', $mon, '∞'); + } + else if ($data == 1) { + $period = trans('Month $0', $data); + $mon++; + } + else { + $period = trans('Months $0-$1', $mon, $mon + $data-1); + $mon += $data; + } + $schema['periods'][] = $period; +} + +$schema['data'] = implode(' » ', $schema['data']); + +$schema['tariffs'] = $DB->GetAll('SELECT t.name, t.value, + a.tariffid, a.id, a.data + FROM promotionassignments a + JOIN tariffs t ON (a.tariffid = t.id) + WHERE a.promotionschemaid = ? + ORDER BY t.name, t.value DESC', array($schema['id'])); + +if (!empty($schema['tariffs'])) { + foreach ($schema['tariffs'] as $idx => $value) { + $tmp = explode(';', $value['data']); + $data = array(); + foreach ($tmp as $didx => $d) { + list($data['value'][$didx], $data['period'][$didx]) = explode(':', $d); + } + $schema['tariffs'][$idx]['data'] = $data; + } +} + +$tariffs = $DB->GetAll('SELECT t.name, t.value, t.id, t.upceil, t.downceil + FROM tariffs t + WHERE t.id NOT IN ( + SELECT tariffid FROM promotionassignments + WHERE promotionschemaid = ?) + ORDER BY t.name, t.value DESC', array($schema['id'])); + +$layout['pagetitle'] = trans('Schema Info: $0', $schema['name']); + +$SESSION->save('backto', $_SERVER['QUERY_STRING']); + +$SMARTY->assign('tariffs', $tariffs); +$SMARTY->assign('activations', $activations); +$SMARTY->assign('schema', $schema); +$SMARTY->display('promotionschemainfo.html'); + +?> Index: lms/modules/promotionschemaset.php diff -u /dev/null lms/modules/promotionschemaset.php:1.1 --- /dev/null Wed Mar 2 11:31:05 2011 +++ lms/modules/promotionschemaset.php Wed Mar 2 11:31:05 2011 @@ -0,0 +1,37 @@ +Execute('UPDATE promotionschemas SET disabled = ? WHERE id = ?', + array(!empty($_GET['access']) ? 0 : 1, $id)); +} + +header('Location: ?'.$SESSION->get('backto')); + +?> Index: lms/modules/promotionset.php diff -u /dev/null lms/modules/promotionset.php:1.1 --- /dev/null Wed Mar 2 11:31:05 2011 +++ lms/modules/promotionset.php Wed Mar 2 11:31:05 2011 @@ -0,0 +1,37 @@ +Execute('UPDATE promotions SET disabled = ? WHERE id = ?', + array(!empty($_GET['access']) ? 0 : 1, $id)); +} + +header('Location: ?'.$SESSION->get('backto')); + +?> Index: lms/modules/tariffadd.php diff -u lms/modules/tariffadd.php:1.68 lms/modules/tariffadd.php:1.69 --- lms/modules/tariffadd.php:1.68 Thu Feb 17 13:08:44 2011 +++ lms/modules/tariffadd.php Wed Mar 2 11:31:05 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: tariffadd.php,v 1.68 2011/02/17 12:08:44 alec Exp $ + * $Id: tariffadd.php,v 1.69 2011/03/02 10:31:05 alec Exp $ */ if(isset($_POST['tariff'])) @@ -45,8 +45,11 @@ if ($tariff['name'] == '') $error['name'] = trans('Subscription name required!'); else if (!$error) { - if ($LMS->GetTariffIDByNameAndValue($tariff['name'], $tariff['value'])) + if ($DB->GetOne('SELECT id FROM tariffs WHERE name = ? AND value = ? AND period = ?', + array($tariff['name'], str_replace(',', '.', $tariff['value']), $tariff['period'])) + ) { $error['name'] = trans('Subscription with specified name and value already exists!'); + } } $items = array('uprate', 'downrate', 'upceil', 'downceil', 'climit', 'plimit', 'dlimit'); Index: lms/modules/tariffdel.php diff -u lms/modules/tariffdel.php:1.8 lms/modules/tariffdel.php:1.9 --- lms/modules/tariffdel.php:1.8 Tue Jan 18 09:12:25 2011 +++ lms/modules/tariffdel.php Wed Mar 2 11:31:05 2011 @@ -21,15 +21,15 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: tariffdel.php,v 1.8 2011/01/18 08:12:25 alec Exp $ + * $Id: tariffdel.php,v 1.9 2011/03/02 10:31:05 alec Exp $ */ $id = intval($_GET['id']); if($id && $_GET['is_sure']=="1" && $LMS->TariffExists($id)) { - if(!$DB->GetOne('SELECT COUNT(customerid) FROM assignments WHERE tariffid = ?', array($id))) - $LMS->TariffDelete($id); + if(!$DB->GetOne('SELECT 1 FROM assignments WHERE tariffid = ? LIMIT 1', array($id))) + $LMS->TariffDelete($id); } $SESSION->redirect('?m=tarifflist'); Index: lms/modules/tariffedit.php diff -u lms/modules/tariffedit.php:1.54 lms/modules/tariffedit.php:1.55 --- lms/modules/tariffedit.php:1.54 Thu Feb 17 13:08:44 2011 +++ lms/modules/tariffedit.php Wed Mar 2 11:31:05 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: tariffedit.php,v 1.54 2011/02/17 12:08:44 alec Exp $ + * $Id: tariffedit.php,v 1.55 2011/03/02 10:31:05 alec Exp $ */ if(!$LMS->TariffExists($_GET['id'])) @@ -45,11 +45,14 @@ if ($tariff['name'] == '') $error['name'] = trans('Subscription name required!'); - else if (!$error - && ($found_id = $LMS->GetTariffIDByNameAndValue($tariff['name'], $tariff['value'])) - && $found_id != $tariff['id'] - ) { - $error['name'] = trans('Subscription with specified name and value already exists!'); + else if (!$error) { + if ($DB->GetOne('SELECT id FROM tariffs WHERE name = ? AND value = ? + AND period = ? AND id <> ?', + array($tariff['name'], str_replace(',', '.', $tariff['value']), + $tariff['period'], $tariff['id'])) + ) { + $error['name'] = trans('Subscription with specified name and value already exists!'); + } } $items = array('uprate', 'downrate', 'upceil', 'downceil', 'climit', 'plimit', 'dlimit'); @@ -61,7 +64,7 @@ elseif(!preg_match('/^[0-9]+$/', $tariff[$item])) $error[$item] = trans('Integer value expected!'); } - + if(($tariff['uprate'] < 8 || $tariff['uprate'] > 100000) && $tariff['uprate'] != 0) $error['uprate'] = trans('This field must be within range 8 - 100000'); if(($tariff['downrate'] < 8 || $tariff['downrate'] > 100000) && $tariff['downrate'] != 0) @@ -80,7 +83,7 @@ elseif(!preg_match('/^[0-9]+$/', $tariff[$item])) $error[$item] = trans('Integer value expected!'); } - + if(($tariff['uprate_n'] < 8 || $tariff['uprate_n'] > 100000) && $tariff['uprate_n']) $error['uprate_n'] = trans('This field must be within range 8 - 100000'); if(($tariff['downrate_n'] < 8 || $tariff['downrate_n'] > 100000) && $tariff['downrate_n']) @@ -89,7 +92,7 @@ $error['upceil_n'] = trans('This field must contain number greater than 8 and greater than upload rate'); if(($tariff['downceil_n'] < 8 || $tariff['downceil_n'] < $tariff['downrate']) && $tariff['downceil_n']) $error['downceil_n'] = trans('This field must contain number greater than 8 and greater than download rate'); - + if(!isset($tariff['taxid'])) $tariff['taxid'] = 0; Index: lms/modules/tariffinfo.php diff -u lms/modules/tariffinfo.php:1.39 lms/modules/tariffinfo.php:1.40 --- lms/modules/tariffinfo.php:1.39 Tue Jan 18 09:12:25 2011 +++ lms/modules/tariffinfo.php Wed Mar 2 11:31:05 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: tariffinfo.php,v 1.39 2011/01/18 08:12:25 alec Exp $ + * $Id: tariffinfo.php,v 1.40 2011/03/02 10:31:05 alec Exp $ */ $netid = isset($_GET['netid']) ? intval($_GET['netid']) : NULL; @@ -33,6 +33,13 @@ $tariff = $LMS->GetTariff($_GET['id'], $netid); +$tariff['promotions'] = $DB->GetAll('SELECT DISTINCT p.name, p.id + FROM promotionassignments a + JOIN promotionschemas s ON (s.id = a.promotionschemaid) + JOIN promotions p ON (p.id = s.promotionid) + WHERE a.tariffid = ? + ORDER BY p.name', array($tariff['id'])); + $layout['pagetitle'] = trans('Subscription Info: $0',$tariff['name']); $SESSION->save('backto', $_SERVER['QUERY_STRING']); Index: lms/modules/tarifflist.php diff -u lms/modules/tarifflist.php:1.44 lms/modules/tarifflist.php:1.45 --- lms/modules/tarifflist.php:1.44 Thu Feb 17 13:08:44 2011 +++ lms/modules/tarifflist.php Wed Mar 2 11:31:05 2011 @@ -21,10 +21,10 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: tarifflist.php,v 1.44 2011/02/17 12:08:44 alec Exp $ + * $Id: tarifflist.php,v 1.45 2011/03/02 10:31:05 alec Exp $ */ -function GetTariffList($order='name,asc', $type=NULL, $customergroupid=NULL) +function GetTariffList($order='name,asc', $type=NULL, $customergroupid=NULL, $promotionid=NULL) { global $DB, $LMS; @@ -65,18 +65,17 @@ $sqlord = " ORDER BY t.name, t.value DESC"; break; } - + $totalincome = 0; $totalcustomers = 0; $totalcount = 0; $totalactivecount = 0; - if($tarifflist = $DB->GetAll('SELECT t.id AS id, t.name, t.value AS value, + if($tarifflist = $DB->GetAll('SELECT t.id, t.name, t.value, taxes.label AS tax, taxes.value AS taxvalue, prodid, - t.description AS description, t.period, - uprate, downrate, upceil, downceil, climit, plimit, - uprate_n, downrate_n, upceil_n, downceil_n, climit_n, plimit_n, - a.customerscount, a.count, a.value AS sumval + t.uprate, t.downrate, t.upceil, t.downceil, t.climit, t.plimit, + t.uprate_n, t.downrate_n, t.upceil_n, t.downceil_n, t.climit_n, t.plimit_n, + t.description, t.period, a.customerscount, a.count, a.value AS sumval FROM tariffs t LEFT JOIN (SELECT a.tariffid, COUNT(*) AS count, COUNT(DISTINCT a.customerid) AS customerscount, @@ -95,11 +94,20 @@ FROM assignments a JOIN tariffs tt ON (tt.id = tariffid)' .($customergroupid ? ' JOIN customerassignments cc ON (cc.customerid = a.customerid) - WHERE cc.customergroupid = '.intval($customergroupid) : '') + WHERE cc.customergroupid = '.intval($customergroupid) : '') + .($promotionid ? ' AND tt.id IN (SELECT pa.tariffid + FROM promotionassignments pa + JOIN promotionschemas ps ON (ps.id = pa.promotionschemaid) + WHERE ps.promotionid = ' .intval($promotionid).')' : '') .' GROUP BY a.tariffid ) a ON (a.tariffid = t.id) - LEFT JOIN taxes ON (t.taxid = taxes.id)' - .($type ? ' WHERE t.type = '.intval($type) : '') + LEFT JOIN taxes ON (t.taxid = taxes.id) + WHERE 1=1' + .($type ? ' AND t.type = '.intval($type) : '') + .($promotionid ? ' AND t.id IN (SELECT pa.tariffid + FROM promotionassignments pa + JOIN promotionschemas ps ON (ps.id = pa.promotionschemaid) + WHERE ps.promotionid = ' .intval($promotionid).')' : '') .($sqlord != '' ? $sqlord : ''))) { $unactive = $DB->GetAllByKey('SELECT tariffid, COUNT(*) AS count, @@ -133,6 +141,10 @@ )' .($type ? ' AND t.type = '.intval($type) : '') .($customergroupid ? ' AND cc.customergroupid = '.intval($customergroupid) : '') + .($promotionid ? ' AND t.id IN (SELECT pa.tariffid + FROM promotionassignments pa + JOIN promotionschemas ps ON (ps.id = pa.promotionschemaid) + WHERE ps.promotionid = ' .intval($promotionid).')' : '') .') x GROUP BY tariffid', 'tariffid'); foreach($tarifflist as $idx => $row) @@ -173,8 +185,6 @@ $tarifflist['totalcustomers'] = $totalcustomers; $tarifflist['totalcount'] = $totalcount; $tarifflist['totalactivecount'] = $totalactivecount; - $tarifflist['type'] = $type; - $tarifflist['customergroupid'] = $customergroupid; $tarifflist['order'] = $order; $tarifflist['direction'] = $direction; @@ -199,16 +209,24 @@ $g = $_GET['g']; $SESSION->save('tlg', $g); -$tarifflist = GetTariffList($o, $t, $g); +if(!isset($_GET['p'])) + $SESSION->restore('tlp', $p); +else + $p = $_GET['p']; +$SESSION->save('tlp', $p); + +$tarifflist = GetTariffList($o, $t, $g, $p); $customergroups = $LMS->CustomergroupGetAll(); +$promotions = $DB->GetAll('SELECT id, name FROM promotions ORDER BY name'); $listdata['total'] = $tarifflist['total']; $listdata['totalincome'] = $tarifflist['totalincome']; $listdata['totalcustomers'] = $tarifflist['totalcustomers']; $listdata['totalcount'] = $tarifflist['totalcount']; $listdata['totalactivecount'] = $tarifflist['totalactivecount']; -$listdata['type'] = $tarifflist['type']; -$listdata['customergroupid'] = $tarifflist['customergroupid']; +$listdata['type'] = $t; +$listdata['customergroupid'] = $g; +$listdata['promotionid'] = $p; $listdata['order'] = $tarifflist['order']; $listdata['direction'] = $tarifflist['direction']; @@ -217,8 +235,6 @@ unset($tarifflist['totalcustomers']); unset($tarifflist['totalcount']); unset($tarifflist['totalactivecount']); -unset($tarifflist['type']); -unset($tarifflist['customergroupid']); unset($tarifflist['order']); unset($tarifflist['direction']); @@ -226,9 +242,11 @@ $SESSION->save('backto', $_SERVER['QUERY_STRING']); -$SMARTY->assign('tarifflist',$tarifflist); -$SMARTY->assign('customergroups',$customergroups); -$SMARTY->assign('listdata',$listdata); +$SMARTY->assign('tarifflist', $tarifflist); +$SMARTY->assign('customergroups', $customergroups); +$SMARTY->assign('promotions', $promotions); +$SMARTY->assign('listdata', $listdata); + $SMARTY->display('tarifflist.html'); ?> From cvs w lms.org.pl Wed Mar 2 11:31:06 2011 From: cvs w lms.org.pl (LMS CVS) Date: Wed, 2 Mar 2011 11:31:06 +0100 (CET) Subject: [lms-commits] CVS update of lms/templates (17 files) Message-ID: <20110302103106.B8340301E565@eftep.altec.pl> Date: Wednesday, March 2, 2011 @ 11:31:06 Author: alec Path: /cvsroot/lms/templates Added: promotionadd.html promotionedit.html promotioninfo.html promotioninfobox.html promotionlist.html promotionschemaadd.html promotionschemadata.html promotionschemaedit.html promotionschemainfo.html promotionschemainfobox.html promotionschemas.html promotiontariffs.html Modified: balancelist.html customerassignmentsedit.html netlist.html tariffinfo.html tarifflist.html - Added Promotions with assignments shedule schemas - Use tariff name+value+period as a unique key instead of just a name - Now PostgreSQL 8.2 is required because of multi-value INSERT usage - Changed money.gif icon Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/templates/balancelist.html.diff?&r1=1.93&r2=1.94 http://cvs.lms.org.pl/viewvc/Development/lms/templates/customerassignmentsedit.html.diff?&r1=1.20&r2=1.21 http://cvs.lms.org.pl/viewvc/Development/lms/templates/netlist.html.diff?&r1=1.47&r2=1.48 http://cvs.lms.org.pl/viewvc/Development/lms/templates/promotionadd.html?rev=1.1 http://cvs.lms.org.pl/viewvc/Development/lms/templates/promotionedit.html?rev=1.1 http://cvs.lms.org.pl/viewvc/Development/lms/templates/promotioninfo.html?rev=1.1 http://cvs.lms.org.pl/viewvc/Development/lms/templates/promotioninfobox.html?rev=1.1 http://cvs.lms.org.pl/viewvc/Development/lms/templates/promotionlist.html?rev=1.1 http://cvs.lms.org.pl/viewvc/Development/lms/templates/promotionschemaadd.html?rev=1.1 http://cvs.lms.org.pl/viewvc/Development/lms/templates/promotionschemadata.html?rev=1.1 http://cvs.lms.org.pl/viewvc/Development/lms/templates/promotionschemaedit.html?rev=1.1 http://cvs.lms.org.pl/viewvc/Development/lms/templates/promotionschemainfo.html?rev=1.1 http://cvs.lms.org.pl/viewvc/Development/lms/templates/promotionschemainfobox.html?rev=1.1 http://cvs.lms.org.pl/viewvc/Development/lms/templates/promotionschemas.html?rev=1.1 http://cvs.lms.org.pl/viewvc/Development/lms/templates/promotiontariffs.html?rev=1.1 http://cvs.lms.org.pl/viewvc/Development/lms/templates/tariffinfo.html.diff?&r1=1.61&r2=1.62 http://cvs.lms.org.pl/viewvc/Development/lms/templates/tarifflist.html.diff?&r1=1.68&r2=1.69 Index: lms/templates/balancelist.html diff -u lms/templates/balancelist.html:1.93 lms/templates/balancelist.html:1.94 --- lms/templates/balancelist.html:1.93 Mon Apr 19 12:56:15 2010 +++ lms/templates/balancelist.html Wed Mar 2 11:31:06 2011 @@ -1,5 +1,5 @@ {include file="header.html"} - +

{$layout.pagetitle}

{include file="calendar_js.html"} {literal} @@ -59,12 +59,12 @@ add += "©=1"; if(document.page.duplicate.checked) add += "&duplicate=1"; - + document.page.action="?m=invoice&print=cached&cash=1" + add; document.page.target="_blank"; document.page.submit(); } - + function filter() { document.page.action="?m=balancelist"; @@ -93,35 +93,31 @@ - + - + +{if $promotionschemas} + + + + + + + + + + +{/if}
- {t}Date:{/t} + {t}Date:{/t} - {t}User:{/t} + {t}User:{/t} - {t}Liability:{/t} + {t}Liability:{/t} - {t}Income:{/t} + {t}Income:{/t} - {t}Expense:{/t} - - » + {t}Expense:{/t} » - {t}After:{/t} + {t}After:{/t} - {t}Customer:{/t} + {t}Customer:{/t} - {t}Description:{/t} -   - + {t}Description:{/t}  
Index: lms/templates/customerassignmentsedit.html diff -u lms/templates/customerassignmentsedit.html:1.20 lms/templates/customerassignmentsedit.html:1.21 --- lms/templates/customerassignmentsedit.html:1.20 Fri Jan 14 10:22:55 2011 +++ lms/templates/customerassignmentsedit.html Wed Mar 2 11:31:06 2011 @@ -1,5 +1,5 @@ {include file="header.html"} - +

{$layout.pagetitle}

{include file="calendar_js.html"} {literal} @@ -20,6 +20,10 @@ { var val = document.forms['assignment'].elements['assignment[tariffid]'].value; +{/literal}{if $promotionschemas} + document.getElementById('a_schema').style.display = val == -2 ? '' : 'none'; + document.getElementById('a_schematariff').style.display = val == -2 ? '' : 'none'; +{/if}{literal} document.getElementById('a_tax').style.display = val == '' ? '' : 'none'; document.getElementById('a_value').style.display = val == '' ? '' : 'none'; document.getElementById('a_productid').style.display = val == '' ? '' : 'none'; @@ -28,8 +32,33 @@ document.getElementById('a_options').style.display = val == -1 ? 'none' : ''; document.getElementById('a_nodes').style.display = val == -1 ? 'none' : ''; document.getElementById('a_day').style.display = val == -1 ? 'none' : ''; - document.getElementById('a_discount').style.display = val == -1 ? 'none' : ''; + document.getElementById('a_discount').style.display = val < -1 ? 'none' : ''; } +{/literal}{if $promotionschemas}{literal} + function set_schema() + { + var sid = document.forms['assignment'].elements['assignment[schemaid]'].value, + assignments = {{/literal}{strip} + {foreach name=fps from=$promotionschemas item=schema} + {if $smarty.foreach.fps.index},{/if}"{$schema.id}": [{$schema.tariffs}] + {/foreach} + {/strip}{literal}}, + select = document.forms['assignment'].elements['assignment[stariffid]'], + t_select = document.forms['assignment'].elements['assignment[tariffid]'], + options = t_select.getElementsByTagName('OPTION'), + selected = select.value, + i, len; + + // remove old options + select.innerHTML = ''; + // copy options from t_select element + for (i=0, len=options.length; i {/literal}
@@ -46,6 +75,9 @@
+ + + {t}Schema{/t}: + + +
+ + + {t}Tariff{/t}: + + +
@@ -239,6 +305,7 @@ var cal4 = new calendar(document.forms['assignment'].elements['assignment[dateto]']); cal4.time_comp = false; set_tariff(); +{if $promotionschemas}set_schema();{/if} {literal} function setCheckbox(id) { Index: lms/templates/netlist.html diff -u lms/templates/netlist.html:1.47 lms/templates/netlist.html:1.48 --- lms/templates/netlist.html:1.47 Fri Nov 13 10:33:06 2009 +++ lms/templates/netlist.html Wed Mar 2 11:31:06 2011 @@ -1,5 +1,5 @@ {include file="header.html"} - +

{$layout.pagetitle}

@@ -48,7 +48,7 @@ @@ -17,7 +17,7 @@ {t}First/last name:{/t} @@ -25,7 +25,7 @@ {t}Position:{/t} @@ -33,7 +33,24 @@ {t}E-mail:{/t} + + + + + + + + @@ -41,7 +58,7 @@ {t}Password:{/t} @@ -49,7 +66,7 @@ {t}Repeat password:{/t} @@ -57,7 +74,7 @@ {t}Allowed hosts:{/t} @@ -79,7 +96,7 @@ {/if} {/section} -
- [ {t}Disable{/t} ] + {if $netlist[netlist].disabled}[ {t}Enable{/t} ]{else}[ {t}Disable{/t} ]{/if} [ {t}Remove{/t} ] [ {t}Edit{/t} ] [ {t}Info{/t} ] Index: lms/templates/promotionadd.html diff -u /dev/null lms/templates/promotionadd.html:1.1 --- /dev/null Wed Mar 2 11:31:06 2011 +++ lms/templates/promotionadd.html Wed Mar 2 11:31:06 2011 @@ -0,0 +1,43 @@ +{include file="header.html"} + +

{$layout.pagetitle}

+ + + + + + + + + + + + + + + + +
+ + + {t}Name:{/t} + + +
+ + + {t}Description:{/t} + + +
+ {t}Submit{/t} + {t}Cancel{/t}
+ {t}Display this form again, when this promotion is saved{/t} +
+

+ +{include file="footer.html"} Index: lms/templates/promotionedit.html diff -u /dev/null lms/templates/promotionedit.html:1.1 --- /dev/null Wed Mar 2 11:31:06 2011 +++ lms/templates/promotionedit.html Wed Mar 2 11:31:06 2011 @@ -0,0 +1,42 @@ +{include file="header.html"} + +

{$layout.pagetitle}

+
+ + + + + + + + + + + + + + + +
+ + + {t}Name:{/t} + + +
+ + + {t}Description:{/t} + + +
+ {t}Submit{/t} + {t}Cancel{/t}
+
+

+ +{include file="footer.html"} Index: lms/templates/promotioninfo.html diff -u /dev/null lms/templates/promotioninfo.html:1.1 --- /dev/null Wed Mar 2 11:31:06 2011 +++ lms/templates/promotioninfo.html Wed Mar 2 11:31:06 2011 @@ -0,0 +1,21 @@ +{include file="header.html"} + +

{$layout.pagetitle}

+ + + + + + + + + + +
+ {include file="promotioninfobox.html"} +
+ {include file="promotionschemas.html"} +
+ {include file="promotiontariffs.html"} +
+{include file="footer.html"} Index: lms/templates/promotioninfobox.html diff -u /dev/null lms/templates/promotioninfobox.html:1.1 --- /dev/null Wed Mar 2 11:31:06 2011 +++ lms/templates/promotioninfobox.html Wed Mar 2 11:31:06 2011 @@ -0,0 +1,40 @@ + + + + + + + + + + + {if $promotion.description} + + + + + {/if} + + + +
+ + + {$promotion.name} ({$promotion.id|string_format:"%04d"}) +
+ + + {if $promotion.disabled}{t}disabled{/t}{else}{t}enabled{/t}{/if} +
+ + + + +
+ {$promotion.description|replace:"\n":"
"} +
+
+ {t}Edit{/t} + {t}Delete{/t} + +
Index: lms/templates/promotionlist.html diff -u /dev/null lms/templates/promotionlist.html:1.1 --- /dev/null Wed Mar 2 11:31:06 2011 +++ lms/templates/promotionlist.html Wed Mar 2 11:31:06 2011 @@ -0,0 +1,73 @@ +{include file="header.html"} + +

{$layout.pagetitle}

+ + + + + + + + + + {cycle values="light,lucid" print=false} + {foreach from=$promotionlist item=promo} + + + + + + + + + {foreachelse} + + + + {/foreach} + + + + + + +
+ {t}Name:{/t} + + {t}ID:{/t} + + {t}Description:{/t} + + {t}Schemas:{/t} + + {t}Tariffs:{/t} + + {t}Add promotion{/t} +
+ {$promo.name} + + ({$promo.id|string_format:"%04d"}) + + {$promo.description} + + {$promo.schemas|default:"-"} + + {$promo.tariffs|default:"-"} + + {if $promo.disabled}[ {t}Enable{/t} ]{else}[ {t}Disable{/t} ]{/if} + [ {t}Delete{/t} ] + [ {t}Edit{/t} ] + [ {t}Info{/t} ] +
+

 

+

{t}There are no promotions in database.{/t}

+

 

+
+ + {t}Total:{/t} + + {$listdata.total|default:"0"} + + {t}Add promotion{/t} +
+{include file="footer.html"} Index: lms/templates/promotionschemaadd.html diff -u /dev/null lms/templates/promotionschemaadd.html:1.1 --- /dev/null Wed Mar 2 11:31:06 2011 +++ lms/templates/promotionschemaadd.html Wed Mar 2 11:31:06 2011 @@ -0,0 +1,87 @@ +{include file="header.html"} + +

{$layout.pagetitle}

+
+ + + + + + + + + + + + + + + + + + + + +
+ + + {t}Name:{/t} + + +
+ + + {t}Periods:{/t} + + {foreach from=$schema.periods item=period key=key} + + {/foreach} + + +
+ + + {t}Description:{/t} + + +
+ {t}Submit{/t} + {t}Cancel{/t}
+ {t}Display this form again, when this schema is saved{/t} +
+

+ +{include file="footer.html"} Index: lms/templates/promotionschemadata.html diff -u /dev/null lms/templates/promotionschemadata.html:1.1 --- /dev/null Wed Mar 2 11:31:06 2011 +++ lms/templates/promotionschemadata.html Wed Mar 2 11:31:06 2011 @@ -0,0 +1,217 @@ + + + + + + {assign value=$schema.periods|@count var=periodcnt} + + + +
+ + {t 0=$schema.tariffs|@count}Schema's Tariffs ($0):{/t} +
+{literal} + Index: lms/templates/promotionschemaedit.html diff -u /dev/null lms/templates/promotionschemaedit.html:1.1 --- /dev/null Wed Mar 2 11:31:06 2011 +++ lms/templates/promotionschemaedit.html Wed Mar 2 11:31:06 2011 @@ -0,0 +1,86 @@ +{include file="header.html"} + +

{$layout.pagetitle}

+
+ + + + + + + + + + + + + + + + + + + + +
+ + + {t}Name:{/t} + + +
+ + + {t}Periods:{/t} + + {foreach from=$schema.periods item=period key=key} + + {/foreach} + + +
+ + + {t}Description:{/t} + + +
+ {t}Submit{/t} + {t}Cancel{/t}
+
+

+ +{include file="footer.html"} Index: lms/templates/promotionschemainfo.html diff -u /dev/null lms/templates/promotionschemainfo.html:1.1 --- /dev/null Wed Mar 2 11:31:06 2011 +++ lms/templates/promotionschemainfo.html Wed Mar 2 11:31:06 2011 @@ -0,0 +1,16 @@ +{include file="header.html"} + +

{$layout.pagetitle}

+ + + + + + + +
+ {include file="promotionschemainfobox.html"} +
+ {include file="promotionschemadata.html"} +
+{include file="footer.html"} Index: lms/templates/promotionschemainfobox.html diff -u /dev/null lms/templates/promotionschemainfobox.html:1.1 --- /dev/null Wed Mar 2 11:31:06 2011 +++ lms/templates/promotionschemainfobox.html Wed Mar 2 11:31:06 2011 @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + {if $schema.description} + + + + + {/if} + + + +
+ + + {$schema.name} ({$schema.id|string_format:"%04d"}) +
+ + + {$schema.data} +
+ + + {if $schema.disabled}{t}disabled{/t}{else}{t}enabled{/t}{/if} +
+ + + {$schema.promotion} +
+ + + + +
+ {$schema.description|replace:"\n":"
"} +
+
+ {t}Edit{/t} + {t}Delete{/t} + +
Index: lms/templates/promotionschemas.html diff -u /dev/null lms/templates/promotionschemas.html:1.1 --- /dev/null Wed Mar 2 11:31:06 2011 +++ lms/templates/promotionschemas.html Wed Mar 2 11:31:06 2011 @@ -0,0 +1,54 @@ + + + + + + + + + +
+ + {t 0=$promotion.schemas|@count}Promotion's Schemas ($0):{/t} + + {t}New Schema{/t} »  +
+ Index: lms/templates/promotiontariffs.html diff -u /dev/null lms/templates/promotiontariffs.html:1.1 --- /dev/null Wed Mar 2 11:31:06 2011 +++ lms/templates/promotiontariffs.html Wed Mar 2 11:31:06 2011 @@ -0,0 +1,62 @@ + + + + + + + + +
+ + {t 0=$promotion.tariffs|@count}Promotion's Tariffs ($0):{/t} +
+{literal} + +{/literal} Index: lms/templates/tariffinfo.html diff -u lms/templates/tariffinfo.html:1.61 lms/templates/tariffinfo.html:1.62 --- lms/templates/tariffinfo.html:1.61 Mon Dec 27 13:35:17 2010 +++ lms/templates/tariffinfo.html Wed Mar 2 11:31:06 2011 @@ -1,5 +1,5 @@ {include file="header.html"} - +

{$layout.pagetitle}

- + {popup_init src="img/overlib.js"} {if !$layout.popup}
From cvs w lms.org.pl Tue Mar 8 13:04:02 2011 From: cvs w lms.org.pl (LMS CVS) Date: Tue, 8 Mar 2011 13:04:02 +0100 (CET) Subject: [lms-commits] CVS update of lms/templates (header.html) Message-ID: <20110308120402.CAA11302B610@eftep.altec.pl> Date: Tuesday, March 8, 2011 @ 13:04:02 Author: alec Path: /cvsroot/lms/templates Modified: header.html - remove commented out code Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/templates/header.html.diff?&r1=1.133&r2=1.134 Index: lms/templates/header.html diff -u lms/templates/header.html:1.133 lms/templates/header.html:1.134 --- lms/templates/header.html:1.133 Tue Mar 8 13:03:43 2011 +++ lms/templates/header.html Tue Mar 8 13:04:02 2011 @@ -1,10 +1,9 @@ - + ::: LMS :{if $layout.pagetitle neq ""} {$layout.pagetitle|striphtml} :{/if}:: -{* *} From cvs w lms.org.pl Tue Mar 8 19:07:12 2011 From: cvs w lms.org.pl (LMS CVS) Date: Tue, 8 Mar 2011 19:07:12 +0100 (CET) Subject: [lms-commits] CVS update of lms/lib/Smarty/plugins (function.tip.php) Message-ID: <20110308180712.4C1A2302B613@eftep.altec.pl> Date: Tuesday, March 8, 2011 @ 19:07:12 Author: alec Path: /cvsroot/lms/lib/Smarty/plugins Modified: function.tip.php - BTS#0000860: Fixed sticky popups Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/lib/Smarty/plugins/function.tip.php.diff?&r1=1.12&r2=1.13 Index: lms/lib/Smarty/plugins/function.tip.php diff -u lms/lib/Smarty/plugins/function.tip.php:1.12 lms/lib/Smarty/plugins/function.tip.php:1.13 --- lms/lib/Smarty/plugins/function.tip.php:1.12 Tue Jan 18 09:12:06 2011 +++ lms/lib/Smarty/plugins/function.tip.php Tue Mar 8 19:07:12 2011 @@ -21,36 +21,30 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: function.tip.php,v 1.12 2011/01/18 08:12:06 alec Exp $ + * $Id: function.tip.php,v 1.13 2011/03/08 18:07:12 alec Exp $ */ function smarty_function_tip($args, &$SMARTY) { - if ($popup = $args['dynpopup']) + if ($popup = $args['dynpopup']) { if(is_array($args)) foreach($args as $argid => $argval) $popup = str_replace('$'.$argid, $argval, $popup); - $text = " onmouseover=\"return overlib('',HAUTO,VAUTO,OFFSETX,30,OFFSETY,15" - .($args['sticky'] ? ',STICKY, MOUSEOFF' : '').");\" onmouseout=\"nd();\""; -// global $SESSION; -// $text = 'onmouseover="if(getSeconds() < '.$SESSION->timeout.'){ return overlib(\'\',HAUTO,VAUTO,OFFSETX,85,OFFSETY,15); }" onmouseout="nd();"'; + $text = " onmouseover=\"popup('$popup',1,".((int)$args['sticky']).",30,15)\" onmouseout=\"pophide()\""; return $text; - } - else if ($popup = $args['popup']) + } + else if ($popup = $args['popup']) { if(is_array($args)) foreach($args as $argid => $argval) $popup = str_replace('$'.$argid, $argval, $popup); - $text = " onclick=\"return overlib('',HAUTO,VAUTO,OFFSETX,10,OFFSETY,10" - .($args['sticky'] ? ',STICKY, MOUSEOFF' : '').");\" onmouseout=\"nd();\""; + $text = " onclick=\"popup('$popup',1,".((int)$args['sticky']).",10,10)\" onmouseout=\"pophide();\""; return $text; - } - else + } + else { if($SMARTY->_tpl_vars['error'][$args['trigger']]) { @@ -59,10 +53,10 @@ $error = str_replace("\r",'',$error); $error = str_replace("\n",'
',$error); - $result = ' onmouseover="return overlib(\''.$error.'\',HAUTO,VAUTO,OFFSETX,15,OFFSETY,15);" onmouseout="nd();" '; - $result .= $args['bold'] ? ' CLASS="alert bold" ' : ' CLASS="alert" '; + $result = ' onmouseover="popup(\''.$error.'\')" onmouseout="pophide()" '; + $result .= $args['bold'] ? 'CLASS="alert bold" ' : ' CLASS="alert" '; } - elseif($args['text'] != '') + elseif($args['text'] != '') { $text = $args['text']; if($SMARTY->_tpl_vars['_LANG'][$text]) @@ -77,10 +71,10 @@ $text = str_replace("\r",'',$text); $text = str_replace("\n",'
',$text); - $result .= 'onmouseover="return overlib(\''.$text.'\',HAUTO,VAUTO,OFFSETX,15,OFFSETY,15);" onmouseout="nd();"'; - $result .= $args['bold'] ? ' CLASS="bold" ' : ''; + $result .= 'onmouseover="popup(\''.$text.'\')" onmouseout="pophide()" '; + $result .= $args['bold'] ? 'CLASS="bold" ' : ''; } - + return $result; } } From cvs w lms.org.pl Tue Mar 8 19:07:12 2011 From: cvs w lms.org.pl (LMS CVS) Date: Tue, 8 Mar 2011 19:07:12 +0100 (CET) Subject: [lms-commits] CVS update of lms/doc (ChangeLog) Message-ID: <20110308180712.0F005302B610@eftep.altec.pl> Date: Tuesday, March 8, 2011 @ 19:07:11 Author: alec Path: /cvsroot/lms/doc Modified: ChangeLog - BTS#0000860: Fixed sticky popups Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/ChangeLog.diff?&r1=1.1543&r2=1.1544 Index: lms/doc/ChangeLog diff -u lms/doc/ChangeLog:1.1543 lms/doc/ChangeLog:1.1544 --- lms/doc/ChangeLog:1.1543 Wed Mar 2 12:37:14 2011 +++ lms/doc/ChangeLog Tue Mar 8 19:07:11 2011 @@ -1,4 +1,4 @@ -$Id: ChangeLog,v 1.1543 2011/03/02 11:37:14 alec Exp $ +$Id: ChangeLog,v 1.1544 2011/03/08 18:07:11 alec Exp $ version ? (????-??-??) @@ -18,6 +18,7 @@ - Use tariff name+value+period as a unique key instead of just a name (alec) - Now PostgreSQL 8.2 is required because of multi-value INSERT usage (alec) - Fixed netdevices searching by MAC address (alec) + - BTS#0000860: Fixed sticky popups (alec) version 1.11.11 Bray (2011-01-17) From cvs w lms.org.pl Tue Mar 8 19:07:12 2011 From: cvs w lms.org.pl (LMS CVS) Date: Tue, 8 Mar 2011 19:07:12 +0100 (CET) Subject: [lms-commits] CVS update of lms/templates (calendar.html, calendar_js.html) Message-ID: <20110308180712.71157302B614@eftep.altec.pl> Date: Tuesday, March 8, 2011 @ 19:07:12 Author: alec Path: /cvsroot/lms/templates Modified: calendar.html calendar_js.html - BTS#0000860: Fixed sticky popups Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/templates/calendar.html.diff?&r1=1.11&r2=1.12 http://cvs.lms.org.pl/viewvc/Development/lms/templates/calendar_js.html.diff?&r1=1.6&r2=1.7 Index: lms/templates/calendar.html diff -u lms/templates/calendar.html:1.11 lms/templates/calendar.html:1.12 --- lms/templates/calendar.html:1.11 Wed Jan 5 21:40:30 2011 +++ lms/templates/calendar.html Tue Mar 8 19:07:12 2011 @@ -1,5 +1,5 @@ - + @@ -90,7 +90,7 @@ if (!dt_datetime) return; if (b_close) { // window.close(); - window.parent.nd(); + window.parent.popclick(); obj_caller.target.value = (document.cal ? obj_caller.gen_tsmp(dt_datetime) : obj_caller.gen_date(dt_datetime) Index: lms/templates/calendar_js.html diff -u lms/templates/calendar_js.html:1.6 lms/templates/calendar_js.html:1.7 --- lms/templates/calendar_js.html:1.6 Thu Dec 23 13:35:13 2010 +++ lms/templates/calendar_js.html Tue Mar 8 19:07:12 2011 @@ -66,9 +66,9 @@ if (obj) { document.getElementById('autoiframe').src = src; } - else - overlib(''; + } + + if (!offset_x) offset_x = 15; + if (!offset_y) offset_y = 15; + + if (sticky) { + overlib(content, HAUTO, VAUTO, OFFSETX, offset_x, OFFSETY, offset_y, STICKY, MOUSEOFF); + var body = document.getElementsByTagName('BODY')[0]; + body.onmousedown = function () { popclick(); }; + lms_sticky_popup = 1; + } + else { + overlib(content, HAUTO, VAUTO, OFFSETX, offset_x, OFFSETY, offset_y); + } +} + +// Hide non-sticky popup +function pophide() +{ + if (lms_sticky_popup) { + return; + } + + return nd(); +} + +// Hide sticky popup +function popclick() +{ + lms_sticky_popup = 0; + o3_removecounter++; + return nd(); +} Index: lms/img/overlib.js diff -u lms/img/overlib.js:1.11 lms/img/overlib.js:1.12 --- lms/img/overlib.js:1.11 Tue Mar 8 13:03:42 2011 +++ lms/img/overlib.js Tue Mar 8 19:07:12 2011 @@ -350,6 +350,8 @@ // The Close onMouseOver function for stickies function cClick() { if (olLoaded) { +// LMS-mod + lms_sticky_popup = 0; runHook("hideObject", FREPLACE, over); o3_showingsticky = 0; } From cvs w lms.org.pl Wed Mar 9 13:55:16 2011 From: cvs w lms.org.pl (LMS CVS) Date: Wed, 9 Mar 2011 13:55:16 +0100 (CET) Subject: [lms-commits] CVS update of lms/doc (ChangeLog) Message-ID: <20110309125516.4DD7D302B610@eftep.altec.pl> Date: Wednesday, March 9, 2011 @ 13:55:16 Author: alec Path: /cvsroot/lms/doc Modified: ChangeLog - Added send_sms_before plugin hook Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/ChangeLog.diff?&r1=1.1544&r2=1.1545 Index: lms/doc/ChangeLog diff -u lms/doc/ChangeLog:1.1544 lms/doc/ChangeLog:1.1545 --- lms/doc/ChangeLog:1.1544 Tue Mar 8 19:07:11 2011 +++ lms/doc/ChangeLog Wed Mar 9 13:55:15 2011 @@ -1,4 +1,4 @@ -$Id: ChangeLog,v 1.1544 2011/03/08 18:07:11 alec Exp $ +$Id: ChangeLog,v 1.1545 2011/03/09 12:55:15 alec Exp $ version ? (????-??-??) @@ -19,6 +19,7 @@ - Now PostgreSQL 8.2 is required because of multi-value INSERT usage (alec) - Fixed netdevices searching by MAC address (alec) - BTS#0000860: Fixed sticky popups (alec) + - Added send_sms_before plugin hook (alec) version 1.11.11 Bray (2011-01-17) From cvs w lms.org.pl Wed Mar 9 13:55:16 2011 From: cvs w lms.org.pl (LMS CVS) Date: Wed, 9 Mar 2011 13:55:16 +0100 (CET) Subject: [lms-commits] CVS update of lms/lib (LMS.class.php) Message-ID: <20110309125516.7CAAC302B612@eftep.altec.pl> Date: Wednesday, March 9, 2011 @ 13:55:16 Author: alec Path: /cvsroot/lms/lib Modified: LMS.class.php - Added send_sms_before plugin hook Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/lib/LMS.class.php.diff?&r1=1.1055&r2=1.1056 Index: lms/lib/LMS.class.php diff -u lms/lib/LMS.class.php:1.1055 lms/lib/LMS.class.php:1.1056 --- lms/lib/LMS.class.php:1.1055 Mon Mar 7 14:53:34 2011 +++ lms/lib/LMS.class.php Wed Mar 9 13:55:16 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: LMS.class.php,v 1.1055 2011/03/07 13:53:34 alec Exp $ + * $Id: LMS.class.php,v 1.1056 2011/03/09 12:55: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.1055 $'; + var $_revision = '$Revision: 1.1056 $'; function LMS(&$DB, &$AUTH, &$CONFIG) // class variables setting { @@ -4126,19 +4126,32 @@ function SendSMS($number, $message, $messageid=0) { - if(empty($this->CONFIG['sms']['service'])) - return trans('SMS "service" not set!'); - else - $service = $this->CONFIG['sms']['service']; - $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 if ($prefix && substr($number, 0, strlen($prefix)) != $prefix) $number = $prefix . $number; - + + $data = array( + 'number' => $number, + 'message' => $message, + 'messageid' => $messageid + ); + + // call external SMS handler(s) + $data = $this->ExecHook('send_sms_before', $data); + + if ($data['abort']) { + return $data['result']; + } + + if(empty($this->CONFIG['sms']['service'])) + return trans('SMS "service" not set!'); + else + $service = $this->CONFIG['sms']['service']; + switch($service) { case 'smscenter': @@ -4157,7 +4170,7 @@ return trans('SMS Message too long!'); if(strlen($number) > 16 || strlen($number) < 4) return trans('Wrong phone number format!'); - + $type = !empty($this->CONFIG['sms']['smscenter_type']) ? $this->CONFIG['sms']['smscenter_type'] : 'dynamic'; $message .= ($type == 'static') ? "\n\n" . $from : ''; @@ -4169,7 +4182,7 @@ 'text' => $message, 'from' => $from ); - + $encodedargs = array(); foreach (array_keys($args) as $thiskey) array_push($encodedargs, urlencode($thiskey) ."=". urlencode($args[$thiskey])); @@ -4181,7 +4194,7 @@ curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, $encodedargs); curl_setopt($curl, CURLOPT_TIMEOUT, 10); - + $page = curl_exec($curl); if(curl_error($curl)) return 'SMS communication error. ' . curl_error($curl); @@ -4233,11 +4246,11 @@ return trans('SMSTools outgoing directory not exists ($0)!', $dir); if(!is_writable($dir)) return trans('Unable to write to SMSTools outgoing directory ($0)!', $dir); - + $filename = $dir.'/lms-'.$messageid.'-'.$number; $message = clear_utf($message); $file = sprintf("To: %s\n\n%s", $number, $message); - + if($fp = fopen($filename, 'w')) { fwrite($fp, $file); @@ -4245,14 +4258,14 @@ } else return trans('Unable to create file $0!', $filename); - + return MSG_NEW; break; default: return trans('Unknown SMS service!'); } } - + function GetMessages($customerid, $limit=NULL) { return $this->DB->GetAll('SELECT i.messageid AS id, i.status, i.error, From cvs w lms.org.pl Wed Mar 9 13:55:16 2011 From: cvs w lms.org.pl (LMS CVS) Date: Wed, 9 Mar 2011 13:55:16 +0100 (CET) Subject: [lms-commits] CVS update of lms/lib/plugins (example.php) Message-ID: <20110309125516.9A2D3302B613@eftep.altec.pl> Date: Wednesday, March 9, 2011 @ 13:55:16 Author: alec Path: /cvsroot/lms/lib/plugins Modified: example.php - Added send_sms_before plugin hook Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/lib/plugins/example.php.diff?&r1=1.2&r2=1.3 Index: lms/lib/plugins/example.php diff -u lms/lib/plugins/example.php:1.2 lms/lib/plugins/example.php:1.3 --- lms/lib/plugins/example.php:1.2 Fri Mar 4 11:47:57 2011 +++ lms/lib/plugins/example.php Wed Mar 9 13:55:16 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: example.php,v 1.2 2011/03/04 10:47:57 alec Exp $ + * $Id: example.php,v 1.3 2011/03/09 12:55:16 alec Exp $ */ /** @@ -85,4 +85,5 @@ node_set_after - After changing node status node_warn_after - After changing a warning flag + send_sms_before - Called just before sending SMS, using this you can add your own service handlers */ From cvs w lms.org.pl Wed Mar 9 14:00:03 2011 From: cvs w lms.org.pl (LMS CVS) Date: Wed, 9 Mar 2011 14:00:03 +0100 (CET) Subject: [lms-commits] CVS update of lms/doc (ChangeLog) Message-ID: <20110309130003.3FBE2302B610@eftep.altec.pl> Date: Wednesday, March 9, 2011 @ 14:00:03 Author: alec Path: /cvsroot/lms/doc Modified: ChangeLog - Don't send deplicated notifications to the users when they are using the same e-mail address Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/ChangeLog.diff?&r1=1.1545&r2=1.1546 Index: lms/doc/ChangeLog diff -u lms/doc/ChangeLog:1.1545 lms/doc/ChangeLog:1.1546 --- lms/doc/ChangeLog:1.1545 Wed Mar 9 13:55:15 2011 +++ lms/doc/ChangeLog Wed Mar 9 14:00:02 2011 @@ -1,4 +1,4 @@ -$Id: ChangeLog,v 1.1545 2011/03/09 12:55:15 alec Exp $ +$Id: ChangeLog,v 1.1546 2011/03/09 13:00:02 alec Exp $ version ? (????-??-??) @@ -20,6 +20,8 @@ - Fixed netdevices searching by MAC address (alec) - BTS#0000860: Fixed sticky popups (alec) - Added send_sms_before plugin hook (alec) + - Don't send deplicated notifications to the users when they are using + the same e-mail address (alec) version 1.11.11 Bray (2011-01-17) From cvs w lms.org.pl Wed Mar 9 14:00:03 2011 From: cvs w lms.org.pl (LMS CVS) Date: Wed, 9 Mar 2011 14:00:03 +0100 (CET) Subject: [lms-commits] CVS update of lms/modules (4 files) Message-ID: <20110309130003.B6B16302B612@eftep.altec.pl> Date: Wednesday, March 9, 2011 @ 14:00:03 Author: alec Path: /cvsroot/lms/modules Modified: rtmessageadd.php rtnoteadd.php rtticketadd.php rtticketedit.php - Don't send deplicated notifications to the users when they are using the same e-mail address Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/modules/rtmessageadd.php.diff?&r1=1.70&r2=1.71 http://cvs.lms.org.pl/viewvc/Development/lms/modules/rtnoteadd.php.diff?&r1=1.15&r2=1.16 http://cvs.lms.org.pl/viewvc/Development/lms/modules/rtticketadd.php.diff?&r1=1.54&r2=1.55 http://cvs.lms.org.pl/viewvc/Development/lms/modules/rtticketedit.php.diff?&r1=1.41&r2=1.42 Index: lms/modules/rtmessageadd.php diff -u lms/modules/rtmessageadd.php:1.70 lms/modules/rtmessageadd.php:1.71 --- lms/modules/rtmessageadd.php:1.70 Tue Feb 1 13:17:06 2011 +++ lms/modules/rtmessageadd.php Wed Mar 9 14:00:03 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: rtmessageadd.php,v 1.70 2011/02/01 12:17:06 alec Exp $ + * $Id: rtmessageadd.php,v 1.71 2011/03/09 13:00:03 alec Exp $ */ function MessageAdd($msg, $headers, $file=NULL) @@ -272,10 +272,11 @@ $body .= trans('E-mail:').' '.$info['email']; } - if($recipients = $DB->GetCol('SELECT email FROM users, rtrights - WHERE users.id=userid AND queueid = ? AND email != \'\' - AND (rtrights.rights & 8) = 8 AND users.id != ? AND deleted = 0', - array($queue['id'], $AUTH->id))) + if($recipients = $DB->GetCol('SELECT DISTINCT email + FROM users, rtrights + WHERE users.id=userid AND queueid = ? AND email != \'\' + AND (rtrights.rights & 8) = 8 AND users.id != ? AND deleted = 0', + array($queue['id'], $AUTH->id))) { foreach($recipients as $email) { Index: lms/modules/rtnoteadd.php diff -u lms/modules/rtnoteadd.php:1.15 lms/modules/rtnoteadd.php:1.16 --- lms/modules/rtnoteadd.php:1.15 Tue Feb 1 13:17:06 2011 +++ lms/modules/rtnoteadd.php Wed Mar 9 14:00:03 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: rtnoteadd.php,v 1.15 2011/02/01 12:17:06 alec Exp $ + * $Id: rtnoteadd.php,v 1.16 2011/03/09 13:00:03 alec Exp $ */ if(isset($_GET['ticketid'])) @@ -104,10 +104,11 @@ $body .= trans('E-mail:').' '.$info['email']; } - if($recipients = $DB->GetCol('SELECT email FROM users, rtrights - WHERE users.id=userid AND queueid = ? AND email != \'\' - AND (rtrights.rights & 8) = 8 AND users.id != ? AND deleted = 0', - array($queue['id'], $AUTH->id))) + if($recipients = $DB->GetCol('SELECT DISTINCT email + FROM users, rtrights + WHERE users.id=userid AND queueid = ? AND email != \'\' + AND (rtrights.rights & 8) = 8 AND users.id != ? AND deleted = 0', + array($queue['id'], $AUTH->id))) { foreach($recipients as $email) { Index: lms/modules/rtticketadd.php diff -u lms/modules/rtticketadd.php:1.54 lms/modules/rtticketadd.php:1.55 --- lms/modules/rtticketadd.php:1.54 Tue Feb 1 13:17:06 2011 +++ lms/modules/rtticketadd.php Wed Mar 9 14:00:03 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: rtticketadd.php,v 1.54 2011/02/01 12:17:06 alec Exp $ + * $Id: rtticketadd.php,v 1.55 2011/03/09 13:00:03 alec Exp $ */ $queue = isset($_GET['id']) ? intval($_GET['id']) : 0; @@ -75,7 +75,7 @@ if(!empty($CONFIG['phpui']['helpdesk_sender_name'])) { $mailfname = $CONFIG['phpui']['helpdesk_sender_name']; - + if($mailfname == 'queue') $mailfname = $LMS->GetQueueName($queue); elseif($mailfname == 'user') $mailfname = $user['name']; $mailfname = '"'.$mailfname.'"'; @@ -115,10 +115,11 @@ $body .= trans('E-mail:').' '.$info['email']; } - if($recipients = $DB->GetCol('SELECT email FROM users, rtrights - WHERE users.id = userid AND queueid = ? AND email != \'\' - AND (rtrights.rights & 8) = 8 AND deleted = 0', - array($queue))) + if($recipients = $DB->GetCol('SELECT DISTINCT email + FROM users, rtrights + WHERE users.id = userid AND queueid = ? AND email != \'\' + AND (rtrights.rights & 8) = 8 AND deleted = 0', + array($queue))) { foreach($recipients as $email) { @@ -132,13 +133,13 @@ } } } - + $SESSION->redirect('?m=rtticketview&id='.$id); } $SMARTY->assign('ticket', $ticket); $SMARTY->assign('error', $error); } - + $layout['pagetitle'] = trans('New Ticket'); $SESSION->save('backto', $_SERVER['QUERY_STRING']); Index: lms/modules/rtticketedit.php diff -u lms/modules/rtticketedit.php:1.41 lms/modules/rtticketedit.php:1.42 --- lms/modules/rtticketedit.php:1.41 Tue Feb 1 13:17:06 2011 +++ lms/modules/rtticketedit.php Wed Mar 9 14:00:03 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: rtticketedit.php,v 1.41 2011/02/01 12:17:06 alec Exp $ + * $Id: rtticketedit.php,v 1.42 2011/03/09 13:00:03 alec Exp $ */ if(($id = $_GET['id']) && !isset($_POST['ticket'])) @@ -153,15 +153,17 @@ $body .= trans('E-mail:').' '.$info['email']; } - if($recipients = $DB->GetCol('SELECT email FROM users, rtrights - WHERE users.id=userid AND queueid = ? AND email != \'\' - AND (rtrights.rights & 8) = 8 AND users.id != ? AND deleted = 0', - array($ticketedit['queueid'], $AUTH->id))) + if($recipients = $DB->GetCol('SELECT DISTINCT email + FROM users, rtrights + WHERE users.id=userid AND queueid = ? AND email != \'\' + AND (rtrights.rights & 8) = 8 AND users.id != ? AND deleted = 0', + array($ticketedit['queueid'], $AUTH->id))) { - $oldrecipients = $DB->GetCol('SELECT email FROM users, rtrights - WHERE users.id=userid AND queueid = ? AND email != \'\' - AND (rtrights.rights & 8) = 8 AND deleted = 0', - array($ticket['queueid'])); + $oldrecipients = $DB->GetCol('SELECT DISTINCT email + FROM users, rtrights + WHERE users.id=userid AND queueid = ? AND email != \'\' + AND (rtrights.rights & 8) = 8 AND deleted = 0', + array($ticket['queueid'])); foreach($recipients as $email) { From cvs w lms.org.pl Thu Mar 10 10:57:32 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 10 Mar 2011 10:57:32 +0100 (CET) Subject: [lms-commits] CVS update of lms/lib/upgradedb (postgres.2011022000.php) Message-ID: <20110310095732.7A982302B610@eftep.altec.pl> Date: Thursday, March 10, 2011 @ 10:57:32 Author: chilek Path: /cvsroot/lms/lib/upgradedb Modified: postgres.2011022000.php - we removed tariffs_name_key earlier, so it is called tariffs_name_value_key at this moment Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/lib/upgradedb/postgres.2011022000.php.diff?&r1=1.1&r2=1.2 Index: lms/lib/upgradedb/postgres.2011022000.php diff -u lms/lib/upgradedb/postgres.2011022000.php:1.1 lms/lib/upgradedb/postgres.2011022000.php:1.2 --- lms/lib/upgradedb/postgres.2011022000.php:1.1 Wed Mar 2 11:31:05 2011 +++ lms/lib/upgradedb/postgres.2011022000.php Thu Mar 10 10:57:32 2011 @@ -60,7 +60,7 @@ ); CREATE INDEX promotionassignments_tariffid_idx ON promotionassignments (tariffid); -ALTER TABLE tariffs DROP CONSTRAINT tariffs_name_key; +ALTER TABLE tariffs DROP CONSTRAINT tariffs_name_value_key; ALTER TABLE tariffs ADD UNIQUE(name, value, period); "); From alec w alec.pl Thu Mar 10 11:10:43 2011 From: alec w alec.pl (A.L.E.C) Date: Thu, 10 Mar 2011 11:10:43 +0100 Subject: [lms-commits] CVS update of lms/lib/upgradedb (postgres.2011022000.php) In-Reply-To: <20110310095732.7A982302B610@eftep.altec.pl> References: <20110310095732.7A982302B610@eftep.altec.pl> Message-ID: <4D78A3A3.3050708@alec.pl> On 10.03.2011 10:57, LMS CVS wrote: > Date: Thursday, March 10, 2011 @ 10:57:32 > Author: chilek > Path: /cvsroot/lms/lib/upgradedb > > Modified: postgres.2011022000.php > > - we removed tariffs_name_key earlier, so it is called tariffs_name_value_key at this moment > -ALTER TABLE tariffs DROP CONSTRAINT tariffs_name_key; > +ALTER TABLE tariffs DROP CONSTRAINT tariffs_name_value_key; Tomku jakiej wersji postgresa używasz? U mnie to działało. Postgres tworząc ten konkretny constraint nazywa go automatycznie tariff_name_key (niezależnie ilu kolumn dotyczy bierze tylko pierwszą). -- Aleksander 'A.L.E.C' Machniak LAN Management System Developer [http://lms.org.pl] Roundcube Webmail Developer [http://roundcube.net] --------------------------------------------------- PGP: 19359DC1 @@ GG: 2275252 @@ WWW: http://alec.pl From cvs w lms.org.pl Thu Mar 10 11:33:16 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 10 Mar 2011 11:33:16 +0100 (CET) Subject: [lms-commits] CVS update of lms/modules (nodeedit.php) Message-ID: <20110310103316.094B9302B610@eftep.altec.pl> Date: Thursday, March 10, 2011 @ 11:33:16 Author: chilek Path: /cvsroot/lms/modules Modified: nodeedit.php - missed default value for netdev Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/modules/nodeedit.php.diff?&r1=1.118&r2=1.119 Index: lms/modules/nodeedit.php diff -u lms/modules/nodeedit.php:1.118 lms/modules/nodeedit.php:1.119 --- lms/modules/nodeedit.php:1.118 Fri Feb 18 15:32:46 2011 +++ lms/modules/nodeedit.php Thu Mar 10 11:33:15 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: nodeedit.php,v 1.118 2011/02/18 14:32:46 alec Exp $ + * $Id: nodeedit.php,v 1.119 2011/03/10 10:33:15 chilek Exp $ */ $action = isset($_GET['action']) ? $_GET['action'] : ''; @@ -161,9 +161,10 @@ $error['passwd'] = trans('Password is too long (max.32 characters)!'); if(!isset($nodeedit['access'])) $nodeedit['access'] = 0; - if(!isset($nodeedit['warning'])) $nodeedit['warning'] = 0; + if(!isset($nodeedit['warning'])) $nodeedit['warning'] = 0; if(!isset($nodeedit['chkmac'])) $nodeedit['chkmac'] = 0; if(!isset($nodeedit['halfduplex'])) $nodeedit['halfduplex'] = 0; + if(!isset($nodeedit['netdev'])) $nodeedit['netdev'] = 0; if($nodeinfo['netdev'] != $nodeedit['netdev'] && $nodeedit['netdev'] != 0) { From cvs w lms.org.pl Thu Mar 10 12:36:38 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 10 Mar 2011 12:36:38 +0100 (CET) Subject: [lms-commits] CVS update of lms/doc/sgml/pl (advanced.sgml, userif.sgml) Message-ID: <20110310113638.C878E302B613@eftep.altec.pl> Date: Thursday, March 10, 2011 @ 12:36:38 Author: alec Path: /cvsroot/lms/doc/sgml/pl Modified: advanced.sgml userif.sgml - Removed userpanel/debug_email option, use mail/debug_email instead - Added sms/debug_phone option - Added SMS notifications from helpdesk - BTS#0000843: Support SMS messages up to 459 chars using smscenter setvice Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/sgml/pl/advanced.sgml.diff?&r1=1.83&r2=1.84 http://cvs.lms.org.pl/viewvc/Development/lms/doc/sgml/pl/userif.sgml.diff?&r1=1.92&r2=1.93 Index: lms/doc/sgml/pl/advanced.sgml diff -u lms/doc/sgml/pl/advanced.sgml:1.83 lms/doc/sgml/pl/advanced.sgml:1.84 --- lms/doc/sgml/pl/advanced.sgml:1.83 Mon Mar 7 13:10:57 2011 +++ lms/doc/sgml/pl/advanced.sgml Thu Mar 10 12:36:38 2011 @@ -1,4 +1,4 @@ - + Dla dociekliwych @@ -84,11 +84,13 @@ id - identyfikator login - login name - nazwa (nazwisko i imię) - email - adres admina - position - nazwa stanowiska admina + email - adres e-mail użytkownika + phone - numer telefonu użytkownika + position - nazwa stanowiska rights - prawa dostępu hosts - lista hostów z prawem do logowania passwd - hasło logowania + ntype - obsługiwane typy powiadomień lastlogindate - data ostatniego logowania lastloginip - adres IP, z którego nastąpiło ostatnie logowanie failedlogindate - data ostatniej nieudanej próby logowania Index: lms/doc/sgml/pl/userif.sgml diff -u lms/doc/sgml/pl/userif.sgml:1.92 lms/doc/sgml/pl/userif.sgml:1.93 --- lms/doc/sgml/pl/userif.sgml:1.92 Mon Mar 7 13:10:57 2011 +++ lms/doc/sgml/pl/userif.sgml Thu Mar 10 12:36:38 2011 @@ -1,4 +1,4 @@ - + Interfejs Użytkownika (LMS-UI) LMS'owy Interfejs Użytkownika to panel administracyjny do tworzenia @@ -54,15 +54,18 @@ Nowy użytkownik - Aby dodać nowe konto użytkownika należy podać login oraz hasło, - które nie może być puste. Podanie imienia, nazwiska i adresu poczty elektronicznej - nie jest wymagane. "Dozwolone hosty" to lista adresów IP hostów lub sieci + Aby dodać nowe konto użytkownika należy podać login, nazwisko/imię oraz hasło, + które nie może być puste. Pozostałe dane nie są wymagane. + "Dozwolone hosty" to lista adresów IP hostów lub sieci oddzielonych przecinkiem, z których dany użytkownik może się logować do systemu (podobnie do opcji konfiguracyjnej 'allow_from'). Jeśli lista ta jest pusta system nie dokonuje sprawdzenia adresu IP. Poniżej można zaznaczyć uprawnienia dostępu do systemu. Jeżeli wszystkie pola pozostawisz puste, użytkownikowi przypisany zostanie 'Pełen dostęp'. + Pole "Powiadomienia" określa jakiego typu powiadomienia (np. z helpdesku) + mają być wysyłane do użytkownika. Aby skorzystać z powiadomień należy też podać adres e-mail i/lub + numer telefonu. Kopie zapasowe @@ -1472,7 +1475,7 @@ newticket_notify Włączenie tej opcji spowoduje, że wszyscy użytkownicy z prawami - do kolejki dostaną powiadomienie mailem o dodaniu do niej nowego + do kolejki dostaną powiadomienie (mailem i/lub smsem) o dodaniu do niej nowego zgłoszenia. Domyślnie: wyłączona. Przykład: newticket_notify = 1 From cvs w lms.org.pl Thu Mar 10 12:36:38 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 10 Mar 2011 12:36:38 +0100 (CET) Subject: [lms-commits] CVS update of lms/doc/sgml (advanced.sgml) Message-ID: <20110310113638.96562302B612@eftep.altec.pl> Date: Thursday, March 10, 2011 @ 12:36:38 Author: alec Path: /cvsroot/lms/doc/sgml Modified: advanced.sgml - Removed userpanel/debug_email option, use mail/debug_email instead - Added sms/debug_phone option - Added SMS notifications from helpdesk - BTS#0000843: Support SMS messages up to 459 chars using smscenter setvice Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/sgml/advanced.sgml.diff?&r1=1.121&r2=1.122 Index: lms/doc/sgml/advanced.sgml diff -u lms/doc/sgml/advanced.sgml:1.121 lms/doc/sgml/advanced.sgml:1.122 --- lms/doc/sgml/advanced.sgml:1.121 Mon Mar 7 13:10:57 2011 +++ lms/doc/sgml/advanced.sgml Thu Mar 10 12:36:38 2011 @@ -1,4 +1,4 @@ - + For curious @@ -81,10 +81,12 @@ login - login name - first and last name email - user's email address + phone - user's phone number position - user's position name rights - binary access rights hosts - list of hosts allowed to login passwd - password to login + ntype - supported notofication types lastlogindate - date of last login lastloginip - IP of last login failedlogindate - date of last failed login attempt From cvs w lms.org.pl Thu Mar 10 12:36:38 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 10 Mar 2011 12:36:38 +0100 (CET) Subject: [lms-commits] CVS update of lms/doc (ChangeLog, lms.mysql, lms.pgsql) Message-ID: <20110310113638.6FF6E302B610@eftep.altec.pl> Date: Thursday, March 10, 2011 @ 12:36:38 Author: alec Path: /cvsroot/lms/doc Modified: ChangeLog lms.mysql lms.pgsql - Removed userpanel/debug_email option, use mail/debug_email instead - Added sms/debug_phone option - Added SMS notifications from helpdesk - BTS#0000843: Support SMS messages up to 459 chars using smscenter setvice Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/ChangeLog.diff?&r1=1.1546&r2=1.1547 http://cvs.lms.org.pl/viewvc/Development/lms/doc/lms.mysql.diff?&r1=1.183&r2=1.184 http://cvs.lms.org.pl/viewvc/Development/lms/doc/lms.pgsql.diff?&r1=1.179&r2=1.180 Index: lms/doc/ChangeLog diff -u lms/doc/ChangeLog:1.1546 lms/doc/ChangeLog:1.1547 --- lms/doc/ChangeLog:1.1546 Wed Mar 9 14:00:02 2011 +++ lms/doc/ChangeLog Thu Mar 10 12:36:38 2011 @@ -1,4 +1,4 @@ -$Id: ChangeLog,v 1.1546 2011/03/09 13:00:02 alec Exp $ +$Id: ChangeLog,v 1.1547 2011/03/10 11:36:38 alec Exp $ version ? (????-??-??) @@ -22,6 +22,10 @@ - Added send_sms_before plugin hook (alec) - Don't send deplicated notifications to the users when they are using the same e-mail address (alec) + - Removed userpanel/debug_email option, use mail/debug_email instead (alec) + - Added sms/debug_phone option (alec) + - Added SMS notifications from helpdesk (alec) + - BTS#0000843: Support SMS messages up to 459 chars using smscenter setvice (alec) version 1.11.11 Bray (2011-01-17) Index: lms/doc/lms.mysql diff -u lms/doc/lms.mysql:1.183 lms/doc/lms.mysql:1.184 --- lms/doc/lms.mysql:1.183 Mon Mar 7 13:10:56 2011 +++ lms/doc/lms.mysql Thu Mar 10 12:36:38 2011 @@ -1,5 +1,5 @@ # -------------------------------------------------------- -# $Id: lms.mysql,v 1.183 2011/03/07 12:10:56 alec Exp $ +# $Id: lms.mysql,v 1.184 2011/03/10 11:36:38 alec Exp $ # -------------------------------------------------------- # -- Drop tables first, MySQL doesn't support CASCADE @@ -93,19 +93,21 @@ # CREATE TABLE users ( - id int(11) NOT NULL auto_increment, - login varchar(32) NOT NULL DEFAULT '', - name varchar(64) NOT NULL DEFAULT '', - email varchar(255) NOT NULL DEFAULT '', + id int(11) NOT NULL auto_increment, + login varchar(32) NOT NULL DEFAULT '', + name varchar(64) NOT NULL DEFAULT '', + email varchar(255) NOT NULL DEFAULT '', + phone varchar(32) DEFAULT NULL, position varchar(255) NOT NULL DEFAULT '', - rights varchar(64) NOT NULL DEFAULT '', - hosts varchar(255) NOT NULL DEFAULT '', - passwd varchar(255) NOT NULL DEFAULT '', + rights varchar(64) NOT NULL DEFAULT '', + hosts varchar(255) NOT NULL DEFAULT '', + passwd varchar(255) NOT NULL DEFAULT '', + ntype smallint DEFAULT NULL, lastlogindate int(11) NOT NULL DEFAULT '0', lastloginip varchar(16) NOT NULL DEFAULT '', failedlogindate int(11) NOT NULL DEFAULT '0', failedloginip varchar(16) NOT NULL DEFAULT '', - deleted tinyint(1) NOT NULL DEFAULT '0', + deleted tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (id), UNIQUE KEY login (login) ) ENGINE=InnoDB; @@ -1477,4 +1479,4 @@ # -------------------------------------------------------- -INSERT INTO dbinfo (keytype, keyvalue) VALUES ('dbversion', '2011030700'); +INSERT INTO dbinfo (keytype, keyvalue) VALUES ('dbversion', '2011031000'); Index: lms/doc/lms.pgsql diff -u lms/doc/lms.pgsql:1.179 lms/doc/lms.pgsql:1.180 --- lms/doc/lms.pgsql:1.179 Mon Mar 7 13:10:56 2011 +++ lms/doc/lms.pgsql Thu Mar 10 12:36:38 2011 @@ -1,7 +1,7 @@ -/* $Id: lms.pgsql,v 1.179 2011/03/07 12:10:56 alec Exp $ */ +/* $Id: lms.pgsql,v 1.180 2011/03/10 11:36:38 alec Exp $ */ -/* -------------------------------------------------------- - Structure of table "users" +/* -------------------------------------------------------- + Structure of table "users" -------------------------------------------------------- */ DROP SEQUENCE users_id_seq; CREATE SEQUENCE users_id_seq; @@ -11,10 +11,12 @@ login varchar(32) DEFAULT '' NOT NULL, name varchar(64) DEFAULT '' NOT NULL, email varchar(255) DEFAULT '' NOT NULL, + phone varchar(32) DEFAULT NULL, position varchar(255) DEFAULT '' NOT NULL, rights varchar(64) DEFAULT '' NOT NULL, hosts varchar(255) DEFAULT '' NOT NULL, passwd varchar(255) DEFAULT '' NOT NULL, + ntype smallint DEFAULT NULL, lastlogindate integer DEFAULT 0 NOT NULL, lastloginip varchar(16) DEFAULT '' NOT NULL, failedlogindate integer DEFAULT 0 NOT NULL, @@ -1574,4 +1576,4 @@ INSERT INTO nastypes (name) VALUES ('usrhiper'); INSERT INTO nastypes (name) VALUES ('other'); -INSERT INTO dbinfo (keytype, keyvalue) VALUES ('dbversion', '2011030700'); +INSERT INTO dbinfo (keytype, keyvalue) VALUES ('dbversion', '2011031000'); From cvs w lms.org.pl Thu Mar 10 12:36:39 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 10 Mar 2011 12:36:39 +0100 (CET) Subject: [lms-commits] CVS update of lms/lib/upgradedb (2 files) Message-ID: <20110310113639.57FCF302B616@eftep.altec.pl> Date: Thursday, March 10, 2011 @ 12:36:39 Author: alec Path: /cvsroot/lms/lib/upgradedb Added: mysql.2011031000.php postgres.2011031000.php - Removed userpanel/debug_email option, use mail/debug_email instead - Added sms/debug_phone option - Added SMS notifications from helpdesk - BTS#0000843: Support SMS messages up to 459 chars using smscenter setvice Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/lib/upgradedb/mysql.2011031000.php?rev=1.1 http://cvs.lms.org.pl/viewvc/Development/lms/lib/upgradedb/postgres.2011031000.php?rev=1.1 Index: lms/lib/upgradedb/mysql.2011031000.php diff -u /dev/null lms/lib/upgradedb/mysql.2011031000.php:1.1 --- /dev/null Thu Mar 10 12:36:39 2011 +++ lms/lib/upgradedb/mysql.2011031000.php Thu Mar 10 12:36:39 2011 @@ -0,0 +1,34 @@ +BeginTrans(); + +$DB->Execute("ALTER TABLE users ADD phone varchar(32) DEFAULT NULL"); +$DB->Execute("ALTER TABLE users ADD ntype smallint DEFAULT NULL"); +$DB->Execute("UPDATE users SET ntype = 1"); // MSG_MAIL + +$DB->Execute("UPDATE dbinfo SET keyvalue = ? WHERE keytype = ?", array('2011031000', 'dbversion')); + +$DB->CommitTrans(); + +?> Index: lms/lib/upgradedb/postgres.2011031000.php diff -u /dev/null lms/lib/upgradedb/postgres.2011031000.php:1.1 --- /dev/null Thu Mar 10 12:36:39 2011 +++ lms/lib/upgradedb/postgres.2011031000.php Thu Mar 10 12:36:39 2011 @@ -0,0 +1,34 @@ +BeginTrans(); + +$DB->Execute("ALTER TABLE users ADD phone varchar(32) DEFAULT NULL"); +$DB->Execute("ALTER TABLE users ADD ntype smallint DEFAULT NULL"); +$DB->Execute("UPDATE users SET ntype = 1"); // MSG_MAIL + +$DB->Execute("UPDATE dbinfo SET keyvalue = ? WHERE keytype = ?", array('2011031000', 'dbversion')); + +$DB->CommitTrans(); + +?> From cvs w lms.org.pl Thu Mar 10 12:36:40 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 10 Mar 2011 12:36:40 +0100 (CET) Subject: [lms-commits] CVS update of lms/userpanel/modules/helpdesk (functions.php) Message-ID: <20110310113640.41E79301E565@eftep.altec.pl> Date: Thursday, March 10, 2011 @ 12:36:40 Author: alec Path: /cvsroot/lms/userpanel/modules/helpdesk Modified: functions.php - Removed userpanel/debug_email option, use mail/debug_email instead - Added sms/debug_phone option - Added SMS notifications from helpdesk - BTS#0000843: Support SMS messages up to 459 chars using smscenter setvice Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/userpanel/modules/helpdesk/functions.php.diff?&r1=1.6&r2=1.7 Index: lms/userpanel/modules/helpdesk/functions.php diff -u lms/userpanel/modules/helpdesk/functions.php:1.6 lms/userpanel/modules/helpdesk/functions.php:1.7 --- lms/userpanel/modules/helpdesk/functions.php:1.6 Tue Jan 18 09:12:35 2011 +++ lms/userpanel/modules/helpdesk/functions.php Thu Mar 10 12:36:40 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: functions.php,v 1.6 2011/01/18 08:12:35 alec Exp $ + * $Id: functions.php,v 1.7 2011/03/10 11:36:40 alec Exp $ */ if (defined('USERPANEL_SETUPMODE')) @@ -29,27 +29,25 @@ function module_setup() { global $SMARTY, $LMS; - + $SMARTY->assign('userlist', $LMS->GetUserNames()); $SMARTY->assign('queuelist', $LMS->GetQueueNames()); $SMARTY->assign('default_queue', $LMS->CONFIG['userpanel']['default_queue']); $SMARTY->assign('default_userid', $LMS->CONFIG['userpanel']['default_userid']); - $SMARTY->assign('debug_email', $LMS->CONFIG['userpanel']['debug_email']); $SMARTY->assign('lms_url', $LMS->CONFIG['userpanel']['lms_url']); $SMARTY->display('module:helpdesk:setup.html'); } - + function module_submit_setup() { global $DB; $DB->Execute('UPDATE uiconfig SET value = ? WHERE section = \'userpanel\' AND var = \'default_queue\'',array($_POST['default_queue'])); $DB->Execute('UPDATE uiconfig SET value = ? WHERE section = \'userpanel\' AND var = \'default_userid\'',array($_POST['default_userid'])); - $DB->Execute('UPDATE uiconfig SET value = ? WHERE section = \'userpanel\' AND var = \'debug_email\'',array($_POST['debug_email'])); $DB->Execute('UPDATE uiconfig SET value = ? WHERE section = \'userpanel\' AND var = \'lms_url\'',array($_POST['lms_url'])); header('Location: ?m=userpanel&module=helpdesk'); } } - + function module_main() { global $SMARTY,$LMS,$SESSION,$CONFIG,$DB; @@ -95,19 +93,19 @@ $ticket['subject'], $ts )); - + $id = $DB->GetLastInsertID('rttickets'); - + $DB->Execute('INSERT INTO rtmessages (ticketid, customerid, createtime, subject, body, mailfrom) - VALUES (?, ?, ?, ?, ?, ?)', - array($id, - $SESSION->id, - $ts, - $ticket['subject'], - $ticket['body'], + VALUES (?, ?, ?, ?, ?, ?)', + array($id, + $SESSION->id, + $ts, + $ticket['subject'], + $ticket['body'], $ticket['mailfrom'] )); - + if(isset($CONFIG['phpui']['newticket_notify']) && chkconfig($CONFIG['phpui']['newticket_notify'])) { $user = $LMS->GetUserInfo($CONFIG['userpanel']['default_userid']); @@ -125,29 +123,62 @@ $mailfrom = $qemail; else $mailfrom = $ticket['mailfrom']; - + $headers['Date'] = date('r'); - $headers['From'] = $mailfname.' <'.$mailfrom.'>'; + $headers['From'] = $mailfname.' <'.$mailfrom.'>'; $headers['Subject'] = sprintf("[RT#%06d] %s", $id, $ticket['subject']); $headers['Reply-To'] = $headers['From']; + $sms_body = $headers['Subject']."\n".$ticket['body']; $body = $ticket['body']."\n\n".$CONFIG['userpanel']['lms_url'].'/?m=rtticketview&id='.$id; - $recipients_query = 'SELECT email FROM users, rtrights WHERE users.id=userid AND email!=\'\' AND (rtrights.rights & 8) = 8 AND queueid='.$ticket['queue']; + if (chkconfig($CONFIG['phpui']['helpdesk_customerinfo'])) { + $info = $DB->GetRow('SELECT '.$DB->Concat('UPPER(lastname)',"' '",'name').' AS customername, + email, address, zip, city, (SELECT phone FROM customercontacts + WHERE customerid = customers.id ORDER BY id LIMIT 1) AS phone + FROM customers WHERE id = ?', array($SESSION->id)); + + $body .= "\n\n-- \n"; + $body .= trans('Customer:').' '.$info['customername']."\n"; + $body .= trans('ID:').' '.sprintf('%04d', $ticket['customerid'])."\n"; + $body .= trans('Address:').' '.$info['address'].', '.$info['zip'].' '.$info['city']."\n"; + $body .= trans('Phone:').' '.$info['phone']."\n"; + $body .= trans('E-mail:').' '.$info['email']; + + $sms_body .= "\n"; + $sms_body .= trans('Customer:').' '.$info['customername']; + $sms_body .= ' '.sprintf('(%04d)', $ticket['customerid']).'. '; + $sms_body .= $info['address'].', '.$info['zip'].' '.$info['city'].'. '; + $sms_body .= $info['phone']; + } + + // send email + if ($recipients = $DB->GetCol('SELECT DISTINCT email + FROM users, rtrights + WHERE users.id = userid AND email != \'\' AND (rtrights.rights & 8) = 8 + AND (ntype & ?) = ? AND queueid = ?', + array(MSG_MAIL, MSG_MAIL, intval($ticket['queue']))) + ) { + foreach($recipients as $email) { + $headers['To'] = '<'.$email.'>'; - if($recipients = $DB->GetCol($recipients_query)) - foreach($recipients as $email) - { - if($CONFIG['userpanel']['debug_email']) - $recip = $CONFIG['userpanel']['debug_email']; - else - $recip = $email; - $headers['To'] = '<'.$recip.'>'; - - $LMS->SendMail($recip, $headers, $body); + $LMS->SendMail($email, $headers, $body); } + } + + // send sms + if (!empty($CONFIG['sms']['service']) && ($recipients = $DB->GetCol('SELECT DISTINCT phone + FROM users, rtrights + WHERE users.id = userid AND phone != \'\' AND (rtrights.rights & 8) = 8 + AND (ntype & ?) = ? AND queueid = ?', + array(MSG_SMS, MSG_SMS, intval($ticket['queue'])))) + ) { + foreach($recipients as $phone) { + $LMS->SendSMS($phone, $sms_body); + } + } } - + header('Location: ?m=helpdesk'); die; } From cvs w lms.org.pl Thu Mar 10 12:36:40 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 10 Mar 2011 12:36:40 +0100 (CET) Subject: [lms-commits] CVS update of lms/templates (useradd.html, useredit.html, userinfo.html) Message-ID: <20110310113640.212E5301E563@eftep.altec.pl> Date: Thursday, March 10, 2011 @ 12:36:40 Author: alec Path: /cvsroot/lms/templates Modified: useradd.html useredit.html userinfo.html - Removed userpanel/debug_email option, use mail/debug_email instead - Added sms/debug_phone option - Added SMS notifications from helpdesk - BTS#0000843: Support SMS messages up to 459 chars using smscenter setvice Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/templates/useradd.html.diff?&r1=1.72&r2=1.73 http://cvs.lms.org.pl/viewvc/Development/lms/templates/useredit.html.diff?&r1=1.24&r2=1.25 http://cvs.lms.org.pl/viewvc/Development/lms/templates/userinfo.html.diff?&r1=1.62&r2=1.63 Index: lms/templates/useradd.html diff -u lms/templates/useradd.html:1.72 lms/templates/useradd.html:1.73 --- lms/templates/useradd.html:1.72 Tue May 12 11:03:11 2009 +++ lms/templates/useradd.html Thu Mar 10 12:36:39 2011 @@ -1,5 +1,5 @@ {include file="header.html"} - +

{$layout.pagetitle}

@@ -9,7 +9,7 @@ {t}Login:{/t}
- +
- +
- +
- + +
+ {t}Phone:{/t} + + +
+ {t}Notification:{/t} + + {t}email{/t} + {t}sms{/t}
- +
- +
- +
+
Index: lms/templates/useredit.html diff -u lms/templates/useredit.html:1.24 lms/templates/useredit.html:1.25 --- lms/templates/useredit.html:1.24 Tue May 12 11:03:11 2009 +++ lms/templates/useredit.html Thu Mar 10 12:36:39 2011 @@ -1,5 +1,5 @@ {include file="header.html"} - +

{$layout.pagetitle}

@@ -12,57 +12,76 @@ {t}Login:{/t} - ({$userinfo.id|string_format:"%04d"}) + ({$userinfo.id|string_format:"%04d"}) - + - + {t}First/last name:{/t} - - + + - + - {t}Position:{/t} - - + {t}Position:{/t} + + - + - {t}E-mail:{/t} - - + {t}E-mail:{/t} + + - + + + + {t}Phone:{/t} + + + + + + + + + {t}Notification:{/t} + + {t}email{/t} + {t}sms{/t} + + + + - + {t}Allowed hosts:{/t} - - + + - + - + {t}Access rights:{/t} - + - - - Index: lms/templates/userinfo.html diff -u lms/templates/userinfo.html:1.62 lms/templates/userinfo.html:1.63 --- lms/templates/userinfo.html:1.62 Wed Oct 17 12:05:23 2007 +++ lms/templates/userinfo.html Thu Mar 10 12:36:39 2011 @@ -1,5 +1,5 @@ {include file="header.html"} - +

{$layout.pagetitle}

{section name=acl loop=$accesslist} @@ -81,13 +100,13 @@
+ + {t}Groups:{/t} + {include file="multiselect.html" selected=$userinfo.selected available_tip="Enabled:" selected_tip="Disabled:"}
@@ -30,13 +30,35 @@ {/if} +{if $userinfo.email} + +{/if} +{if $userinfo.phone} + + + + + +{/if} + + + + @@ -55,7 +77,7 @@ - - @@ -113,8 +130,7 @@ {t}Deadline:{/t} @@ -155,7 +171,7 @@
{t}E-mail:{/t} - {if $userinfo.email}{$userinfo.email}{else}-{/if} + {$userinfo.email} +
+ + {t}Phone:{/t} + {$userinfo.phone} +
+ + {t}Notification:{/t} + {if !$userinfo.ntype}{t}none{/t}{else}{$userinfo.ntype}{/if}
{t}Access rights:{/t} + {section name=acl loop=$accesslist}
  • {$accesslist[acl]}
  • {/section} @@ -66,7 +88,7 @@
    {t}Excluded groups:{/t} + {foreach from=$excludedgroups item=item}
  • {$item.name}
  • {foreachelse} From cvs w lms.org.pl Thu Mar 10 12:36:40 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 10 Mar 2011 12:36:40 +0100 (CET) Subject: [lms-commits] CVS update of lms/userpanel/modules/helpdesk/locale/pl (strings.php) Message-ID: <20110310113640.60F0F301E567@eftep.altec.pl> Date: Thursday, March 10, 2011 @ 12:36:40 Author: alec Path: /cvsroot/lms/userpanel/modules/helpdesk/locale/pl Modified: strings.php - Removed userpanel/debug_email option, use mail/debug_email instead - Added sms/debug_phone option - Added SMS notifications from helpdesk - BTS#0000843: Support SMS messages up to 459 chars using smscenter setvice Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/userpanel/modules/helpdesk/locale/pl/strings.php.diff?&r1=1.5&r2=1.6 Index: lms/userpanel/modules/helpdesk/locale/pl/strings.php diff -u lms/userpanel/modules/helpdesk/locale/pl/strings.php:1.5 lms/userpanel/modules/helpdesk/locale/pl/strings.php:1.6 --- lms/userpanel/modules/helpdesk/locale/pl/strings.php:1.5 Tue Jan 18 09:12:35 2011 +++ lms/userpanel/modules/helpdesk/locale/pl/strings.php Thu Mar 10 12:36:40 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: strings.php,v 1.5 2011/01/18 08:12:35 alec Exp $ + * $Id: strings.php,v 1.6 2011/03/10 11:36:40 alec Exp $ */ $_LANG['Allows you to contact with network administrator'] = 'Pozwala Ci skontaktować się z administratorem'; @@ -30,8 +30,6 @@ $_LANG['Click icon on the left to see request details'] = 'Kliknij ikonę po lewej stronie aby zobaczyć szczegóły zgłoszenia'; $_LANG['Date:'] = 'Data:'; $_LANG['dead'] = 'martwy'; -$_LANG['Debug email:'] = 'Testowy e-mail:'; -$_LANG['Debug email for new tickets notifications.'] = 'Testowy adres e-mail, pod który będą wysyłane powiadomienia o nowych zgłoszeniach.'; $_LANG['Default queue:'] = 'Domyślna kolejka:'; $_LANG['Default user:'] = 'Domyślny użytkownik:'; $_LANG['Details'] = 'Szczegóły'; From cvs w lms.org.pl Thu Mar 10 12:36:39 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 10 Mar 2011 12:36:39 +0100 (CET) Subject: [lms-commits] CVS update of lms/modules (13 files) Message-ID: <20110310113639.D496530CB565@eftep.altec.pl> Date: Thursday, March 10, 2011 @ 12:36:39 Author: alec Path: /cvsroot/lms/modules Modified: customer.inc.php customerinfo.php messageadd.php rtmessageadd.php rtnoteadd.php rtticketadd.php rtticketedit.php useradd.php useredit.php userinfo.php voipaccountadd.php voipaccountedit.php voipaccountinfo.php - Removed userpanel/debug_email option, use mail/debug_email instead - Added sms/debug_phone option - Added SMS notifications from helpdesk - BTS#0000843: Support SMS messages up to 459 chars using smscenter setvice Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/modules/customer.inc.php.diff?&r1=1.8&r2=1.9 http://cvs.lms.org.pl/viewvc/Development/lms/modules/customerinfo.php.diff?&r1=1.24&r2=1.25 http://cvs.lms.org.pl/viewvc/Development/lms/modules/messageadd.php.diff?&r1=1.15&r2=1.16 http://cvs.lms.org.pl/viewvc/Development/lms/modules/rtmessageadd.php.diff?&r1=1.71&r2=1.72 http://cvs.lms.org.pl/viewvc/Development/lms/modules/rtnoteadd.php.diff?&r1=1.16&r2=1.17 http://cvs.lms.org.pl/viewvc/Development/lms/modules/rtticketadd.php.diff?&r1=1.55&r2=1.56 http://cvs.lms.org.pl/viewvc/Development/lms/modules/rtticketedit.php.diff?&r1=1.42&r2=1.43 http://cvs.lms.org.pl/viewvc/Development/lms/modules/useradd.php.diff?&r1=1.80&r2=1.81 http://cvs.lms.org.pl/viewvc/Development/lms/modules/useredit.php.diff?&r1=1.100&r2=1.101 http://cvs.lms.org.pl/viewvc/Development/lms/modules/userinfo.php.diff?&r1=1.57&r2=1.58 http://cvs.lms.org.pl/viewvc/Development/lms/modules/voipaccountadd.php.diff?&r1=1.6&r2=1.7 http://cvs.lms.org.pl/viewvc/Development/lms/modules/voipaccountedit.php.diff?&r1=1.6&r2=1.7 http://cvs.lms.org.pl/viewvc/Development/lms/modules/voipaccountinfo.php.diff?&r1=1.7&r2=1.8 Index: lms/modules/customer.inc.php diff -u lms/modules/customer.inc.php:1.8 lms/modules/customer.inc.php:1.9 --- lms/modules/customer.inc.php:1.8 Tue Jan 18 09:12:21 2011 +++ lms/modules/customer.inc.php Thu Mar 10 12:36:39 2011 @@ -21,13 +21,20 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: customer.inc.php,v 1.8 2011/01/18 08:12:21 alec Exp $ + * $Id: customer.inc.php,v 1.9 2011/03/10 11:36:39 alec Exp $ */ if($layout['module'] != 'customeredit') { $customerinfo = $LMS->GetCustomer($customerid); + + if(!$customerinfo || $customerinfo['deleted']) + { + $SESSION->redirect('?m=customerlist'); + } + $SMARTY->assign_by_ref('customerinfo', $customerinfo); + } $expired = !empty($_GET['expired']) ? true : false; Index: lms/modules/customerinfo.php diff -u lms/modules/customerinfo.php:1.24 lms/modules/customerinfo.php:1.25 --- lms/modules/customerinfo.php:1.24 Tue Jan 18 09:12:21 2011 +++ lms/modules/customerinfo.php Thu Mar 10 12:36:39 2011 @@ -21,20 +21,10 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: customerinfo.php,v 1.24 2011/01/18 08:12:21 alec Exp $ + * $Id: customerinfo.php,v 1.25 2011/03/10 11:36:39 alec Exp $ */ -if(!preg_match('/^[0-9]+$/', $_GET['id'])) -{ - $SESSION->redirect('?m=customerlist'); -} - -if($LMS->CustomerExists($_GET['id']) == 0) -{ - $SESSION->redirect('?m=customerlist'); -} - -$customerid = $_GET['id']; +$customerid = intval($_GET['id']); include(MODULES_DIR.'/customer.inc.php'); Index: lms/modules/messageadd.php diff -u lms/modules/messageadd.php:1.15 lms/modules/messageadd.php:1.16 --- lms/modules/messageadd.php:1.15 Tue Jan 18 09:12:23 2011 +++ lms/modules/messageadd.php Thu Mar 10 12:36:39 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: messageadd.php,v 1.15 2011/01/18 08:12:23 alec Exp $ + * $Id: messageadd.php,v 1.16 2011/03/10 11:36:39 alec Exp $ */ function GetRecipients($filter, $type=MSG_MAIL) @@ -196,13 +196,13 @@ else // upload errors switch($_FILES['file']['error']) { - case 1: + case 1: case 2: $error['file'] = trans('File is too large.'); break; case 3: $error['file'] = trans('File upload has finished prematurely.'); break; case 4: $error['file'] = trans('Path to file was not specified.'); break; default: $error['file'] = trans('Problem during file upload.'); break; } - } + } if(!$error) { @@ -240,20 +240,12 @@ )); $msgid = $DB->GetLastInsertID('messages'); - $prefix = !empty($CONFIG['sms']['prefix']) ? $CONFIG['sms']['prefix'] : ''; foreach($recipients as $key => $row) { if($message['type'] == MSG_MAIL) - $recipients[$key]['destination'] = !empty($CONFIG['mail']['debug_email']) ? $CONFIG['mail']['debug_email'] : $row['email']; + $recipients[$key]['destination'] = $row['email']; else { - $number = !empty($CONFIG['mail']['debug_sms']) ? $CONFIG['mail']['debug_sms'] : $row['phone']; - - $number = preg_replace('/[^0-9]/', '', $number); - $number = preg_replace('/^0+/', '', $number); - if ($prefix && substr($number, 0, strlen($prefix)) != $prefix) - $number = $prefix . $number; - $recipients[$key]['destination'] = $number; } @@ -281,16 +273,20 @@ if(!empty($CONFIG['mail']['debug_email'])) echo ''.trans('Warning! Debug mode (using address $0).',$CONFIG['mail']['debug_email']).'
    '; - + $headers['From'] = '"'.$message['from'].'" <'.$message['sender'].'>'; $headers['Subject'] = $message['subject']; $headers['Reply-To'] = $headers['From']; } - + else { + if (!empty($CONFIG['sms']['debug_phone'])) + echo ''.trans('Warning! Debug mode (using phone $0).',$CONFIG['sms']['debug_phone']).'
    '; + } + foreach($recipients as $key => $row) { $body = $message['body']; - + BodyVars($body, $row); if($message['type'] == MSG_MAIL) Index: lms/modules/rtmessageadd.php diff -u lms/modules/rtmessageadd.php:1.71 lms/modules/rtmessageadd.php:1.72 --- lms/modules/rtmessageadd.php:1.71 Wed Mar 9 14:00:03 2011 +++ lms/modules/rtmessageadd.php Thu Mar 10 12:36:39 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: rtmessageadd.php,v 1.71 2011/03/09 13:00:03 alec Exp $ + * $Id: rtmessageadd.php,v 1.72 2011/03/10 11:36:39 alec Exp $ */ function MessageAdd($msg, $headers, $file=NULL) @@ -143,9 +143,6 @@ && ($user['email'] || $queue['email']) && $message['destination'] != $queue['email']) { - if(!empty($CONFIG['mail']['debug_email'])) - $message['destination'] = $CONFIG['mail']['debug_email']; - $recipients = $message['destination']; $message['mailfrom'] = $user['email'] ? $user['email'] : $queue['email']; @@ -171,7 +168,7 @@ $LMS->SendMail($recipients, $headers, $body, $files); } - else + else { $message['messageid'] = ''; if($message['customerid'] || $message['userid']) @@ -186,8 +183,6 @@ { ($message['destination']!='' ? $addmsg = 1 : $addmsg = 0); - if(!empty($CONFIG['mail']['debug_email'])) - $message['destination'] = $CONFIG['mail']['debug_email']; if($message['destination']=='') $message['destination'] = $queue['email']; $recipients = $message['destination']; @@ -228,6 +223,18 @@ MessageAdd($message, $headers, $_FILES['file']); } + // setting status and the ticket owner + if (isset($message['state'])) + $LMS->SetTicketState($message['ticketid'], RT_RESOLVED); + else if (!$DB->GetOne('SELECT state FROM rttickets WHERE id = ?', array($message['ticketid']))) + $LMS->SetTicketState($message['ticketid'], RT_OPEN); + + $DB->Execute('UPDATE rttickets SET cause = ? WHERE id = ?', array($message['cause'], $message['ticketid'])); + + if(!$DB->GetOne('SELECT owner FROM rttickets WHERE id = ?', array($message['ticketid']))) + $DB->Execute('UPDATE rttickets SET owner = ? WHERE id = ?', array($AUTH->id, $message['ticketid'])); + + // Users notification if(isset($message['notify']) && ($user['email'] || $queue['email'])) { $mailfname = ''; @@ -245,18 +252,19 @@ } $mailfrom = $user['email'] ? $user['email'] : $queue['email']; - - $headers['From'] = $mailfname.' <'.$mailfrom.'>'; + + $headers['From'] = $mailfname.' <'.$mailfrom.'>'; $headers['Subject'] = sprintf("[RT#%06d] %s", $message['ticketid'], $DB->GetOne('SELECT subject FROM rttickets WHERE id = ?', array($message['ticketid']))); $headers['Reply-To'] = $headers['From']; + $sms_body = $headers['Subject']."\n".$message['body']; $body = $message['body']."\n\nhttp" .(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '').'://' .$_SERVER['HTTP_HOST'] .substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], '/') + 1) .'?m=rtticketview&id='.$message['ticketid']; - if(chkconfig($CONFIG['phpui']['helpdesk_customerinfo']) + if(chkconfig($CONFIG['phpui']['helpdesk_customerinfo']) && ($cid = $DB->GetOne('SELECT customerid FROM rttickets WHERE id = ?', array($message['ticketid'])))) { $info = $DB->GetRow('SELECT '.$DB->Concat('UPPER(lastname)',"' '",'name').' AS customername, @@ -270,37 +278,42 @@ $body .= trans('Address:').' '.$info['address'].', '.$info['zip'].' '.$info['city']."\n"; $body .= trans('Phone:').' '.$info['phone']."\n"; $body .= trans('E-mail:').' '.$info['email']; + + $sms_body .= "\n"; + $sms_body .= trans('Customer:').' '.$info['customername']; + $sms_body .= ' '.sprintf('(%04d)', $ticket['customerid']).'. '; + $sms_body .= $info['address'].', '.$info['zip'].' '.$info['city'].'. '; + $sms_body .= $info['phone']; } + // send email if($recipients = $DB->GetCol('SELECT DISTINCT email FROM users, rtrights WHERE users.id=userid AND queueid = ? AND email != \'\' - AND (rtrights.rights & 8) = 8 AND users.id != ? AND deleted = 0', - array($queue['id'], $AUTH->id))) - { - foreach($recipients as $email) - { - if(!empty($CONFIG['mail']['debug_email'])) - $recip = $CONFIG['mail']['debug_email']; - else - $recip = $email; - $headers['To'] = '<'.$recip.'>'; + AND (rtrights.rights & 8) = 8 AND users.id != ? + AND deleted = 0 AND (ntype & ?) = ?', + array($queue['id'], $AUTH->id, MSG_MAIL, MSG_MAIL)) + ) { + foreach($recipients as $email) { + $headers['To'] = '<'.$email.'>'; - $LMS->SendMail($recip, $headers, $body); + $LMS->SendMail($email, $headers, $body); } } - } - - // setting status and ticket owner - if(isset($message['state'])) - $LMS->SetTicketState($message['ticketid'], RT_RESOLVED); - elseif(!$DB->GetOne('SELECT state FROM rttickets WHERE id = ?', array($message['ticketid']))) - $LMS->SetTicketState($message['ticketid'], RT_OPEN); - - $DB->Execute('UPDATE rttickets SET cause = ? WHERE id = ?', array($message['cause'], $message['ticketid'])); - if(!$DB->GetOne('SELECT owner FROM rttickets WHERE id = ?', array($message['ticketid']))) - $DB->Execute('UPDATE rttickets SET owner = ? WHERE id = ?', array($AUTH->id, $message['ticketid'])); + // send sms + if(!empty($CONFIG['sms']['service']) && ($recipients = $DB->GetCol('SELECT DISTINCT phone + FROM users, rtrights + WHERE users.id=userid AND queueid = ? AND phone != \'\' + AND (rtrights.rights & 8) = 8 AND users.id != ? + AND deleted = 0 AND (ntype & ?) = ?', + array($queue['id'], $AUTH->id, MSG_SMS, MSG_SMS))) + ) { + foreach($recipients as $phone) { + $LMS->SendSMS($phone, $sms_body); + } + } + } $SESSION->redirect('?m=rtticketview&id='.$message['ticketid']); } Index: lms/modules/rtnoteadd.php diff -u lms/modules/rtnoteadd.php:1.16 lms/modules/rtnoteadd.php:1.17 --- lms/modules/rtnoteadd.php:1.16 Wed Mar 9 14:00:03 2011 +++ lms/modules/rtnoteadd.php Thu Mar 10 12:36:39 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: rtnoteadd.php,v 1.16 2011/03/09 13:00:03 alec Exp $ + * $Id: rtnoteadd.php,v 1.17 2011/03/10 11:36:39 alec Exp $ */ if(isset($_GET['ticketid'])) @@ -34,13 +34,13 @@ $SESSION->close(); die; } - + $note = $DB->GetRow('SELECT id AS ticketid, state, cause FROM rttickets WHERE id = ?', array($note['ticketid'])); } elseif(isset($_POST['note'])) { $note = $_POST['note']; - + if($note['body'] == '') $error['body'] = trans('Note body not specified!'); @@ -58,13 +58,13 @@ $LMS->SetTicketState($note['ticketid'], $note['state']); $DB->Execute('UPDATE rttickets SET cause = ? WHERE id = ?', array($note['cause'], $note['ticketid'])); - + if(isset($note['notify'])) { $user = $LMS->GetUserInfo($AUTH->id); $queue = $LMS->GetQueueByTicketId($note['ticketid']); $mailfname = ''; - + if(!empty($CONFIG['phpui']['helpdesk_sender_name'])) { $mailfname = $CONFIG['phpui']['helpdesk_sender_name']; @@ -73,16 +73,17 @@ $mailfname = $queue['name']; elseif($mailfname == 'user') $mailfname = $user['name']; - + $mailfname = '"'.$mailfname.'"'; } $mailfrom = $user['email'] ? $user['email'] : $queue['email']; - - $headers['From'] = $mailfname.' <'.$mailfrom.'>'; + + $headers['From'] = $mailfname.' <'.$mailfrom.'>'; $headers['Subject'] = sprintf("[RT#%06d] %s", $note['ticketid'], $DB->GetOne('SELECT subject FROM rttickets WHERE id = ?', array($note['ticketid']))); $headers['Reply-To'] = $headers['From']; + $sms_body = $headers['Subject']."\n".$note['body']; $body = $note['body']."\n\nhttp" .(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '').'://' .$_SERVER['HTTP_HOST'] @@ -91,7 +92,7 @@ if(chkconfig($CONFIG['phpui']['helpdesk_customerinfo']) && ($cid = $DB->GetOne('SELECT customerid FROM rttickets WHERE id = ?', array($note['ticketid'])))) - { + { $info = $DB->GetRow('SELECT id, '.$DB->Concat('UPPER(lastname)',"' '",'name').' AS customername, email, address, zip, city, (SELECT phone FROM customercontacts WHERE customerid = customers.id ORDER BY id LIMIT 1) AS phone @@ -102,23 +103,39 @@ $body .= trans('Address:').' '.$info['address'].', '.$info['zip'].' '.$info['city']."\n"; $body .= trans('Phone:').' '.$info['phone']."\n"; $body .= trans('E-mail:').' '.$info['email']; + + $sms_body .= "\n"; + $sms_body .= trans('Customer:').' '.$info['customername']; + $sms_body .= ' '.sprintf('(%04d)', $ticket['customerid']).'. '; + $sms_body .= $info['address'].', '.$info['zip'].' '.$info['city'].'. '; + $sms_body .= $info['phone']; } + // send email if($recipients = $DB->GetCol('SELECT DISTINCT email FROM users, rtrights WHERE users.id=userid AND queueid = ? AND email != \'\' - AND (rtrights.rights & 8) = 8 AND users.id != ? AND deleted = 0', - array($queue['id'], $AUTH->id))) - { - foreach($recipients as $email) - { - if(!empty($CONFIG['mail']['debug_email'])) - $recip = $CONFIG['mail']['debug_email']; - else - $recip = $email; - $headers['To'] = '<'.$recip.'>'; + AND (rtrights.rights & 8) = 8 AND users.id != ? + AND deleted = 0 AND (ntype & ?) = ?', + array($queue['id'], $AUTH->id, MSG_MAIL, MSG_MAIL)) + ) { + foreach ($recipients as $email) { + $headers['To'] = '<'.$email.'>'; + + $LMS->SendMail($email, $headers, $body); + } + } - $LMS->SendMail($recip, $headers, $body); + // send sms + if (!empty($CONFIG['sms']['service']) && ($recipients = $DB->GetCol('SELECT DISTINCT phone + FROM users, rtrights + WHERE users.id=userid AND queueid = ? AND phone != \'\' + AND (rtrights.rights & 8) = 8 AND users.id != ? + AND deleted = 0 AND (ntype & ?) = ?', + array($queue['id'], $AUTH->id, MSG_SMS, MSG_SMS))) + ) { + foreach ($recipients as $phone) { + $LMS->SendSMS($phone, $sms_body); } } } Index: lms/modules/rtticketadd.php diff -u lms/modules/rtticketadd.php:1.55 lms/modules/rtticketadd.php:1.56 --- lms/modules/rtticketadd.php:1.55 Wed Mar 9 14:00:03 2011 +++ lms/modules/rtticketadd.php Thu Mar 10 12:36:39 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: rtticketadd.php,v 1.55 2011/03/09 13:00:03 alec Exp $ + * $Id: rtticketadd.php,v 1.56 2011/03/10 11:36:39 alec Exp $ */ $queue = isset($_GET['id']) ? intval($_GET['id']) : 0; @@ -89,11 +89,12 @@ $mailfrom = $qemail; else $mailfrom = $ticket['mailfrom']; - + $headers['From'] = $mailfname.' <'.$mailfrom.'>'; $headers['Subject'] = sprintf("[RT#%06d] %s", $id, $ticket['subject']); $headers['Reply-To'] = $headers['From']; + $sms_body = $headers['Subject']."\n".$ticket['body']; $body = $ticket['body']."\n\nhttp" .(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '').'://' .$_SERVER['HTTP_HOST'] @@ -113,23 +114,39 @@ $body .= trans('Address:').' '.$info['address'].', '.$info['zip'].' '.$info['city']."\n"; $body .= trans('Phone:').' '.$info['phone']."\n"; $body .= trans('E-mail:').' '.$info['email']; + + $sms_body .= "\n"; + $sms_body .= trans('Customer:').' '.$info['customername']; + $sms_body .= ' '.sprintf('(%04d)', $ticket['customerid']).'. '; + $sms_body .= $info['address'].', '.$info['zip'].' '.$info['city'].'. '; + $sms_body .= $info['phone']; } + // send email if($recipients = $DB->GetCol('SELECT DISTINCT email FROM users, rtrights WHERE users.id = userid AND queueid = ? AND email != \'\' - AND (rtrights.rights & 8) = 8 AND deleted = 0', - array($queue))) - { - foreach($recipients as $email) - { - if(!empty($CONFIG['mail']['debug_email'])) - $recip = $CONFIG['mail']['debug_email']; - else - $recip = $email; - $headers['To'] = '<'.$recip.'>'; + AND (rtrights.rights & 8) = 8 AND deleted = 0 + AND (ntype & ?) = ?', + array($queue, MSG_MAIL, MSG_MAIL)) + ) { + foreach($recipients as $email) { + $headers['To'] = '<'.$email.'>'; - $LMS->SendMail($recip, $headers, $body); + $LMS->SendMail($email, $headers, $body); + } + } + + // send sms + if (!empty($CONFIG['sms']['service']) && ($recipients = $DB->GetCol('SELECT DISTINCT phone + FROM users, rtrights + WHERE users.id = userid AND queueid = ? AND phone != \'\' + AND (rtrights.rights & 8) = 8 AND deleted = 0 + AND (ntype & ?) = ?', + array($queue, MSG_SMS, MSG_SMS))) + ) { + foreach ($recipients as $phone) { + $LMS->SendSMS($phone, $sms_body); } } } Index: lms/modules/rtticketedit.php diff -u lms/modules/rtticketedit.php:1.42 lms/modules/rtticketedit.php:1.43 --- lms/modules/rtticketedit.php:1.42 Wed Mar 9 14:00:03 2011 +++ lms/modules/rtticketedit.php Thu Mar 10 12:36:39 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: rtticketedit.php,v 1.42 2011/03/09 13:00:03 alec Exp $ + * $Id: rtticketedit.php,v 1.43 2011/03/10 11:36:39 alec Exp $ */ if(($id = $_GET['id']) && !isset($_POST['ticket'])) @@ -123,7 +123,7 @@ { $mailfname = $user['name']; } - + $mailfname = '"'.$mailfname.'"'; } @@ -135,6 +135,7 @@ $body = $ticket['messages'][0]['body']; + $sms_body = $headers['Subject']."\n".$body; $body .= "\n\nhttp".(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '').'://' .$_SERVER['HTTP_HOST'].substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], '/') + 1) .'?m=rtticketview&id='.$ticket['ticketid']; @@ -151,30 +152,56 @@ $body .= trans('Address:').' '.$info['address'].', '.$info['zip'].' '.$info['city']."\n"; $body .= trans('Phone:').' '.$info['phone']."\n"; $body .= trans('E-mail:').' '.$info['email']; + + $sms_body .= "\n"; + $sms_body .= trans('Customer:').' '.$info['customername']; + $sms_body .= ' '.sprintf('(%04d)', $ticket['customerid']).'. '; + $sms_body .= $info['address'].', '.$info['zip'].' '.$info['city'].'. '; + $sms_body .= $info['phone']; } + // send email if($recipients = $DB->GetCol('SELECT DISTINCT email FROM users, rtrights WHERE users.id=userid AND queueid = ? AND email != \'\' - AND (rtrights.rights & 8) = 8 AND users.id != ? AND deleted = 0', - array($ticketedit['queueid'], $AUTH->id))) - { + AND (rtrights.rights & 8) = 8 AND users.id != ? + AND deleted = 0 AND (ntype & ?) = ?', + array($ticketedit['queueid'], $AUTH->id, MSG_MAIL, MSG_MAIL)) + ) { $oldrecipients = $DB->GetCol('SELECT DISTINCT email FROM users, rtrights WHERE users.id=userid AND queueid = ? AND email != \'\' - AND (rtrights.rights & 8) = 8 AND deleted = 0', - array($ticket['queueid'])); + AND (rtrights.rights & 8) = 8 AND deleted = 0 + AND (ntype & ?) = ?', + array($ticket['queueid'], MSG_MAIL, MSG_MAIL)); - foreach($recipients as $email) - { + foreach($recipients as $email) { if(in_array($email, (array)$oldrecipients)) continue; - if(!empty($CONFIG['mail']['debug_email'])) - $recip = $CONFIG['mail']['debug_email']; - else - $recip = $email; - $headers['To'] = '<'.$recip.'>'; - $LMS->SendMail($recip, $headers, $body); + $headers['To'] = '<'.$email.'>'; + $LMS->SendMail($email, $headers, $body); + } + } + + // send sms + if (!empty($CONFIG['sms']['service']) && ($recipients = $DB->GetCol('SELECT DISTINCT phone + FROM users, rtrights + WHERE users.id = userid AND queueid = ? AND phone != \'\' + AND (rtrights.rights & 8) = 8 AND users.id != ? + AND deleted = 0 AND (ntype & ?) = ?', + array($ticketedit['queueid'], $AUTH->id, MSG_SMS, MSG_SMS))) + ) { + $oldrecipients = $DB->GetCol('SELECT DISTINCT phone + FROM users, rtrights + WHERE users.id=userid AND queueid = ? AND phone != \'\' + AND (rtrights.rights & 8) = 8 AND deleted = 0 + AND (ntype & ?) = ?', + array($ticket['queueid'], MSG_SMS, MSG_SMS)); + + foreach ($recipients as $phone) { + if (in_array($phone, (array)$oldrecipients)) continue; + + $LMS->SendSMS($phone, $sms_body); } } } Index: lms/modules/useradd.php diff -u lms/modules/useradd.php:1.80 lms/modules/useradd.php:1.81 --- lms/modules/useradd.php:1.80 Tue Jan 18 09:12:26 2011 +++ lms/modules/useradd.php Thu Mar 10 12:36:39 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: useradd.php,v 1.80 2011/01/18 08:12:26 alec Exp $ + * $Id: useradd.php,v 1.81 2011/03/10 11:36:39 alec Exp $ */ $acl = isset($_POST['acl']) ? $_POST['acl'] : array(); @@ -29,23 +29,22 @@ if(sizeof($useradd)) { - - foreach($useradd as $key => $value) - $useradd[$key] = trim($value); - + if (!is_array($value)) + $useradd[$key] = trim($value); + if($useradd['login']=='' && $useradd['name']=='' && $useradd['password']=='' && $useradd['confirm']=='') { $SESSION->redirect('?m=useradd'); } - + if($useradd['login']=='') $error['login'] = trans('Login can\'t be empty!'); elseif(!preg_match('/^[a-z0-9.-_]+$/i', $useradd['login'])) $error['login'] = trans('Login contains forbidden characters!'); elseif($LMS->GetUserIDByLogin($useradd['login'])) $error['login'] = trans('User with specified login exists or that login was used in the past!'); - + if($useradd['email']!='' && !check_email($useradd['email'])) $error['email'] = trans('E-mail isn\'t correct!'); @@ -57,11 +56,10 @@ elseif($useradd['password']!=$useradd['confirm']) $error['password'] = trans('Passwords does not match!'); - // zróbmy maskę ACL... - + // ACL mask... $mask = ''; $outmask = ''; - + for($i=0;$i<256;$i++) $mask .= '0'; @@ -75,15 +73,19 @@ $useradd['rights'] = preg_replace('/^[0]*(.*)$/','\1',$outmask); + if (!empty($useradd['ntype'])) { + $useradd['ntype'] = array_sum(array_map('intval', $useradd['ntype'])); + } + if(!$error) { $id = $LMS->UserAdd($useradd); - + if(isset($_POST['selected'])) foreach($_POST['selected'] as $idx => $name) $DB->Execute('INSERT INTO excludedgroups (customergroupid, userid) VALUES(?, ?)', array($idx, $id)); - + $SESSION->redirect('?m=userinfo&id='.$id); } elseif(isset($_POST['selected'])) @@ -93,6 +95,9 @@ $useradd['selected'][$idx]['name'] = $name; } } +else { + $useradd['ntype'] = MSG_MAIL | MSG_SMS; +} foreach($access['table'] as $idx => $row) { Index: lms/modules/useredit.php diff -u lms/modules/useredit.php:1.100 lms/modules/useredit.php:1.101 --- lms/modules/useredit.php:1.100 Tue Jan 18 09:12:26 2011 +++ lms/modules/useredit.php Thu Mar 10 12:36:39 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: useredit.php,v 1.100 2011/01/18 08:12:26 alec Exp $ + * $Id: useredit.php,v 1.101 2011/03/10 11:36:39 alec Exp $ */ if(!$LMS->UserExists($_GET['id'])) @@ -35,9 +35,10 @@ { $acl = $_POST['acl']; $userinfo['id'] = $_GET['id']; - + foreach($userinfo as $key => $value) - $userinfo[$key] = trim($value); + if (!is_array($value)) + $userinfo[$key] = trim($value); if($userinfo['login'] == '') $error['login'] = trans('Login can\'t be empty!'); @@ -51,12 +52,11 @@ if($userinfo['email']!='' && !check_email($userinfo['email'])) $error['email'] = trans('E-mail isn\'t correct!'); - - // let's make an ACL mask... + // let's make an ACL mask... $mask = ''; $outmask = ''; - + for($i=0;$i<256;$i++) $mask .= '0'; @@ -69,11 +69,15 @@ $userinfo['rights'] = preg_replace('/^[0]*(.*)$/','\1',$outmask); + if (!empty($userinfo['ntype'])) { + $userinfo['ntype'] = array_sum(array_map('intval', $userinfo['ntype'])); + } + if(!$error) { $LMS->UserUpdate($userinfo); - - $DB->Execute('DELETE FROM excludedgroups WHERE userid = ?', array($userinfo['id'])); + + $DB->Execute('DELETE FROM excludedgroups WHERE userid = ?', array($userinfo['id'])); if(isset($_POST['selected'])) foreach($_POST['selected'] as $idx => $name) $DB->Execute('INSERT INTO excludedgroups (customergroupid, userid) @@ -98,7 +102,7 @@ $row['id'] = $idx; if(isset($acl[$idx])) $row['enabled'] = TRUE; - + $accesslist[] = $row; } } @@ -106,7 +110,7 @@ else { $rights = $LMS->GetUserRights($_GET['id']); - + foreach($access['table'] as $idx => $row) { $row['id'] = $idx; Index: lms/modules/userinfo.php diff -u lms/modules/userinfo.php:1.57 lms/modules/userinfo.php:1.58 --- lms/modules/userinfo.php:1.57 Tue Jan 18 09:12:26 2011 +++ lms/modules/userinfo.php Thu Mar 10 12:36:39 2011 @@ -21,22 +21,30 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: userinfo.php,v 1.57 2011/01/18 08:12:26 alec Exp $ + * $Id: userinfo.php,v 1.58 2011/03/10 11:36:39 alec Exp $ */ -if(!$LMS->UserExists($_GET['id'])) +$userinfo = $LMS->GetUserInfo($_GET['id']); + +if (!$userinfo || $userinfo['deleted']) { $SESSION->redirect('?m=userlist'); } -$userinfo = $LMS->GetUserInfo($_GET['id']); -$layout['pagetitle'] = trans('User Info: $0', $userinfo['login']); - $rights = $LMS->GetUserRights($_GET['id']); foreach($rights as $right) if($access['table'][$right]['name']) $accesslist[] = $access['table'][$right]['name']; +$ntype = array(); +if ($userinfo['ntype'] & MSG_MAIL) + $ntype[] = trans('email'); +if ($userinfo['ntype'] & MSG_SMS) + $ntype[] = trans('sms'); +$userinfo['ntype'] = implode(', ', $ntype); + +$layout['pagetitle'] = trans('User Info: $0', $userinfo['login']); + $SESSION->save('backto', $_SERVER['QUERY_STRING']); $SMARTY->assign('userinfo', $userinfo); Index: lms/modules/voipaccountadd.php diff -u lms/modules/voipaccountadd.php:1.6 lms/modules/voipaccountadd.php:1.7 --- lms/modules/voipaccountadd.php:1.6 Tue Jan 18 09:12:26 2011 +++ lms/modules/voipaccountadd.php Thu Mar 10 12:36:39 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: voipaccountadd.php,v 1.6 2011/01/18 08:12:26 alec Exp $ + * $Id: voipaccountadd.php,v 1.7 2011/03/10 11:36:39 alec Exp $ */ $voipaccountdata['ownerid'] = 0; @@ -116,7 +116,7 @@ { include(MODULES_DIR.'/customer.inc.php'); } - + $SMARTY->assign('customers', $customers); $SMARTY->assign('error', $error); $SMARTY->assign('voipaccountdata', $voipaccountdata); Index: lms/modules/voipaccountedit.php diff -u lms/modules/voipaccountedit.php:1.6 lms/modules/voipaccountedit.php:1.7 --- lms/modules/voipaccountedit.php:1.6 Tue Jan 18 09:12:26 2011 +++ lms/modules/voipaccountedit.php Thu Mar 10 12:36:39 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: voipaccountedit.php,v 1.6 2011/01/18 08:12:26 alec Exp $ + * $Id: voipaccountedit.php,v 1.7 2011/03/10 11:36:39 alec Exp $ */ if(!$LMS->VoipAccountExists($_GET['id'])) @@ -31,14 +31,14 @@ header('Location: ?m=voipaccountlist'); $voipaccountid = intval($_GET['id']); -$customerid = $LMS->GetVoipAccountOwner($voipaccountid); $voipaccountinfo = $LMS->GetVoipAccount($voipaccountid); +$customerid = $voipaccountinfo['ownerid']; if(!isset($_GET['ownerid'])) $SESSION->save('backto', $SESSION->get('backto') . '&ownerid='.$customerid); else $SESSION->save('backto', $_SERVER['QUERY_STRING']); - + $layout['pagetitle'] = trans('Voip Account Edit: $0', $voipaccountinfo['login']); if(isset($_POST['voipaccountedit'])) Index: lms/modules/voipaccountinfo.php diff -u lms/modules/voipaccountinfo.php:1.7 lms/modules/voipaccountinfo.php:1.8 --- lms/modules/voipaccountinfo.php:1.7 Tue Jan 18 09:12:26 2011 +++ lms/modules/voipaccountinfo.php Thu Mar 10 12:36:39 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: voipaccountinfo.php,v 1.7 2011/01/18 08:12:26 alec Exp $ + * $Id: voipaccountinfo.php,v 1.8 2011/03/10 11:36:39 alec Exp $ */ if(!preg_match('/^[0-9]+$/', $_GET['id'])) @@ -40,8 +40,8 @@ } $voipaccountid = $_GET['id']; -$customerid = $LMS->GetVoipAccountOwner($voipaccountid); $voipaccountinfo = $LMS->GetVoipAccount($voipaccountid); +$customerid = $voipaccountinfo['ownerid']; include(MODULES_DIR.'/customer.inc.php'); From cvs w lms.org.pl Thu Mar 10 12:36:39 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 10 Mar 2011 12:36:39 +0100 (CET) Subject: [lms-commits] CVS update of lms/lib (3 files) Message-ID: <20110310113639.13D7A302B614@eftep.altec.pl> Date: Thursday, March 10, 2011 @ 12:36:39 Author: alec Path: /cvsroot/lms/lib Modified: LMS.class.php LMSDB_common.class.php upgradedb.php - Removed userpanel/debug_email option, use mail/debug_email instead - Added sms/debug_phone option - Added SMS notifications from helpdesk - BTS#0000843: Support SMS messages up to 459 chars using smscenter setvice Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/lib/LMS.class.php.diff?&r1=1.1056&r2=1.1057 http://cvs.lms.org.pl/viewvc/Development/lms/lib/LMSDB_common.class.php.diff?&r1=1.56&r2=1.57 http://cvs.lms.org.pl/viewvc/Development/lms/lib/upgradedb.php.diff?&r1=1.188&r2=1.189 Index: lms/lib/LMS.class.php diff -u lms/lib/LMS.class.php:1.1056 lms/lib/LMS.class.php:1.1057 --- lms/lib/LMS.class.php:1.1056 Wed Mar 9 13:55:16 2011 +++ lms/lib/LMS.class.php Thu Mar 10 12:36:38 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: LMS.class.php,v 1.1056 2011/03/09 12:55:16 alec Exp $ + * $Id: LMS.class.php,v 1.1057 2011/03/10 11:36:38 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.1056 $'; + var $_revision = '$Revision: 1.1057 $'; function LMS(&$DB, &$AUTH, &$CONFIG) // class variables setting { @@ -282,34 +282,40 @@ return $userslist; } - function GetUserIDByLogin($login) + function GetUserIDByLogin($login) { return $this->DB->GetOne('SELECT id FROM users WHERE login=?', array($login)); } - function UserAdd($useradd) + function UserAdd($user) { - if($this->DB->Execute('INSERT INTO users (login, name, email, passwd, rights, - hosts, position) VALUES (?, ?, ?, ?, ?, ?, ?)', - array($useradd['login'], - $useradd['name'], - $useradd['email'], - crypt($useradd['password']), - $useradd['rights'], - $useradd['hosts'], - $useradd['position'] + if($this->DB->Execute('INSERT INTO users (login, name, email, passwd, rights, + hosts, position, ntype, phone) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)', + array($user['login'], + $user['name'], + $user['email'], + crypt($user['password']), + $user['rights'], + $user['hosts'], + $user['position'], + !empty($user['ntype']) ? $user['ntype'] : null, + !empty($user['phone']) ? $user['phone'] : null, ))) - return $this->DB->GetOne('SELECT id FROM users WHERE login=?', array($useradd['login'])); + return $this->DB->GetOne('SELECT id FROM users WHERE login=?', array($user['login'])); else return FALSE; } - function UserDelete($id) + function UserDelete($id) { - return $this->DB->Execute('UPDATE users SET deleted=1 WHERE id=?', array($id)); + if ($this->DB->Execute('UPDATE users SET deleted=1 WHERE id=?', array($id))) { + $this->cache['users'][$id]['deleted'] = 1; + return true; + } } - function UserExists($id) + function UserExists($id) { switch($this->DB->GetOne('SELECT deleted FROM users WHERE id=?', array($id))) { @@ -326,12 +332,12 @@ } } - function GetUserInfo($id) // zwraca pe?ne info o podanym userie + function GetUserInfo($id) { - if($userinfo = $this->DB->GetRow('SELECT id, login, name, email, hosts, lastlogindate, - lastloginip, failedlogindate, failedloginip, deleted, position - FROM users WHERE id=?', array($id))) + if($userinfo = $this->DB->GetRow('SELECT * FROM users WHERE id = ?', array($id))) { + $this->cache['users'][$id] = $userinfo; + if($userinfo['id']==$this->AUTH->id) { $userinfo['lastlogindate'] = $this->AUTH->last; @@ -367,23 +373,27 @@ return $userinfo; } - function UserUpdate($userinfo) + function UserUpdate($user) { - return $this->DB->Execute('UPDATE users SET login=?, name=?, email=?, rights=?, - hosts=?, position=? WHERE id=?', - array($userinfo['login'], - $userinfo['name'], - $userinfo['email'], - $userinfo['rights'], - $userinfo['hosts'], - $userinfo['position'], - $userinfo['id'] + return $this->DB->Execute('UPDATE users SET login=?, name=?, email=?, rights=?, + hosts=?, position=?, ntype=?, phone=? WHERE id=?', + array($user['login'], + $user['name'], + $user['email'], + $user['rights'], + $user['hosts'], + $user['position'], + !empty($user['ntype']) ? $user['ntype'] : null, + !empty($user['phone']) ? $user['phone'] : null, + $user['id'] )); } function GetUserRights($id) { - $mask = $this->DB->GetOne('SELECT rights FROM users WHERE id = ?', array($id)); + if (!($mask = $this->GetCache('users', $id, 'rights'))) { + $mask = $this->DB->GetOne('SELECT rights FROM users WHERE id = ?', array($id)); + } $len = strlen($mask); $bin = ''; @@ -4085,6 +4095,11 @@ $headers['Mime-Version'] = '1.0'; $headers['Subject'] = qp_encode($headers['Subject']); + if (!empty($this->CONFIG['mail']['debug_email'])) { + $recipients = $this->CONFIG['mail']['debug_email']; + $headers['To'] = '<'.$recipients.'>'; + } + if (empty($headers['Date'])) $headers['Date'] = date('r'); @@ -4126,6 +4141,16 @@ function SendSMS($number, $message, $messageid=0) { + $msg_len = mb_strlen($message); + + if (!$msg_len) { + return trans('SMS message is empty!'); + } + + 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); @@ -4134,6 +4159,11 @@ if ($prefix && substr($number, 0, strlen($prefix)) != $prefix) $number = $prefix . $number; + // message ID must be unique + if (!$messageid) { + $messageid = '0.'.time(); + } + $data = array( 'number' => $number, 'message' => $message, @@ -4166,8 +4196,13 @@ else $from = $this->CONFIG['sms']['from']; - if(strlen($message) > 159 || strlen($message) == 0) + if ($msg_len < 160) + $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) return trans('Wrong phone number format!'); @@ -4177,7 +4212,7 @@ $args = array ( 'user' => $this->CONFIG['sms']['username'], 'pass' => $this->CONFIG['sms']['password'], - 'type' => 'sms', + 'type' => $type_sms, 'number' => $number, 'text' => $message, 'from' => $from Index: lms/lib/LMSDB_common.class.php diff -u lms/lib/LMSDB_common.class.php:1.56 lms/lib/LMSDB_common.class.php:1.57 --- lms/lib/LMSDB_common.class.php:1.56 Tue Jan 18 09:12:05 2011 +++ lms/lib/LMSDB_common.class.php Thu Mar 10 12:36:38 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: LMSDB_common.class.php,v 1.56 2011/01/18 08:12:05 alec Exp $ + * $Id: LMSDB_common.class.php,v 1.57 2011/03/10 11:36:38 alec Exp $ */ /* @@ -31,7 +31,7 @@ Class LMSDB_common { var $_version = '1.11-cvs'; - var $_revision = '$Revision: 1.56 $'; + var $_revision = '$Revision: 1.57 $'; // Driver powinien nadpisać tą zmienną wartością TRUE, żeby // funkcja inicjująca baze danych wiedziała że driver się poprawnie @@ -51,7 +51,7 @@ var $_result = NULL; var $errors = array(); - var $debug = FALSE; + var $debug = true;//FALSE; function LMSDB_common() { Index: lms/lib/upgradedb.php diff -u lms/lib/upgradedb.php:1.188 lms/lib/upgradedb.php:1.189 --- lms/lib/upgradedb.php:1.188 Mon Mar 7 13:10:58 2011 +++ lms/lib/upgradedb.php Thu Mar 10 12:36:38 2011 @@ -21,10 +21,10 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: upgradedb.php,v 1.188 2011/03/07 12:10:58 alec Exp $ + * $Id: upgradedb.php,v 1.189 2011/03/10 11:36:38 alec Exp $ */ -define('DBVERSION', '2011030700'); // here should be always the newest version of database! +define('DBVERSION', '2011031000'); // here should be always the newest version of database! // it placed here to avoid read disk every time when we call this file. /* From cvs w lms.org.pl Thu Mar 10 12:36:39 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 10 Mar 2011 12:36:39 +0100 (CET) Subject: [lms-commits] CVS update of lms/lib/locale/pl (strings.php) Message-ID: <20110310113639.38C48302B615@eftep.altec.pl> Date: Thursday, March 10, 2011 @ 12:36:39 Author: alec Path: /cvsroot/lms/lib/locale/pl Modified: strings.php - Removed userpanel/debug_email option, use mail/debug_email instead - Added sms/debug_phone option - Added SMS notifications from helpdesk - BTS#0000843: Support SMS messages up to 459 chars using smscenter setvice Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/lib/locale/pl/strings.php.diff?&r1=1.378&r2=1.379 Index: lms/lib/locale/pl/strings.php diff -u lms/lib/locale/pl/strings.php:1.378 lms/lib/locale/pl/strings.php:1.379 --- lms/lib/locale/pl/strings.php:1.378 Mon Mar 7 13:10:58 2011 +++ lms/lib/locale/pl/strings.php Thu Mar 10 12:36:39 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: strings.php,v 1.378 2011/03/07 12:10:58 alec Exp $ + * $Id: strings.php,v 1.379 2011/03/10 11:36:39 alec Exp $ */ $_LANG['$0 ($1 addresses)'] = '$0 ($1 adresów)'; @@ -429,7 +429,7 @@ $_LANG['Enter beginning of DHCP range (optional)'] = 'Wprowadź początek zakresu DHCP (opcjonalnie)'; $_LANG['Enter/change your registration info'] = 'Wprowadź/zmień swoje dane rejestracyjne'; $_LANG['Enter city'] = 'Wprowadź nazwę miasta'; -$_LANG['Enter coma separated list of hosts or networks'] = 'Wprowadź listę hostów lub sieci oddzielonych przecinkami'; +$_LANG['Enter comma-separated list of hosts or networks (optional)'] = 'Wprowadź listę hostów lub sieci oddzielonych przecinkami (opcjonalnie)'; $_LANG['Enter comment'] = 'Wprowadź komentarz'; $_LANG['Enter contact phone'] = 'Wprowadź telefon kontaktowy'; $_LANG['Enter country'] = 'Wprowadź kraj'; @@ -2247,7 +2247,6 @@ $_LANG['Records number:'] = 'Liczba rekordów:'; $_LANG['Domain admin e-mail address.'] = 'Adres e-mail administratora domeny.'; $_LANG['Are you sure you want to delete this record?'] = 'Jesteś pewien, że chcesz usunąć ten rekord?'; -$_LANG['You can\'t add PTR record to this domain!'] = 'Nie możesz dodać rekordu PTR do tej domeny!'; $_LANG['Enter IP address of mailserver'] = 'Wprowadź adres IP serwera pocztowego'; $_LANG['Enter IP address of master NS'] = 'Wprowadź adres IP głównego serwera nazw'; $_LANG['Enter IP address of webserver'] = 'wprowadź adres IP serwera www'; @@ -2444,5 +2443,11 @@ $_LANG['Additional subscription after promotion period:'] = 'Dodatkowa taryfa po okresie promocji:'; $_LANG['Additional subscription is useless when contract prolongation is not set!'] = 'Dodatkowa taryfa nie ma sensu gdy nie zaznaczono przedłużenia umowy!'; $_LANG['Contract prolongation after promotion period:'] = 'Przedłużenie umowy po okresie promocji:'; +$_LANG['Enter phone number for SMS notification (optional)'] = 'Wprowadź numer telefonu dla powiadomień SMS'; +$_LANG['Enter user login'] = 'Wprowadź login użytkownika'; +$_LANG['Enter user name'] = 'Wprowadź nazwisko i imię użytkownika'; +$_LANG['Enter user position (optional)'] = 'Wprowadź stanowisko użytkownika (optional)'; +$_LANG['Notification:'] = 'Powiadomienia:'; +$_LANG['SMS message is empty!'] = 'Wiadomość SMS jest pusta!'; ?> From cvs w lms.org.pl Thu Mar 10 12:36:40 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 10 Mar 2011 12:36:40 +0100 (CET) Subject: [lms-commits] CVS update of lms/userpanel/modules/helpdesk/templates (setup.html) Message-ID: <20110310113640.7E88E301E579@eftep.altec.pl> Date: Thursday, March 10, 2011 @ 12:36:40 Author: alec Path: /cvsroot/lms/userpanel/modules/helpdesk/templates Modified: setup.html - Removed userpanel/debug_email option, use mail/debug_email instead - Added sms/debug_phone option - Added SMS notifications from helpdesk - BTS#0000843: Support SMS messages up to 459 chars using smscenter setvice Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/userpanel/modules/helpdesk/templates/setup.html.diff?&r1=1.1&r2=1.2 Index: lms/userpanel/modules/helpdesk/templates/setup.html diff -u lms/userpanel/modules/helpdesk/templates/setup.html:1.1 lms/userpanel/modules/helpdesk/templates/setup.html:1.2 --- lms/userpanel/modules/helpdesk/templates/setup.html:1.1 Fri Jun 13 11:15:20 2008 +++ lms/userpanel/modules/helpdesk/templates/setup.html Thu Mar 10 12:36:40 2011 @@ -1,5 +1,5 @@ {include file="header.html"} - +

    {$layout.pagetitle}

    @@ -34,14 +34,6 @@ - - - - Date: Thursday, March 10, 2011 @ 12:37:22 Author: alec Path: /cvsroot/lms/doc/html/pl Modified: devel-db.html menu-administration.html menu-configuration.html - documentation regen Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/html/pl/devel-db.html.diff?&r1=1.73&r2=1.74 http://cvs.lms.org.pl/viewvc/Development/lms/doc/html/pl/menu-administration.html.diff?&r1=1.17&r2=1.18 http://cvs.lms.org.pl/viewvc/Development/lms/doc/html/pl/menu-configuration.html.diff?&r1=1.31&r2=1.32 Index: lms/doc/html/pl/devel-db.html diff -u lms/doc/html/pl/devel-db.html:1.73 lms/doc/html/pl/devel-db.html:1.74 --- lms/doc/html/pl/devel-db.html:1.73 Mon Mar 7 13:10:57 2011 +++ lms/doc/html/pl/devel-db.html Thu Mar 10 12:37:21 2011 @@ -126,11 +126,15 @@ >email - adres e-mail użytkownikaphone - numer telefonu użytkownika3.2.3. Nowy użytkownik

    Aby dodać nowe konto użytkownika należy podać login oraz hasło, - które nie może być puste. Podanie imienia, nazwiska i adresu poczty elektronicznej - nie jest wymagane. "Dozwolone hosty" to lista adresów IP hostów lub sieci +>Aby dodać nowe konto użytkownika należy podać login, nazwisko/imię oraz hasło, + które nie może być puste. Pozostałe dane nie są wymagane. + "Dozwolone hosty" to lista adresów IP hostów lub sieci oddzielonych przecinkiem, z których dany użytkownik może się logować do systemu (podobnie do opcji konfiguracyjnej 'allow_from'). Jeśli lista ta jest pusta system nie dokonuje sprawdzenia adresu IP. Poniżej można zaznaczyć uprawnienia dostępu do systemu. Jeżeli wszystkie pola pozostawisz puste, użytkownikowi przypisany zostanie 'Pełen dostęp'.

    Pole "Powiadomienia" określa jakiego typu powiadomienia (np. z helpdesku) + mają być wysyłane do użytkownika. Aby skorzystać z powiadomień należy też podać adres e-mail i/lub + numer telefonu.

    newticket_notify

    Włączenie tej opcji spowoduje, że wszyscy użytkownicy z prawami - do kolejki dostaną powiadomienie mailem o dodaniu do niej nowego + do kolejki dostaną powiadomienie (mailem i/lub smsem) o dodaniu do niej nowego zgłoszenia. Domyślnie: wyłączona.

    Przykład: Date: Thursday, March 10, 2011 @ 12:37:21 Author: alec Path: /cvsroot/lms/doc Modified: README README.pl - documentation regen Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/README.diff?&r1=1.233&r2=1.234 http://cvs.lms.org.pl/viewvc/Development/lms/doc/README.pl.diff?&r1=1.63&r2=1.64 Index: lms/doc/README diff -u lms/doc/README:1.233 lms/doc/README:1.234 --- lms/doc/README:1.233 Mon Mar 7 13:10:56 2011 +++ lms/doc/README Thu Mar 10 12:37:21 2011 @@ -5319,10 +5319,12 @@ login - login name - first and last name email - user's email address + phone - user's phone number position - user's position name rights - binary access rights hosts - list of hosts allowed to login passwd - password to login + ntype - supported notofication types lastlogindate - date of last login lastloginip - IP of last login failedlogindate - date of last failed login attempt Index: lms/doc/README.pl diff -u lms/doc/README.pl:1.63 lms/doc/README.pl:1.64 --- lms/doc/README.pl:1.63 Mon Mar 7 13:10:56 2011 +++ lms/doc/README.pl Thu Mar 10 12:37:21 2011 @@ -1199,15 +1199,18 @@ 3.2.3. Nowy użytkownik - Aby dodać nowe konto użytkownika należy podać login oraz hasło, które - nie może być puste. Podanie imienia, nazwiska i adresu poczty - elektronicznej nie jest wymagane. "Dozwolone hosty" to lista adresów IP - hostów lub sieci oddzielonych przecinkiem, z których dany użytkownik - może się logować do systemu (podobnie do opcji konfiguracyjnej - 'allow_from'). Jeśli lista ta jest pusta system nie dokonuje - sprawdzenia adresu IP. Poniżej można zaznaczyć uprawnienia dostępu do - systemu. Jeżeli wszystkie pola pozostawisz puste, użytkownikowi - przypisany zostanie 'Pełen dostęp'. + Aby dodać nowe konto użytkownika należy podać login, nazwisko/imię oraz + hasło, które nie może być puste. Pozostałe dane nie są wymagane. + "Dozwolone hosty" to lista adresów IP hostów lub sieci oddzielonych + przecinkiem, z których dany użytkownik może się logować do systemu + (podobnie do opcji konfiguracyjnej 'allow_from'). Jeśli lista ta jest + pusta system nie dokonuje sprawdzenia adresu IP. Poniżej można + zaznaczyć uprawnienia dostępu do systemu. Jeżeli wszystkie pola + pozostawisz puste, użytkownikowi przypisany zostanie 'Pełen dostęp'. + + Pole "Powiadomienia" określa jakiego typu powiadomienia (np. z + helpdesku) mają być wysyłane do użytkownika. Aby skorzystać z + powiadomień należy też podać adres e-mail i/lub numer telefonu. __________________________________________________________________ 3.2.4. Kopie zapasowe @@ -2666,8 +2669,8 @@ Przykład: helpdesk_sender_name = Helpdesk * newticket_notify Włączenie tej opcji spowoduje, że wszyscy użytkownicy z prawami do - kolejki dostaną powiadomienie mailem o dodaniu do niej nowego - zgłoszenia. Domyślnie: wyłączona. + kolejki dostaną powiadomienie (mailem i/lub smsem) o dodaniu do + niej nowego zgłoszenia. Domyślnie: wyłączona. Przykład: newticket_notify = 1 * helpdesk_stats Dodaje statystyki przyczyn zgłoszeń na stronie informacji o @@ -6250,11 +6253,13 @@ id - identyfikator login - login name - nazwa (nazwisko i imię) - email - adres admina - position - nazwa stanowiska admina + email - adres e-mail użytkownika + phone - numer telefonu użytkownika + position - nazwa stanowiska rights - prawa dostępu hosts - lista hostów z prawem do logowania passwd - hasło logowania + ntype - obsługiwane typy powiadomień lastlogindate - data ostatniego logowania lastloginip - adres IP, z którego nastąpiło ostatnie logowanie failedlogindate - data ostatniej nieudanej próby logowania From cvs w lms.org.pl Thu Mar 10 13:06:43 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 10 Mar 2011 13:06:43 +0100 (CET) Subject: [lms-commits] CVS update of lms/doc (ChangeLog, lms.pgsql) Message-ID: <20110310120643.7B3E9302B610@eftep.altec.pl> Date: Thursday, March 10, 2011 @ 13:06:43 Author: alec Path: /cvsroot/lms/doc Modified: ChangeLog lms.pgsql - Force names of multicolumn unique constraints in PostgreSQL Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/ChangeLog.diff?&r1=1.1547&r2=1.1548 http://cvs.lms.org.pl/viewvc/Development/lms/doc/lms.pgsql.diff?&r1=1.180&r2=1.181 Index: lms/doc/ChangeLog diff -u lms/doc/ChangeLog:1.1547 lms/doc/ChangeLog:1.1548 --- lms/doc/ChangeLog:1.1547 Thu Mar 10 12:36:38 2011 +++ lms/doc/ChangeLog Thu Mar 10 13:06:43 2011 @@ -1,4 +1,4 @@ -$Id: ChangeLog,v 1.1547 2011/03/10 11:36:38 alec Exp $ +$Id: ChangeLog,v 1.1548 2011/03/10 12:06:43 alec Exp $ version ? (????-??-??) @@ -26,6 +26,7 @@ - Added sms/debug_phone option (alec) - Added SMS notifications from helpdesk (alec) - BTS#0000843: Support SMS messages up to 459 chars using smscenter setvice (alec) + - Force names of multicolumn unique constraints in PostgreSQL (alec) version 1.11.11 Bray (2011-01-17) Index: lms/doc/lms.pgsql diff -u lms/doc/lms.pgsql:1.180 lms/doc/lms.pgsql:1.181 --- lms/doc/lms.pgsql:1.180 Thu Mar 10 12:36:38 2011 +++ lms/doc/lms.pgsql Thu Mar 10 13:06:43 2011 @@ -1,4 +1,4 @@ -/* $Id: lms.pgsql,v 1.180 2011/03/10 11:36:38 alec Exp $ */ +/* $Id: lms.pgsql,v 1.181 2011/03/10 12:06:43 alec Exp $ */ /* -------------------------------------------------------- Structure of table "users" @@ -222,7 +222,7 @@ nodeid integer NOT NULL REFERENCES nodes (id) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY (id), - UNIQUE (mac, nodeid) + CONSTRAINT macs_mac_key UNIQUE (mac, nodeid) ); /* -------------------------------------------------------- @@ -251,7 +251,7 @@ nodegroupid integer NOT NULL DEFAULT 0, nodeid integer NOT NULL DEFAULT 0, PRIMARY KEY (id), - UNIQUE (nodeid, nodegroupid) + CONSTRAINT nodegroupassignments_nodeid_key UNIQUE (nodeid, nodegroupid) ); /* -------------------------------------------------------- @@ -267,7 +267,7 @@ assignmentid integer NOT NULL REFERENCES assignments (id) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY (id), - UNIQUE (nodeid, assignmentid) + CONSTRAINT nodeassignments_nodeid_key UNIQUE (nodeid, assignmentid) ); CREATE INDEX nodeassignments_assignmentid_idx ON nodeassignments (assignmentid); @@ -313,7 +313,7 @@ quota_sql_limit integer DEFAULT NULL, description text DEFAULT '' NOT NULL, PRIMARY KEY (id), - UNIQUE (name, value, period) + CONSTRAINT tariffs_name_key UNIQUE (name, value, period) ); CREATE INDEX tariffs_type_idx ON tariffs (type); @@ -350,7 +350,7 @@ ctariffid integer DEFAULT NULL REFERENCES tariffs (id) ON DELETE RESTRICT ON UPDATE CASCADE, PRIMARY KEY (id), - UNIQUE (promotionid, name) + CONSTRAINT promotionschemas_promotionid_key UNIQUE (promotionid, name) ); CREATE INDEX promotionschemas_ctariffid_idx ON promotionschemas (ctariffid); @@ -368,7 +368,7 @@ REFERENCES tariffs (id) ON DELETE CASCADE ON UPDATE CASCADE, data text DEFAULT NULL, PRIMARY KEY (id), - UNIQUE (promotionschemaid, tariffid) + CONSTRAINT promotionassignments_promotionschemaid_key UNIQUE (promotionschemaid, tariffid) ); CREATE INDEX promotionassignments_tariffid_idx ON promotionassignments (tariffid); @@ -520,7 +520,7 @@ value numeric(9,2) DEFAULT 0 NOT NULL, description text DEFAULT '' NOT NULL, PRIMARY KEY (id), - UNIQUE (docid, itemid) + CONSTRAINT debitnotecontents_docid_key UNIQUE (docid, itemid) ); /* -------------------------------------------------------- Structure of table "numberplanassignments" @@ -533,7 +533,7 @@ planid integer DEFAULT 0 NOT NULL, divisionid integer DEFAULT 0 NOT NULL, PRIMARY KEY (id), - UNIQUE (planid, divisionid) + CONSTRAINT numberplanassignments_planid_key UNIQUE (planid, divisionid) ); CREATE INDEX numberplanassignments_divisionid_idx ON numberplanassignments (divisionid); @@ -564,7 +564,7 @@ customerid integer NOT NULL REFERENCES customers (id) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY (id), - UNIQUE (customergroupid, customerid) + CONSTRAINT customerassignments_customergroupid_key UNIQUE (customergroupid, customerid) ); CREATE INDEX customerassignments_customerid_idx ON customerassignments (customerid); @@ -596,7 +596,7 @@ srcport smallint DEFAULT 0 NOT NULL, dstport smallint DEFAULT 0 NOT NULL, PRIMARY KEY (id), - UNIQUE (src, dst) + CONSTRAINT netlinks_src_key UNIQUE (src, dst) ); /* --------------------------------------------------- @@ -730,7 +730,7 @@ REFERENCES rtqueues (id) ON DELETE CASCADE ON UPDATE CASCADE, rights integer DEFAULT 0 NOT NULL, PRIMARY KEY (id), - UNIQUE (userid, queueid) + CONSTRAINT rtrights_userid_key UNIQUE (userid, queueid) ); /* --------------------------------------------------- @@ -761,7 +761,7 @@ mail_bcc varchar(255) DEFAULT '' NOT NULL, description text DEFAULT '' NOT NULL, PRIMARY KEY (id), - UNIQUE (login, domainid) + CONSTRAINT passwd_login_key UNIQUE (login, domainid) ); CREATE INDEX passwd_ownerid_idx ON passwd (ownerid); @@ -833,7 +833,7 @@ login varchar(255) DEFAULT '' NOT NULL, domainid integer DEFAULT 0 NOT NULL, PRIMARY KEY (id), - UNIQUE (login, domainid) + CONSTRAINT aliases_login_key UNIQUE (login, domainid) ); /* --------------------------------------------------- @@ -848,7 +848,7 @@ accountid integer DEFAULT 0 NOT NULL, mail_forward varchar(255) DEFAULT '' NOT NULL, PRIMARY KEY (id), - UNIQUE (aliasid, accountid, mail_forward) + CONSTRAINT aliasassignments_aliasid_key UNIQUE (aliasid, accountid, mail_forward) ); /* --------------------------------------------------- @@ -865,7 +865,7 @@ description text NOT NULL DEFAULT '', disabled smallint NOT NULL DEFAULT 0, PRIMARY KEY (id), - UNIQUE (section, var) + CONSTRAINT uiconfig_section_key UNIQUE (section, var) ); /* --------------------------------------------------- @@ -897,7 +897,7 @@ CREATE TABLE eventassignments ( eventid integer DEFAULT 0 NOT NULL, userid integer DEFAULT 0 NOT NULL, - UNIQUE (eventid, userid) + CONSTRAINT eventassignments_eventid_key UNIQUE (eventid, userid) ); /* --------------------------------------------------- @@ -941,7 +941,7 @@ name varchar(255) NOT NULL, idate integer NOT NULL, PRIMARY KEY (id), - UNIQUE (idate, name) + CONSTRAINT sourcefiles_idate_key UNIQUE (idate, name) ); CREATE INDEX sourcefiles_userid_idx ON sourcefiles (userid); @@ -1022,7 +1022,7 @@ description text DEFAULT '' NOT NULL, disabled smallint DEFAULT 0 NOT NULL, PRIMARY KEY (id), - UNIQUE(instanceid, var) + CONSTRAINT daemonconfig_instanceid_key UNIQUE(instanceid, var) ); /* --------------------------------------------------- @@ -1037,7 +1037,7 @@ doctype integer DEFAULT 0 NOT NULL, rights integer DEFAULT 0 NOT NULL, PRIMARY KEY (id), - UNIQUE (userid, doctype) + CONSTRAINT docrights_userid_key UNIQUE (userid, doctype) ); /* --------------------------------------------------- @@ -1052,7 +1052,7 @@ regid integer DEFAULT 0 NOT NULL, rights integer DEFAULT 0 NOT NULL, PRIMARY KEY (id), - UNIQUE (userid, regid) + CONSTRAINT cashrights_userid_key UNIQUE (userid, regid) ); /* --------------------------------------------------- @@ -1087,7 +1087,7 @@ snapshot numeric(9,2) DEFAULT 0 NOT NULL, description text DEFAULT '' NOT NULL, PRIMARY KEY (id), - UNIQUE (regid, time) + CONSTRAINT cashreglog_regid_key UNIQUE (regid, time) ); /* --------------------------------------------------- @@ -1245,7 +1245,7 @@ REFERENCES customergroups (id) ON DELETE CASCADE ON UPDATE CASCADE, userid integer NOT NULL DEFAULT 0, PRIMARY KEY (id), - UNIQUE (userid, customergroupid) + CONSTRAINT excludedgroups_userid_key UNIQUE (userid, customergroupid) ); CREATE INDEX excludedgroups_customergroupid_idx ON excludedgroups (customergroupid); @@ -1418,7 +1418,7 @@ customerid integer DEFAULT 0 NOT NULL, rightid integer DEFAULT 0 NOT NULL, PRIMARY KEY (id), - UNIQUE (customerid, rightid) + CONSTRAINT up_rights_assignments_customerid_key UNIQUE (customerid, rightid) ); /* --------------------------------------------------- From cvs w lms.org.pl Thu Mar 10 13:06:43 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 10 Mar 2011 13:06:43 +0100 (CET) Subject: [lms-commits] CVS update of lms/lib/upgradedb (11 files) Message-ID: <20110310120643.CFCEF302B610@eftep.altec.pl> Date: Thursday, March 10, 2011 @ 13:06:43 Author: alec Path: /cvsroot/lms/lib/upgradedb Modified: postgres.2007071600.php postgres.2008010400.php postgres.2008021500.php postgres.2008061300.php postgres.2008122900.php postgres.2009051200.php postgres.2009062300.php postgres.2010050600.php postgres.2010122000.php postgres.2011021700.php postgres.2011022000.php - Force names of multicolumn unique constraints in PostgreSQL Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/lib/upgradedb/postgres.2007071600.php.diff?&r1=1.6&r2=1.7 http://cvs.lms.org.pl/viewvc/Development/lms/lib/upgradedb/postgres.2008010400.php.diff?&r1=1.5&r2=1.6 http://cvs.lms.org.pl/viewvc/Development/lms/lib/upgradedb/postgres.2008021500.php.diff?&r1=1.5&r2=1.6 http://cvs.lms.org.pl/viewvc/Development/lms/lib/upgradedb/postgres.2008061300.php.diff?&r1=1.7&r2=1.8 http://cvs.lms.org.pl/viewvc/Development/lms/lib/upgradedb/postgres.2008122900.php.diff?&r1=1.5&r2=1.6 http://cvs.lms.org.pl/viewvc/Development/lms/lib/upgradedb/postgres.2009051200.php.diff?&r1=1.3&r2=1.4 http://cvs.lms.org.pl/viewvc/Development/lms/lib/upgradedb/postgres.2009062300.php.diff?&r1=1.3&r2=1.4 http://cvs.lms.org.pl/viewvc/Development/lms/lib/upgradedb/postgres.2010050600.php.diff?&r1=1.4&r2=1.5 http://cvs.lms.org.pl/viewvc/Development/lms/lib/upgradedb/postgres.2010122000.php.diff?&r1=1.2&r2=1.3 http://cvs.lms.org.pl/viewvc/Development/lms/lib/upgradedb/postgres.2011021700.php.diff?&r1=1.1&r2=1.2 http://cvs.lms.org.pl/viewvc/Development/lms/lib/upgradedb/postgres.2011022000.php.diff?&r1=1.2&r2=1.3 Index: lms/lib/upgradedb/postgres.2007071600.php diff -u lms/lib/upgradedb/postgres.2007071600.php:1.6 lms/lib/upgradedb/postgres.2007071600.php:1.7 --- lms/lib/upgradedb/postgres.2007071600.php:1.6 Tue Jan 18 09:12:15 2011 +++ lms/lib/upgradedb/postgres.2007071600.php Thu Mar 10 13:06:43 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: postgres.2007071600.php,v 1.6 2011/01/18 08:12:15 alec Exp $ + * $Id: postgres.2007071600.php,v 1.7 2011/03/10 12:06:43 alec Exp $ */ $DB->BeginTrans(); @@ -33,7 +33,7 @@ customergroupid integer NOT NULL DEFAULT 0, userid integer NOT NULL DEFAULT 0, PRIMARY KEY (id), - UNIQUE (userid, customergroupid) + CONSTRAINT excludedgroups_userid_key UNIQUE (userid, customergroupid) ); "); Index: lms/lib/upgradedb/postgres.2008010400.php diff -u lms/lib/upgradedb/postgres.2008010400.php:1.5 lms/lib/upgradedb/postgres.2008010400.php:1.6 --- lms/lib/upgradedb/postgres.2008010400.php:1.5 Tue Jan 18 09:12:15 2011 +++ lms/lib/upgradedb/postgres.2008010400.php Thu Mar 10 13:06:43 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: postgres.2008010400.php,v 1.5 2011/01/18 08:12:15 alec Exp $ + * $Id: postgres.2008010400.php,v 1.6 2011/03/10 12:06:43 alec Exp $ */ $DB->BeginTrans(); @@ -42,7 +42,7 @@ nodegroupid integer NOT NULL DEFAULT 0, nodeid integer NOT NULL DEFAULT 0, PRIMARY KEY (id), - UNIQUE (nodeid, nodegroupid) + CONSTRAINT nodegroupassignments_nodeid_key UNIQUE (nodeid, nodegroupid) ); "); Index: lms/lib/upgradedb/postgres.2008021500.php diff -u lms/lib/upgradedb/postgres.2008021500.php:1.5 lms/lib/upgradedb/postgres.2008021500.php:1.6 --- lms/lib/upgradedb/postgres.2008021500.php:1.5 Tue Jan 18 09:12:15 2011 +++ lms/lib/upgradedb/postgres.2008021500.php Thu Mar 10 13:06:43 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: postgres.2008021500.php,v 1.5 2011/01/18 08:12:15 alec Exp $ + * $Id: postgres.2008021500.php,v 1.6 2011/03/10 12:06:43 alec Exp $ */ $DB->BeginTrans(); @@ -33,7 +33,7 @@ aliasid integer DEFAULT 0 NOT NULL, accountid integer DEFAULT 0 NOT NULL, PRIMARY KEY (id), - UNIQUE (aliasid, accountid) + CONSTRAINT aliasassignments_aliasid_key UNIQUE (aliasid, accountid) ); ALTER TABLE aliases ADD domainid integer NOT NULL DEFAULT 0; @@ -44,7 +44,7 @@ SELECT id, accountid FROM aliases; ALTER TABLE aliases DROP accountid; - ALTER TABLE aliases ADD UNIQUE (login, domainid); + ALTER TABLE aliases ADD CONSTRAINT aliases_login_key UNIQUE (login, domainid); "); $DB->Execute("UPDATE dbinfo SET keyvalue = ? WHERE keytype = ?", array('2008021500', 'dbversion')); Index: lms/lib/upgradedb/postgres.2008061300.php diff -u lms/lib/upgradedb/postgres.2008061300.php:1.7 lms/lib/upgradedb/postgres.2008061300.php:1.8 --- lms/lib/upgradedb/postgres.2008061300.php:1.7 Tue Jan 18 09:12:15 2011 +++ lms/lib/upgradedb/postgres.2008061300.php Thu Mar 10 13:06:43 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: postgres.2008061300.php,v 1.7 2011/01/18 08:12:15 alec Exp $ + * $Id: postgres.2008061300.php,v 1.8 2011/03/10 12:06:43 alec Exp $ */ $tables = $DB->ListTables(); @@ -50,7 +50,7 @@ customerid integer DEFAULT 0 NOT NULL, rightid integer DEFAULT 0 NOT NULL, PRIMARY KEY (id), - UNIQUE (customerid, rightid) + CONSTRAINT up_rights_assignments_customerid_key UNIQUE (customerid, rightid) ) "); Index: lms/lib/upgradedb/postgres.2008122900.php diff -u lms/lib/upgradedb/postgres.2008122900.php:1.5 lms/lib/upgradedb/postgres.2008122900.php:1.6 --- lms/lib/upgradedb/postgres.2008122900.php:1.5 Tue Jan 18 09:12:16 2011 +++ lms/lib/upgradedb/postgres.2008122900.php Thu Mar 10 13:06:43 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: postgres.2008122900.php,v 1.5 2011/01/18 08:12:16 alec Exp $ + * $Id: postgres.2008122900.php,v 1.6 2011/03/10 12:06:43 alec Exp $ */ $DB->BeginTrans(); @@ -33,7 +33,7 @@ planid integer DEFAULT 0 NOT NULL, divisionid integer DEFAULT 0 NOT NULL, PRIMARY KEY (id), - UNIQUE (planid, divisionid) + CONSTRAINT numberplanassignments_planid_key UNIQUE (planid, divisionid) ); CREATE INDEX numberplanassignments_divisionid_idx ON numberplanassignments (divisionid); "); Index: lms/lib/upgradedb/postgres.2009051200.php diff -u lms/lib/upgradedb/postgres.2009051200.php:1.3 lms/lib/upgradedb/postgres.2009051200.php:1.4 --- lms/lib/upgradedb/postgres.2009051200.php:1.3 Tue Jan 18 09:12:16 2011 +++ lms/lib/upgradedb/postgres.2009051200.php Thu Mar 10 13:06:43 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: postgres.2009051200.php,v 1.3 2011/01/18 08:12:16 alec Exp $ + * $Id: postgres.2009051200.php,v 1.4 2011/03/10 12:06:43 alec Exp $ */ $DB->BeginTrans(); @@ -35,7 +35,7 @@ doctype integer DEFAULT 0 NOT NULL, rights integer DEFAULT 0 NOT NULL, PRIMARY KEY (id), - UNIQUE (userid, doctype) + CONSTRAINT docrights_userid_key UNIQUE (userid, doctype) ); "); Index: lms/lib/upgradedb/postgres.2009062300.php diff -u lms/lib/upgradedb/postgres.2009062300.php:1.3 lms/lib/upgradedb/postgres.2009062300.php:1.4 --- lms/lib/upgradedb/postgres.2009062300.php:1.3 Tue Jan 18 09:12:16 2011 +++ lms/lib/upgradedb/postgres.2009062300.php Thu Mar 10 13:06:43 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: postgres.2009062300.php,v 1.3 2011/01/18 08:12:16 alec Exp $ + * $Id: postgres.2009062300.php,v 1.4 2011/03/10 12:06:43 alec Exp $ */ $DB->BeginTrans(); @@ -36,9 +36,9 @@ value numeric(9,2) DEFAULT 0 NOT NULL, description text DEFAULT '' NOT NULL, PRIMARY KEY (id), - UNIQUE (docid, itemid) + CONSTRAINT debitnotecontents_docid_key UNIQUE (docid, itemid) ); - + "); $DB->Execute("UPDATE dbinfo SET keyvalue = ? WHERE keytype = ?", array('2009062300', 'dbversion')); Index: lms/lib/upgradedb/postgres.2010050600.php diff -u lms/lib/upgradedb/postgres.2010050600.php:1.4 lms/lib/upgradedb/postgres.2010050600.php:1.5 --- lms/lib/upgradedb/postgres.2010050600.php:1.4 Tue Jan 18 09:12:16 2011 +++ lms/lib/upgradedb/postgres.2010050600.php Thu Mar 10 13:06:43 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: postgres.2010050600.php,v 1.4 2011/01/18 08:12:16 alec Exp $ + * $Id: postgres.2010050600.php,v 1.5 2011/03/10 12:06:43 alec Exp $ */ $DB->BeginTrans(); @@ -34,7 +34,7 @@ nodeid integer NOT NULL REFERENCES nodes (id) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY (id), - UNIQUE (mac, nodeid) + CONSTRAINT macs_mac_key UNIQUE (mac, nodeid) ); INSERT INTO macs (mac, nodeid) Index: lms/lib/upgradedb/postgres.2010122000.php diff -u lms/lib/upgradedb/postgres.2010122000.php:1.2 lms/lib/upgradedb/postgres.2010122000.php:1.3 --- lms/lib/upgradedb/postgres.2010122000.php:1.2 Tue Jan 18 09:12:17 2011 +++ lms/lib/upgradedb/postgres.2010122000.php Thu Mar 10 13:06:43 2011 @@ -32,7 +32,7 @@ name varchar(255) NOT NULL, idate integer NOT NULL, PRIMARY KEY (id), - UNIQUE (idate, name) + CONSTRAINT sourcefiles_idate_key UNIQUE (idate, name) ); CREATE INDEX sourcefiles_userid_idx ON sourcefiles (userid); Index: lms/lib/upgradedb/postgres.2011021700.php diff -u lms/lib/upgradedb/postgres.2011021700.php:1.1 lms/lib/upgradedb/postgres.2011021700.php:1.2 --- lms/lib/upgradedb/postgres.2011021700.php:1.1 Thu Feb 17 13:08:43 2011 +++ lms/lib/upgradedb/postgres.2011021700.php Thu Mar 10 13:06:43 2011 @@ -24,7 +24,7 @@ $DB->BeginTrans(); $DB->Execute("ALTER TABLE tariffs DROP CONSTRAINT tariffs_name_key"); -$DB->Execute("ALTER TABLE tariffs ADD UNIQUE(name, value)"); +$DB->Execute("ALTER TABLE tariffs ADD CONSTRAINT tariffs_name_key UNIQUE(name, value)"); $DB->Execute("UPDATE dbinfo SET keyvalue = ? WHERE keytype = ?", array('2011021700', 'dbversion')); Index: lms/lib/upgradedb/postgres.2011022000.php diff -u lms/lib/upgradedb/postgres.2011022000.php:1.2 lms/lib/upgradedb/postgres.2011022000.php:1.3 --- lms/lib/upgradedb/postgres.2011022000.php:1.2 Thu Mar 10 10:57:32 2011 +++ lms/lib/upgradedb/postgres.2011022000.php Thu Mar 10 13:06:43 2011 @@ -60,8 +60,8 @@ ); CREATE INDEX promotionassignments_tariffid_idx ON promotionassignments (tariffid); -ALTER TABLE tariffs DROP CONSTRAINT tariffs_name_value_key; -ALTER TABLE tariffs ADD UNIQUE(name, value, period); +ALTER TABLE tariffs DROP CONSTRAINT tariffs_name_key; +ALTER TABLE tariffs ADD CONSTRAINT tariffs_name_key UNIQUE(name, value, period); "); From cvs w lms.org.pl Fri Mar 11 10:43:39 2011 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 11 Mar 2011 10:43:39 +0100 (CET) Subject: [lms-commits] CVS update of lms/lib (LMSDB_common.class.php) Message-ID: <20110311094339.DB76A302B610@eftep.altec.pl> Date: Friday, March 11, 2011 @ 10:43:39 Author: chilek Path: /cvsroot/lms/lib Modified: LMSDB_common.class.php - fixed forgotten debug flag set to true Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/lib/LMSDB_common.class.php.diff?&r1=1.57&r2=1.58 Index: lms/lib/LMSDB_common.class.php diff -u lms/lib/LMSDB_common.class.php:1.57 lms/lib/LMSDB_common.class.php:1.58 --- lms/lib/LMSDB_common.class.php:1.57 Thu Mar 10 12:36:38 2011 +++ lms/lib/LMSDB_common.class.php Fri Mar 11 10:43:39 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: LMSDB_common.class.php,v 1.57 2011/03/10 11:36:38 alec Exp $ + * $Id: LMSDB_common.class.php,v 1.58 2011/03/11 09:43:39 chilek Exp $ */ /* @@ -31,7 +31,7 @@ Class LMSDB_common { var $_version = '1.11-cvs'; - var $_revision = '$Revision: 1.57 $'; + var $_revision = '$Revision: 1.58 $'; // Driver powinien nadpisać tą zmienną wartością TRUE, żeby // funkcja inicjująca baze danych wiedziała że driver się poprawnie @@ -51,7 +51,7 @@ var $_result = NULL; var $errors = array(); - var $debug = true;//FALSE; + var $debug = FALSE; function LMSDB_common() { From cvs w lms.org.pl Fri Mar 11 14:28:36 2011 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 11 Mar 2011 14:28:36 +0100 (CET) Subject: [lms-commits] CVS update of lms/daemon/modules/payments (payments.c) Message-ID: <20110311132836.1F1BA302B610@eftep.altec.pl> Date: Friday, March 11, 2011 @ 14:28:36 Author: alec Path: /cvsroot/lms/daemon/modules/payments Modified: payments.c - lmsd/payments: improved performance of assignment suspension check Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/daemon/modules/payments/payments.c.diff?&r1=1.94&r2=1.95 Index: lms/daemon/modules/payments/payments.c diff -u lms/daemon/modules/payments/payments.c:1.94 lms/daemon/modules/payments/payments.c:1.95 --- lms/daemon/modules/payments/payments.c:1.94 Tue Mar 1 11:39:36 2011 +++ lms/daemon/modules/payments/payments.c Fri Mar 11 14:28:35 2011 @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: payments.c,v 1.94 2011/03/01 10:39:36 alec Exp $ + * $Id: payments.c,v 1.95 2011/03/11 13:28:35 alec Exp $ */ #include #include @@ -260,7 +260,7 @@ char *insert, *description, *invoiceid, *value, *taxid, *currtime; char *d_period, *w_period, *m_period, *q_period, *y_period, *h_period; int i, imonth, imday, today, n=2, k=2, m=2, o=2, pl=0; - int docid=0, last_customerid=0, last_paytype=0, last_plan=0, exec=0, suspended=0, itemid=0; + int docid=0, last_cid=0, last_paytype=0, last_plan=0, exec=0, suspended=0, itemid=0; time_t t; struct tm *tt; @@ -559,33 +559,31 @@ // payments accounting and invoices writing for(i=0; idb_nrows(res); i++) { - int uid = atoi(g->db_get_data(res,i,"customerid")); - int s_state = atoi(g->db_get_data(res,i,"suspended")); - int period = atoi(g->db_get_data(res,i,"period")); - int settlement = atoi(g->db_get_data(res,i,"settlement")); - int datefrom = atoi(g->db_get_data(res,i,"datefrom")); - int t_period = atoi(g->db_get_data(res,i,"t_period")); + char *cid_c = g->db_get_data(res,i,"customerid"); char *discount = g->db_get_data(res,i,"discount"); - double val = atof(g->db_get_data(res,i,"value")); + int cid = atoi(cid_c); + int s_state = atoi(g->db_get_data(res,i,"suspended")); + int period = atoi(g->db_get_data(res,i,"period")); + int settlement = atoi(g->db_get_data(res,i,"settlement")); + int datefrom = atoi(g->db_get_data(res,i,"datefrom")); + int t_period = atoi(g->db_get_data(res,i,"t_period")); + double val = atof(g->db_get_data(res,i,"value")); if( !val ) continue; // assignments suspending check - if( suspended != uid ) + if( last_cid != cid ) { - result = g->db_pquery(g->conn, "SELECT 1 FROM assignments, customers " - "WHERE customerid = customers.id AND tariffid = 0 AND liabilityid = 0 " - "AND (datefrom <= ? OR datefrom = 0) AND (dateto >= ? OR dateto = 0) " - "AND customerid = ?", currtime, currtime, g->db_get_data(res,i,"customerid")); + result = g->db_pquery(g->conn, "SELECT 1 FROM assignments " + "WHERE customerid = ? AND tariffid = 0 AND liabilityid = 0 " + "AND (datefrom <= ? OR datefrom = 0) AND (dateto >= ? OR dateto = 0)", + cid_c, currtime, currtime); - if( g->db_nrows(result) ) - { - suspended = uid; - } + suspended = g->db_nrows(result) ? 1 : 0; g->db_free(&result); } - if( suspended == uid || s_state ) + if( suspended || s_state ) val = val * p->suspension_percentage / 100; if( !val ) continue; @@ -618,7 +616,7 @@ // prepare insert to 'cash' table insert = strdup("INSERT INTO cash (time, value, taxid, customerid, comment, docid, itemid) " "VALUES (?, %value * -1, %taxid, %customerid, '?', %docid, %itemid)"); - g->str_replace(&insert, "%customerid", g->db_get_data(res,i,"customerid")); + g->str_replace(&insert, "%customerid", cid_c); g->str_replace(&insert, "%value", value); g->str_replace(&insert, "%taxid", taxid); @@ -673,7 +671,7 @@ numberplan = (n < pl) ? n : -1; - if ( last_customerid != uid || last_paytype != paytype || last_plan != numberplan) + if ( last_cid != cid || last_paytype != paytype || last_plan != numberplan) { char *countryid = g->db_get_data(res,i,"countryid"); char *numberplanid, *paytime, *paytype_str = strdup(itoa(paytype)); @@ -737,7 +735,7 @@ numberplanid, countryid, divisionid, - g->db_get_data(res,i,"customerid"), + cid_c, g->db_get_data(res,i,"lastname"), g->db_get_data(res,i,"custname"), g->db_get_data(res,i,"address"), @@ -837,7 +835,7 @@ insert = strdup("INSERT INTO cash (time, value, taxid, customerid, comment, docid, itemid) " "VALUES (?, %value * -1, %taxid, %customerid, '?', %docid, %itemid)"); - g->str_replace(&insert, "%customerid", g->db_get_data(res,i,"customerid")); + g->str_replace(&insert, "%customerid", cid_c); g->str_replace(&insert, "%value", value); g->str_replace(&insert, "%taxid", taxid); @@ -908,7 +906,7 @@ free(description); } - last_customerid = uid; + last_cid = cid; } g->db_free(&res); From cvs w lms.org.pl Fri Mar 11 14:28:36 2011 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 11 Mar 2011 14:28:36 +0100 (CET) Subject: [lms-commits] CVS update of lms/doc (ChangeLog) Message-ID: <20110311132836.54412302B612@eftep.altec.pl> Date: Friday, March 11, 2011 @ 14:28:36 Author: alec Path: /cvsroot/lms/doc Modified: ChangeLog - lmsd/payments: improved performance of assignment suspension check Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/ChangeLog.diff?&r1=1.1548&r2=1.1549 Index: lms/doc/ChangeLog diff -u lms/doc/ChangeLog:1.1548 lms/doc/ChangeLog:1.1549 --- lms/doc/ChangeLog:1.1548 Thu Mar 10 13:06:43 2011 +++ lms/doc/ChangeLog Fri Mar 11 14:28:36 2011 @@ -1,4 +1,4 @@ -$Id: ChangeLog,v 1.1548 2011/03/10 12:06:43 alec Exp $ +$Id: ChangeLog,v 1.1549 2011/03/11 13:28:36 alec Exp $ version ? (????-??-??) @@ -27,6 +27,7 @@ - Added SMS notifications from helpdesk (alec) - BTS#0000843: Support SMS messages up to 459 chars using smscenter setvice (alec) - Force names of multicolumn unique constraints in PostgreSQL (alec) + - lmsd/payments: improved performance of assignment suspension check (alec) version 1.11.11 Bray (2011-01-17) From cvs w lms.org.pl Fri Mar 11 14:32:47 2011 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 11 Mar 2011 14:32:47 +0100 (CET) Subject: [lms-commits] CVS update of lms/modules (export.php) Message-ID: <20110311133247.36B8D302B612@eftep.altec.pl> Date: Friday, March 11, 2011 @ 14:32:47 Author: alec Path: /cvsroot/lms/modules Modified: export.php - Fixed mixed %NETTO and %VAT variables values in export file Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/modules/export.php.diff?&r1=1.14&r2=1.15 Index: lms/modules/export.php diff -u lms/modules/export.php:1.14 lms/modules/export.php:1.15 --- lms/modules/export.php:1.14 Tue Jan 18 09:12:22 2011 +++ lms/modules/export.php Fri Mar 11 14:32:47 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: export.php,v 1.14 2011/01/18 08:12:22 alec Exp $ + * $Id: export.php,v 1.15 2011/03/11 13:32:47 alec Exp $ */ include(isset($CONFIG['phpui']['export_config']) && $CONFIG['phpui']['export_config'] ? $CONFIG['phpui']['export_config'] : 'exportcfg.php'); @@ -269,11 +269,11 @@ { $line = $record ? $record : $inv_record; $i++; - + $clariondate = intval($doc['cdate']/86400)+61731; $date = date($date_format, $doc['cdate']); $number = docnumber($doc['number'], $doc['template'], $doc['cdate'], $doc['extnumber']); - + $line = str_replace('%CLARION_DATE', $clariondate, $line); $line = str_replace('%NUMBER', $number, $line); $line = str_replace('%DATE', $date, $line); @@ -300,9 +300,9 @@ $line = str_replace('%TAXED'.$v, form_num($taxes[$id]['taxed']), $line); $line = str_replace('%VAT'.$v, form_num($tax['tax']), $line); $line = str_replace('%NETTO'.$v, form_num($tax['val']), $line); - - $netto_v += $tax['tax']; - $tax_v += $tax['val']; + + $netto_v += $tax['val']; + $tax_v += $tax['tax']; } for($x=$v+1; $x<=8; $x++) { @@ -311,7 +311,7 @@ $line = str_replace('%NETTO'.$x, '0.00', $line); $line = str_replace('%TAXED'.$x, '0.00', $line); } - + $line = str_replace('%VAT', form_num($tax_v), $line); $line = str_replace('%NETTO', form_num($netto_v), $line); @@ -327,14 +327,14 @@ else $line = str_replace('%SUFFIX', '', $line); } - + if(strpos($line,'%TYPE')!==FALSE) { if($doc['reference']) $type = $cnote_type; else $type = $invoice_type; - + $line = str_replace('%TYPE', $type, $line); } @@ -353,9 +353,9 @@ $line = str_replace('%N', $doc['number'], $line); $line = str_replace('%I', $i, $line); - + print $line.$endln; - + unset($rec); unset($rectax); } From cvs w lms.org.pl Fri Mar 11 14:32:47 2011 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 11 Mar 2011 14:32:47 +0100 (CET) Subject: [lms-commits] CVS update of lms/doc (ChangeLog) Message-ID: <20110311133247.14C6A302B610@eftep.altec.pl> Date: Friday, March 11, 2011 @ 14:32:47 Author: alec Path: /cvsroot/lms/doc Modified: ChangeLog - Fixed mixed %NETTO and %VAT variables values in export file Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/ChangeLog.diff?&r1=1.1549&r2=1.1550 Index: lms/doc/ChangeLog diff -u lms/doc/ChangeLog:1.1549 lms/doc/ChangeLog:1.1550 --- lms/doc/ChangeLog:1.1549 Fri Mar 11 14:28:36 2011 +++ lms/doc/ChangeLog Fri Mar 11 14:32:46 2011 @@ -1,4 +1,4 @@ -$Id: ChangeLog,v 1.1549 2011/03/11 13:28:36 alec Exp $ +$Id: ChangeLog,v 1.1550 2011/03/11 13:32:46 alec Exp $ version ? (????-??-??) @@ -28,6 +28,7 @@ - BTS#0000843: Support SMS messages up to 459 chars using smscenter setvice (alec) - Force names of multicolumn unique constraints in PostgreSQL (alec) - lmsd/payments: improved performance of assignment suspension check (alec) + - Fixed mixed %NETTO and %VAT variables values in export file (alec) version 1.11.11 Bray (2011-01-17) From cvs w lms.org.pl Fri Mar 11 14:45:51 2011 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 11 Mar 2011 14:45:51 +0100 (CET) Subject: [lms-commits] CVS update of lms/doc (ChangeLog) Message-ID: <20110311134551.47AB5302B610@eftep.altec.pl> Date: Friday, March 11, 2011 @ 14:45:51 Author: alec Path: /cvsroot/lms/doc Modified: ChangeLog - Since now use square brackets for devs names in Changelog entries Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/ChangeLog.diff?&r1=1.1550&r2=1.1551 Index: lms/doc/ChangeLog diff -u lms/doc/ChangeLog:1.1550 lms/doc/ChangeLog:1.1551 --- lms/doc/ChangeLog:1.1550 Fri Mar 11 14:32:46 2011 +++ lms/doc/ChangeLog Fri Mar 11 14:45:51 2011 @@ -1,34 +1,34 @@ -$Id: ChangeLog,v 1.1550 2011/03/11 13:32:46 alec Exp $ +$Id: ChangeLog,v 1.1551 2011/03/11 13:45:51 alec Exp $ version ? (????-??-??) - - Don't send mail to deleted users (alec) - - BTS#0000847: Fixed UI language setting when HTTP_ACCEPT_LANGUAGE is not set (alec) + - Don't send mail to deleted users [alec] + - BTS#0000847: Fixed UI language setting when HTTP_ACCEPT_LANGUAGE is not set [alec] - Added option finances/cashimport_use_idate to use file import date - instead of cash operation date (alec) - - Fixed goto feature of the second scroller on the page (alec) - - BTS#0000848: Fixed cash import history report when source is selected (alec) - - Fixed SQL query in lms-makewarnings (alec) - - Fixed order of tables in database backup (alec) - - Fixed printing of DB errors while recovering database backup (alec) - - Added simple plugin API with some hooks on node actions (alec) - - BTS#0000856: Fixed "Hide/Show expired" link on node* pages (alec) - - lmsd/payments: Fixed error "Unknown column 'ats.customerid' in 'where clause'" (alec) - - Added Promotions with assignments shedule schemas (alec) - - Use tariff name+value+period as a unique key instead of just a name (alec) - - Now PostgreSQL 8.2 is required because of multi-value INSERT usage (alec) - - Fixed netdevices searching by MAC address (alec) - - BTS#0000860: Fixed sticky popups (alec) - - Added send_sms_before plugin hook (alec) + instead of cash operation date [alec] + - Fixed goto feature of the second scroller on the page [alec] + - BTS#0000848: Fixed cash import history report when source is selected [alec] + - Fixed SQL query in lms-makewarnings [alec] + - Fixed order of tables in database backup [alec] + - Fixed printing of DB errors while recovering database backup [alec] + - Added simple plugin API with some hooks on node actions [alec] + - BTS#0000856: Fixed "Hide/Show expired" link on node* pages [alec] + - lmsd/payments: Fixed error "Unknown column 'ats.customerid' in 'where clause'" [alec] + - Added Promotions with assignments shedule schemas [alec] + - Use tariff name+value+period as a unique key instead of just a name [alec] + - Now PostgreSQL 8.2 is required because of multi-value INSERT usage [alec] + - Fixed netdevices searching by MAC address [alec] + - BTS#0000860: Fixed sticky popups [alec] + - Added send_sms_before plugin hook [alec] - Don't send deplicated notifications to the users when they are using - the same e-mail address (alec) - - Removed userpanel/debug_email option, use mail/debug_email instead (alec) - - Added sms/debug_phone option (alec) - - Added SMS notifications from helpdesk (alec) - - BTS#0000843: Support SMS messages up to 459 chars using smscenter setvice (alec) - - Force names of multicolumn unique constraints in PostgreSQL (alec) - - lmsd/payments: improved performance of assignment suspension check (alec) - - Fixed mixed %NETTO and %VAT variables values in export file (alec) + the same e-mail address [alec] + - Removed userpanel/debug_email option, use mail/debug_email instead [alec] + - Added sms/debug_phone option [alec] + - Added SMS notifications from helpdesk [alec] + - BTS#0000843: Support SMS messages up to 459 chars using smscenter setvice [alec] + - Force names of multicolumn unique constraints in PostgreSQL [alec] + - lmsd/payments: improved performance of assignment suspension check [alec] + - Fixed mixed %NETTO and %VAT variables values in export file [alec] version 1.11.11 Bray (2011-01-17) From cvs w lms.org.pl Sat Mar 12 19:31:40 2011 From: cvs w lms.org.pl (LMS CVS) Date: Sat, 12 Mar 2011 19:31:40 +0100 (CET) Subject: [lms-commits] CVS update of lms/modules (export.php) Message-ID: <20110312183140.3B219302B610@eftep.altec.pl> Date: Saturday, March 12, 2011 @ 19:31:40 Author: alec Path: /cvsroot/lms/modules Modified: export.php - Next %VAT and %NETTO fix Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/modules/export.php.diff?&r1=1.15&r2=1.16 Index: lms/modules/export.php diff -u lms/modules/export.php:1.15 lms/modules/export.php:1.16 --- lms/modules/export.php:1.15 Fri Mar 11 14:32:47 2011 +++ lms/modules/export.php Sat Mar 12 19:31:39 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: export.php,v 1.15 2011/03/11 13:32:47 alec Exp $ + * $Id: export.php,v 1.16 2011/03/12 18:31:39 alec Exp $ */ include(isset($CONFIG['phpui']['export_config']) && $CONFIG['phpui']['export_config'] ? $CONFIG['phpui']['export_config'] : 'exportcfg.php'); @@ -229,7 +229,7 @@ if(is_array($inv_record)) foreach($inv_record as $r) $record .= $r; - + foreach($items as $idx => $row) { $docid = $row['docid']; @@ -256,13 +256,13 @@ $rectax[$item['taxid']]['val'] -= $refitemval; $rec['brutto'] -= $refitemsum; } - + $sum = $row['value'] * $row['count']; $val = round($row['value'] / ($taxes[$taxid]['value']+100) * 100, 2) * $row['count']; $tax = $sum - $val; - + $rectax[$taxid]['tax'] += $tax; - $rectax[$taxid]['val'] += $val; + $rectax[$taxid]['val'] += $val; $rec['brutto'] += $sum; if($row['docid'] != $items[$idx+1]['docid']) @@ -293,6 +293,9 @@ $line = str_replace('%ABSVALUE', str_replace('-','',form_num($rec['brutto'])), $line); $v = 0; + $netto_v = 0; + $tax_v = 0; + foreach($rectax as $id => $tax) { $v++; @@ -304,6 +307,7 @@ $netto_v += $tax['val']; $tax_v += $tax['tax']; } + for($x=$v+1; $x<=8; $x++) { $line = str_replace('%VATP'.$x, '0.00', $line); From cvs w lms.org.pl Sun Mar 13 10:46:13 2011 From: cvs w lms.org.pl (LMS CVS) Date: Sun, 13 Mar 2011 10:46:13 +0100 (CET) Subject: [lms-commits] CVS update of lms/daemon/modules/cutoff (cutoff.c, cutoff.h) Message-ID: <20110313094613.4B435302B612@eftep.altec.pl> Date: Sunday, March 13, 2011 @ 10:46:13 Author: alec Path: /cvsroot/lms/daemon/modules/cutoff Modified: cutoff.c cutoff.h - lmsd/cutoff: Fixed "Column 'period' in where clause is ambiguous" Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/daemon/modules/cutoff/cutoff.c.diff?&r1=1.43&r2=1.44 http://cvs.lms.org.pl/viewvc/Development/lms/daemon/modules/cutoff/cutoff.h.diff?&r1=1.14&r2=1.15 Index: lms/daemon/modules/cutoff/cutoff.c diff -u lms/daemon/modules/cutoff/cutoff.c:1.43 lms/daemon/modules/cutoff/cutoff.c:1.44 --- lms/daemon/modules/cutoff/cutoff.c:1.43 Tue Jan 18 09:12:02 2011 +++ lms/daemon/modules/cutoff/cutoff.c Sun Mar 13 10:46:13 2011 @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: cutoff.c,v 1.43 2011/01/18 08:12:02 alec Exp $ + * $Id: cutoff.c,v 1.44 2011/03/13 09:46:13 alec Exp $ */ #include @@ -30,6 +30,7 @@ #include "lmsd.h" #include "cutoff.h" +#include "defs.h" char * itoa(int i) { @@ -375,7 +376,7 @@ free(query); } - + // debtors if(plimit) query = strdup( @@ -386,17 +387,22 @@ "FROM cash " "GROUP BY customerid " "HAVING SUM(value) < 0 " - ") ca ON (c.id = ca.customerid) " + ") ca ON (c.id = ca.customerid) " // monthly assignments sum - "JOIN (SELECT SUM(value) AS tariff, customerid " - "FROM assignments, tariffs " - "WHERE tariffid = tariffs.id " - "AND period = 3 " - "AND suspended = 0 " - "AND (datefrom <= %NOW% OR datefrom = 0) " - "AND (dateto >= %NOW% OR dateto = 0) " - "GROUP BY customerid " - ") t ON (t.customerid = c.id) " + "JOIN (SELECT " + "SUM(t.value * (CASE t.period " + "WHEN " _YEARLY_ " THEN 1/12.0 " + "WHEN " _HALFYEARLY_ " THEN 1/6.0 " + "WHEN " _QUARTERLY_ " THEN 1/3.0 " + "ELSE 1 END)) AS tariff, a.customerid " + "FROM assignments a " + "JOIN tariffs t ON (a.tariffid = t.id) " + "WHERE a.period = 3 " + "AND a.suspended = 0 " + "AND (a.datefrom <= %NOW% OR a.datefrom = 0) " + "AND (a.dateto >= %NOW% OR a.dateto = 0) " + "GROUP BY a.customerid " + ") t ON (t.customerid = c.id) " "WHERE c.deleted = 0 " "AND c.cutoffstop < %NOW% " #ifdef USE_PGSQL Index: lms/daemon/modules/cutoff/cutoff.h diff -u lms/daemon/modules/cutoff/cutoff.h:1.14 lms/daemon/modules/cutoff/cutoff.h:1.15 --- lms/daemon/modules/cutoff/cutoff.h:1.14 Tue Jun 10 09:09:26 2008 +++ lms/daemon/modules/cutoff/cutoff.h Sun Mar 13 10:46:13 2011 @@ -2,7 +2,7 @@ struct cutoff_module { MODULE base; - + int warn_only; int nodegroup_only; int nodeassignments; @@ -17,7 +17,7 @@ char *expwarning; char *customergroups; - char *excluded_customergroups; + char *excluded_customergroups; char *networks; char *excluded_networks; }; From cvs w lms.org.pl Sun Mar 13 10:46:13 2011 From: cvs w lms.org.pl (LMS CVS) Date: Sun, 13 Mar 2011 10:46:13 +0100 (CET) Subject: [lms-commits] CVS update of lms/daemon/modules/payments (payments.c, payments.h) Message-ID: <20110313094613.6EB4A302B613@eftep.altec.pl> Date: Sunday, March 13, 2011 @ 10:46:13 Author: alec Path: /cvsroot/lms/daemon/modules/payments Modified: payments.c payments.h - lmsd/cutoff: Fixed "Column 'period' in where clause is ambiguous" Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/daemon/modules/payments/payments.c.diff?&r1=1.95&r2=1.96 http://cvs.lms.org.pl/viewvc/Development/lms/daemon/modules/payments/payments.h.diff?&r1=1.18&r2=1.19 Index: lms/daemon/modules/payments/payments.c diff -u lms/daemon/modules/payments/payments.c:1.95 lms/daemon/modules/payments/payments.c:1.96 --- lms/daemon/modules/payments/payments.c:1.95 Fri Mar 11 14:28:35 2011 +++ lms/daemon/modules/payments/payments.c Sun Mar 13 10:46:13 2011 @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: payments.c,v 1.95 2011/03/11 13:28:35 alec Exp $ + * $Id: payments.c,v 1.96 2011/03/13 09:46:13 alec Exp $ */ #include #include @@ -29,6 +29,7 @@ #include "lmsd.h" #include "payments.h" +#include "defs.h" char * itoa(int i) { Index: lms/daemon/modules/payments/payments.h diff -u lms/daemon/modules/payments/payments.h:1.18 lms/daemon/modules/payments/payments.h:1.19 --- lms/daemon/modules/payments/payments.h:1.18 Wed Jun 23 16:03:52 2010 +++ lms/daemon/modules/payments/payments.h Sun Mar 13 10:46:13 2011 @@ -27,23 +27,6 @@ int number; }; -#define HALFYEARLY 7 -#define CONTINUOUS 6 -#define YEARLY 5 -#define QUARTERLY 4 -#define MONTHLY 3 -#define WEEKLY 2 -#define DAILY 1 -#define DISPOSABLE 0 - -#define _HALFYEARLY_ "7" -#define _YEARLY_ "5" -#define _QUARTERLY_ "4" -#define _MONTHLY_ "3" -#define _WEEKLY_ "2" -#define _DAILY_ "1" -#define _DISPOSABLE_ "0" - #ifdef USE_PGSQL #define BROADCAST "cast(cast(address as bit(32)) | ~ cast(inet_aton(mask) as bit(32)) as bigint)" #define CURRVAL "SELECT currval('')" From cvs w lms.org.pl Sun Mar 13 10:46:13 2011 From: cvs w lms.org.pl (LMS CVS) Date: Sun, 13 Mar 2011 10:46:13 +0100 (CET) Subject: [lms-commits] CVS update of lms/daemon (defs.h, lmsd.h) Message-ID: <20110313094613.277BB302B610@eftep.altec.pl> Date: Sunday, March 13, 2011 @ 10:46:13 Author: alec Path: /cvsroot/lms/daemon Added: defs.h Modified: lmsd.h - lmsd/cutoff: Fixed "Column 'period' in where clause is ambiguous" Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/daemon/defs.h?rev=1.1 http://cvs.lms.org.pl/viewvc/Development/lms/daemon/lmsd.h.diff?&r1=1.10&r2=1.11 Index: lms/daemon/defs.h diff -u /dev/null lms/daemon/defs.h:1.1 --- /dev/null Sun Mar 13 10:46:13 2011 +++ lms/daemon/defs.h Sun Mar 13 10:46:12 2011 @@ -0,0 +1,16 @@ +#define _HALFYEARLY_ "7" +#define _YEARLY_ "5" +#define _QUARTERLY_ "4" +#define _MONTHLY_ "3" +#define _WEEKLY_ "2" +#define _DAILY_ "1" +#define _DISPOSABLE_ "0" + +#define HALFYEARLY 7 +#define CONTINUOUS 6 +#define YEARLY 5 +#define QUARTERLY 4 +#define MONTHLY 3 +#define WEEKLY 2 +#define DAILY 1 +#define DISPOSABLE 0 Index: lms/daemon/lmsd.h diff -u lms/daemon/lmsd.h:1.10 lms/daemon/lmsd.h:1.11 --- lms/daemon/lmsd.h:1.10 Fri Jan 2 16:33:12 2009 +++ lms/daemon/lmsd.h Sun Mar 13 10:46:12 2011 @@ -16,11 +16,11 @@ #define APIVERSION 5 #define PROGNAME "lmsd" -struct global +struct global { int api_version; ConnHandle *conn; - + // db functions ConnHandle * (*db_connect)(const char *, const char *, const char *, const char *, int, int); int (*db_disconnect)(ConnHandle *); @@ -42,7 +42,7 @@ int (*config_getint)(Config *, char *, char *, int); int (*config_getbool)(Config *, char *, char *, int); double (*config_getdouble)(Config *, char *, char *, double); - + // util functions int (*str_replace)(char **, const char *, const char *); char * (*str_save)(char *, const char *); From cvs w lms.org.pl Sun Mar 13 10:46:13 2011 From: cvs w lms.org.pl (LMS CVS) Date: Sun, 13 Mar 2011 10:46:13 +0100 (CET) Subject: [lms-commits] CVS update of lms/doc (ChangeLog) Message-ID: <20110313094613.921AE302B614@eftep.altec.pl> Date: Sunday, March 13, 2011 @ 10:46:13 Author: alec Path: /cvsroot/lms/doc Modified: ChangeLog - lmsd/cutoff: Fixed "Column 'period' in where clause is ambiguous" Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/ChangeLog.diff?&r1=1.1551&r2=1.1552 Index: lms/doc/ChangeLog diff -u lms/doc/ChangeLog:1.1551 lms/doc/ChangeLog:1.1552 --- lms/doc/ChangeLog:1.1551 Fri Mar 11 14:45:51 2011 +++ lms/doc/ChangeLog Sun Mar 13 10:46:13 2011 @@ -1,4 +1,4 @@ -$Id: ChangeLog,v 1.1551 2011/03/11 13:45:51 alec Exp $ +$Id: ChangeLog,v 1.1552 2011/03/13 09:46:13 alec Exp $ version ? (????-??-??) @@ -29,6 +29,7 @@ - Force names of multicolumn unique constraints in PostgreSQL [alec] - lmsd/payments: improved performance of assignment suspension check [alec] - Fixed mixed %NETTO and %VAT variables values in export file [alec] + - lmsd/cutoff: Fixed "Column 'period' in where clause is ambiguous" [alec] version 1.11.11 Bray (2011-01-17) From cvs w lms.org.pl Wed Mar 16 08:06:29 2011 From: cvs w lms.org.pl (LMS CVS) Date: Wed, 16 Mar 2011 08:06:29 +0100 (CET) Subject: [lms-commits] CVS update of lms/lib/upgradedb (mysql.2011022000.php) Message-ID: <20110316070629.462FB302B610@eftep.altec.pl> Date: Wednesday, March 16, 2011 @ 08:06:29 Author: alec Path: /cvsroot/lms/lib/upgradedb Modified: mysql.2011022000.php - Fix parse error Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/lib/upgradedb/mysql.2011022000.php.diff?&r1=1.1&r2=1.2 Index: lms/lib/upgradedb/mysql.2011022000.php diff -u lms/lib/upgradedb/mysql.2011022000.php:1.1 lms/lib/upgradedb/mysql.2011022000.php:1.2 --- lms/lib/upgradedb/mysql.2011022000.php:1.1 Wed Mar 2 11:31:05 2011 +++ lms/lib/upgradedb/mysql.2011022000.php Wed Mar 16 08:06:28 2011 @@ -31,7 +31,7 @@ disabled tinyint(1) DEFAULT '0' NOT NULL, PRIMARY KEY (id), UNIQUE KEY name (name) -) ENGINE=InnoDB") +) ENGINE=InnoDB"); $DB->Execute(" CREATE TABLE promotionschemas ( From cvs w lms.org.pl Wed Mar 16 16:24:24 2011 From: cvs w lms.org.pl (LMS CVS) Date: Wed, 16 Mar 2011 16:24:24 +0100 (CET) Subject: [lms-commits] CVS update of lms/lib (accesstable.php) Message-ID: <20110316152424.4027A302B610@eftep.altec.pl> Date: Wednesday, March 16, 2011 @ 16:24:24 Author: chilek Path: /cvsroot/lms/lib Modified: accesstable.php - fixed customerbalance access permission Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/lib/accesstable.php.diff?&r1=1.139&r2=1.140 Index: lms/lib/accesstable.php diff -u lms/lib/accesstable.php:1.139 lms/lib/accesstable.php:1.140 --- lms/lib/accesstable.php:1.139 Wed Mar 2 11:31:04 2011 +++ lms/lib/accesstable.php Wed Mar 16 16:24:24 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: accesstable.php,v 1.139 2011/03/02 10:31:04 alec Exp $ + * $Id: accesstable.php,v 1.140 2011/03/16 15:24:24 chilek Exp $ */ unset($access); @@ -38,7 +38,7 @@ $access['table'][2]['allow_reg'] = '^nodeset$'; $access['table'][3]['name'] = trans('finances management'); -$access['table'][3]['allow_reg'] = '^((tariff|customerassignment)(add|info|list|move|edit|del)|(payment)(add|del|edit|info|list)|(balance|customerbalance)(new|add|ok|del|list)|(cashreg(list|add|edit|del|info))|(invoice|invoice(list|new|edit|del|note|report|paid))|(note|note(list|add|edit|del|paid))|number|export|print|cashimport|cashimportparser|cashpackagedel)$'; +$access['table'][3]['allow_reg'] = '^((tariff|customerassignment)(add|info|list|move|edit|del)|(payment)(add|del|edit|info|list)|(balance|customerbalance)(new|add|ok|del|list|)|(cashreg(list|add|edit|del|info))|(invoice|invoice(list|new|edit|del|note|report|paid))|(note|note(list|add|edit|del|paid))|number|export|print|cashimport|cashimportparser|cashpackagedel)$'; $access['table'][4]['name'] = trans('configuration reload'); $access['table'][4]['allow_reg'] = '^reload$'; From cvs w lms.org.pl Thu Mar 17 13:50:46 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 17 Mar 2011 13:50:46 +0100 (CET) Subject: [lms-commits] CVS update of lms/doc (ChangeLog) Message-ID: <20110317125046.E9A24302B610@eftep.altec.pl> Date: Thursday, March 17, 2011 @ 13:50:46 Author: alec Path: /cvsroot/lms/doc Modified: ChangeLog - Fixed customers listing so, when using group/network filter together with "deleted" status, the list is empty Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/ChangeLog.diff?&r1=1.1552&r2=1.1553 Index: lms/doc/ChangeLog diff -u lms/doc/ChangeLog:1.1552 lms/doc/ChangeLog:1.1553 --- lms/doc/ChangeLog:1.1552 Sun Mar 13 10:46:13 2011 +++ lms/doc/ChangeLog Thu Mar 17 13:50:46 2011 @@ -1,4 +1,4 @@ -$Id: ChangeLog,v 1.1552 2011/03/13 09:46:13 alec Exp $ +$Id: ChangeLog,v 1.1553 2011/03/17 12:50:46 alec Exp $ version ? (????-??-??) @@ -30,6 +30,8 @@ - lmsd/payments: improved performance of assignment suspension check [alec] - Fixed mixed %NETTO and %VAT variables values in export file [alec] - lmsd/cutoff: Fixed "Column 'period' in where clause is ambiguous" [alec] + - Fixed customers listing so, when using group/network filter together + with "deleted" status, the list is empty [alec] version 1.11.11 Bray (2011-01-17) From cvs w lms.org.pl Thu Mar 17 13:50:47 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 17 Mar 2011 13:50:47 +0100 (CET) Subject: [lms-commits] CVS update of lms/lib (LMS.class.php) Message-ID: <20110317125047.46C9A302B613@eftep.altec.pl> Date: Thursday, March 17, 2011 @ 13:50:47 Author: alec Path: /cvsroot/lms/lib Modified: LMS.class.php - Fixed customers listing so, when using group/network filter together with "deleted" status, the list is empty Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/lib/LMS.class.php.diff?&r1=1.1057&r2=1.1058 Index: lms/lib/LMS.class.php diff -u lms/lib/LMS.class.php:1.1057 lms/lib/LMS.class.php:1.1058 --- lms/lib/LMS.class.php:1.1057 Thu Mar 10 12:36:38 2011 +++ lms/lib/LMS.class.php Thu Mar 17 13:50:47 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: LMS.class.php,v 1.1057 2011/03/10 11:36:38 alec Exp $ + * $Id: LMS.class.php,v 1.1058 2011/03/17 12:50:47 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.1057 $'; + var $_revision = '$Revision: 1.1058 $'; function LMS(&$DB, &$AUTH, &$CONFIG) // class variables setting { @@ -733,28 +733,28 @@ break; } - if($state == 4) { - $deleted = 1; - // don't use customergroup and network filtering - // when customer is deleted because we drop group assignments and nodes - // in DeleteCustomer() - $network=NULL; - $customergroup=NULL; - } - else - $deleted = 0; - - $disabled = ($state == 5) ? 1 : 0; - $indebted = ($state == 6) ? 1 : 0; - $online = ($state == 7) ? 1 : 0; - $groupless = ($state == 8) ? 1 : 0; - $tariffless = ($state == 9) ? 1 : 0; - $suspended = ($state == 10) ? 1 : 0; - - if($state>3) - $state = 0; + switch ($state) { + case 4: + // When customer is deleted we have no assigned groups or nodes, see DeleteCustomer(). + // Return empty list in this case + if (!empty($network) || !empty($customergroup) || !empty($nodegroup)) { + $customerlist['total'] = 0; + $customerlist['state'] = 0; + $customerlist['order'] = $order; + $customerlist['direction'] = $direction; + return $customerlist; + } + $deleted = 1; + break; + case 5: $disabled = 1; break; + case 6: $indebted = 1; break; + case 7: $online = 1; break; + case 8: $groupless = 1; break; + case 9: $tariffless = 1; break; + case 10: $suspended = 1; break; + } - if($network) + if ($network) $net = $this->GetNetworkParams($network); $over = 0; $below = 0; @@ -893,8 +893,8 @@ WHERE ownerid > 0 GROUP BY ownerid ) s ON (s.ownerid = c.id) - WHERE deleted = '.$deleted - .($state ? ' AND c.status = '.intval($state) : '') + WHERE deleted = '.intval($deleted) + .($state <= 3 ? ' AND c.status = '.intval($state) : '') .($division ? ' AND c.divisionid = '.intval($division) : '') .($online ? ' AND s.online = 1' : '') .($indebted ? ' AND b.value < 0' : '') From cvs w lms.org.pl Thu Mar 17 13:50:47 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 17 Mar 2011 13:50:47 +0100 (CET) Subject: [lms-commits] CVS update of lms/templates (customersearch.html) Message-ID: <20110317125047.11346302B612@eftep.altec.pl> Date: Thursday, March 17, 2011 @ 13:50:47 Author: alec Path: /cvsroot/lms/templates Modified: customersearch.html - Fixed customers listing so, when using group/network filter together with "deleted" status, the list is empty Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/templates/customersearch.html.diff?&r1=1.22&r2=1.23 Index: lms/templates/customersearch.html diff -u lms/templates/customersearch.html:1.22 lms/templates/customersearch.html:1.23 --- lms/templates/customersearch.html:1.22 Thu Nov 6 15:02:59 2008 +++ lms/templates/customersearch.html Thu Mar 17 13:50:46 2011 @@ -1,5 +1,5 @@ {include file="header.html"} - +

    {$layout.pagetitle}

    {include file="calendar_js.html"} -{include file="footer.html"} +{include file="footer.html"} From cvs w lms.org.pl Thu Mar 17 14:01:02 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 17 Mar 2011 14:01:02 +0100 (CET) Subject: [lms-commits] CVS update of lms/daemon/modules/tc (tc.c) Message-ID: <20110317130102.F273D302B610@eftep.altec.pl> Date: Thursday, March 17, 2011 @ 14:01:02 Author: alec Path: /cvsroot/lms/daemon/modules/tc Modified: tc.c - lmsd/tc: Added %h1, %h2, %h3, %h4 variables Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/daemon/modules/tc/tc.c.diff?&r1=1.44&r2=1.45 Index: lms/daemon/modules/tc/tc.c diff -u lms/daemon/modules/tc/tc.c:1.44 lms/daemon/modules/tc/tc.c:1.45 --- lms/daemon/modules/tc/tc.c:1.44 Tue Jan 18 09:12:04 2011 +++ lms/daemon/modules/tc/tc.c Thu Mar 17 14:01:02 2011 @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: tc.c,v 1.44 2011/01/18 08:12:04 alec Exp $ + * $Id: tc.c,v 1.45 2011/03/17 13:01:02 alec Exp $ */ #include @@ -43,7 +43,7 @@ char * itoha(int i) { static char string[8]; - sprintf(string, "%x", i); + sprintf(string, "%02X", i); return string; } @@ -202,15 +202,24 @@ int h_downceil = (int) n_downceil/cnt; int h_plimit = (int) n_plimit/cnt; int h_climit = (int) n_climit/cnt; - + unsigned long iplong = inet_addr(ipaddr); unsigned int hostip = ntohl(iplong); - - char *o1 = strdup(itoa((hostip >> 24) & 0xff)); // 1st octet - char *o2 = strdup(itoa((hostip >> 16) & 0xff)); // 2nd octet - char *o3 = strdup(itoa((hostip >> 8) & 0xff)); // 3rd octet - char *o4 = strdup(itoa(hostip & 0xff)); // 4th octet - char *i16 = strdup(itoha(hostip & 0xff)); // 4th octet in hex + + int d1 = (hostip >> 24) & 0xff; // 1st octet + int d2 = (hostip >> 16) & 0xff; // 2nd octet + int d3 = (hostip >> 8) & 0xff; // 3rd octet + int d4 = hostip & 0xff; // 4th octet + + char *o1 = strdup(itoa(d1)); + char *o2 = strdup(itoa(d2)); + char *o3 = strdup(itoa(d3)); + char *o4 = strdup(itoa(d4)); + + char *h1 = strdup(itoha(d1)); // 1st octet in hex + char *h2 = strdup(itoha(d2)); // 2nd octet in hex + char *h3 = strdup(itoha(d3)); // 3rd octet in hex + char *h4 = strdup(itoha(d4)); // 4th octet in hex // test node's membership in networks for(v=0; vstr_replace(&mark_up, "%n", name); g->str_replace(&mark_up, "%if", nets[v].interface); - g->str_replace(&mark_up, "%i16", i16); + g->str_replace(&mark_up, "%h1", h1); + g->str_replace(&mark_up, "%h2", h2); + g->str_replace(&mark_up, "%h3", h3); + g->str_replace(&mark_up, "%h4", h4); + g->str_replace(&mark_up, "%i16", h4); // for backward compat. g->str_replace(&mark_up, "%i", ipaddr); g->str_replace(&mark_up, "%m", mac); g->str_replace(&mark_up, "%o1", o1); @@ -234,10 +247,14 @@ g->str_replace(&mark_up, "%o4", o4); g->str_replace(&mark_up, "%x", itoa(x)); fprintf(fh, "%s", mark_up); - + g->str_replace(&mark_down, "%n", name); g->str_replace(&mark_down, "%if", nets[v].interface); - g->str_replace(&mark_down, "%i16", i16); + g->str_replace(&mark_down, "%h1", h1); + g->str_replace(&mark_down, "%h2", h2); + g->str_replace(&mark_down, "%h3", h3); + g->str_replace(&mark_down, "%h4", h4); + g->str_replace(&mark_down, "%i16", h4); // for backward comapt. g->str_replace(&mark_down, "%i", ipaddr); g->str_replace(&mark_down, "%m", mac); g->str_replace(&mark_down, "%o1", o1); @@ -251,9 +268,17 @@ { g->str_replace(&htb_up, "%n", name); g->str_replace(&htb_up, "%if", nets[v].interface); - g->str_replace(&htb_up, "%i16", i16); + g->str_replace(&htb_up, "%h1", h1); + g->str_replace(&htb_up, "%h2", h2); + g->str_replace(&htb_up, "%h3", h3); + g->str_replace(&htb_up, "%h4", h4); + g->str_replace(&htb_up, "%i16", h4); // for backard compat. g->str_replace(&htb_up, "%i", ipaddr); g->str_replace(&htb_up, "%m", mac); + g->str_replace(&htb_up, "%o1", o1); + g->str_replace(&htb_up, "%o2", o2); + g->str_replace(&htb_up, "%o3", o3); + g->str_replace(&htb_up, "%o4", o4); g->str_replace(&htb_up, "%x", itoa(x)); g->str_replace(&htb_up, "%uprate", itoa(h_uprate)); if(!h_upceil) @@ -263,9 +288,17 @@ g->str_replace(&htb_down, "%n", name); g->str_replace(&htb_down, "%if", nets[v].interface); - g->str_replace(&htb_down, "%i16", i16); + g->str_replace(&htb_down, "%h1", h1); + g->str_replace(&htb_down, "%h2", h2); + g->str_replace(&htb_down, "%h3", h3); + g->str_replace(&htb_down, "%h4", h4); + g->str_replace(&htb_down, "%i16", h4); // for backward compat. g->str_replace(&htb_down, "%i", ipaddr); g->str_replace(&htb_down, "%m", mac); + g->str_replace(&htb_down, "%o1", o1); + g->str_replace(&htb_down, "%o2", o2); + g->str_replace(&htb_down, "%o3", o3); + g->str_replace(&htb_down, "%o4", o4); g->str_replace(&htb_down, "%x", itoa(x)); g->str_replace(&htb_down, "%downrate", itoa(h_downrate)); if(!h_downceil) @@ -286,7 +319,11 @@ g->str_replace(&cl, "%climit", itoa(h_climit)); g->str_replace(&cl, "%n", name); g->str_replace(&cl, "%if", nets[v].interface); - g->str_replace(&cl, "%i16", i16); + g->str_replace(&cl, "%h1", h1); + g->str_replace(&cl, "%h2", h2); + g->str_replace(&cl, "%h3", h3); + g->str_replace(&cl, "%h4", h4); + g->str_replace(&cl, "%i16", h4); // for backward compat. g->str_replace(&cl, "%i", ipaddr); g->str_replace(&cl, "%m", mac); g->str_replace(&cl, "%o1", o1); @@ -296,13 +333,17 @@ g->str_replace(&cl, "%x", itoa(x)); fprintf(fh, "%s", cl); } - + if(h_plimit) { g->str_replace(&pl, "%plimit", itoa(h_plimit)); g->str_replace(&pl, "%n", name); g->str_replace(&pl, "%if", nets[v].interface); - g->str_replace(&pl, "%i16", i16); + g->str_replace(&pl, "%h1", h1); + g->str_replace(&pl, "%h2", h2); + g->str_replace(&pl, "%h3", h3); + g->str_replace(&pl, "%h4", h4); + g->str_replace(&pl, "%i16", h4); // for backward compat. g->str_replace(&pl, "%i", ipaddr); g->str_replace(&pl, "%m", mac); g->str_replace(&pl, "%o1", o1); @@ -319,8 +360,12 @@ g->str_replace(&cl, "%climit", itoa(n_climit)); g->str_replace(&cl, "%n", name); g->str_replace(&cl, "%if", nets[v].interface); - g->str_replace(&cl, "%i16", i16); - g->str_replace(&cl, "%i", ipaddr); + g->str_replace(&cl, "%h1", h1); + g->str_replace(&cl, "%h2", h2); + g->str_replace(&cl, "%h3", h3); + g->str_replace(&cl, "%h4", h4); + g->str_replace(&cl, "%i16", h4); // for backward compat. + g->str_replace(&cl, "%i", ipaddr); g->str_replace(&cl, "%m", mac); g->str_replace(&cl, "%o1", o1); g->str_replace(&cl, "%o2", o2); @@ -329,13 +374,17 @@ g->str_replace(&cl, "%x", itoa(x)); fprintf(fh, "%s", cl); } - + if(n_plimit) { g->str_replace(&pl, "%plimit", itoa(n_plimit)); g->str_replace(&pl, "%n", name); g->str_replace(&pl, "%if", nets[v].interface); - g->str_replace(&pl, "%i16", i16); + g->str_replace(&pl, "%h1", h1); + g->str_replace(&pl, "%h2", h2); + g->str_replace(&pl, "%h3", h3); + g->str_replace(&pl, "%h4", h4); + g->str_replace(&pl, "%i16", h4); // for backward compat. g->str_replace(&pl, "%i", ipaddr); g->str_replace(&pl, "%m", mac); g->str_replace(&pl, "%o1", o1); @@ -346,10 +395,10 @@ fprintf(fh, "%s", pl); } } - + if(tc->one_class_per_host) x++; } - + if(!tc->one_class_per_host && j==g->db_nrows(nres)-1 && got_node && n_downrate && n_uprate) { g->str_replace(&htb_up, "%n", name); @@ -377,7 +426,8 @@ free(cl); free(pl); free(mark_up); free(mark_down); free(htb_up); free(htb_down); - free(o1); free(o2); free(o3); free(o4); free(i16); + free(o1); free(o2); free(o3); free(o4); + free(h1); free(h2); free(h3); free(h4); } g->db_free(&nres); } From cvs w lms.org.pl Thu Mar 17 14:01:03 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 17 Mar 2011 14:01:03 +0100 (CET) Subject: [lms-commits] CVS update of lms/doc (ChangeLog, README, README.pl) Message-ID: <20110317130103.4AFA2302B610@eftep.altec.pl> Date: Thursday, March 17, 2011 @ 14:01:03 Author: alec Path: /cvsroot/lms/doc Modified: ChangeLog README README.pl - lmsd/tc: Added %h1, %h2, %h3, %h4 variables Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/ChangeLog.diff?&r1=1.1553&r2=1.1554 http://cvs.lms.org.pl/viewvc/Development/lms/doc/README.diff?&r1=1.234&r2=1.235 http://cvs.lms.org.pl/viewvc/Development/lms/doc/README.pl.diff?&r1=1.64&r2=1.65 Index: lms/doc/ChangeLog diff -u lms/doc/ChangeLog:1.1553 lms/doc/ChangeLog:1.1554 --- lms/doc/ChangeLog:1.1553 Thu Mar 17 13:50:46 2011 +++ lms/doc/ChangeLog Thu Mar 17 14:01:03 2011 @@ -1,4 +1,4 @@ -$Id: ChangeLog,v 1.1553 2011/03/17 12:50:46 alec Exp $ +$Id: ChangeLog,v 1.1554 2011/03/17 13:01:03 alec Exp $ version ? (????-??-??) @@ -32,6 +32,7 @@ - lmsd/cutoff: Fixed "Column 'period' in where clause is ambiguous" [alec] - Fixed customers listing so, when using group/network filter together with "deleted" status, the list is empty [alec] + - lmsd/tc: Added %h1, %h2, %h3, %h4 variables [alec] version 1.11.11 Bray (2011-01-17) Index: lms/doc/README diff -u lms/doc/README:1.234 lms/doc/README:1.235 --- lms/doc/README:1.234 Thu Mar 10 12:37:21 2011 +++ lms/doc/README Thu Mar 17 14:01:03 2011 @@ -4373,10 +4373,9 @@ are not zeroes rules are written to file with variables replacement. The following variables can be used in rules: %name - host name, %i - IP address, %m - MAC, %if - network interface, %uprate, %downrate, - %upceil, %downceil, %plimit, %climit, %i16 - IP's last octet heximal - representation, %o1, %o2, %o3, %o4 - IP's octets and %x - integer - counter with initial value of 100 incremented by one for each node (or - customer). + %upceil, %downceil, %plimit, %climit, %o1, %o2, %o3, %o4 - IP's octets, + %h1, %h2, %h3, %h4 - IP's octets in hex and %x - integer counter with + initial value of 100 incremented by one for each node (or customer). Default policy for creating HTB class is one class per all nodes belonging to each customer. It can be changed with 'one_class_per_host' Index: lms/doc/README.pl diff -u lms/doc/README.pl:1.64 lms/doc/README.pl:1.65 --- lms/doc/README.pl:1.64 Thu Mar 10 12:37:21 2011 +++ lms/doc/README.pl Thu Mar 17 14:01:03 2011 @@ -4965,10 +4965,10 @@ reguł do pliku z podmianą zmiennych. W regułkach można stosować następujące zmienne: %name - nazwa hosta, %i - adres IP, %m - MAC, %if - interfejs, %uprate, %downrate, %upceil, %downceil, %plimit, %climit, - %i16 - ostatni oktet adresu IP w formacie szesnastkowym, %o1, %o2, %o3, - %o4 - kolejne oktety adresu IP oraz %x - licznik o wartości początkowej - 100 zwiększany o jeden dla każdego komputera (lub klienta, w zależności - od ustawienia opcji one_class_per_host). + %o1, %o2, %o3, %o4 - kolejne oktety adresu IP, %h1, %h2, %h3, %h4 - + kolejne oktety adresu IP w zapisie szesnastkowym oraz %x - licznik o + wartości początkowej 100 zwiększany o jeden dla każdego komputera (lub + klienta, w zależności od ustawienia opcji one_class_per_host). Domyślna polityka tworzenia klas htb zakłada utworzenie jednej klasy dla wszystkich komputerów klienta. Może to być zmienione za pomocą From cvs w lms.org.pl Thu Mar 17 14:01:03 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 17 Mar 2011 14:01:03 +0100 (CET) Subject: [lms-commits] CVS update of lms/doc/html/en (daemon-modules.html) Message-ID: <20110317130103.687EA302B612@eftep.altec.pl> Date: Thursday, March 17, 2011 @ 14:01:03 Author: alec Path: /cvsroot/lms/doc/html/en Modified: daemon-modules.html - lmsd/tc: Added %h1, %h2, %h3, %h4 variables Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/html/en/daemon-modules.html.diff?&r1=1.50&r2=1.51 Index: lms/doc/html/en/daemon-modules.html diff -u lms/doc/html/en/daemon-modules.html:1.50 lms/doc/html/en/daemon-modules.html:1.51 --- lms/doc/html/en/daemon-modules.html:1.50 Fri Jan 14 15:07:26 2011 +++ lms/doc/html/en/daemon-modules.html Thu Mar 17 14:01:03 2011 @@ -1666,9 +1666,9 @@ downceil, connection limit) are being calculated for each customer. Then, loop is performed to check networks and groups (if specified). If limit values are not zeroes rules are written to file with variables replacement. The following variables can be used in rules: %name - host - name, %i - IP address, %m - MAC, %if - network interface, %uprate, %downrate, %upceil, %downceil, - %plimit, %climit, %i16 - IP's last octet heximal representation, %o1, %o2, %o3, %o4 - IP's octets - and %x - integer counter with initial value of 100 incremented by one for each node (or customer).

    Default policy for creating HTB class is one class per all nodes belonging to each customer. It can be changed with 'one_class_per_host' option.

    Date: Thursday, March 17, 2011 @ 14:01:03 Author: alec Path: /cvsroot/lms/doc/html/pl Modified: daemon-modules.html - lmsd/tc: Added %h1, %h2, %h3, %h4 variables Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/html/pl/daemon-modules.html.diff?&r1=1.72&r2=1.73 Index: lms/doc/html/pl/daemon-modules.html diff -u lms/doc/html/pl/daemon-modules.html:1.72 lms/doc/html/pl/daemon-modules.html:1.73 --- lms/doc/html/pl/daemon-modules.html:1.72 Sun Jan 16 12:21:09 2011 +++ lms/doc/html/pl/daemon-modules.html Thu Mar 17 14:01:03 2011 @@ -1768,9 +1768,9 @@ Następnie wykonywana jest pętla ze sprawdzeniem przynależności do grupy klientów i sieci (jeśli określono). Jeśli wartości ograniczeń są różne od zera następuje zapis reguł do pliku z podmianą zmiennych. W regułkach można stosować następujące - zmienne: %name - nazwa hosta, %i - adres IP, %m - MAC, %if - interfejs, %uprate, %downrate, %upceil, - %downceil, %plimit, %climit, %i16 - ostatni oktet adresu IP w formacie - szesnastkowym, %o1, %o2, %o3, %o4 - kolejne oktety adresu IP oraz %x - licznik o wartości początkowej 100 + zmienne: %name - nazwa hosta, %i - adres IP, %m - MAC, %if - interfejs, %uprate, %downrate, %upceil, + %downceil, %plimit, %climit, %o1, %o2, %o3, %o4 - kolejne oktety adresu IP, + %h1, %h2, %h3, %h4 - kolejne oktety adresu IP w zapisie szesnastkowym oraz %x - licznik o wartości początkowej 100 zwiększany o jeden dla każdego komputera (lub klienta, w zależności od ustawienia opcji Date: Thursday, March 17, 2011 @ 14:01:03 Author: alec Path: /cvsroot/lms/doc/sgml Modified: daemon.sgml - lmsd/tc: Added %h1, %h2, %h3, %h4 variables Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/sgml/daemon.sgml.diff?&r1=1.111&r2=1.112 Index: lms/doc/sgml/daemon.sgml diff -u lms/doc/sgml/daemon.sgml:1.111 lms/doc/sgml/daemon.sgml:1.112 --- lms/doc/sgml/daemon.sgml:1.111 Fri Jan 14 15:07:26 2011 +++ lms/doc/sgml/daemon.sgml Thu Mar 17 14:01:03 2011 @@ -1,4 +1,4 @@ - + LMS Daemon @@ -884,9 +884,9 @@ downceil, connection limit) are being calculated for each customer. Then, loop is performed to check networks and groups (if specified). If limit values are not zeroes rules are written to file with variables replacement. The following variables can be used in rules: %name - host - name, %i - IP address, %m - MAC, %if - network interface, %uprate, %downrate, %upceil, %downceil, - %plimit, %climit, %i16 - IP's last octet heximal representation, %o1, %o2, %o3, %o4 - IP's octets - and %x - integer counter with initial value of 100 incremented by one for each node (or customer). + name, %i - IP address, %m - MAC, %if - network interface, %uprate, %downrate, %upceil, %downceil, + %plimit, %climit, %o1, %o2, %o3, %o4 - IP's octets, %h1, %h2, %h3, %h4 - IP's octets in hex + and %x - integer counter with initial value of 100 incremented by one for each node (or customer). Default policy for creating HTB class is one class per all nodes belonging to each customer. It can be changed with 'one_class_per_host' option. Default configuration assumes that your system supports HTB and iptables with From cvs w lms.org.pl Thu Mar 17 14:01:03 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 17 Mar 2011 14:01:03 +0100 (CET) Subject: [lms-commits] CVS update of lms/doc/sgml/pl (daemon.sgml) Message-ID: <20110317130103.D9184302B613@eftep.altec.pl> Date: Thursday, March 17, 2011 @ 14:01:03 Author: alec Path: /cvsroot/lms/doc/sgml/pl Modified: daemon.sgml - lmsd/tc: Added %h1, %h2, %h3, %h4 variables Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/sgml/pl/daemon.sgml.diff?&r1=1.85&r2=1.86 Index: lms/doc/sgml/pl/daemon.sgml diff -u lms/doc/sgml/pl/daemon.sgml:1.85 lms/doc/sgml/pl/daemon.sgml:1.86 --- lms/doc/sgml/pl/daemon.sgml:1.85 Sun Jan 16 12:21:09 2011 +++ lms/doc/sgml/pl/daemon.sgml Thu Mar 17 14:01:03 2011 @@ -1,4 +1,4 @@ - + LMS Daemon @@ -959,9 +959,9 @@ Następnie wykonywana jest pętla ze sprawdzeniem przynależności do grupy klientów i sieci (jeśli określono). Jeśli wartości ograniczeń są różne od zera następuje zapis reguł do pliku z podmianą zmiennych. W regułkach można stosować następujące - zmienne: %name - nazwa hosta, %i - adres IP, %m - MAC, %if - interfejs, %uprate, %downrate, %upceil, - %downceil, %plimit, %climit, %i16 - ostatni oktet adresu IP w formacie - szesnastkowym, %o1, %o2, %o3, %o4 - kolejne oktety adresu IP oraz %x - licznik o wartości początkowej 100 + zmienne: %name - nazwa hosta, %i - adres IP, %m - MAC, %if - interfejs, %uprate, %downrate, %upceil, + %downceil, %plimit, %climit, %o1, %o2, %o3, %o4 - kolejne oktety adresu IP, + %h1, %h2, %h3, %h4 - kolejne oktety adresu IP w zapisie szesnastkowym oraz %x - licznik o wartości początkowej 100 zwiększany o jeden dla każdego komputera (lub klienta, w zależności od ustawienia opcji one_class_per_host). Domyślna polityka tworzenia klas htb zakłada utworzenie jednej klasy dla From cvs w lms.org.pl Thu Mar 17 14:12:14 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 17 Mar 2011 14:12:14 +0100 (CET) Subject: [lms-commits] CVS update of lms/daemon/modules/hostfile (hostfile.c) Message-ID: <20110317131214.9CB0C302B610@eftep.altec.pl> Date: Thursday, March 17, 2011 @ 14:12:14 Author: alec Path: /cvsroot/lms/daemon/modules/hostfile Modified: hostfile.c - lmsd/tc-new: Added %h1, %h2, %h3, %h4 variables Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/daemon/modules/hostfile/hostfile.c.diff?&r1=1.67&r2=1.68 Index: lms/daemon/modules/hostfile/hostfile.c diff -u lms/daemon/modules/hostfile/hostfile.c:1.67 lms/daemon/modules/hostfile/hostfile.c:1.68 --- lms/daemon/modules/hostfile/hostfile.c:1.67 Tue Jan 18 09:12:03 2011 +++ lms/daemon/modules/hostfile/hostfile.c Thu Mar 17 14:12:14 2011 @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: hostfile.c,v 1.67 2011/01/18 08:12:03 alec Exp $ + * $Id: hostfile.c,v 1.68 2011/03/17 13:12:14 alec Exp $ */ #include @@ -34,8 +34,8 @@ char * itoha(int i) { - static char string[8]; - sprintf(string, "%x", i); + static char string[8]; + sprintf(string, "%02X", i); return string; } From cvs w lms.org.pl Thu Mar 17 14:12:14 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 17 Mar 2011 14:12:14 +0100 (CET) Subject: [lms-commits] CVS update of lms/daemon/modules/tc-new (tc-new.c) Message-ID: <20110317131214.BBB7D302B612@eftep.altec.pl> Date: Thursday, March 17, 2011 @ 14:12:14 Author: alec Path: /cvsroot/lms/daemon/modules/tc-new Modified: tc-new.c - lmsd/tc-new: Added %h1, %h2, %h3, %h4 variables Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/daemon/modules/tc-new/tc-new.c.diff?&r1=1.9&r2=1.10 Index: lms/daemon/modules/tc-new/tc-new.c diff -u lms/daemon/modules/tc-new/tc-new.c:1.9 lms/daemon/modules/tc-new/tc-new.c:1.10 --- lms/daemon/modules/tc-new/tc-new.c:1.9 Sun Jan 16 12:21:08 2011 +++ lms/daemon/modules/tc-new/tc-new.c Thu Mar 17 14:12:14 2011 @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: tc-new.c,v 1.9 2011/01/16 11:21:08 alec Exp $ + * $Id: tc-new.c,v 1.10 2011/03/17 13:12:14 alec Exp $ */ #include @@ -44,7 +44,7 @@ char * itoha(int i) { static char string[8]; - sprintf(string, "%x", i); + sprintf(string, "%02X", i); return string; } @@ -373,11 +373,21 @@ // octal parts of IP unsigned int hostip = ntohl(inet_addr(host.ip)); - char *o1 = strdup(itoa((hostip >> 24) & 0xff)); // first octet - char *o2 = strdup(itoa((hostip >> 16) & 0xff)); // second octet - char *o3 = strdup(itoa((hostip >> 8) & 0xff)); // third octet - char *o4 = strdup(itoa(hostip & 0xff)); // last octet - char *i16 = strdup(itoha(hostip & 0xff)); // last octet in hex + + int d1 = (hostip >> 24) & 0xff; // first octet + int d2 = (hostip >> 16) & 0xff; // second octet + int d3 = (hostip >> 8) & 0xff; // third octet + int d4 = hostip & 0xff; // last octet + + char *o1 = strdup(itoa(d1)); + char *o2 = strdup(itoa(d2)); + char *o3 = strdup(itoa(d3)); + char *o4 = strdup(itoa(d4)); + + char *h1 = strdup(itoha(d1)); + char *h2 = strdup(itoha(d2)); + char *h3 = strdup(itoha(d3)); + char *h4 = strdup(itoha(d4)); char *h_up = strdup(tc->filter_up); char *h_down = strdup(tc->filter_down); @@ -391,7 +401,7 @@ // make rules... g->str_replace(&h_up, "%n", host.name); g->str_replace(&h_up, "%if", nets[host.network].interface); - g->str_replace(&h_up, "%i16", i16); + g->str_replace(&h_up, "%i16", h4); g->str_replace(&h_up, "%i", host.ip); g->str_replace(&h_up, "%ms", host.mac); g->str_replace(&h_up, "%m", mac); @@ -400,11 +410,15 @@ g->str_replace(&h_up, "%o2", o2); g->str_replace(&h_up, "%o3", o3); g->str_replace(&h_up, "%o4", o4); + g->str_replace(&h_up, "%h1", h1); + g->str_replace(&h_up, "%h2", h2); + g->str_replace(&h_up, "%h3", h3); + g->str_replace(&h_up, "%h4", h4); g->str_replace(&h_up, "%h", itoa(ux)); g->str_replace(&h_down, "%n", host.name); g->str_replace(&h_down, "%if", nets[host.network].interface); - g->str_replace(&h_down, "%i16", i16); + g->str_replace(&h_down, "%i16", h4); g->str_replace(&h_down, "%i", host.ip); g->str_replace(&h_down, "%ms", host.mac); g->str_replace(&h_down, "%m", mac); @@ -413,6 +427,10 @@ g->str_replace(&h_down, "%o2", o2); g->str_replace(&h_down, "%o3", o3); g->str_replace(&h_down, "%o4", o4); + g->str_replace(&h_down, "%h1", h1); + g->str_replace(&h_down, "%h2", h2); + g->str_replace(&h_down, "%h3", h3); + g->str_replace(&h_down, "%h4", h4); g->str_replace(&h_down, "%h", itoa(dx)); // ...write to file @@ -429,7 +447,7 @@ g->str_replace(&cl, "%climit", itoa(c.climit)); g->str_replace(&cl, "%n", host.name); g->str_replace(&cl, "%if", nets[host.network].interface); - g->str_replace(&cl, "%i16", i16); + g->str_replace(&cl, "%i16", h4); g->str_replace(&cl, "%i", host.ip); g->str_replace(&cl, "%ms", host.mac); g->str_replace(&cl, "%m", mac); @@ -437,6 +455,10 @@ g->str_replace(&cl, "%o2", o2); g->str_replace(&cl, "%o3", o3); g->str_replace(&cl, "%o4", o4); + g->str_replace(&cl, "%h1", h1); + g->str_replace(&cl, "%h2", h2); + g->str_replace(&cl, "%h3", h3); + g->str_replace(&cl, "%h4", h4); fprintf(fh, "%s", cl); free(cl); @@ -449,7 +471,7 @@ g->str_replace(&pl, "%plimit", itoa(c.plimit)); g->str_replace(&pl, "%n", host.name); g->str_replace(&pl, "%if", nets[host.network].interface); - g->str_replace(&pl, "%i16", i16); + g->str_replace(&pl, "%i16", h4); g->str_replace(&pl, "%i", host.ip); g->str_replace(&pl, "%ms", host.mac); g->str_replace(&pl, "%m", mac); @@ -457,6 +479,10 @@ g->str_replace(&pl, "%o2", o2); g->str_replace(&pl, "%o3", o3); g->str_replace(&pl, "%o4", o4); + g->str_replace(&pl, "%h1", h1); + g->str_replace(&pl, "%h2", h2); + g->str_replace(&pl, "%h3", h3); + g->str_replace(&pl, "%h4", h4); fprintf(fh, "%s", pl); free(pl); @@ -469,7 +495,10 @@ free(o2); free(o3); free(o4); - free(i16); + free(h1); + free(h2); + free(h3); + free(h4); free(mac); } From cvs w lms.org.pl Thu Mar 17 14:12:15 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 17 Mar 2011 14:12:15 +0100 (CET) Subject: [lms-commits] CVS update of lms/doc/html/pl (daemon-modules.html) Message-ID: <20110317131215.148AB302B610@eftep.altec.pl> Date: Thursday, March 17, 2011 @ 14:12:15 Author: alec Path: /cvsroot/lms/doc/html/pl Modified: daemon-modules.html - lmsd/tc-new: Added %h1, %h2, %h3, %h4 variables Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/html/pl/daemon-modules.html.diff?&r1=1.73&r2=1.74 Index: lms/doc/html/pl/daemon-modules.html diff -u lms/doc/html/pl/daemon-modules.html:1.73 lms/doc/html/pl/daemon-modules.html:1.74 --- lms/doc/html/pl/daemon-modules.html:1.73 Thu Mar 17 14:01:03 2011 +++ lms/doc/html/pl/daemon-modules.html Thu Mar 17 14:12:14 2011 @@ -2231,9 +2231,11 @@ >filter_up

    Definicja filtrów dla ruchu w kierunku od hosta. Dozwolone zmienne: - %n - nazwa hosta, %if - nazwa interfejsu sieci, %i16 - ostatni oktet adresu szesnastkowo, + %n - nazwa hosta, %if - nazwa interfejsu sieci, %i - adres, %m - mac, %ms - lista adresów MAC hosta (oddzielonych przecinkiem), - %o1, %o2, %o3, %o4 - oktety adresu dziesiętnie, %h - uchwyt klasy, %x - uchwyt filtra (unikalny numer reguły). Domyślnie: + %o1, %o2, %o3, %o4 - oktety adresu dziesiętnie, %h1, %h2, %h3, %h4 - oktety adresu + w zapisie szesnastkowym, %h - uchwyt klasy, %x - uchwyt filtra (unikalny numer reguły). + Domyślnie:

    # %n
    @@ -2251,10 +2253,11 @@
     >filter_down

    Definicja filtrów dla ruchu w kierunku do hosta. Dozwolone zmienne: - %n - nazwa hosta, %if - nazwa interfejsu sieci, %i16 - ostatni - oktet adresu szesnastkowo, %i - adres, %m - mac, - %ms - lista adresów MAC hosta (oddzielonych przecinkiem), %o1, %o2, %o3, - %o4 - oktety adresu dziesiętnie, %h - uchwyt klasy, %x - uchwyt + %n - nazwa hosta, %if - nazwa interfejsu sieci, %i - adres, %m - mac, + %ms - lista adresów MAC hosta (oddzielonych przecinkiem), + %o1, %o2, %o3, %o4 - oktety adresu dziesiętnie, + %h1, %h2, %h3, %h4 - oktety adresu w zapisie szesnastkowym, + %h - uchwyt klasy, %x - uchwyt filtra (unikalny numer reguły). Domyślnie:

    Definicja reguły dla limitu połączeń hosta. Dozwolone zmienne: %n - nazwa hosta, %if - nazwa interfejsu sieci, - %i16 - ostatni oktet adresu szesnastkowo, %i - adres, %m - mac, - %ms - lista adresów MAC hosta (oddzielonych przecinkiem), - %o1, %o2, %o3, %o4 - oktety adresu dziesiętnie, %climit - limit - połączeń. Domyślnie: + %i - adres, %m - mac, %ms - lista adresów MAC hosta (oddzielonych przecinkiem), + %o1, %o2, %o3, %o4 - oktety adresu dziesiętnie, + %h1, %h2, %h3, %h4 - oktety adresu w zapisie szesnastkowym, + %climit - limit połączeń. Domyślnie:

    $IPT -t filter -I FORWARD -p tcp -s %i -m connlimit --connlimit-above %climit -j REJECT
    @@ -2294,10 +2297,10 @@
     >

    Definicja reguły dla limitu pakietów dla hosta. Dozwolone zmienne: %n - nazwa hosta, %if - nazwa interfejsu sieci, - %i16 - ostatni oktet adresu szesnastkowo, %i - adres, %m - mac, - %ms - lista adresów MAC hosta (oddzielonych przecinkiem), - %o1, %o2, %o3, %o4 - oktety adresu dziesiętnie, %plimit - limit - pakietów. Domyślnie: + %i - adres, %m - mac, %ms - lista adresów MAC hosta (oddzielonych przecinkiem), + %o1, %o2, %o3, %o4 - oktety adresu dziesiętnie, + %h1, %h2, %h3, %h4 - oktety adresu w zapisie szesnastkowym, + %plimit - limit pakietów. Domyślnie:

    $IPT -t filter -I FORWARD -d %i -m limit --limit %plimit/s -j ACCEPT
    
    From cvs w lms.org.pl  Thu Mar 17 14:12:14 2011
    From: cvs w lms.org.pl (LMS CVS)
    Date: Thu, 17 Mar 2011 14:12:14 +0100 (CET)
    Subject: [lms-commits] CVS update of lms/doc (ChangeLog, README.pl)
    Message-ID: <20110317131214.E6A0D302B613@eftep.altec.pl>
    
    Date: Thursday, March 17, 2011 @ 14:12:14
    Author: alec
    Path: /cvsroot/lms/doc
    
    Modified: ChangeLog README.pl
    
    - lmsd/tc-new: Added %h1, %h2, %h3, %h4 variables
    
    
    Diff URLs:
    http://cvs.lms.org.pl/viewvc/Development/lms/doc/ChangeLog.diff?&r1=1.1554&r2=1.1555
    http://cvs.lms.org.pl/viewvc/Development/lms/doc/README.pl.diff?&r1=1.65&r2=1.66
    
    
    Index: lms/doc/ChangeLog
    diff -u lms/doc/ChangeLog:1.1554 lms/doc/ChangeLog:1.1555
    --- lms/doc/ChangeLog:1.1554	Thu Mar 17 14:01:03 2011
    +++ lms/doc/ChangeLog	Thu Mar 17 14:12:14 2011
    @@ -1,4 +1,4 @@
    -$Id: ChangeLog,v 1.1554 2011/03/17 13:01:03 alec Exp $
    +$Id: ChangeLog,v 1.1555 2011/03/17 13:12:14 alec Exp $
     
     version ? (????-??-??)
     
    @@ -32,7 +32,7 @@
       - lmsd/cutoff: Fixed "Column 'period' in where clause is ambiguous" [alec]
       - Fixed customers listing so, when using group/network filter together
         with "deleted" status, the list is empty [alec]
    -  - lmsd/tc: Added %h1, %h2, %h3, %h4 variables [alec]
    +  - lmsd/tc,tc-new: Added %h1, %h2, %h3, %h4 variables [alec]
     
     version 1.11.11 Bray (2011-01-17)
     
    Index: lms/doc/README.pl
    diff -u lms/doc/README.pl:1.65 lms/doc/README.pl:1.66
    --- lms/doc/README.pl:1.65	Thu Mar 17 14:01:03 2011
    +++ lms/doc/README.pl	Thu Mar 17 14:12:14 2011
    @@ -5200,11 +5200,11 @@
            quantum 1500"
          * filter_up
            Definicja filtrów dla ruchu w kierunku od hosta. Dozwolone zmienne:
    -       %n - nazwa hosta, %if - nazwa interfejsu sieci, %i16 - ostatni
    -       oktet adresu szesnastkowo, %i - adres, %m - mac, %ms - lista
    -       adresów MAC hosta (oddzielonych przecinkiem), %o1, %o2, %o3, %o4 -
    -       oktety adresu dziesiętnie, %h - uchwyt klasy, %x - uchwyt filtra
    -       (unikalny numer reguły). Domyślnie:
    +       %n - nazwa hosta, %if - nazwa interfejsu sieci, %i - adres, %m -
    +       mac, %ms - lista adresów MAC hosta (oddzielonych przecinkiem), %o1,
    +       %o2, %o3, %o4 - oktety adresu dziesiętnie, %h1, %h2, %h3, %h4 -
    +       oktety adresu w zapisie szesnastkowym, %h - uchwyt klasy, %x -
    +       uchwyt filtra (unikalny numer reguły). Domyślnie:
     # %n
     $IPT -t mangle -A LIMITS -s %i -j MARK --set-mark %x
     $TC filter add dev $WAN parent 2:0 protocol ip prio 5 handle %x fw flowid 2:%h
    @@ -5212,30 +5212,32 @@
            --set-class 2:%h\n"
          * filter_down
            Definicja filtrów dla ruchu w kierunku do hosta. Dozwolone zmienne:
    -       %n - nazwa hosta, %if - nazwa interfejsu sieci, %i16 - ostatni
    -       oktet adresu szesnastkowo, %i - adres, %m - mac, %ms - lista
    -       adresów MAC hosta (oddzielonych przecinkiem), %o1, %o2, %o3, %o4 -
    -       oktety adresu dziesiętnie, %h - uchwyt klasy, %x - uchwyt filtra
    -       (unikalny numer reguły). Domyślnie:
    +       %n - nazwa hosta, %if - nazwa interfejsu sieci, %i - adres, %m -
    +       mac, %ms - lista adresów MAC hosta (oddzielonych przecinkiem), %o1,
    +       %o2, %o3, %o4 - oktety adresu dziesiętnie, %h1, %h2, %h3, %h4 -
    +       oktety adresu w zapisie szesnastkowym, %h - uchwyt klasy, %x -
    +       uchwyt filtra (unikalny numer reguły). Domyślnie:
     $IPT -t mangle -A LIMITS -d %i -j MARK --set-mark %x
     $TC filter add dev $LAN parent 1:0 protocol ip prio 5 handle %x fw flowid 1:%h
            Przykład: class_down = "%n\n$IPT -A dst%o3 -d %i -j CLASSIFY
            --set-class 1:%h\n"
          * climit
            Definicja reguły dla limitu połączeń hosta. Dozwolone zmienne: %n -
    -       nazwa hosta, %if - nazwa interfejsu sieci, %i16 - ostatni oktet
    -       adresu szesnastkowo, %i - adres, %m - mac, %ms - lista adresów MAC
    -       hosta (oddzielonych przecinkiem), %o1, %o2, %o3, %o4 - oktety
    -       adresu dziesiętnie, %climit - limit połączeń. Domyślnie:
    +       nazwa hosta, %if - nazwa interfejsu sieci, %i - adres, %m - mac,
    +       %ms - lista adresów MAC hosta (oddzielonych przecinkiem), %o1, %o2,
    +       %o3, %o4 - oktety adresu dziesiętnie, %h1, %h2, %h3, %h4 - oktety
    +       adresu w zapisie szesnastkowym, %climit - limit połączeń.
    +       Domyślnie:
     $IPT -t filter -I FORWARD -p tcp -s %i -m connlimit --connlimit-above %climit -j REJECT
     
            Przykład: climit = ""
          * plimit
            Definicja reguły dla limitu pakietów dla hosta. Dozwolone zmienne:
    -       %n - nazwa hosta, %if - nazwa interfejsu sieci, %i16 - ostatni
    -       oktet adresu szesnastkowo, %i - adres, %m - mac, %ms - lista
    -       adresów MAC hosta (oddzielonych przecinkiem), %o1, %o2, %o3, %o4 -
    -       oktety adresu dziesiętnie, %plimit - limit pakietów. Domyślnie:
    +       %n - nazwa hosta, %if - nazwa interfejsu sieci, %i - adres, %m -
    +       mac, %ms - lista adresów MAC hosta (oddzielonych przecinkiem), %o1,
    +       %o2, %o3, %o4 - oktety adresu dziesiętnie, %h1, %h2, %h3, %h4 -
    +       oktety adresu w zapisie szesnastkowym, %plimit - limit pakietów.
    +       Domyślnie:
     $IPT -t filter -I FORWARD -d %i -m limit --limit %plimit/s -j ACCEPT
     $IPT -t filter -I FORWARD -s %i -m limit --limit %plimit/s -j ACCEPT
     
    
    From cvs w lms.org.pl  Thu Mar 17 14:12:15 2011
    From: cvs w lms.org.pl (LMS CVS)
    Date: Thu, 17 Mar 2011 14:12:15 +0100 (CET)
    Subject: [lms-commits] CVS update of lms/doc/sgml/pl (daemon.sgml)
    Message-ID: <20110317131215.3687B302B612@eftep.altec.pl>
    
    Date: Thursday, March 17, 2011 @ 14:12:15
    Author: alec
    Path: /cvsroot/lms/doc/sgml/pl
    
    Modified: daemon.sgml
    
    - lmsd/tc-new: Added %h1, %h2, %h3, %h4 variables
    
    
    Diff URLs:
    http://cvs.lms.org.pl/viewvc/Development/lms/doc/sgml/pl/daemon.sgml.diff?&r1=1.86&r2=1.87
    
    
    Index: lms/doc/sgml/pl/daemon.sgml
    diff -u lms/doc/sgml/pl/daemon.sgml:1.86 lms/doc/sgml/pl/daemon.sgml:1.87
    --- lms/doc/sgml/pl/daemon.sgml:1.86	Thu Mar 17 14:01:03 2011
    +++ lms/doc/sgml/pl/daemon.sgml	Thu Mar 17 14:12:15 2011
    @@ -1,4 +1,4 @@
    -
    +
     
     	LMS Daemon
     	
    @@ -1250,9 +1250,11 @@
     				
     					filter_up
     					Definicja filtrów dla ruchu w kierunku od hosta. Dozwolone zmienne:
    -					%n - nazwa hosta, %if - nazwa interfejsu sieci, %i16 - ostatni oktet adresu szesnastkowo, 
    +					%n - nazwa hosta, %if - nazwa interfejsu sieci,
     					%i - adres, %m - mac, %ms - lista adresów MAC hosta (oddzielonych przecinkiem),
    -					%o1, %o2, %o3, %o4 - oktety adresu dziesiętnie, %h - uchwyt klasy, %x - uchwyt filtra (unikalny numer reguły). Domyślnie: 
    +					%o1, %o2, %o3, %o4 - oktety adresu dziesiętnie, %h1, %h2, %h3, %h4 - oktety adresu
    +					w zapisie szesnastkowym, %h - uchwyt klasy, %x - uchwyt filtra (unikalny numer reguły).
    +					Domyślnie:
     					
     # %n
     $IPT -t mangle -A LIMITS -s %i -j MARK --set-mark %x
    @@ -1263,10 +1265,11 @@
     				
     					filter_down
     					Definicja filtrów dla ruchu w kierunku do hosta. Dozwolone zmienne:
    -					%n - nazwa hosta, %if - nazwa interfejsu sieci, %i16 - ostatni 
    -					oktet adresu szesnastkowo, %i - adres, %m - mac, 
    -					%ms - lista adresów MAC hosta (oddzielonych przecinkiem), %o1, %o2, %o3, 
    -					%o4 - oktety adresu dziesiętnie, %h - uchwyt klasy, %x - uchwyt
    +					%n - nazwa hosta, %if - nazwa interfejsu sieci, %i - adres, %m - mac, 
    +					%ms - lista adresów MAC hosta (oddzielonych przecinkiem),
    +					%o1, %o2, %o3, %o4 - oktety adresu dziesiętnie,
    +					%h1, %h2, %h3, %h4 - oktety adresu w zapisie szesnastkowym,
    +					%h - uchwyt klasy, %x - uchwyt
     					filtra (unikalny numer reguły). Domyślnie: 
     					
     $IPT -t mangle -A LIMITS -d %i -j MARK --set-mark %x
    @@ -1278,10 +1281,10 @@
     					climit
     					Definicja reguły dla limitu połączeń hosta. Dozwolone 
     					zmienne: %n - nazwa hosta, %if - nazwa interfejsu sieci, 
    -					%i16 - ostatni oktet adresu szesnastkowo, %i - adres, %m - mac,
    -					%ms - lista adresów MAC hosta (oddzielonych przecinkiem),
    -					%o1, %o2, %o3, %o4 - oktety adresu dziesiętnie, %climit - limit
    -					połączeń. Domyślnie:
    +					%i - adres, %m - mac, %ms - lista adresów MAC hosta (oddzielonych przecinkiem),
    +					%o1, %o2, %o3, %o4 - oktety adresu dziesiętnie,
    +					%h1, %h2, %h3, %h4 - oktety adresu w zapisie szesnastkowym,
    +					%climit - limit połączeń. Domyślnie:
     					
     $IPT -t filter -I FORWARD -p tcp -s %i -m connlimit --connlimit-above %climit -j REJECT
     					
    @@ -1291,10 +1294,10 @@
     					plimit
     					Definicja reguły dla limitu pakietów dla hosta. Dozwolone 
     					zmienne: %n - nazwa hosta, %if - nazwa interfejsu sieci, 
    -					%i16 - ostatni oktet adresu szesnastkowo, %i - adres, %m - mac,
    -					%ms - lista adresów MAC hosta (oddzielonych przecinkiem),
    -					%o1, %o2, %o3, %o4 - oktety adresu dziesiętnie, %plimit - limit
    -					pakietów. Domyślnie:
    +				    %i - adres, %m - mac, %ms - lista adresów MAC hosta (oddzielonych przecinkiem),
    +					%o1, %o2, %o3, %o4 - oktety adresu dziesiętnie,
    +					%h1, %h2, %h3, %h4 - oktety adresu w zapisie szesnastkowym,
    +					%plimit - limit	pakietów. Domyślnie:
     					
     $IPT -t filter -I FORWARD -d %i -m limit --limit %plimit/s -j ACCEPT
     $IPT -t filter -I FORWARD -s %i -m limit --limit %plimit/s -j ACCEPT										
    
    From cvs w lms.org.pl  Fri Mar 18 09:30:30 2011
    From: cvs w lms.org.pl (LMS CVS)
    Date: Fri, 18 Mar 2011 09:30:30 +0100 (CET)
    Subject: [lms-commits] CVS update of lms/lib (LMS.class.php)
    Message-ID: <20110318083030.81567302B610@eftep.altec.pl>
    
    Date: Friday, March 18, 2011 @ 09:30:30
    Author: alec
    Path: /cvsroot/lms/lib
    
    Modified: LMS.class.php
    
    - Fixed last changes in GetCustomerList()
    
    
    Diff URLs:
    http://cvs.lms.org.pl/viewvc/Development/lms/lib/LMS.class.php.diff?&r1=1.1058&r2=1.1059
    
    
    Index: lms/lib/LMS.class.php
    diff -u lms/lib/LMS.class.php:1.1058 lms/lib/LMS.class.php:1.1059
    --- lms/lib/LMS.class.php:1.1058	Thu Mar 17 13:50:47 2011
    +++ lms/lib/LMS.class.php	Fri Mar 18 09:30:30 2011
    @@ -21,7 +21,7 @@
      *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
      *  USA.
      *
    - *  $Id: LMS.class.php,v 1.1058 2011/03/17 12:50:47 alec Exp $
    + *  $Id: LMS.class.php,v 1.1059 2011/03/18 08:30:30 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.1058 $';
    +	var $_revision = '$Revision: 1.1059 $';
     
     	function LMS(&$DB, &$AUTH, &$CONFIG) // class variables setting
     	{
    @@ -893,8 +893,8 @@
     					WHERE ownerid > 0
     					GROUP BY ownerid
     				) s ON (s.ownerid = c.id)
    -				WHERE deleted = '.intval($deleted)
    -				.($state <= 3 ? ' AND c.status = '.intval($state) : '')
    +				WHERE c.deleted = '.intval($deleted)
    +				.($state <= 3 && $state > 0 ? ' AND c.status = '.intval($state) : '')
     				.($division ? ' AND c.divisionid = '.intval($division) : '')
     				.($online ? ' AND s.online = 1' : '')
     				.($indebted ? ' AND b.value < 0' : '')
    
    From cvs w lms.org.pl  Fri Mar 18 09:51:43 2011
    From: cvs w lms.org.pl (LMS CVS)
    Date: Fri, 18 Mar 2011 09:51:43 +0100 (CET)
    Subject: [lms-commits] CVS update of lms/doc (ChangeLog)
    Message-ID: <20110318085143.166E2302B610@eftep.altec.pl>
    
    Date: Friday, March 18, 2011 @ 09:51:43
    Author: alec
    Path: /cvsroot/lms/doc
    
    Modified: ChangeLog
    
    - fixed "Check All" checkbox on Cash Operations Import list
    
    
    Diff URLs:
    http://cvs.lms.org.pl/viewvc/Development/lms/doc/ChangeLog.diff?&r1=1.1555&r2=1.1556
    
    
    Index: lms/doc/ChangeLog
    diff -u lms/doc/ChangeLog:1.1555 lms/doc/ChangeLog:1.1556
    --- lms/doc/ChangeLog:1.1555	Thu Mar 17 14:12:14 2011
    +++ lms/doc/ChangeLog	Fri Mar 18 09:51:42 2011
    @@ -1,4 +1,4 @@
    -$Id: ChangeLog,v 1.1555 2011/03/17 13:12:14 alec Exp $
    +$Id: ChangeLog,v 1.1556 2011/03/18 08:51:42 alec Exp $
     
     version ? (????-??-??)
     
    @@ -33,6 +33,7 @@
       - Fixed customers listing so, when using group/network filter together
         with "deleted" status, the list is empty [alec]
       - lmsd/tc,tc-new: Added %h1, %h2, %h3, %h4 variables [alec]
    +  - fixed "Check All" checkbox on Cash Operations Import list [alec]
     
     version 1.11.11 Bray (2011-01-17)
     
    
    From cvs w lms.org.pl  Fri Mar 18 09:51:43 2011
    From: cvs w lms.org.pl (LMS CVS)
    Date: Fri, 18 Mar 2011 09:51:43 +0100 (CET)
    Subject: [lms-commits] CVS update of lms/templates (cashimport.html)
    Message-ID: <20110318085143.3BADD302B612@eftep.altec.pl>
    
    Date: Friday, March 18, 2011 @ 09:51:43
    Author: alec
    Path: /cvsroot/lms/templates
    
    Modified: cashimport.html
    
    - fixed "Check All" checkbox on Cash Operations Import list
    
    
    Diff URLs:
    http://cvs.lms.org.pl/viewvc/Development/lms/templates/cashimport.html.diff?&r1=1.22&r2=1.23
    
    
    Index: lms/templates/cashimport.html
    diff -u lms/templates/cashimport.html:1.22 lms/templates/cashimport.html:1.23
    --- lms/templates/cashimport.html:1.22	Wed Dec 22 11:51:45 2010
    +++ lms/templates/cashimport.html	Fri Mar 18 09:51:43 2011
    @@ -1,5 +1,5 @@
     {include file="header.html"}
    -
    +
     

    {$layout.pagetitle}

    {literal} Index: lms/templates/invoicenew.html diff -u lms/templates/invoicenew.html:1.67 lms/templates/invoicenew.html:1.68 --- lms/templates/invoicenew.html:1.67 Mon Jun 21 10:58:17 2010 +++ lms/templates/invoicenew.html Fri Mar 25 09:14:41 2011 @@ -1,5 +1,5 @@ {include file="header.html"} - +

    {$layout.pagetitle}

    {if $newinvoice} From cvs w lms.org.pl Fri Mar 25 09:43:24 2011 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 25 Mar 2011 09:43:24 +0100 (CET) Subject: [lms-commits] CVS update of lms/lib/upgradedb (2 files) Message-ID: <20110325084324.C9FCA30CB579@eftep.altec.pl> Date: Friday, March 25, 2011 @ 09:43:24 Author: chilek Path: /cvsroot/lms/lib/upgradedb Modified: mysql.2011032500.php postgres.2011032500.php - copy cdate to sdate only for invoices and invoicenotes Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/lib/upgradedb/mysql.2011032500.php.diff?&r1=1.1&r2=1.2 http://cvs.lms.org.pl/viewvc/Development/lms/lib/upgradedb/postgres.2011032500.php.diff?&r1=1.1&r2=1.2 Index: lms/lib/upgradedb/mysql.2011032500.php diff -u lms/lib/upgradedb/mysql.2011032500.php:1.1 lms/lib/upgradedb/mysql.2011032500.php:1.2 --- lms/lib/upgradedb/mysql.2011032500.php:1.1 Fri Mar 25 09:14:40 2011 +++ lms/lib/upgradedb/mysql.2011032500.php Fri Mar 25 09:43:24 2011 @@ -25,7 +25,7 @@ $DB->Execute("ALTER TABLE documents ADD sdate int(11) DEFAULT '0' NOT NULL"); -$DB->Execute("UPDATE documents SET sdate = cdate"); +$DB->Execute("UPDATE documents SET sdate = cdate WHERE type IN (?, ?)", array(DOC_INVOICE, DOC_CNOTE)); $DB->Execute("UPDATE dbinfo SET keyvalue = ? WHERE keytype = ?", array('2011032500', 'dbversion')); Index: lms/lib/upgradedb/postgres.2011032500.php diff -u lms/lib/upgradedb/postgres.2011032500.php:1.1 lms/lib/upgradedb/postgres.2011032500.php:1.2 --- lms/lib/upgradedb/postgres.2011032500.php:1.1 Fri Mar 25 09:14:40 2011 +++ lms/lib/upgradedb/postgres.2011032500.php Fri Mar 25 09:43:24 2011 @@ -23,10 +23,9 @@ $DB->BeginTrans(); -$DB->Execute(" - ALTER TABLE documents ADD sdate integer DEFAULT 0 NOT NULL; - UPDATE documents SET sdate = cdate; -"); +$DB->Execute("ALTER TABLE documents ADD sdate integer DEFAULT 0 NOT NULL"); + +$DB->Execute("UPDATE documents SET sdate = cdate WHERE type IN (?, ?)", array(DOC_INVOICE, DOC_CNOTE)); $DB->Execute("UPDATE dbinfo SET keyvalue = ? WHERE keytype = ?", array('2011032500', 'dbversion')); From cvs w lms.org.pl Fri Mar 25 09:59:05 2011 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 25 Mar 2011 09:59:05 +0100 (CET) Subject: [lms-commits] CVS update of lms/modules (invoicenew.php, invoicenote.php) Message-ID: <20110325085905.BA1AF30CB57B@eftep.altec.pl> Date: Friday, March 25, 2011 @ 09:59:05 Author: chilek Path: /cvsroot/lms/modules Modified: invoicenew.php invoicenote.php - sale date for credit notes Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/modules/invoicenew.php.diff?&r1=1.84&r2=1.85 http://cvs.lms.org.pl/viewvc/Development/lms/modules/invoicenote.php.diff?&r1=1.44&r2=1.45 Index: lms/modules/invoicenew.php diff -u lms/modules/invoicenew.php:1.84 lms/modules/invoicenew.php:1.85 --- lms/modules/invoicenew.php:1.84 Fri Mar 25 09:14:40 2011 +++ lms/modules/invoicenew.php Fri Mar 25 09:59:05 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: invoicenew.php,v 1.84 2011/03/25 08:14:40 chilek Exp $ + * $Id: invoicenew.php,v 1.85 2011/03/25 08:59:05 chilek Exp $ */ // Invoiceless liabilities: Zobowiazania/obciazenia na ktore nie zostala wystawiona faktura @@ -170,7 +170,7 @@ list($syear, $smonth, $sday) = explode('/', $invoice['sdate']); if(checkdate($smonth, $sday, $syear)) { - $invoice['sdate'] = mktime(date('G', time()), date('i',time()), date('s', time()), $smonth, $sday, $syear); + $invoice['sdate'] = mktime(date('G', $currtime), date('i', $currtime), date('s', $currtime), $smonth, $sday, $syear); $scurrmonth = $smonth; } else @@ -186,7 +186,7 @@ list($year, $month, $day) = explode('/', $invoice['cdate']); if(checkdate($month, $day, $year)) { - $invoice['cdate'] = mktime(date('G',time()),date('i',time()),date('s',time()),$month,$day,$year); + $invoice['cdate'] = mktime(date('G', $currtime), date('i', $currtime), date('s', $currtime), $month, $day, $year); $currmonth = $month; } else Index: lms/modules/invoicenote.php diff -u lms/modules/invoicenote.php:1.44 lms/modules/invoicenote.php:1.45 --- lms/modules/invoicenote.php:1.44 Tue Jan 18 09:12:23 2011 +++ lms/modules/invoicenote.php Fri Mar 25 09:59:05 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: invoicenote.php,v 1.44 2011/01/18 08:12:23 alec Exp $ + * $Id: invoicenote.php,v 1.45 2011/03/25 08:59:05 chilek Exp $ */ $taxeslist = $LMS->GetTaxes(); @@ -35,35 +35,37 @@ foreach ($invoice['content'] as $item) { - $nitem['tariffid'] = $item['tariffid']; + $nitem['tariffid'] = $item['tariffid']; $nitem['name'] = $item['description']; $nitem['prodid'] = $item['prodid']; - $nitem['count'] = str_replace(',','.',$item['count']); - $nitem['discount'] = str_replace(',','.',$item['discount']); - $nitem['jm'] = str_replace(',','.',$item['content']); - $nitem['valuenetto'] = str_replace(',','.',$item['basevalue']); - $nitem['valuebrutto'] = str_replace(',','.',$item['value']); - $nitem['s_valuenetto'] = str_replace(',','.',$item['totalbase']); - $nitem['s_valuebrutto'] = str_replace(',','.',$item['total']); + $nitem['count'] = str_replace(',', '.', $item['count']); + $nitem['discount'] = str_replace(',', '.', $item['discount']); + $nitem['jm'] = str_replace(',', '.', $item['content']); + $nitem['valuenetto'] = str_replace(',', '.', $item['basevalue']); + $nitem['valuebrutto'] = str_replace(',', '.', $item['value']); + $nitem['s_valuenetto'] = str_replace(',', '.', $item['totalbase']); + $nitem['s_valuebrutto'] = str_replace(',', '.', $item['total']); $nitem['tax'] = isset($taxeslist[$item['taxid']]) ? $taxeslist[$item['taxid']]['label'] : 0; $nitem['taxid'] = $item['taxid']; $nitem['itemid'] = $item['itemid']; $invoicecontents[$nitem['itemid']] = $nitem; } - + $cnote['numberplanid'] = $DB->GetOne('SELECT id FROM numberplans WHERE doctype = ? AND isdefault = 1', array(DOC_CNOTE)); - $cnote['cdate'] = time(); + $currtime = time(); + $cnote['cdate'] = $currtime; + $cnote['sdate'] = $currtime; $cnote['reason'] = ''; $cnote['paytype'] = $invoice['paytype']; - $t = $invoice['cdate'] + $invoice['paytime']*86400; + $t = $invoice['cdate'] + $invoice['paytime'] * 86400; $deadline = mktime(23, 59, 59, date('m',$t), date('d',$t), date('Y',$t)); - + if($cnote['cdate'] > $deadline) $cnote['paytime'] = 0; else - $cnote['paytime'] = floor(($deadline - $cnote['cdate'])/86400); - + $cnote['paytime'] = floor(($deadline - $cnote['cdate']) / 86400); + $cnote['use_current_division'] = true; $SESSION->save('cnote', $cnote); @@ -104,12 +106,34 @@ if($cnote['paytime'] < 0) $cnote['paytime'] = 14; + $currtime = time(); + + if($cnote['sdate']) + { + list($syear, $smonth, $sday) = explode('/', $cnote['sdate']); + if(checkdate($smonth, $sday, $syear)) + { + $cnote['sdate'] = mktime(date('G', $currtime), date('i', $currtime), date('s', $currtime), $smonth, $sday, $syear); + if($cnote['sdate'] < $invoice['cdate']) + { + $error['sdate'] = trans('Credit note date cannot be earlier than invoice date!'); + } + } + else + { + $error['sdate'] = trans('Incorrect date format! Using current date.'); + $cnote['sdate'] = $currtime; + } + } + else + $cnote['sdate'] = $currtime; + if($cnote['cdate']) { - list($year, $month, $day) = explode('/',$cnote['cdate']); + list($year, $month, $day) = explode('/', $cnote['cdate']); if(checkdate($month, $day, $year)) { - $cnote['cdate'] = mktime(date('G',time()),date('i',time()),date('s',time()),$month,$day,$year); + $cnote['cdate'] = mktime(date('G', $currtime), date('i', $currtime), date('s', $currtime), $month, $day, $year); if($cnote['cdate'] < $invoice['cdate']) { $error['cdate'] = trans('Credit note date cannot be earlier than invoice date!'); @@ -118,12 +142,15 @@ else { $error['cdate'] = trans('Incorrect date format! Using current date.'); - $cnote['cdate'] = time(); + $cnote['cdate'] = $currtime; } } else - $cnote['cdate'] = time(); - + $cnote['cdate'] = $currtime; + + if($cnote['sdate'] > $cnote['cdate']) + $error['sdate'] = trans('Sale date of credit note shouldn\'t be later than settlement date!'); + if($cnote['number']) { if(!preg_match('/^[0-9]+$/', $cnote['number'])) From cvs w lms.org.pl Fri Mar 25 09:59:05 2011 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 25 Mar 2011 09:59:05 +0100 (CET) Subject: [lms-commits] CVS update of lms/templates (invoicenote.html) Message-ID: <20110325085905.D7E5B30CB57C@eftep.altec.pl> Date: Friday, March 25, 2011 @ 09:59:05 Author: chilek Path: /cvsroot/lms/templates Modified: invoicenote.html - sale date for credit notes Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/templates/invoicenote.html.diff?&r1=1.24&r2=1.25 Index: lms/templates/invoicenote.html diff -u lms/templates/invoicenote.html:1.24 lms/templates/invoicenote.html:1.25 --- lms/templates/invoicenote.html:1.24 Mon Jun 21 10:58:17 2010 +++ lms/templates/invoicenote.html Fri Mar 25 09:59:05 2011 @@ -1,5 +1,5 @@ {include file="header.html"} - +

    {$layout.pagetitle}

    {include file="calendar_js.html"} From cvs w lms.org.pl Fri Mar 25 10:04:14 2011 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 25 Mar 2011 10:04:14 +0100 (CET) Subject: [lms-commits] CVS update of lms/modules (invoicenote.php) Message-ID: <20110325090414.D69F63046362@eftep.altec.pl> Date: Friday, March 25, 2011 @ 10:04:14 Author: chilek Path: /cvsroot/lms/modules Modified: invoicenote.php - locales for credit notes sale date Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/modules/invoicenote.php.diff?&r1=1.45&r2=1.46 Index: lms/modules/invoicenote.php diff -u lms/modules/invoicenote.php:1.45 lms/modules/invoicenote.php:1.46 --- lms/modules/invoicenote.php:1.45 Fri Mar 25 09:59:05 2011 +++ lms/modules/invoicenote.php Fri Mar 25 10:04:14 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: invoicenote.php,v 1.45 2011/03/25 08:59:05 chilek Exp $ + * $Id: invoicenote.php,v 1.46 2011/03/25 09:04:14 chilek Exp $ */ $taxeslist = $LMS->GetTaxes(); @@ -149,7 +149,7 @@ $cnote['cdate'] = $currtime; if($cnote['sdate'] > $cnote['cdate']) - $error['sdate'] = trans('Sale date of credit note shouldn\'t be later than settlement date!'); + $error['sdate'] = trans('Sale date of credit note shouldn\'t be later than credit note settlement date!'); if($cnote['number']) { From cvs w lms.org.pl Fri Mar 25 10:04:14 2011 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 25 Mar 2011 10:04:14 +0100 (CET) Subject: [lms-commits] CVS update of lms/lib/locale/pl (strings.php) Message-ID: <20110325090414.B78E43010A78@eftep.altec.pl> Date: Friday, March 25, 2011 @ 10:04:14 Author: chilek Path: /cvsroot/lms/lib/locale/pl Modified: strings.php - locales for credit notes sale date Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/lib/locale/pl/strings.php.diff?&r1=1.381&r2=1.382 Index: lms/lib/locale/pl/strings.php diff -u lms/lib/locale/pl/strings.php:1.381 lms/lib/locale/pl/strings.php:1.382 --- lms/lib/locale/pl/strings.php:1.381 Fri Mar 25 09:14:40 2011 +++ lms/lib/locale/pl/strings.php Fri Mar 25 10:04:14 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: strings.php,v 1.381 2011/03/25 08:14:40 chilek Exp $ + * $Id: strings.php,v 1.382 2011/03/25 09:04:14 chilek Exp $ */ $_LANG['$0 ($1 addresses)'] = '$0 ($1 adresów)'; @@ -1504,6 +1504,7 @@ $_LANG['Credit note template file. Default: "invoice.html". Should be placed in templates directory.'] = 'Szablon faktury korygującej. Domyślnie:"invoice.html". Powinien być umieszczony w katalogu templates.'; $_LANG['To repay:'] = 'Do zwrotu:'; $_LANG['Credit note date cannot be earlier than invoice date!'] = 'Data wystawienia korekty nie może być wcześniejsza od daty wystawienia korygowanej faktury'; +$_LANG['Sale date of credit note shouldn\'t be later than credit note settlement date!'] = 'Data sprzedaży dla korekty nie może być wcześniejsza od daty wystawienia korekty faktury'; $_LANG['Incorrect date format! Using current date.'] = 'Nieprawidłowy format daty! Przyjęto bieżącą datę.'; $_LANG['show only credit notes'] = 'pokaż tylko korekty'; $_LANG['There are errors in credit note main information!'] = 'W podstawowych informacjach korekty są błędy!'; From cvs w lms.org.pl Fri Mar 25 11:32:16 2011 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 25 Mar 2011 11:32:16 +0100 (CET) Subject: [lms-commits] CVS update of lms/bin (lms-payments) Message-ID: <20110325103216.963A23046362@eftep.altec.pl> Date: Friday, March 25, 2011 @ 11:32:16 Author: chilek Path: /cvsroot/lms/bin Modified: lms-payments - sale date in lms-payments script Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/bin/lms-payments.diff?&r1=1.129&r2=1.130 Index: lms/bin/lms-payments diff -u lms/bin/lms-payments:1.129 lms/bin/lms-payments:1.130 --- lms/bin/lms-payments:1.129 Fri Jan 21 13:15:55 2011 +++ lms/bin/lms-payments Fri Mar 25 11:32:16 2011 @@ -20,7 +20,7 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. # -# $Id: lms-payments,v 1.129 2011/01/21 12:15:55 alec Exp $ +# $Id: lms-payments,v 1.130 2011/03/25 10:32:16 chilek Exp $ use strict; use DBI; @@ -539,11 +539,11 @@ if($paytime eq -1) { $paytime = $deadline; } my $idbq = $dbase->prepare("INSERT INTO documents (number, numberplanid, type, countryid, divisionid, - customerid, name, address, zip, city, ten, ssn, cdate, paytime, paytype) + customerid, name, address, zip, city, ten, ssn, cdate, sdate, paytime, paytype) 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, $paytime, $inv_paytype); + $urow->{'city'}, $urow->{'ten'}, $urow->{'ssn'}, $currtime, $currtime, $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 Mar 25 11:39:40 2011 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 25 Mar 2011 11:39:40 +0100 (CET) Subject: [lms-commits] CVS update of lms/daemon/modules/payments (payments.c) Message-ID: <20110325103940.DFA083046362@eftep.altec.pl> Date: Friday, March 25, 2011 @ 11:39:40 Author: chilek Path: /cvsroot/lms/daemon/modules/payments Modified: payments.c - sale date in payments daemon module Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/daemon/modules/payments/payments.c.diff?&r1=1.96&r2=1.97 Index: lms/daemon/modules/payments/payments.c diff -u lms/daemon/modules/payments/payments.c:1.96 lms/daemon/modules/payments/payments.c:1.97 --- lms/daemon/modules/payments/payments.c:1.96 Sun Mar 13 10:46:13 2011 +++ lms/daemon/modules/payments/payments.c Fri Mar 25 11:39:40 2011 @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: payments.c,v 1.96 2011/03/13 09:46:13 alec Exp $ + * $Id: payments.c,v 1.97 2011/03/25 10:39:40 chilek Exp $ */ #include #include @@ -730,7 +730,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, paytime, paytype) " + "customerid, name, address, zip, city, ten, ssn, cdate, sdate, paytime, paytype) " "VALUES (?, ?, 1, ?, ?, ?, '? ?', '?', '?', '?', '?', '?', ?, ?, ?)", itoa(number), numberplanid, @@ -745,6 +745,7 @@ g->db_get_data(res,i,"ten"), g->db_get_data(res,i,"ssn"), currtime, + currtime, paytime, paytype_str ); From cvs w lms.org.pl Fri Mar 25 13:30:49 2011 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 25 Mar 2011 13:30:49 +0100 (CET) Subject: [lms-commits] CVS update of lms/lib/locale/pl (strings.php) Message-ID: <20110325123049.68B8A3046362@eftep.altec.pl> Date: Friday, March 25, 2011 @ 13:30:49 Author: chilek Path: /cvsroot/lms/lib/locale/pl Modified: strings.php - sale date of invoice can be later than its settlement date Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/lib/locale/pl/strings.php.diff?&r1=1.382&r2=1.383 Index: lms/lib/locale/pl/strings.php diff -u lms/lib/locale/pl/strings.php:1.382 lms/lib/locale/pl/strings.php:1.383 --- lms/lib/locale/pl/strings.php:1.382 Fri Mar 25 10:04:14 2011 +++ lms/lib/locale/pl/strings.php Fri Mar 25 13:30:49 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: strings.php,v 1.382 2011/03/25 09:04:14 chilek Exp $ + * $Id: strings.php,v 1.383 2011/03/25 12:30:49 chilek Exp $ */ $_LANG['$0 ($1 addresses)'] = '$0 ($1 adresów)'; @@ -742,7 +742,6 @@ $_LANG['last $0 transactions'] = 'ostatnie $0 transakcji'; $_LANG['Last 30 Days'] = 'Ostatnie 30 dni'; $_LANG['Last date of invoice settlement is $0. If sure, you want to write invoice with date of $1, then click "Submit" again.'] = 'Ostatnia data wystawienia faktury to $0. Jeżeli jesteś pewien, że chcesz zapisać fakturę z datą $1, to ponownie kliknij "Zapisz".'; -$_LANG['Sale date of invoice shouldn\'t be later than settlement date. If sure, you want to write invoice with sale date of $0, then click "Submit" again.'] = 'Data sprzedaży na fakturze nie powinna być późniejsza niż data wystawienia faktury. Jeżeli jesteś pewien, że chcesz zapisać fakturę z datą sprzedaży $0, to ponownie kliknij "Zapisz".'; $_LANG['Last Day'] = 'Ostatni dzień'; $_LANG['Last day stats for all networks'] = 'Statystyki z ostatniego dnia dla wszystkich sieci'; $_LANG['Last date of receipt settlement is $0. If sure, you want to write receipt with date of $1, then click "Submit" again.'] = 'Ostatnia data wystawienia pokwitowania to $0. Jeśli na pewno chcesz wystawić dowód wpłaty z datą $1 kliknij ponownie "Zapisz".'; @@ -1504,7 +1503,6 @@ $_LANG['Credit note template file. Default: "invoice.html". Should be placed in templates directory.'] = 'Szablon faktury korygującej. Domyślnie:"invoice.html". Powinien być umieszczony w katalogu templates.'; $_LANG['To repay:'] = 'Do zwrotu:'; $_LANG['Credit note date cannot be earlier than invoice date!'] = 'Data wystawienia korekty nie może być wcześniejsza od daty wystawienia korygowanej faktury'; -$_LANG['Sale date of credit note shouldn\'t be later than credit note settlement date!'] = 'Data sprzedaży dla korekty nie może być wcześniejsza od daty wystawienia korekty faktury'; $_LANG['Incorrect date format! Using current date.'] = 'Nieprawidłowy format daty! Przyjęto bieżącą datę.'; $_LANG['show only credit notes'] = 'pokaż tylko korekty'; $_LANG['There are errors in credit note main information!'] = 'W podstawowych informacjach korekty są błędy!'; From cvs w lms.org.pl Fri Mar 25 13:30:49 2011 From: cvs w lms.org.pl (LMS CVS) Date: Fri, 25 Mar 2011 13:30:49 +0100 (CET) Subject: [lms-commits] CVS update of lms/templates (3 files) Message-ID: <20110325123049.C2D1C3231E67@eftep.altec.pl> Date: Friday, March 25, 2011 @ 13:30:49 Author: chilek Path: /cvsroot/lms/templates Modified: invoiceedit.html invoicenew.html invoicenote.html - sale date of invoice can be later than its settlement date Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/templates/invoiceedit.html.diff?&r1=1.41&r2=1.42 http://cvs.lms.org.pl/viewvc/Development/lms/templates/invoicenew.html.diff?&r1=1.68&r2=1.69 http://cvs.lms.org.pl/viewvc/Development/lms/templates/invoicenote.html.diff?&r1=1.25&r2=1.26 Index: lms/templates/invoiceedit.html diff -u lms/templates/invoiceedit.html:1.41 lms/templates/invoiceedit.html:1.42 --- lms/templates/invoiceedit.html:1.41 Fri Mar 25 09:14:41 2011 +++ lms/templates/invoiceedit.html Fri Mar 25 13:30:49 2011 @@ -1,5 +1,5 @@ {include file="header.html"} - +

    {$layout.pagetitle}

    {include file="calendar_js.html"} {/literal} Index: lms/templates/documentedit.html diff -u lms/templates/documentedit.html:1.7 lms/templates/documentedit.html:1.8 --- lms/templates/documentedit.html:1.7 Thu May 14 19:27:33 2009 +++ lms/templates/documentedit.html Thu Mar 31 13:11:22 2011 @@ -1,5 +1,5 @@ {include file="header.html"} - +

    {$layout.pagetitle}

    {include file="calendar_js.html"} {literal} @@ -7,32 +7,32 @@ From cvs w lms.org.pl Thu Mar 31 13:53:13 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 31 Mar 2011 13:53:13 +0200 (CEST) Subject: [lms-commits] CVS update of lms/lib/locale/pl (strings.php) Message-ID: <20110331115313.C188B3231E7A@eftep.altec.pl> Date: Thursday, March 31, 2011 @ 13:53:13 Author: alec Path: /cvsroot/lms/lib/locale/pl Modified: strings.php - Added searching by option name in configuration options list Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/lib/locale/pl/strings.php.diff?&r1=1.385&r2=1.386 Index: lms/lib/locale/pl/strings.php diff -u lms/lib/locale/pl/strings.php:1.385 lms/lib/locale/pl/strings.php:1.386 --- lms/lib/locale/pl/strings.php:1.385 Thu Mar 31 13:11:21 2011 +++ lms/lib/locale/pl/strings.php Thu Mar 31 13:53:13 2011 @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: strings.php,v 1.385 2011/03/31 11:11:21 alec Exp $ + * $Id: strings.php,v 1.386 2011/03/31 11:53:13 alec Exp $ */ $_LANG['$0 ($1 addresses)'] = '$0 ($1 adresów)'; @@ -905,7 +905,8 @@ $_LANG['no access'] = 'brak dostępu'; $_LANG['No cash operations to import.'] = 'Brak operacji kasowych do zaimportowania.'; $_LANG['No computers were found, either exists in the database or nbtscan binary not found.'] = 'Nie znaleziono żadnych komputerów bądź wszystkie komputery są już w bazie danych lub program nbtscan nie jest dostępny w systemie.'; -$_LANG['No configuration options in database. Click here to import them from lms.ini.'] = 'Brak opcji konfiguracyjnych w bazie danych. Kliknij tutaj aby je zaimportować do bazy.'; +$_LANG['No configuration options in database.'] = 'Brak opcji konfiguracyjnych w bazie danych.'; +$_LANG['Click here to import them from lms.ini.'] = 'Kliknij tutaj aby je zaimportować do bazy.'; $_LANG['Node ID:'] = 'ID komputera:'; $_LANG['Node Info: $0'] = 'Informacje o komputerze: $0'; $_LANG['Node IP address'] = 'Adres IP komputera'; @@ -2455,5 +2456,6 @@ $_LANG['Warning! Debug mode (using phone $0).'] = 'UWAGA! Tryb debugowania (używam numeru $0).'; $_LANG['RBE'] = 'EDG/KRS'; $_LANG['ICN'] = 'Dow. os.'; +$_LANG['Option'] = 'Opcja'; ?> From cvs w lms.org.pl Thu Mar 31 13:53:13 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 31 Mar 2011 13:53:13 +0200 (CEST) Subject: [lms-commits] CVS update of lms/doc (ChangeLog) Message-ID: <20110331115313.997B93231E77@eftep.altec.pl> Date: Thursday, March 31, 2011 @ 13:53:13 Author: alec Path: /cvsroot/lms/doc Modified: ChangeLog - Added searching by option name in configuration options list Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/ChangeLog.diff?&r1=1.1565&r2=1.1566 Index: lms/doc/ChangeLog diff -u lms/doc/ChangeLog:1.1565 lms/doc/ChangeLog:1.1566 --- lms/doc/ChangeLog:1.1565 Wed Mar 30 14:51:24 2011 +++ lms/doc/ChangeLog Thu Mar 31 13:53:13 2011 @@ -1,4 +1,4 @@ -$Id: ChangeLog,v 1.1565 2011/03/30 12:51:24 alec Exp $ +$Id: ChangeLog,v 1.1566 2011/03/31 11:53:13 alec Exp $ version ? (????-??-??) @@ -10,6 +10,7 @@ - BTS#0000863: changed temporary referenced $number variable to actual variable [chilan] - Fixed performance of nodes quick-searching on MySQL [alec] - Fix regression where wasn't possible to view information about deleted customer [alec] + - Added searching by option name in configuration options list [alec] version 1.11.12 Aris (2011-03-18) From cvs w lms.org.pl Thu Mar 31 13:53:13 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 31 Mar 2011 13:53:13 +0200 (CEST) Subject: [lms-commits] CVS update of lms/modules (configlist.php) Message-ID: <20110331115313.E089B300759D@eftep.altec.pl> Date: Thursday, March 31, 2011 @ 13:53:13 Author: alec Path: /cvsroot/lms/modules Modified: configlist.php - Added searching by option name in configuration options list Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/modules/configlist.php.diff?&r1=1.69&r2=1.70 Index: lms/modules/configlist.php diff -u lms/modules/configlist.php:1.69 lms/modules/configlist.php:1.70 --- lms/modules/configlist.php:1.69 Tue Jan 18 09:12:20 2011 +++ lms/modules/configlist.php Thu Mar 31 13:53:13 2011 @@ -21,10 +21,10 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * - * $Id: configlist.php,v 1.69 2011/01/18 08:12:20 alec Exp $ + * $Id: configlist.php,v 1.70 2011/03/31 11:53:13 alec Exp $ */ -function GetConfigList($order='var,asc', $section='') +function GetConfigList($order='var,asc', $section='', $search='') { global $DB; @@ -42,15 +42,13 @@ break; } - if($section) - $config = $DB->GetAll('SELECT id, section, var, value, description as usercomment, disabled - FROM uiconfig WHERE section != \'userpanel\' AND section = ?' - .$sqlord, array($section)); - else - $config = $DB->GetAll('SELECT id, section, var, value, description as usercomment, disabled - FROM uiconfig WHERE section != \'userpanel\''.$sqlord); + $config = $DB->GetAll('SELECT id, section, var, value, description as usercomment, disabled + FROM uiconfig WHERE section != \'userpanel\'' + .($section ? ' AND section = '.$DB->Escape($section) : '') + .($search ? ' AND var ?LIKE? '.$DB->Escape('%'.$search.'%') : '') + .$sqlord); - if($config) foreach ($config as $idx => $item) + if($config) foreach ($config as $idx => $item) { switch($item['section']) { @@ -541,15 +539,22 @@ $s = $_GET['s']; $SESSION->save('conls', $s); +if(!isset($_GET['n'])) + $SESSION->restore('conln', $n); +else + $n = $_GET['n']; +$SESSION->save('conln', $n); + if ($SESSION->is_set('conlp') && !isset($_GET['page'])) $SESSION->restore('conlp', $_GET['page']); -$configlist = GetConfigList($o, $s); +$configlist = GetConfigList($o, $s, $n); $listdata['total'] = $configlist['total']; $listdata['order'] = $configlist['order']; $listdata['direction'] = $configlist['direction']; $listdata['section'] = $configlist['section']; +$listdata['search'] = $n; unset($configlist['total']); unset($configlist['order']); From cvs w lms.org.pl Thu Mar 31 13:53:14 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 31 Mar 2011 13:53:14 +0200 (CEST) Subject: [lms-commits] CVS update of lms/templates (configlist.html, invoicelist.html) Message-ID: <20110331115314.15D803231E65@eftep.altec.pl> Date: Thursday, March 31, 2011 @ 13:53:14 Author: alec Path: /cvsroot/lms/templates Modified: configlist.html invoicelist.html - Added searching by option name in configuration options list Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/templates/configlist.html.diff?&r1=1.21&r2=1.22 http://cvs.lms.org.pl/viewvc/Development/lms/templates/invoicelist.html.diff?&r1=1.81&r2=1.82 Index: lms/templates/configlist.html diff -u lms/templates/configlist.html:1.21 lms/templates/configlist.html:1.22 --- lms/templates/configlist.html:1.21 Wed Feb 3 15:43:03 2010 +++ lms/templates/configlist.html Thu Mar 31 13:53:13 2011 @@ -1,5 +1,5 @@ {include file="header.html"} - +

    {$layout.pagetitle}

    {t}Module Configuration:{/t}
    - {t}Debug email:{/t} - - -
    {t}LMS url:{/t} From cvs w lms.org.pl Thu Mar 10 12:37:21 2011 From: cvs w lms.org.pl (LMS CVS) Date: Thu, 10 Mar 2011 12:37:21 +0100 (CET) Subject: [lms-commits] CVS update of lms/doc/html/en (devel-db.html) Message-ID: <20110310113721.E2B5A301E565@eftep.altec.pl> Date: Thursday, March 10, 2011 @ 12:37:21 Author: alec Path: /cvsroot/lms/doc/html/en Modified: devel-db.html - documentation regen Diff URLs: http://cvs.lms.org.pl/viewvc/Development/lms/doc/html/en/devel-db.html.diff?&r1=1.66&r2=1.67 Index: lms/doc/html/en/devel-db.html diff -u lms/doc/html/en/devel-db.html:1.66 lms/doc/html/en/devel-db.html:1.67 --- lms/doc/html/en/devel-db.html:1.66 Mon Mar 7 13:10:57 2011 +++ lms/doc/html/en/devel-db.html Thu Mar 10 12:37:21 2011 @@ -126,6 +126,10 @@ >
    phone - user's phone number
    position - user's position name
    ntype - supported notofication types
    lastlogindate - date of last login
    email - adres admina
    position - nazwa stanowiska admina
    position - nazwa stanowiska
    ntype - obsługiwane typy powiadomień
    lastlogindate - data ostatniego logowania
    @@ -22,6 +22,7 @@ + {t}Filter:{/t} {t}Section:{/t} + {t}Option{/t}: + +  »»» - + {if $listdata.total != 0} Index: lms/templates/invoicelist.html diff -u lms/templates/invoicelist.html:1.81 lms/templates/invoicelist.html:1.82 --- lms/templates/invoicelist.html:1.81 Mon Apr 19 12:56:15 2010 +++ lms/templates/invoicelist.html Thu Mar 31 13:53:13 2011 @@ -1,5 +1,5 @@ {include file="header.html"} - +

    {$layout.pagetitle}

    {if $invoice.invoice} Index: lms/templates/customerinfoshort.html diff -u lms/templates/customerinfoshort.html:1.25 lms/templates/customerinfoshort.html:1.26 --- lms/templates/customerinfoshort.html:1.25 Thu Mar 31 13:11:22 2011 +++ lms/templates/customerinfoshort.html Thu Mar 31 20:19:17 2011 @@ -1,5 +1,5 @@ - + @@ -174,7 +174,8 @@
    @@ -67,7 +71,13 @@

     

    -

    {t}No configuration options in database. Click here to import them from lms.ini.{/t}

    +

    + {if $listdata.search} + {t}No configuration options in database.{/t} + {else} + {t}No configuration options in database.{/t} {t}Click here to import them from lms.ini.{/t} + {/if} +

     

    Index: lms/templates/dynpopup.html diff -u lms/templates/dynpopup.html:1.8 lms/templates/dynpopup.html:1.9 --- lms/templates/dynpopup.html:1.8 Wed Jan 5 21:40:30 2011 +++ lms/templates/dynpopup.html Thu Mar 31 20:19:17 2011 @@ -1,5 +1,5 @@ - + @@ -14,7 +14,8 @@ {$content} Index: lms/templates/invoiceedit.html diff -u lms/templates/invoiceedit.html:1.42 lms/templates/invoiceedit.html:1.43 --- lms/templates/invoiceedit.html:1.42 Fri Mar 25 13:30:49 2011 +++ lms/templates/invoiceedit.html Thu Mar 31 20:19:17 2011 @@ -1,9 +1,8 @@ {include file="header.html"} - +

    {$layout.pagetitle}

    {include file="calendar_js.html"} +
    @@ -91,21 +108,21 @@
    - {t}Sale date:{/t} + {t}Settlement date:{/t} - + + {if $invoice.cdatewarning} + + {/if}
    - {t}Settlement date:{/t} + {t}Sale date:{/t} - - {if $invoice.cdatewarning} - - {/if} +
    - - ({$invoice.cdate+$invoice.paytime*86400|date_format:"%Y/%m/%d"}) +
    {if $customer} -

    +
    @@ -168,9 +184,8 @@
    -

    {/if} -

    +
    + {foreachelse} @@ -331,13 +346,20 @@
    @@ -237,7 +252,7 @@ -
    {include file="footer.html"} - Index: lms/templates/invoicenew.html diff -u lms/templates/invoicenew.html:1.69 lms/templates/invoicenew.html:1.70 --- lms/templates/invoicenew.html:1.69 Fri Mar 25 13:30:49 2011 +++ lms/templates/invoicenew.html Thu Mar 31 20:19:17 2011 @@ -1,5 +1,5 @@ {include file="header.html"} - +

    {$layout.pagetitle}

    {if $newinvoice}
    @@ -120,21 +138,21 @@ - {t}Sale date:{/t} + {t}Settlement date:{/t} - + + {if $invoice.cdatewarning} + + {/if} - {t}Settlement date:{/t} + {t}Sale date:{/t} - - {if $invoice.cdatewarning} - - {/if} + @@ -142,13 +160,10 @@ {t}Deadline:{/t} - {t}default{/t} - {t}other{/t} - {t}default{/t} + {t}other{/t} + - {* if $invoice.cdate && $invoice.paytime} - ({$invoice.cdate+$invoice.paytime*86400|date_format:"%Y/%m/%d"}) - {/if *} @@ -190,7 +205,7 @@
    {if $customer} -

    +
    @@ -203,9 +218,8 @@
    -

    {/if} -

    +
    {if $covenantlist} @@ -329,7 +343,7 @@ + {foreachelse} @@ -423,13 +437,21 @@
    -
    {include file="footer.html"} Index: lms/templates/invoicenote.html diff -u lms/templates/invoicenote.html:1.26 lms/templates/invoicenote.html:1.27 --- lms/templates/invoicenote.html:1.26 Fri Mar 25 13:30:49 2011 +++ lms/templates/invoicenote.html Thu Mar 31 20:19:17 2011 @@ -1,10 +1,9 @@ {include file="header.html"} - +

    {$layout.pagetitle}

    {include file="calendar_js.html"}
    @@ -50,21 +66,21 @@ - {t}Sale date:{/t} + {t}Settlement date:{/t} - + + {if $cnote.cdatewarning} + + {/if} - {t}Settlement date:{/t} + {t}Sale date:{/t} - - {if $cnote.cdatewarning} - - {/if} + @@ -72,10 +88,7 @@ {t}Deadline:{/t} - - {if $cnote.cdate} - ({$cnote.cdate+$cnote.paytime*86400|date_format:"%Y/%m/%d"}) - {/if} + @@ -115,7 +128,7 @@
    -

    +

    @@ -159,7 +172,7 @@ {if $item.deleted} {$item.name} {else} - + {/if} + {/foreach} {if $contents} @@ -256,13 +269,21 @@
    @@ -217,7 +230,7 @@ {else} {/if} -
    {include file="footer.html"} Index: lms/templates/netdevlistshort.html diff -u lms/templates/netdevlistshort.html:1.2 lms/templates/netdevlistshort.html:1.3 --- lms/templates/netdevlistshort.html:1.2 Thu Dec 23 13:35:13 2010 +++ lms/templates/netdevlistshort.html Thu Mar 31 20:19:17 2011 @@ -1,5 +1,5 @@ - + @@ -47,7 +47,8 @@ Index: lms/templates/nodegrouplistshort.html diff -u lms/templates/nodegrouplistshort.html:1.4 lms/templates/nodegrouplistshort.html:1.5 --- lms/templates/nodegrouplistshort.html:1.4 Thu Dec 23 13:35:13 2010 +++ lms/templates/nodegrouplistshort.html Thu Mar 31 20:19:17 2011 @@ -1,5 +1,5 @@ - + @@ -39,7 +39,8 @@ Index: lms/templates/nodelistshort.html diff -u lms/templates/nodelistshort.html:1.20 lms/templates/nodelistshort.html:1.21 --- lms/templates/nodelistshort.html:1.20 Wed Mar 30 14:42:23 2011 +++ lms/templates/nodelistshort.html Thu Mar 31 20:19:17 2011 @@ -1,5 +1,5 @@ - + @@ -56,9 +56,8 @@ {/section} Index: lms/templates/rtticketinfoshort.html diff -u lms/templates/rtticketinfoshort.html:1.4 lms/templates/rtticketinfoshort.html:1.5 --- lms/templates/rtticketinfoshort.html:1.4 Wed Jan 5 21:40:30 2011 +++ lms/templates/rtticketinfoshort.html Thu Mar 31 20:19:17 2011 @@ -1,5 +1,5 @@ - + @@ -68,7 +68,8 @@ Index: lms/templates/trafficgraph.html diff -u lms/templates/trafficgraph.html:1.6 lms/templates/trafficgraph.html:1.7 --- lms/templates/trafficgraph.html:1.6 Wed Jan 5 21:40:30 2011 +++ lms/templates/trafficgraph.html Thu Mar 31 20:19:17 2011 @@ -1,5 +1,5 @@ - + @@ -29,7 +29,8 @@ »