From ae4bd4445e8142331bdc4ae9da63a97e89e7dd2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Mon, 9 Jun 2014 15:38:43 +0200 Subject: [PATCH 01/68] Moved dol_syslog query log to the database handler and decreased report level to DEBUG --- htdocs/admin/menus/index.php | 1 - htdocs/comm/mailing/liste.php | 1 - htdocs/compta/bank/categ.php | 3 --- htdocs/compta/bank/releve.php | 1 - htdocs/compta/dons/class/don.class.php | 4 ---- htdocs/compta/journal/purchasesjournal.php | 1 - htdocs/compta/journal/sellsjournal.php | 1 - htdocs/compta/paiement/cheque/fiche.php | 1 - htdocs/core/db/mssql.class.php | 2 ++ htdocs/core/db/mysql.class.php | 2 ++ htdocs/core/db/mysqli.class.php | 2 ++ htdocs/core/db/pgsql.class.php | 3 +++ htdocs/core/db/sqlite.class.php | 2 ++ htdocs/core/lib/functions2.lib.php | 3 --- htdocs/core/modules/mailings/contacts3.modules.php | 1 - htdocs/fichinter/class/fichinter.class.php | 1 - htdocs/fourn/class/paiementfourn.class.php | 2 -- htdocs/opensurvey/class/opensurveysondage.class.php | 1 - htdocs/opensurvey/exportcsv.php | 1 - htdocs/opensurvey/public/studs.php | 1 - htdocs/opensurvey/results.php | 4 ---- htdocs/societe/consumption.php | 1 - htdocs/user/perms.php | 1 - scripts/emailings/mailing-send.php | 1 - 24 files changed, 11 insertions(+), 30 deletions(-) diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php index e598afe07a3..bade95cdcce 100644 --- a/htdocs/admin/menus/index.php +++ b/htdocs/admin/menus/index.php @@ -304,7 +304,6 @@ if ($conf->use_javascript_ajax) $sql.= " AND fk_menu >= 0"; $sql.= " ORDER BY m.position, m.rowid"; // Order is position then rowid (because we need a sort criteria when position is same) - dol_syslog("sql=".$sql); $res = $db->query($sql); if ($res) { diff --git a/htdocs/comm/mailing/liste.php b/htdocs/comm/mailing/liste.php index 617096561a3..3e06e5af005 100644 --- a/htdocs/comm/mailing/liste.php +++ b/htdocs/comm/mailing/liste.php @@ -82,7 +82,6 @@ else $sql.= $db->plimit($conf->liste_limit +1, $offset); } -dol_syslog("sql=".$sql); //print $sql; $result = $db->query($sql); if ($result) diff --git a/htdocs/compta/bank/categ.php b/htdocs/compta/bank/categ.php index 41abab1ace0..5aa72d4c049 100644 --- a/htdocs/compta/bank/categ.php +++ b/htdocs/compta/bank/categ.php @@ -52,7 +52,6 @@ if (GETPOST('add')) $sql.= ", ".$conf->entity; $sql.= ")"; - dol_syslog("sql=".$sql); $result = $db->query($sql); if (!$result) { @@ -73,7 +72,6 @@ if (GETPOST('update')) $sql.= " WHERE rowid = '".GETPOST('categid')."'"; $sql.= " AND entity = ".$conf->entity; - dol_syslog("sql=".$sql); $result = $db->query($sql); if (!$result) { @@ -92,7 +90,6 @@ if ($action == 'delete') $sql.= " WHERE rowid = '".GETPOST('categid')."'"; $sql.= " AND entity = ".$conf->entity; - dol_syslog("sql=".$sql); $result = $db->query($sql); if (!$result) { diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index 0d0246f28e6..dba271e672b 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -277,7 +277,6 @@ else $sql.= " AND b.fk_account = ba.rowid"; $sql.= $db->order("b.datev, b.datec", "ASC"); // We add date of creation to have correct order when everything is done the same day - dol_syslog("sql=".$sql); $result = $db->query($sql); if ($result) { diff --git a/htdocs/compta/dons/class/don.class.php b/htdocs/compta/dons/class/don.class.php index f7bd819d969..a37b0433c80 100644 --- a/htdocs/compta/dons/class/don.class.php +++ b/htdocs/compta/dons/class/don.class.php @@ -535,7 +535,6 @@ class Don extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 1, fk_user_valid = $userid WHERE rowid = $rowid AND fk_statut = 0"; - dol_syslog("sql=".$sql); $resql=$this->db->query($sql); if ($resql) { @@ -571,7 +570,6 @@ class Don extends CommonObject } $sql .= " WHERE rowid = $rowid AND fk_statut = 1"; - dol_syslog("sql=".$sql); $resql=$this->db->query($sql); if ($resql) { @@ -603,7 +601,6 @@ class Don extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 3 WHERE rowid = $rowid AND fk_statut = 2"; - dol_syslog("sql=".$sql); $resql=$this->db->query($sql); if ($resql) { @@ -633,7 +630,6 @@ class Don extends CommonObject { $sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = -1 WHERE rowid = ".$rowid; - dol_syslog("sql=".$sql); $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/compta/journal/purchasesjournal.php b/htdocs/compta/journal/purchasesjournal.php index 52562ed0244..5e481b49dcc 100644 --- a/htdocs/compta/journal/purchasesjournal.php +++ b/htdocs/compta/journal/purchasesjournal.php @@ -117,7 +117,6 @@ if ($date_start && $date_end) $sql .= " AND f.datef >= '".$db->idate($date_start // TODO Find a better trick to avoid problem with some mysql installations if (in_array($db->type, array('mysql', 'mysqli'))) $db->query('SET SQL_BIG_SELECTS=1'); -dol_syslog("sql=".$sql); $result = $db->query($sql); if ($result) { diff --git a/htdocs/compta/journal/sellsjournal.php b/htdocs/compta/journal/sellsjournal.php index 931b8757470..ce8bd9c7944 100644 --- a/htdocs/compta/journal/sellsjournal.php +++ b/htdocs/compta/journal/sellsjournal.php @@ -121,7 +121,6 @@ $sql.= " ORDER BY f.rowid"; // TODO Find a better trick to avoid problem with some mysql installations if (in_array($db->type, array('mysql', 'mysqli'))) $db->query('SET SQL_BIG_SELECTS=1'); -dol_syslog("sql=".$sql); $result = $db->query($sql); if ($result) { diff --git a/htdocs/compta/paiement/cheque/fiche.php b/htdocs/compta/paiement/cheque/fiche.php index fe396976f10..a2bf8a7bede 100644 --- a/htdocs/compta/paiement/cheque/fiche.php +++ b/htdocs/compta/paiement/cheque/fiche.php @@ -609,7 +609,6 @@ else $sql.= " AND b.fk_bordereau = ".$object->id; $sql.= " ORDER BY $sortfield $sortorder"; - dol_syslog("sql=".$sql); $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/core/db/mssql.class.php b/htdocs/core/db/mssql.class.php index bf67bd7d8b3..52c4fc85de1 100644 --- a/htdocs/core/db/mssql.class.php +++ b/htdocs/core/db/mssql.class.php @@ -359,6 +359,8 @@ class DoliDBMssql extends DoliDB $ret = mssql_query($query, $this->db); } + dol_syslog('sql='.$query, LOG_DEBUG); + if (! preg_match("/^COMMIT/i",$query) && ! preg_match("/^ROLLBACK/i",$query)) { // Si requete utilisateur, on la sauvegarde ainsi que son resultset diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php index ab9d6e5850e..00cc3868cd6 100644 --- a/htdocs/core/db/mysql.class.php +++ b/htdocs/core/db/mysql.class.php @@ -263,6 +263,8 @@ class DoliDBMysql extends DoliDB $ret = mysql_query($query, $this->db); } + dol_syslog('sql='.$query, LOG_DEBUG); + if (! preg_match("/^COMMIT/i",$query) && ! preg_match("/^ROLLBACK/i",$query)) { // Si requete utilisateur, on la sauvegarde ainsi que son resultset diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 40061a4fa1a..336780a1a09 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -265,6 +265,8 @@ class DoliDBMysqli extends DoliDB $ret = mysqli_query($this->db,$query); } + dol_syslog('sql='.$query, LOG_DEBUG); + if (! preg_match("/^COMMIT/i",$query) && ! preg_match("/^ROLLBACK/i",$query)) { // Si requete utilisateur, on la sauvegarde ainsi que son resultset diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 155977cc8d1..b5959df1f63 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -492,6 +492,9 @@ class DoliDBPgsql extends DoliDB } $ret = @pg_query($this->db, $query); + + dol_syslog('sql='.$query, LOG_DEBUG); + //print $query; if (! preg_match("/^COMMIT/i",$query) && ! preg_match("/^ROLLBACK/i",$query)) // Si requete utilisateur, on la sauvegarde ainsi que son resultset { diff --git a/htdocs/core/db/sqlite.class.php b/htdocs/core/db/sqlite.class.php index ad5c6532c9e..f06a92c401f 100644 --- a/htdocs/core/db/sqlite.class.php +++ b/htdocs/core/db/sqlite.class.php @@ -399,6 +399,8 @@ class DoliDBSqlite extends DoliDB $this->error=$e->getMessage(); } + dol_syslog('sql='.$query, LOG_DEBUG); + if (! preg_match("/^COMMIT/i",$query) && ! preg_match("/^ROLLBACK/i",$query)) { // Si requete utilisateur, on la sauvegarde ainsi que son resultset diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 917ceaf0e65..2f2a313699a 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1582,7 +1582,6 @@ function cleanCorruptedTree($db, $tabletocleantree, $fieldfkparent) // Check loops on each other $sql = "UPDATE ".MAIN_DB_PREFIX.$tabletocleantree." SET ".$fieldfkparent." = 0 WHERE ".$fieldfkparent." = rowid"; // So we update only records linked to themself - dol_syslog("sql=".$sql); $resql = $db->query($sql); if ($resql) { @@ -1623,7 +1622,6 @@ function cleanCorruptedTree($db, $tabletocleantree, $fieldfkparent) $sql = "UPDATE ".MAIN_DB_PREFIX.$tabletocleantree; $sql.= " SET ".$fieldfkparent." = 0"; $sql.= " WHERE rowid IN (".join(',',$listofidtoclean).")"; // So we update only records detected wrong - dol_syslog("sql=".$sql); $resql = $db->query($sql); if ($resql) { @@ -1643,7 +1641,6 @@ function cleanCorruptedTree($db, $tabletocleantree, $fieldfkparent) $sql = "UPDATE ".MAIN_DB_PREFIX.$tabletocleantree; $sql.= " SET ".$fieldfkparent." = 0"; $sql.= " WHERE ".$fieldfkparent." NOT IN (".join(',',$listofid).")"; // So we update only records linked to a non existing parent - dol_syslog("sql=".$sql); $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/core/modules/mailings/contacts3.modules.php b/htdocs/core/modules/mailings/contacts3.modules.php index 4c6480b8812..2cf5a708056 100644 --- a/htdocs/core/modules/mailings/contacts3.modules.php +++ b/htdocs/core/modules/mailings/contacts3.modules.php @@ -92,7 +92,6 @@ class mailing_contacts3 extends MailingTargets if ($filtersarray[0] <> 'all') $sql.= " AND c.label = '".$this->db->escape($filtersarray[0])."'"; $sql.= " ORDER BY sp.lastname, sp.firstname"; - dol_syslog("sql=".$sql); $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index d7bb50682fe..52585d29122 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -875,7 +875,6 @@ class Fichinter extends CommonObject $sql.= " WHERE rowid = ".$this->id; $sql.= " AND entity = ".$conf->entity; - dol_syslog("sql=".$sql); if ($this->db->query($sql)) { $this->fk_contrat = $contractid; diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index 627b2de0d84..69912e77cb0 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -286,13 +286,11 @@ class PaiementFourn extends Paiement // Efface la ligne de paiement (dans paiement_facture et paiement) $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'paiementfourn_facturefourn'; $sql.= ' WHERE fk_paiementfourn = '.$this->id; - dol_syslog("sql=".$sql); $resql = $this->db->query($sql); if ($resql) { $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'paiementfourn'; $sql.= ' WHERE rowid = '.$this->id; - dol_syslog("sql=".$sql); $result = $this->db->query($sql); if (! $result) { diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index 37c04e50a29..602f5405ca2 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -474,7 +474,6 @@ class Opensurveysondage extends CommonObject $sql = "INSERT INTO ".MAIN_DB_PREFIX."opensurvey_comments (id_sondage, comment, usercomment)"; $sql.= " VALUES ('".$this->db->escape($this->id_sondage)."','".$this->db->escape($comment)."','".$this->db->escape($comment_user)."')"; $resql = $this->db->query($sql); - dol_syslog("sql=".$sql); if (!$resql) { return false; diff --git a/htdocs/opensurvey/exportcsv.php b/htdocs/opensurvey/exportcsv.php index 2c31b67f574..fec8174a7ef 100644 --- a/htdocs/opensurvey/exportcsv.php +++ b/htdocs/opensurvey/exportcsv.php @@ -86,7 +86,6 @@ $sql ='SELECT nom, reponses'; $sql.=' FROM '.MAIN_DB_PREFIX."opensurvey_user_studs"; $sql.=" WHERE id_sondage='" . $db->escape($numsondage) . "'"; $sql.=" ORDER BY id_users"; -dol_syslog("sql=".$sql); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/opensurvey/public/studs.php b/htdocs/opensurvey/public/studs.php index 01bb969df20..f970df5bc4d 100644 --- a/htdocs/opensurvey/public/studs.php +++ b/htdocs/opensurvey/public/studs.php @@ -212,7 +212,6 @@ if ($testmodifier) $sql.= " SET reponses = '".$db->escape($nouveauchoix)."'"; $sql.= " WHERE id_users = '".$db->escape($idtomodify)."'"; - dol_syslog("sql=".$sql); $resql = $db->query($sql); if (! $resql) dol_print_error($db); } diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php index 48c585c0f2e..2d93dfd5de4 100644 --- a/htdocs/opensurvey/results.php +++ b/htdocs/opensurvey/results.php @@ -151,7 +151,6 @@ if ($testmodifier) $sql.= " SET reponses = '".$db->escape($nouveauchoix)."'"; $sql.= " WHERE id_users = '".$db->escape($idtomodify)."'"; - dol_syslog("sql=".$sql); $resql = $db->query($sql); if (! $resql) dol_print_error($db); } @@ -172,7 +171,6 @@ if (GETPOST("ajoutercolonne") && GETPOST('nouvellecolonne') && $object->format = $sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_sondage"; $sql.= " SET sujet = '".$db->escape($nouveauxsujets)."'"; $sql.= " WHERE id_sondage = '".$db->escape($numsondage)."'"; - dol_syslog("sql=".$sql); $resql = $db->query($sql); if (! $resql) dol_print_error($db); else { @@ -258,7 +256,6 @@ if (isset($_POST["ajoutercolonne"]) && $object->format == "D") $sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_sondage"; $sql.= " SET sujet = '".$db->escape($dateinsertion)."'"; $sql.= " WHERE id_sondage = '".$db->escape($numsondage)."'"; - dol_syslog("sql=".$sql); $resql = $db->query($sql); if (! $resql) dol_print_error($db); else { @@ -340,7 +337,6 @@ for ($i = 0; $i < $nbcolonnes; $i++) // Mise a jour des sujets dans la base $sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_sondage"; $sql.= " SET sujet = '".$db->escape($nouveauxsujets)."' WHERE id_sondage = '".$db->escape($numsondage)."'"; - dol_syslog("sql=".$sql); $resql = $db->query($sql); if (! $resql) dol_print_error($db); diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 520d003305d..f166369631a 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -245,7 +245,6 @@ print_barre_liste($langs->trans('ProductsIntoElements', $typeElementString.' '.$ if ($sql_select) { - dol_syslog("sql=".$sql); $resql=$db->query($sql); if (!$resql) dol_print_error($db); } diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index 49bd0877e6e..af7a95af74d 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -306,7 +306,6 @@ $sql.= " AND r.entity = ".((! empty($conf->multicompany->enabled) && ! empty($fu if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) $sql.= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is disable $sql.= " ORDER BY r.module, r.id"; -dol_syslog("sql=".$sql); $result=$db->query($sql); if ($result) { diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index 4f341b7a39b..c271b6dd7a2 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -71,7 +71,6 @@ if ($id != 'all') $sql.= " LIMIT 1"; } -dol_syslog("sql=".$sql); $resql=$db->query($sql); if ($resql) { From 9fbd7806f0621d4606b6b2e7ab74ae4da2d35319 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Thu, 12 Jun 2014 11:31:53 +0200 Subject: [PATCH 02/68] More substitutions --- dev/skeletons/skeleton_class.class.php | 8 +-- dev/skeletons/skeleton_page.php | 2 +- dev/skeletons/skeleton_script.php | 2 +- htdocs/adherents/card_subscriptions.php | 2 +- htdocs/adherents/cartes/carte.php | 2 +- htdocs/adherents/class/adherent.class.php | 38 +++++------ .../adherents/class/adherent_type.class.php | 4 +- htdocs/adherents/class/cotisation.class.php | 8 +-- htdocs/adherents/index.php | 4 +- htdocs/adherents/liste.php | 2 +- htdocs/adherents/stats/byproperties.php | 2 +- htdocs/adherents/stats/geo.php | 2 +- htdocs/admin/barcode.php | 2 +- htdocs/admin/boxes.php | 10 +-- htdocs/admin/const.php | 2 +- htdocs/admin/dict.php | 8 +-- htdocs/admin/external_rss.php | 2 +- htdocs/admin/tools/listevents.php | 2 +- htdocs/barcode/codeinit.php | 2 +- htdocs/bookmarks/class/bookmark.class.php | 8 +-- htdocs/cashdesk/class/Facturation.class.php | 2 +- htdocs/cashdesk/facturation.php | 2 +- htdocs/cashdesk/facturation_dhtml.php | 2 +- htdocs/categories/class/categorie.class.php | 16 ++--- htdocs/comm/action/class/actioncomm.class.php | 14 ++-- .../comm/action/class/cactioncomm.class.php | 4 +- htdocs/comm/action/index.php | 4 +- htdocs/comm/action/listactions.php | 2 +- htdocs/comm/action/rapport/index.php | 2 +- htdocs/comm/mailing/class/mailing.class.php | 14 ++-- htdocs/comm/mailing/fiche.php | 8 +-- htdocs/comm/propal/class/propal.class.php | 16 ++--- htdocs/commande/class/commande.class.php | 30 ++++----- htdocs/compta/bank/account.php | 4 +- htdocs/compta/bank/class/account.class.php | 28 ++++---- htdocs/compta/bank/class/bankcateg.class.php | 8 +-- htdocs/compta/bank/ligne.php | 2 +- htdocs/compta/bank/releve.php | 4 +- htdocs/compta/charges/index.php | 2 +- .../deplacement/class/deplacement.class.php | 10 +-- htdocs/compta/dons/class/don.class.php | 6 +- .../facture/class/facture-rec.class.php | 4 +- htdocs/compta/facture/class/facture.class.php | 36 +++++------ .../facture/class/paymentterm.class.php | 10 +-- .../compta/localtax/class/localtax.class.php | 10 +-- .../cheque/class/remisecheque.class.php | 16 ++--- .../compta/paiement/class/paiement.class.php | 8 +-- htdocs/compta/payment_sc/fiche.php | 2 +- .../class/bonprelevement.class.php | 64 +++++++++---------- htdocs/compta/resultat/clientfourn.php | 18 +++--- htdocs/compta/resultat/index.php | 18 +++--- .../salaries/class/paymentsalary.class.php | 8 +-- .../sociales/class/chargesociales.class.php | 14 ++-- .../class/paymentsocialcontribution.class.php | 12 ++-- htdocs/compta/stats/cabyprodserv.php | 2 +- htdocs/compta/stats/casoc.php | 2 +- htdocs/compta/tva/class/tva.class.php | 10 +-- htdocs/contact/class/contact.class.php | 20 +++--- htdocs/contact/list.php | 2 +- htdocs/contrat/class/contrat.class.php | 34 +++++----- htdocs/contrat/index.php | 2 +- htdocs/contrat/services.php | 2 +- htdocs/core/boxes/box_actions.php | 2 +- htdocs/core/boxes/box_clients.php | 2 +- htdocs/core/boxes/box_comptes.php | 2 +- htdocs/core/boxes/box_prospect.php | 2 +- htdocs/core/class/commoninvoice.class.php | 2 +- htdocs/core/class/commonobject.class.php | 62 +++++++++--------- htdocs/core/class/cpays.class.php | 8 +-- htdocs/core/class/ctypent.class.php | 8 +-- htdocs/core/class/discount.class.php | 20 +++--- htdocs/core/class/events.class.php | 8 +-- htdocs/core/class/extrafields.class.php | 8 +-- htdocs/core/class/html.form.class.php | 28 ++++---- htdocs/core/class/html.formcompany.class.php | 8 +-- htdocs/core/class/html.formcontract.class.php | 2 +- htdocs/core/class/html.formorder.class.php | 2 +- htdocs/core/class/html.formother.class.php | 2 +- htdocs/core/class/html.formprojet.class.php | 2 +- htdocs/core/class/html.formpropal.class.php | 2 +- .../class/html.formsocialcontrib.class.php | 2 +- htdocs/core/class/infobox.class.php | 6 +- htdocs/core/class/link.class.php | 6 +- htdocs/core/class/menubase.class.php | 10 +-- htdocs/core/class/notify.class.php | 6 +- htdocs/core/class/stats.class.php | 12 ++-- htdocs/core/db/mysql.class.php | 2 +- htdocs/core/db/mysqli.class.php | 2 +- htdocs/core/db/sqlite.class.php | 4 +- htdocs/core/lib/admin.lib.php | 14 ++-- htdocs/core/lib/company.lib.php | 12 ++-- htdocs/core/lib/functions.lib.php | 2 +- htdocs/core/lib/functions2.lib.php | 8 +-- htdocs/core/lib/invoice2.lib.php | 4 +- htdocs/core/lib/price.lib.php | 2 +- htdocs/core/lib/sendings.lib.php | 2 +- htdocs/core/lib/tax.lib.php | 6 +- htdocs/core/login/functions_dolibarr.php | 2 +- htdocs/core/login/functions_openid.php | 2 +- htdocs/core/modules/DolibarrModules.class.php | 44 ++++++------- htdocs/core/modules/action/rapport.pdf.php | 2 +- .../modules/commande/mod_commande_marbre.php | 2 +- .../modules/contract/mod_contract_serpis.php | 2 +- .../expedition/mod_expedition_safor.php | 2 +- .../core/modules/facture/mod_facture_mars.php | 4 +- .../modules/facture/mod_facture_terre.php | 4 +- .../modules/import/import_csv.modules.php | 2 +- .../modules/livraison/mod_livraison_jade.php | 2 +- .../core/modules/mailings/fraise.modules.php | 2 +- .../modules/project/mod_project_simple.php | 2 +- .../modules/project/task/mod_task_simple.php | 2 +- .../modules/propale/mod_propale_marbre.php | 2 +- .../modules/rapport/pdf_paiement.class.php | 2 +- .../modules/societe/mod_codeclient_monkey.php | 2 +- .../mod_facture_fournisseur_cactus.php | 4 +- ..._50_modNotification_Notification.class.php | 2 +- htdocs/cron/class/cronjob.class.php | 12 ++-- htdocs/ecm/class/ecmdirectory.class.php | 16 ++--- htdocs/expedition/class/expedition.class.php | 20 +++--- .../class/expeditionbatch.class.php | 8 +-- htdocs/expedition/shipment.php | 2 +- htdocs/exports/class/export.class.php | 8 +-- htdocs/fichinter/class/fichinter.class.php | 30 ++++----- htdocs/fourn/ajax/getSupplierPrices.php | 2 +- htdocs/fourn/class/fournisseur.class.php | 2 +- .../class/fournisseur.commande.class.php | 32 +++++----- .../fourn/class/fournisseur.facture.class.php | 30 ++++----- .../fourn/class/fournisseur.product.class.php | 12 ++-- htdocs/fourn/class/paiementfourn.class.php | 2 +- htdocs/fourn/product/liste.php | 2 +- htdocs/ftp/admin/ftpclient.php | 2 +- htdocs/holiday/class/holiday.class.php | 30 ++++----- htdocs/imports/class/import.class.php | 6 +- htdocs/install/upgrade.php | 6 +- htdocs/install/upgrade2.php | 36 +++++------ htdocs/livraison/class/livraison.class.php | 12 ++-- .../class/opensurveysondage.class.php | 12 ++-- htdocs/product/class/product.class.php | 24 +++---- htdocs/product/class/productbatch.class.php | 12 ++-- htdocs/product/liste.php | 2 +- htdocs/product/stock/class/entrepot.class.php | 16 ++--- .../stock/class/mouvementstock.class.php | 10 +-- htdocs/product/stock/index.php | 2 +- htdocs/projet/class/task.class.php | 30 ++++----- htdocs/projet/liste.php | 2 +- htdocs/resource/class/resource.class.php | 24 +++---- htdocs/societe/ajaxcompanies.php | 2 +- htdocs/societe/class/address.class.php | 2 +- .../class/companybankaccount.class.php | 2 +- htdocs/societe/class/societe.class.php | 28 ++++---- htdocs/societe/soc.php | 2 +- htdocs/user/class/user.class.php | 24 +++---- htdocs/user/class/usergroup.class.php | 10 +-- htdocs/user/fiche.php | 2 +- htdocs/user/perms.php | 4 +- .../webservices/server_productorservice.php | 2 +- htdocs/webservices/server_thirdparty.php | 2 +- scripts/emailings/mailing-send.php | 4 +- 158 files changed, 715 insertions(+), 715 deletions(-) diff --git a/dev/skeletons/skeleton_class.class.php b/dev/skeletons/skeleton_class.class.php index c36dad4b4b5..53f6d0a66f3 100644 --- a/dev/skeletons/skeleton_class.class.php +++ b/dev/skeletons/skeleton_class.class.php @@ -91,7 +91,7 @@ class Skeleton_Class extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -149,7 +149,7 @@ class Skeleton_Class extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."mytable as t"; $sql.= " WHERE t.rowid = ".$id; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch"); $resql=$this->db->query($sql); if ($resql) { @@ -204,7 +204,7 @@ class Skeleton_Class extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update"); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -278,7 +278,7 @@ class Skeleton_Class extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."mytable"; $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete"); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } } diff --git a/dev/skeletons/skeleton_page.php b/dev/skeletons/skeleton_page.php index bf63a769af7..00222bcce61 100644 --- a/dev/skeletons/skeleton_page.php +++ b/dev/skeletons/skeleton_page.php @@ -139,7 +139,7 @@ if ($action == 'list') print_liste_field_titre($langs->trans('field2'),$_SERVER['PHP_SELF'],'t.field2','',$param,'',$sortfield,$sortorder); print ''; - dol_syslog($script_file." sql=".$sql, LOG_DEBUG); + dol_syslog($script_file, LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/dev/skeletons/skeleton_script.php b/dev/skeletons/skeleton_script.php index b10b57a730a..877a420d6af 100644 --- a/dev/skeletons/skeleton_script.php +++ b/dev/skeletons/skeleton_script.php @@ -119,7 +119,7 @@ $sql.= " FROM ".MAIN_DB_PREFIX."skeleton"; $sql.= " WHERE field3 = 'xxx'"; $sql.= " ORDER BY field1 ASC"; -dol_syslog($script_file." sql=".$sql, LOG_DEBUG); +dol_syslog($script_file, LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index 0fcedb8e96d..e120ea96360 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -307,7 +307,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ $sql ="UPDATE ".MAIN_DB_PREFIX."cotisation SET fk_bank=".$insertid; $sql.=" WHERE rowid=".$crowid; - dol_syslog("card_subscriptions::cotisation sql=".$sql); + dol_syslog("card_subscriptions::cotisation", LOG_DEBUG); $resql = $db->query($sql); if (! $resql) { diff --git a/htdocs/adherents/cartes/carte.php b/htdocs/adherents/cartes/carte.php index dbccbdb4f01..ade8f059810 100644 --- a/htdocs/adherents/cartes/carte.php +++ b/htdocs/adherents/cartes/carte.php @@ -72,7 +72,7 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg if ($foruserlogin) $sql.=" AND d.login='".$db->escape($foruserlogin)."'"; $sql.= " ORDER BY d.rowid ASC"; - dol_syslog("Search members sql=".$sql); + dol_syslog("Search members", LOG_DEBUG); $result = $db->query($sql); if ($result) { diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 77cbff2918a..7dcb131b7df 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -310,7 +310,7 @@ class Adherent extends CommonObject $sql.= ", ".(! empty($this->import_key) ? "'".$this->import_key."'":"null"); $sql.= ")"; - dol_syslog(get_class($this)."::create sql=".$sql); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -335,7 +335,7 @@ class Adherent extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."user SET"; $sql.= " fk_member = '".$this->id."'"; $sql.= " WHERE rowid = ".$this->user_id; - dol_syslog(get_class($this)."::create sql=".$sql); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { @@ -455,7 +455,7 @@ class Adherent extends CommonObject $sql.= ", fk_user_mod=".($user->id>0?$user->id:'null'); // Can be null because member can be create by a guest $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::update update member sql=".$sql); + dol_syslog(get_class($this)."::update update member", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -501,14 +501,14 @@ class Adherent extends CommonObject { dol_syslog(get_class($this)."::update update link to user"); $sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member = NULL WHERE fk_member = ".$this->id; - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $this->error=$this->db->error(); $this->db->rollback(); return -5; } // If there is a user linked to this member if ($this->user_id > 0) { $sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member = ".$this->id." WHERE rowid = ".$this->user_id; - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $this->error=$this->db->error(); $this->db->rollback(); return -5; } } @@ -650,7 +650,7 @@ class Adherent extends CommonObject $sql.= " WHERE fk_adherent='".$this->id."'"; $sql.= " ORDER by dateadh DESC"; // Sort by start subscription date - dol_syslog(get_class($this)."::update_end_date sql=".$sql); + dol_syslog(get_class($this)."::update_end_date", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -663,7 +663,7 @@ class Adherent extends CommonObject $sql.= " datefin=".($datefin != '' ? "'".$this->db->idate($datefin)."'" : "null"); $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::update_end_date sql=".$sql); + dol_syslog(get_class($this)."::update_end_date", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -711,7 +711,7 @@ class Adherent extends CommonObject // Remove category $sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_member WHERE fk_member = ".$rowid; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -726,7 +726,7 @@ class Adherent extends CommonObject if (! $error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."cotisation WHERE fk_adherent = ".$rowid; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -769,7 +769,7 @@ class Adherent extends CommonObject if (! $error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent WHERE rowid = ".$rowid; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -846,7 +846,7 @@ class Adherent extends CommonObject $sql.= " WHERE rowid = ".$this->id; //dol_syslog("Adherent::Password sql=hidden"); - dol_syslog(get_class($this)."::setPassword sql=".$sql); + dol_syslog(get_class($this)."::setPassword", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -922,7 +922,7 @@ class Adherent extends CommonObject // If user is linked to this member, remove old link to this member $sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member = NULL WHERE fk_member = ".$this->id; - dol_syslog(get_class($this)."::setUserId sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::setUserId", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $this->error=$this->db->error(); $this->db->rollback(); return -1; } @@ -931,7 +931,7 @@ class Adherent extends CommonObject { $sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member = ".$this->id; $sql.= " WHERE rowid = ".$userid; - dol_syslog(get_class($this)."::setUserId sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::setUserId", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $this->error=$this->db->error(); $this->db->rollback(); return -2; } } @@ -960,7 +960,7 @@ class Adherent extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET fk_soc = null"; $sql.= " WHERE fk_soc = '".$thirdpartyid."'"; $sql.= " AND entity = ".$conf->entity; - dol_syslog(get_class($this)."::setThirdPartyId sql=".$sql); + dol_syslog(get_class($this)."::setThirdPartyId", LOG_DEBUG); $resql = $this->db->query($sql); } @@ -968,7 +968,7 @@ class Adherent extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET fk_soc = ".($thirdpartyid>0 ? $thirdpartyid : 'null'); $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::setThirdPartyId sql=".$sql); + dol_syslog(get_class($this)."::setThirdPartyId", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1088,7 +1088,7 @@ class Adherent extends CommonObject $sql.= " AND d.ref_ext='".$this->db->escape($ref_ext)."'"; } - dol_syslog(get_class($this)."::fetch sql=".$sql); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -1198,7 +1198,7 @@ class Adherent extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."cotisation as c"; $sql.= " WHERE c.fk_adherent = ".$this->id; $sql.= " ORDER BY c.dateadh"; - dol_syslog(get_class($this)."::fetch_subscriptions sql=".$sql); + dol_syslog(get_class($this)."::fetch_subscriptions", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -1356,7 +1356,7 @@ class Adherent extends CommonObject $sql.= ", fk_user_valid=".$user->id; $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::validate sql=".$sql); + dol_syslog(get_class($this)."::validate", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -1902,7 +1902,7 @@ class Adherent extends CommonObject $sql.= ' FROM '.MAIN_DB_PREFIX.'adherent as a'; $sql.= ' WHERE a.rowid = '.$id; - dol_syslog(get_class($this)."::info sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::info", LOG_DEBUG); $result=$this->db->query($sql); if ($result) { diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index e861af709b8..78e046978e9 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -76,7 +76,7 @@ class AdherentType extends CommonObject $sql.= ", ".$conf->entity; $sql.= ")"; - dol_syslog("Adherent_type::create sql=".$sql); + dol_syslog("Adherent_type::create", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -188,7 +188,7 @@ class AdherentType extends CommonObject $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d"; $sql .= " WHERE d.rowid = ".$rowid; - dol_syslog("Adherent_type::fetch sql=".$sql); + dol_syslog("Adherent_type::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) diff --git a/htdocs/adherents/class/cotisation.class.php b/htdocs/adherents/class/cotisation.class.php index 1fc0994b54a..712205c3a0d 100644 --- a/htdocs/adherents/class/cotisation.class.php +++ b/htdocs/adherents/class/cotisation.class.php @@ -82,7 +82,7 @@ class Cotisation extends CommonObject $sql.= " '".$this->db->idate($this->datef)."',"; $sql.= " ".$this->amount.",'".$this->db->escape($this->note)."')"; - dol_syslog(get_class($this)."::create sql=".$sql); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -113,7 +113,7 @@ class Cotisation extends CommonObject $sql.=" FROM ".MAIN_DB_PREFIX."cotisation"; $sql.=" WHERE rowid=".$rowid; - dol_syslog(get_class($this)."::fetch sql=".$sql); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -168,7 +168,7 @@ class Cotisation extends CommonObject $sql .= " fk_bank = ".($this->fk_bank ? $this->fk_bank : 'null'); $sql .= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::update sql=".$sql); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -207,7 +207,7 @@ class Cotisation extends CommonObject $this->db->begin(); $sql = "DELETE FROM ".MAIN_DB_PREFIX."cotisation WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index e64466ce9a6..0aaafa461fb 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -68,7 +68,7 @@ $sql.= " AND d.entity IN (".getEntity().")"; $sql.= " WHERE t.entity IN (".getEntity().")"; $sql.= " GROUP BY t.rowid, t.libelle, t.cotisation, d.statut"; -dol_syslog("index.php::select nb of members by type sql=".$sql, LOG_DEBUG); +dol_syslog("index.php::select nb of members by type", LOG_DEBUG); $result = $db->query($sql); if ($result) { @@ -106,7 +106,7 @@ $sql.= " AND d.statut = 1 AND d.datefin >= '".$db->idate($now)."'"; $sql.= " AND t.rowid = d.fk_adherent_type"; $sql.= " GROUP BY d.fk_adherent_type"; -dol_syslog("index.php::select nb of uptodate members by type sql=".$sql, LOG_DEBUG); +dol_syslog("index.php::select nb of uptodate members by type", LOG_DEBUG); $result = $db->query($sql); if ($result) { diff --git a/htdocs/adherents/liste.php b/htdocs/adherents/liste.php index a5fbe1dc5c9..c1dfb9d2302 100644 --- a/htdocs/adherents/liste.php +++ b/htdocs/adherents/liste.php @@ -158,7 +158,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($conf->liste_limit+1, $offset); -dol_syslog("get list sql=".$sql); +dol_syslog("get list", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/adherents/stats/byproperties.php b/htdocs/adherents/stats/byproperties.php index e8355cbb941..fdb9153ba88 100644 --- a/htdocs/adherents/stats/byproperties.php +++ b/htdocs/adherents/stats/byproperties.php @@ -74,7 +74,7 @@ $sql.=" GROUP BY d.morphy"; $foundphy=$foundmor=0; // Define $data array -dol_syslog("Count member sql=".$sql); +dol_syslog("Count member", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php index 1cb98f353b6..ecf27f78465 100644 --- a/htdocs/adherents/stats/geo.php +++ b/htdocs/adherents/stats/geo.php @@ -138,7 +138,7 @@ if ($mode) //print $langsen->trans("Country"."FI");exit; // Define $data array - dol_syslog("Count member sql=".$sql); + dol_syslog("Count member", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index 988b49efd07..78c99916910 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -203,7 +203,7 @@ $sql.= " FROM ".MAIN_DB_PREFIX."c_barcode_type"; $sql.= " WHERE entity = ".$conf->entity; $sql.= " ORDER BY code"; -dol_syslog("admin/barcode.php sql=".$sql); +dol_syslog("admin/barcode.php", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php index d58a1576a31..bc140735c61 100644 --- a/htdocs/admin/boxes.php +++ b/htdocs/admin/boxes.php @@ -66,7 +66,7 @@ if ($action == 'add') $sql.= " WHERE param = 'MAIN_BOXES_".$db->escape(GETPOST("pos","alpha"))."' AND value = '1'"; $sql.= " AND entity = ".$conf->entity; $resql = $db->query($sql); - dol_syslog("boxes.php search fk_user to activate box for sql=".$sql); + dol_syslog("boxes.php search fk_user to activate box for", LOG_DEBUG); if ($resql) { $num = $db->num_rows($resql); @@ -93,7 +93,7 @@ if ($action == 'add') { $nbboxonleft=$nbboxonright=0; $sql = "SELECT box_order FROM ".MAIN_DB_PREFIX."boxes WHERE position = ".GETPOST("pos","alpha")." AND fk_user = ".$fk_user." AND entity = ".$conf->entity; - dol_syslog("boxes.php activate box sql=".$sql); + dol_syslog("boxes.php activate box", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { @@ -112,7 +112,7 @@ if ($action == 'add') $sql.= GETPOST("boxid","int").", ".GETPOST("pos","alpha").", '".(($nbboxonleft > $nbboxonright) ? 'B01' : 'A01')."', ".$fk_user.", ".$conf->entity; $sql.= ")"; - dol_syslog("boxes.php activate box sql=".$sql); + dol_syslog("boxes.php activate box", LOG_DEBUG); $resql = $db->query($sql); if (! $resql) { @@ -235,7 +235,7 @@ $sql.= " AND b.box_id = bd.rowid"; $sql.= " AND b.fk_user=0"; $sql.= " ORDER by b.position, b.box_order"; -dol_syslog("Search available boxes sql=".$sql, LOG_DEBUG); +dol_syslog("Search available boxes", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { @@ -271,7 +271,7 @@ if ($resql) $sql.= " WHERE entity = ".$conf->entity; $sql.= " AND LENGTH(box_order) <= 2"; - dol_syslog("Execute requests to renumber box order sql=".$sql); + dol_syslog("Execute requests to renumber box order", LOG_DEBUG); $result = $db->query($sql); if ($result) { diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index eb9cae41917..48e637fb8a3 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -233,7 +233,7 @@ if (empty($user->entity) && $debug) {} // to force for superadmin elseif ($user->entity || empty($conf->multicompany->enabled)) $sql.= " AND visible = 1"; $sql.= " ORDER BY entity, name ASC"; -dol_syslog("Const::listConstant sql=".$sql); +dol_syslog("Const::listConstant", LOG_DEBUG); $result = $db->query($sql); if ($result) { diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index d834929d00f..6120e94f4ac 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -528,7 +528,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) } $sql.=",1)"; - dol_syslog("actionadd sql=".$sql); + dol_syslog("actionadd", LOG_DEBUG); $result = $db->query($sql); if ($result) // Add is ok { @@ -576,7 +576,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) } $sql.= " WHERE ".$rowidcol." = '".$rowid."'"; - dol_syslog("actionmodify sql=".$sql); + dol_syslog("actionmodify", LOG_DEBUG); //print $sql; $resql = $db->query($sql); if (! $resql) @@ -599,7 +599,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete $sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'"; - dol_syslog("delete sql=".$sql); + dol_syslog("delete", LOG_DEBUG); $result = $db->query($sql); if (! $result) { @@ -826,7 +826,7 @@ if ($id) print ''; // List of available values in database - dol_syslog("htdocs/admin/dict sql=".$sql, LOG_DEBUG); + dol_syslog("htdocs/admin/dict", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/admin/external_rss.php b/htdocs/admin/external_rss.php index 0b9534689d0..1944521a581 100644 --- a/htdocs/admin/external_rss.php +++ b/htdocs/admin/external_rss.php @@ -229,7 +229,7 @@ $sql ="SELECT rowid, file, note FROM ".MAIN_DB_PREFIX."boxes_def"; $sql.=" WHERE file = 'box_external_rss.php'"; $sql.=" ORDER BY note"; -dol_syslog("select rss boxes sql=".$sql,LOG_DEBUG); +dol_syslog("select rss boxes", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index 10bd42d9590..c2671f698a4 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -78,7 +78,7 @@ if ($action == 'confirm_purge' && $confirm == 'yes' && $user->admin) $sql = "DELETE FROM ".MAIN_DB_PREFIX."events"; $sql.= " WHERE entity = ".$conf->entity; - dol_syslog("listevents purge sql=".$sql); + dol_syslog("listevents purge", LOG_DEBUG); $resql = $db->query($sql); if (! $resql) { diff --git a/htdocs/barcode/codeinit.php b/htdocs/barcode/codeinit.php index d6ca6a7d66f..a5d207b5339 100644 --- a/htdocs/barcode/codeinit.php +++ b/htdocs/barcode/codeinit.php @@ -126,7 +126,7 @@ if ($action == 'initbarcodeproducts') $sql.=$db->order("datec","ASC"); $sql.=$db->plimit($maxperinit); - dol_syslog("codeinit sql=".$sql, LOG_DEBUG); + dol_syslog("codeinit", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/bookmarks/class/bookmark.class.php b/htdocs/bookmarks/class/bookmark.class.php index 2aa86c5db20..aa92d2bedb9 100644 --- a/htdocs/bookmarks/class/bookmark.class.php +++ b/htdocs/bookmarks/class/bookmark.class.php @@ -65,7 +65,7 @@ class Bookmark $sql.= " WHERE rowid = ".$id; $sql.= " AND entity = ".$conf->entity; - dol_syslog("Bookmark::fetch sql=".$sql, LOG_DEBUG); + dol_syslog("Bookmark::fetch", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -123,7 +123,7 @@ class Bookmark if ($this->fk_soc) $sql.=",".$this->fk_soc; $sql.= ")"; - dol_syslog("Bookmark::update sql=".$sql, LOG_DEBUG); + dol_syslog("Bookmark::update", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -173,7 +173,7 @@ class Bookmark $sql.= " ,position = '".$this->position."'"; $sql.= " WHERE rowid = ".$this->id; - dol_syslog("Bookmark::update sql=".$sql, LOG_DEBUG); + dol_syslog("Bookmark::update", LOG_DEBUG); if ($this->db->query($sql)) { return 1; @@ -196,7 +196,7 @@ class Bookmark $sql = "DELETE FROM ".MAIN_DB_PREFIX."bookmark"; $sql .= " WHERE rowid = ".$id; - dol_syslog("Bookmark::remove sql=".$sql, LOG_DEBUG); + dol_syslog("Bookmark::remove", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/cashdesk/class/Facturation.class.php b/htdocs/cashdesk/class/Facturation.class.php index b2bb87a0bb2..296ced0f172 100644 --- a/htdocs/cashdesk/class/Facturation.class.php +++ b/htdocs/cashdesk/class/Facturation.class.php @@ -103,7 +103,7 @@ class Facturation $sql.= " FROM ".MAIN_DB_PREFIX."c_tva"; $sql.= " WHERE rowid = ".$this->tva(); - dol_syslog("ajoutArticle sql=".$sql); + dol_syslog("ajoutArticle", LOG_DEBUG); $resql = $db->query($sql); if ($resql) diff --git a/htdocs/cashdesk/facturation.php b/htdocs/cashdesk/facturation.php index 4d442c0dbd3..2f3da75d977 100644 --- a/htdocs/cashdesk/facturation.php +++ b/htdocs/cashdesk/facturation.php @@ -65,7 +65,7 @@ if ( GETPOST('filtre') ) { else $sql.= ")"; $sql.= " ORDER BY label"; - dol_syslog("facturation.php sql=".$sql); + dol_syslog("facturation.php", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/cashdesk/facturation_dhtml.php b/htdocs/cashdesk/facturation_dhtml.php index 88a22f7865a..e481fcbecf6 100644 --- a/htdocs/cashdesk/facturation_dhtml.php +++ b/htdocs/cashdesk/facturation_dhtml.php @@ -62,7 +62,7 @@ if (dol_strlen($_GET["code"]) >= 0) // If search criteria is on char length at l } $sql.= " ORDER BY label"; - dol_syslog("facturation_dhtml.php sql=".$sql); + dol_syslog("facturation_dhtml.php", LOG_DEBUG); $result = $db->query($sql); if ($result) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 8d2c4ceed46..2d657dc6e1c 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -87,7 +87,7 @@ class Categorie extends CommonObject if ($label) $sql.= " WHERE label = '".$this->db->escape($label)."' AND entity=".$conf->entity;; } - dol_syslog(get_class($this)."::fetch sql=".$sql); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -278,7 +278,7 @@ class Categorie extends CommonObject $sql .= ", fk_parent = ".$this->fk_parent; $sql .= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::update sql=".$sql); + dol_syslog(get_class($this)."::update", LOG_DEBUG); if ($this->db->query($sql)) { @@ -488,7 +488,7 @@ class Categorie extends CommonObject $sql = 'SELECT fk_parent FROM '.MAIN_DB_PREFIX.'categorie'; $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::add_type sql=".$sql); + dol_syslog(get_class($this)."::add_type", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -626,7 +626,7 @@ class Categorie extends CommonObject $sql.= " AND c.fk_categorie = ".$this->id; $sql.= " AND c.fk_".$field." = o.rowid"; - dol_syslog(get_class($this)."::getObjectsInCateg sql=".$sql); + dol_syslog(get_class($this)."::getObjectsInCateg", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -679,7 +679,7 @@ class Categorie extends CommonObject } $sql = "SELECT COUNT(*) as nb FROM " . MAIN_DB_PREFIX . "categorie_" . $category_table; $sql .= " WHERE fk_categorie = " . $this->id . " AND fk_" . $field . " = " . $object_id; - dol_syslog(get_class($this)."::containsObject sql=".$sql); + dol_syslog(get_class($this)."::containsObject", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { return $this->db->fetch_object($resql)->nb; @@ -737,7 +737,7 @@ class Categorie extends CommonObject $sql.= " WHERE fk_parent != 0"; $sql.= " AND entity IN (".getEntity('category',1).")"; - dol_syslog(get_class($this)."::load_motherof sql=".$sql); + dol_syslog(get_class($this)."::load_motherof", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -788,7 +788,7 @@ class Categorie extends CommonObject $sql.= " WHERE c.entity IN (".getEntity('category',1).")"; $sql.= " AND c.type = ".$type; - dol_syslog(get_class($this)."::get_full_arbo get category list sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::get_full_arbo get category list", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -982,7 +982,7 @@ class Categorie extends CommonObject $sql.= " AND c.fk_parent = ".$this->fk_parent; $sql.= " AND c.label = '".$this->db->escape($this->label)."'"; - dol_syslog(get_class($this)."::already_exists sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::already_exists", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index ee9e4c032ee..03d3f7b8025 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -202,7 +202,7 @@ class ActionComm extends CommonObject $sql.= $conf->entity; $sql.= ")"; - dol_syslog(get_class($this)."::add sql=".$sql); + dol_syslog(get_class($this)."::add", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -292,7 +292,7 @@ class ActionComm extends CommonObject $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc"; $sql.= " WHERE a.id=".$id." AND a.fk_action=c.id"; - dol_syslog(get_class($this)."::fetch sql=".$sql); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -369,7 +369,7 @@ class ActionComm extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm"; $sql.= " WHERE id=".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $res=$this->db->query($sql); if ($res < 0) { $this->error=$this->db->lasterror(); @@ -477,7 +477,7 @@ class ActionComm extends CommonObject $sql.= ", fk_user_done=".($this->userdone->id > 0 ? "'".$this->userdone->id."'":"null"); $sql.= " WHERE id=".$this->id; - dol_syslog(get_class($this)."::update sql=".$sql); + dol_syslog(get_class($this)."::update", LOG_DEBUG); if ($this->db->query($sql)) { @@ -558,7 +558,7 @@ class ActionComm extends CommonObject } if (! empty($filter)) $sql.= $filter; - dol_syslog(get_class()."::getActions sql=".$sql); + dol_syslog(get_class()."::getActions", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { @@ -644,7 +644,7 @@ class ActionComm extends CommonObject $sql.= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a'; $sql.= ' WHERE a.id = '.$id; - dol_syslog(get_class($this)."::info sql=".$sql); + dol_syslog(get_class($this)."::info", LOG_DEBUG); $result=$this->db->query($sql); if ($result) { @@ -930,7 +930,7 @@ class ActionComm extends CommonObject $sql.= " ORDER by datep"; //print $sql;exit; - dol_syslog(get_class($this)."::build_exportfile select events sql=".$sql); + dol_syslog(get_class($this)."::build_exportfile select events", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index 68960c5a6c0..8908b4e2a46 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -64,7 +64,7 @@ class CActionComm if (is_numeric($id)) $sql.= " WHERE id=".$id; else $sql.= " WHERE code='".$id."'"; - dol_syslog(get_class($this)."::fetch sql=".$sql); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -117,7 +117,7 @@ class CActionComm if (! empty($excludetype)) $sql.=($active != ''?" AND":" WHERE")." type <> '".$excludetype."'"; $sql.= " ORDER BY module, position"; - dol_syslog(get_class($this)."::liste_array sql=".$sql); + dol_syslog(get_class($this)."::liste_array", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 92b87d94ad1..2c3791c4c1b 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -361,7 +361,7 @@ if ($filtera > 0 || $filtert > 0 || $filterd > 0) $sql.= ' ORDER BY datep'; //print $sql; -dol_syslog("comm/action/index.php sql=".$sql, LOG_DEBUG); +dol_syslog("comm/action/index.php", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { @@ -472,7 +472,7 @@ if ($showbirthday) } $sql.= ' ORDER BY birthday'; - dol_syslog("comm/action/index.php sql=".$sql, LOG_DEBUG); + dol_syslog("comm/action/index.php", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index e6944f4c829..56a9efa5589 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -183,7 +183,7 @@ $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit + 1, $offset); //print $sql; -dol_syslog("comm/action/listactions.php sql=".$sql); +dol_syslog("comm/action/listactions.php", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/comm/action/rapport/index.php b/htdocs/comm/action/rapport/index.php index 78f1ca24827..f34678787fa 100644 --- a/htdocs/comm/action/rapport/index.php +++ b/htdocs/comm/action/rapport/index.php @@ -89,7 +89,7 @@ $sql.= " ORDER BY year DESC, month DESC, df DESC"; $sql.= $db->plimit($limit+1,$offset); //print $sql; -dol_syslog("select sql=".$sql); +dol_syslog("select", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index 99b1a2f4419..2cb298bff3f 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -109,7 +109,7 @@ class Mailing extends CommonObject $this->titre = $langs->trans("NoTitle"); } - dol_syslog("Mailing::Create sql=".$sql); + dol_syslog("Mailing::Create", LOG_DEBUG); $result=$this->db->query($sql); if ($result) { @@ -157,7 +157,7 @@ class Mailing extends CommonObject $sql .= ", bgimage = '".($this->bgimage?$this->bgimage:null)."'"; $sql .= " WHERE rowid = ".$this->id; - dol_syslog("Mailing::Update sql=".$sql); + dol_syslog("Mailing::Update", LOG_DEBUG); $result=$this->db->query($sql); if ($result) { @@ -192,7 +192,7 @@ class Mailing extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."mailing as m"; $sql.= " WHERE m.rowid = ".$rowid; - dol_syslog(get_class($this)."::fetch sql=".$sql); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $result=$this->db->query($sql); if ($result) { @@ -325,7 +325,7 @@ class Mailing extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles "; $sql.= " WHERE fk_mailing = ".$fromid; - dol_syslog(get_class($this)."::createFromClone sql=".$sql); + dol_syslog(get_class($this)."::createFromClone", LOG_DEBUG); $result=$this->db->query($sql); if ($result) { @@ -384,7 +384,7 @@ class Mailing extends CommonObject $sql .= " SET statut = 1, date_valid = '".$this->db->idate($now)."', fk_user_valid=".$user->id; $sql .= " WHERE rowid = ".$this->id; - dol_syslog("Mailing::valid sql=".$sql, LOG_DEBUG); + dol_syslog("Mailing::valid", LOG_DEBUG); if ($this->db->query($sql)) { return 1; @@ -409,7 +409,7 @@ class Mailing extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing"; $sql.= " WHERE rowid = ".$rowid; - dol_syslog("Mailing::delete sql=".$sql, LOG_DEBUG); + dol_syslog("Mailing::delete", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -436,7 +436,7 @@ class Mailing extends CommonObject $sql.= " SET statut = 0"; $sql.= " WHERE fk_mailing = ".$this->id; - dol_syslog("Mailing::reset_targets_status sql=".$sql, LOG_DEBUG); + dol_syslog("Mailing::reset_targets_status", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php index d803de28357..b08eb746a09 100644 --- a/htdocs/comm/mailing/fiche.php +++ b/htdocs/comm/mailing/fiche.php @@ -173,7 +173,7 @@ if ($action == 'sendallconfirmed' && $confirm == 'yes') $sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc"; $sql .= " WHERE mc.statut < 1 AND mc.fk_mailing = ".$object->id; - dol_syslog("fiche.php: select targets sql=".$sql, LOG_DEBUG); + dol_syslog("fiche.php: select targets", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { @@ -295,7 +295,7 @@ if ($action == 'sendallconfirmed' && $confirm == 'yes') { //Update status communication of thirdparty prospect $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=2 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE rowid=".$obj->rowid.")"; - dol_syslog("fiche.php: set prospect thirdparty status sql=".$sql, LOG_DEBUG); + dol_syslog("fiche.php: set prospect thirdparty status", LOG_DEBUG); $resql2=$db->query($sql); if (! $resql2) { @@ -304,7 +304,7 @@ if ($action == 'sendallconfirmed' && $confirm == 'yes') //Update status communication of contact prospect $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=2 WHERE rowid IN (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."socpeople AS sc INNER JOIN ".MAIN_DB_PREFIX."mailing_cibles AS mc ON mc.rowid=".$obj->rowid." AND mc.source_type = 'contact' AND mc.source_id = sc.rowid)"; - dol_syslog("fiche.php: set prospect contact status sql=".$sql, LOG_DEBUG); + dol_syslog("fiche.php: set prospect contact status", LOG_DEBUG); $resql2=$db->query($sql); if (! $resql2) @@ -363,7 +363,7 @@ if ($action == 'sendallconfirmed' && $confirm == 'yes') } $sql="UPDATE ".MAIN_DB_PREFIX."mailing SET statut=".$statut." WHERE rowid=".$object->id; - dol_syslog("comm/mailing/fiche.php: update global status sql=".$sql, LOG_DEBUG); + dol_syslog("comm/mailing/fiche.php: update global status", LOG_DEBUG); $resql2=$db->query($sql); if (! $resql2) { diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 070f0232215..5122bd15f51 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -749,7 +749,7 @@ class Propal extends CommonObject $sql.= ", ".$conf->entity; $sql.= ")"; - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -760,7 +760,7 @@ class Propal extends CommonObject $this->ref='(PROV'.$this->id.')'; $sql = 'UPDATE '.MAIN_DB_PREFIX."propal SET ref='".$this->ref."' WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::create sql=".$sql); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) $error++; @@ -1075,7 +1075,7 @@ class Propal extends CommonObject if ($ref) $sql.= " AND p.ref='".$ref."'"; else $sql.= " AND p.rowid=".$rowid; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -1410,7 +1410,7 @@ class Propal extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET datep = '".$this->db->idate($date)."'"; $sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0"; - dol_syslog(get_class($this)."::set_date sql=".$sql); + dol_syslog(get_class($this)."::set_date", LOG_DEBUG); if ($this->db->query($sql) ) { $this->date = $date; @@ -1667,7 +1667,7 @@ class Propal extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::reopen sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::reopen", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); @@ -1993,7 +1993,7 @@ class Propal extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."facture"; $sql.= " WHERE rowid IN (".implode(',',$linkedInvoices).")"; - dol_syslog(get_class($this)."::InvoiceArrayList sql=".$sql); + dol_syslog(get_class($this)."::InvoiceArrayList", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -2974,7 +2974,7 @@ class PropaleLigne extends CommonObject $this->db->begin(); $sql = "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE rowid = ".$this->rowid; - dol_syslog("PropaleLigne::delete sql=".$sql, LOG_DEBUG); + dol_syslog("PropaleLigne::delete", LOG_DEBUG); if ($this->db->query($sql) ) { @@ -3085,7 +3085,7 @@ class PropaleLigne extends CommonObject $sql.= " , date_end=".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null"); $sql.= " WHERE rowid = ".$this->rowid; - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index e2b0f5506fb..5af12ef11bb 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -229,7 +229,7 @@ class Commande extends CommonOrder $sql.= " fk_user_valid = ".$user->id; $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::valid() sql=".$sql); + dol_syslog(get_class($this)."::valid()", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -352,7 +352,7 @@ class Commande extends CommonOrder $sql.= " SET fk_statut = 0"; $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::set_draft sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::set_draft", LOG_DEBUG); if ($this->db->query($sql)) { // If stock is decremented on validate order, we must reincrement it @@ -424,7 +424,7 @@ class Commande extends CommonOrder $sql.= ' SET fk_statut=1, facture=0'; $sql.= ' WHERE rowid = '.$this->id; - dol_syslog(get_class($this)."::set_reopen sql=".$sql); + dol_syslog(get_class($this)."::set_reopen", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -535,7 +535,7 @@ class Commande extends CommonOrder $sql.= " WHERE rowid = ".$this->id; $sql.= " AND fk_statut = 1"; - dol_syslog(get_class($this)."::cancel sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::cancel", LOG_DEBUG); if ($this->db->query($sql)) { // If stock is decremented on validate order, we must reincrement it @@ -672,7 +672,7 @@ class Commande extends CommonOrder $sql.= ", ".$conf->entity; $sql.= ")"; - dol_syslog(get_class($this)."::create sql=".$sql); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -1327,7 +1327,7 @@ class Commande extends CommonOrder if ($ref_ext) $sql.= " AND c.ref_ext='".$this->db->escape($ref_ext)."'"; if ($ref_int) $sql.= " AND c.ref_int='".$this->db->escape($ref_int)."'"; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -1511,7 +1511,7 @@ class Commande extends CommonOrder if ($only_product) $sql .= ' AND p.fk_product_type = 0'; $sql .= ' ORDER BY l.rang'; - dol_syslog(get_class($this)."::fetch_lines sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -1638,7 +1638,7 @@ class Commande extends CommonOrder $sql.= ' GROUP BY cd.rowid, cd.fk_product'; //print $sql; - dol_syslog(get_class($this)."::loadExpeditions sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::loadExpeditions", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -1938,7 +1938,7 @@ class Commande extends CommonOrder $sql.= " SET date_livraison = ".($date_livraison ? "'".$this->db->idate($date_livraison)."'" : 'null'); $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::set_date_livraison sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::set_date_livraison", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -2206,7 +2206,7 @@ class Commande extends CommonOrder $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande SET facture = 1'; $sql.= ' WHERE rowid = '.$this->id.' AND fk_statut > 0'; - dol_syslog(get_class($this)."::classifyBilled sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::classifyBilled", LOG_DEBUG); if ($this->db->query($sql)) { // Appel des triggers @@ -2445,7 +2445,7 @@ class Commande extends CommonOrder { // Delete order details $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commandedet WHERE fk_commande = ".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); if (! $this->db->query($sql) ) { dol_syslog(get_class($this)."::delete error", LOG_ERR); @@ -2454,7 +2454,7 @@ class Commande extends CommonOrder // Delete order $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commande WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); if (! $this->db->query($sql) ) { dol_syslog(get_class($this)."::delete error", LOG_ERR); @@ -3156,7 +3156,7 @@ class OrderLine extends CommonOrderLine $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commandedet WHERE rowid='".$this->rowid."';"; - dol_syslog("OrderLine::delete sql=".$sql); + dol_syslog("OrderLine::delete", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -3269,7 +3269,7 @@ class OrderLine extends CommonOrderLine $sql.= " ".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null"); $sql.= ')'; - dol_syslog(get_class($this)."::insert sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::insert", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -3379,7 +3379,7 @@ class OrderLine extends CommonOrderLine if (! empty($this->rang)) $sql.= ", rang=".$this->rang; $sql.= " WHERE rowid = ".$this->rowid; - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 27690ae7093..ecc1443d838 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -241,7 +241,7 @@ if ($id > 0 || ! empty($ref)) $sql.= " AND ba.entity = ".$conf->entity; $sql.= $sql_rech; - dol_syslog("account.php count transactions - sql=".$sql, LOG_DEBUG); + dol_syslog("account.php count transactions -", LOG_DEBUG); $result=$db->query($sql); if ($result) { @@ -485,7 +485,7 @@ if ($id > 0 || ! empty($ref)) $sql.= $db->order("b.datev, b.datec", "ASC"); // We add date of creation to have correct order when everything is done the same day $sql.= $db->plimit($limitsql, 0); - dol_syslog("account.php get transactions - sql=".$sql, LOG_DEBUG); + dol_syslog("account.php get transactions -", LOG_DEBUG); $result = $db->query($sql); if ($result) { diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 8bcabf7f17b..0179149e69f 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -146,7 +146,7 @@ class Account extends CommonObject $sql.= ", '".$type."'"; $sql.= ")"; - dol_syslog(get_class($this)."::add_url_line sql=".$sql); + dol_syslog(get_class($this)."::add_url_line", LOG_DEBUG); if ($this->db->query($sql)) { $rowid = $this->db->last_insert_id(MAIN_DB_PREFIX."bank_url"); @@ -189,7 +189,7 @@ class Account extends CommonObject } $sql.= " ORDER BY type, label"; - dol_syslog(get_class($this)."::get_url sql=".$sql); + dol_syslog(get_class($this)."::get_url", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -302,7 +302,7 @@ class Account extends CommonObject $sql.= ", ".($banque?"'".$this->db->escape($banque)."'":"null"); $sql.= ")"; - dol_syslog(get_class($this)."::addline sql=".$sql); + dol_syslog(get_class($this)."::addline", LOG_DEBUG); if ($this->db->query($sql)) { $rowid = $this->db->last_insert_id(MAIN_DB_PREFIX."bank"); @@ -404,7 +404,7 @@ class Account extends CommonObject $sql.= ", ".$this->country_id; $sql.= ")"; - dol_syslog(get_class($this)."::create sql=".$sql); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -513,7 +513,7 @@ class Account extends CommonObject $sql.= " WHERE rowid = ".$this->id; $sql.= " AND entity = ".$conf->entity; - dol_syslog(get_class($this)."::update sql=".$sql); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -617,7 +617,7 @@ class Account extends CommonObject if ($id) $sql.= " AND ba.rowid = ".$id; if ($ref) $sql.= " AND ba.ref = '".$this->db->escape($ref)."'"; - dol_syslog(get_class($this)."::fetch sql=".$sql); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -691,7 +691,7 @@ class Account extends CommonObject $sql.= " WHERE rowid = ".$this->rowid; $sql.= " AND entity = ".$conf->entity; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { return 1; @@ -1091,7 +1091,7 @@ class AccountLine extends CommonObject else if ($ref) $sql.= " AND b.rowid='".$this->db->escape($ref)."'"; else $sql.= " AND b.rowid=".$rowid; - dol_syslog(get_class($this)."::fetch sql=".$sql); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -1166,12 +1166,12 @@ class AccountLine extends CommonObject } $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid=".$this->rowid; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $result = $this->db->query($sql); if (! $result) $nbko++; $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank WHERE rowid=".$this->rowid; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $result = $this->db->query($sql); if (! $result) $nbko++; @@ -1208,7 +1208,7 @@ class AccountLine extends CommonObject $this->db->begin(); $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_url WHERE fk_bank=".$this->rowid; - dol_syslog(get_class($this)."::delete_urls sql=".$sql); + dol_syslog(get_class($this)."::delete_urls", LOG_DEBUG); $result = $this->db->query($sql); if (! $result) $nbko++; @@ -1242,7 +1242,7 @@ class AccountLine extends CommonObject $sql.= " dateo='".$this->db->idate($this->dateo)."'"; $sql.= " WHERE rowid = ".$this->rowid; - dol_syslog(get_class($this)."::update sql=".$sql); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1276,7 +1276,7 @@ class AccountLine extends CommonObject $sql.= ", fk_user_rappro = ".$user->id; $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::update_conciliation sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update_conciliation", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1290,7 +1290,7 @@ class AccountLine extends CommonObject $sql.= ", ".$cat; $sql.= ")"; - dol_syslog(get_class($this)."::update_conciliation sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update_conciliation", LOG_DEBUG); $resql = $this->db->query($sql); // No error check. Can fail if category already affected diff --git a/htdocs/compta/bank/class/bankcateg.class.php b/htdocs/compta/bank/class/bankcateg.class.php index c4066bae655..1bcadc4eb1a 100644 --- a/htdocs/compta/bank/class/bankcateg.class.php +++ b/htdocs/compta/bank/class/bankcateg.class.php @@ -84,7 +84,7 @@ class BankCateg // extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -142,7 +142,7 @@ class BankCateg // extends CommonObject $sql.= " WHERE t.rowid = ".$id; $sql.= " AND t.entity = ".$conf->entity; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -192,7 +192,7 @@ class BankCateg // extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -249,7 +249,7 @@ class BankCateg // extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } diff --git a/htdocs/compta/bank/ligne.php b/htdocs/compta/bank/ligne.php index fee53c412b8..1ebc99a344d 100644 --- a/htdocs/compta/bank/ligne.php +++ b/htdocs/compta/bank/ligne.php @@ -175,7 +175,7 @@ if ($user->rights->banque->consolidate && ($action == 'num_releve' || $action == else $sql.=", rappro = ".$rappro; $sql.= " WHERE rowid = ".$rowid; - dol_syslog("ligne.php sql=".$sql, LOG_DEBUG); + dol_syslog("ligne.php", LOG_DEBUG); $result = $db->query($sql); if ($result) { diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index dba271e672b..172140c2c64 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -189,7 +189,7 @@ else $sql.= " AND b.fk_account = ".$acct->id; $sql.= " ORDER BY b.num_releve DESC"; - dol_syslog("htdocs/compta/bank/releve.php sql=".$sql); + dol_syslog("htdocs/compta/bank/releve.php", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { @@ -211,7 +211,7 @@ else $sql.= " AND b.fk_account = ".$acct->id; $sql.= " ORDER BY b.num_releve ASC"; - dol_syslog("htdocs/compta/bank/releve.php sql=".$sql); + dol_syslog("htdocs/compta/bank/releve.php", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index f38f7e72aa2..e4286157617 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -207,7 +207,7 @@ if ($conf->tax->enabled) //$sql.= $db->plimit($limit+1,$offset); //print $sql; - dol_syslog("compta/charges/index.php: select payment sql=".$sql); + dol_syslog("compta/charges/index.php: select payment", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index f47046e2bdd..d46585c300d 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -120,7 +120,7 @@ class Deplacement extends CommonObject $sql.= ", ".($this->fk_soc > 0? $this->fk_soc : "null"); $sql.= ")"; - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -203,7 +203,7 @@ class Deplacement extends CommonObject $sql .= " , fk_projet = ".($this->fk_project>0?$this->fk_project:0); $sql .= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -230,7 +230,7 @@ class Deplacement extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."deplacement"; $sql.= " WHERE rowid = ".$id; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $result = $this->db->query($sql); if ( $result ) { @@ -271,7 +271,7 @@ class Deplacement extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."deplacement WHERE rowid = ".$id; - dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -381,7 +381,7 @@ class Deplacement extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."c_type_fees"; $sql.= " WHERE active = ".$active; - dol_syslog(get_class($this)."::listOfTypes sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::listOfTypes", LOG_DEBUG); $result = $this->db->query($sql); if ( $result ) { diff --git a/htdocs/compta/dons/class/don.class.php b/htdocs/compta/dons/class/don.class.php index a37b0433c80..df99859e663 100644 --- a/htdocs/compta/dons/class/don.class.php +++ b/htdocs/compta/dons/class/don.class.php @@ -354,7 +354,7 @@ class Don extends CommonObject $sql.= ", '".$this->db->escape($this->phone_mobile)."'"; $sql.= ")"; - dol_syslog("Don::create sql=".$sql, LOG_DEBUG); + dol_syslog("Don::create", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -414,7 +414,7 @@ class Don extends CommonObject $sql .= ",fk_statut=".$this->statut; $sql .= " WHERE rowid = $this->id"; - dol_syslog("Don::update sql=".$sql); + dol_syslog("Don::update", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -478,7 +478,7 @@ class Don extends CommonObject $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON cp.id = d.fk_paiement"; $sql.= " WHERE d.rowid = ".$rowid." AND d.entity = ".$conf->entity; - dol_syslog(get_class($this)."::fetch sql=".$sql); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 7147f51c613..f87e640d78e 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -216,7 +216,7 @@ class FactureRec extends Facture $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = f.rowid AND el.targettype = 'facture'"; $sql.= ' WHERE f.rowid='.$rowid; - dol_syslog("FactureRec::Fetch rowid=".$rowid." sql=".$sql, LOG_DEBUG); + dol_syslog("FactureRec::Fetch rowid=".$rowid."", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -497,7 +497,7 @@ class FactureRec extends Facture $sql.= ", ".$rang; $sql.= ", ".$special_code.")"; - dol_syslog(get_class($this)."::addline sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::addline", LOG_DEBUG); if ($this->db->query($sql)) { $this->id=$facid; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 81bf47715e6..48d6e4d34e8 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -263,7 +263,7 @@ class Facture extends CommonInvoice $sql.= ",".$this->mode_reglement_id; $sql.= ", '".$this->db->idate($datelim)."', '".$this->modelpdf."')"; - dol_syslog(get_class($this)."::create sql=".$sql); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -273,7 +273,7 @@ class Facture extends CommonInvoice $this->ref='(PROV'.$this->id.')'; $sql = 'UPDATE '.MAIN_DB_PREFIX."facture SET facnumber='".$this->ref."' WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::create sql=".$sql); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) $error++; @@ -846,7 +846,7 @@ class Facture extends CommonInvoice if ($ref_ext) $sql.= " AND f.ref_ext='".$this->db->escape($ref_ext)."'"; if ($ref_int) $sql.= " AND f.ref_int='".$this->db->escape($ref_int)."'"; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -1089,7 +1089,7 @@ class Facture extends CommonInvoice $this->db->begin(); - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); @@ -1311,7 +1311,7 @@ class Facture extends CommonInvoice $sql.= ' SET fk_facture = NULL, fk_facture_line = NULL'; $sql.= ' WHERE fk_facture_line IN ('.join(',',$list_rowid_det).')'; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); if (! $this->db->query($sql)) { $this->error=$this->db->error()." sql=".$sql; @@ -1501,7 +1501,7 @@ class Facture extends CommonInvoice if ($close_note) $sql.= ", close_note='".$this->db->escape($close_note)."'"; $sql.= ' WHERE rowid = '.$this->id; - dol_syslog(get_class($this)."::set_paid sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::set_paid", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1557,7 +1557,7 @@ class Facture extends CommonInvoice $sql.= ' SET paye=0, fk_statut=1, close_code=null, close_note=null'; $sql.= ' WHERE rowid = '.$this->id; - dol_syslog(get_class($this)."::set_unpaid sql=".$sql); + dol_syslog(get_class($this)."::set_unpaid", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1767,7 +1767,7 @@ class Facture extends CommonInvoice } $sql.= ' WHERE rowid = '.$this->id; - dol_syslog(get_class($this)."::validate sql=".$sql); + dol_syslog(get_class($this)."::validate", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -1907,7 +1907,7 @@ class Facture extends CommonInvoice $sql.= " SET fk_statut = 0"; $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::set_draft sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::set_draft", LOG_DEBUG); $result=$this->db->query($sql); if ($result) { @@ -2321,7 +2321,7 @@ class Facture extends CommonInvoice $sql.= ' SET fk_facture_line = NULL'; $sql.= ' WHERE fk_facture_line = '.$rowid; - dol_syslog(get_class($this)."::deleteline sql=".$sql); + dol_syslog(get_class($this)."::deleteline", LOG_DEBUG); $result = $this->db->query($sql); if (! $result) { @@ -2461,7 +2461,7 @@ class Facture extends CommonInvoice $sql.= ' AND p.fk_paiement = t.id'; if ($filtertype) $sql.=" AND t.code='PRE'"; - dol_syslog(get_class($this)."::getListOfPayments sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::getListOfPayments", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -2857,7 +2857,7 @@ class Facture extends CommonInvoice if ($socid > 0) $sql.=" AND f.fk_soc = ".$socid; $sql.= " ORDER BY f.facnumber"; - dol_syslog(get_class($this)."::list_qualified_avoir_invoices sql=".$sql); + dol_syslog(get_class($this)."::list_qualified_avoir_invoices", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -2906,7 +2906,7 @@ class Facture extends CommonInvoice $sql.= ' WHERE fk_facture = '.$this->id; $sql.= ' AND traite = 0'; - dol_syslog(get_class($this)."::demande_prelevement sql=".$sql); + dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -2937,7 +2937,7 @@ class Facture extends CommonInvoice $sql .= ",'".$bac->number."'"; $sql .= ",'".$bac->cle_rib."')"; - dol_syslog(get_class($this)."::demande_prelevement sql=".$sql); + dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG); if ($this->db->query($sql)) { return 1; @@ -3569,7 +3569,7 @@ class FactureLigne extends CommonInvoiceLine $sql.= " ".price2num($this->total_localtax2); $sql.= ')'; - dol_syslog(get_class($this)."::insert sql=".$sql); + dol_syslog(get_class($this)."::insert", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -3732,7 +3732,7 @@ class FactureLigne extends CommonInvoiceLine if (! empty($this->rang)) $sql.= ", rang=".$this->rang; $sql.= " WHERE rowid = ".$this->rowid; - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -3783,7 +3783,7 @@ class FactureLigne extends CommonInvoiceLine $this->db->begin(); $sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet WHERE rowid = ".$this->rowid; - dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); if ($this->db->query($sql) ) { // Appel des triggers @@ -3831,7 +3831,7 @@ class FactureLigne extends CommonInvoiceLine $sql.= ",total_ttc=".price2num($this->total_ttc).""; $sql.= " WHERE rowid = ".$this->rowid; - dol_syslog(get_class($this)."::update_total sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update_total", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) diff --git a/htdocs/compta/facture/class/paymentterm.class.php b/htdocs/compta/facture/class/paymentterm.class.php index 62ebcbacdbd..b137c0da85c 100644 --- a/htdocs/compta/facture/class/paymentterm.class.php +++ b/htdocs/compta/facture/class/paymentterm.class.php @@ -119,7 +119,7 @@ class PaymentTerm // extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -185,7 +185,7 @@ class PaymentTerm // extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."c_payment_term as t"; $sql.= " WHERE t.rowid = ".$id; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -235,7 +235,7 @@ class PaymentTerm // extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."c_payment_term as t"; $sql.= " WHERE t.code = 'RECEP'"; - dol_syslog(get_class($this)."::getDefaultId sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::getDefaultId", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -301,7 +301,7 @@ class PaymentTerm // extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -357,7 +357,7 @@ class PaymentTerm // extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } diff --git a/htdocs/compta/localtax/class/localtax.class.php b/htdocs/compta/localtax/class/localtax.class.php index b500a701254..5580cbe70a3 100644 --- a/htdocs/compta/localtax/class/localtax.class.php +++ b/htdocs/compta/localtax/class/localtax.class.php @@ -95,7 +95,7 @@ class Localtax extends CommonObject $sql.= " '".$this->fk_user_modif."'"; $sql.= ")"; - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -152,7 +152,7 @@ class Localtax extends CommonObject $sql.= " fk_user_modif='".$this->fk_user_modif."'"; $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { @@ -202,7 +202,7 @@ class Localtax extends CommonObject $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON t.fk_bank = b.rowid"; $sql.= " WHERE t.rowid = ".$id; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -253,7 +253,7 @@ class Localtax extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."localtax"; $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { @@ -488,7 +488,7 @@ class Localtax extends CommonObject $sql.=", '".$user->id."', NULL"; $sql.= ")"; - dol_syslog(get_class($this)."::addPayment sql=".$sql); + dol_syslog(get_class($this)."::addPayment", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 917c88e0743..e6f8963b3e9 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -73,7 +73,7 @@ class RemiseCheque extends CommonObject if ($id) $sql.= " AND bc.rowid = ".$id; if ($ref) $sql.= " AND bc.number = '".$this->db->escape($ref)."'"; - dol_syslog("RemiseCheque::fetch sql=".$sql, LOG_DEBUG); + dol_syslog("RemiseCheque::fetch", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -155,7 +155,7 @@ class RemiseCheque extends CommonObject $sql.= ", ''"; $sql.= ")"; - dol_syslog("RemiseCheque::Create sql=".$sql, LOG_DEBUG); + dol_syslog("RemiseCheque::Create", LOG_DEBUG); $resql = $this->db->query($sql); if ( $resql ) { @@ -172,7 +172,7 @@ class RemiseCheque extends CommonObject $sql.= " SET number='(PROV".$this->id.")'"; $sql.= " WHERE rowid='".$this->id."';"; - dol_syslog("RemiseCheque::Create sql=".$sql, LOG_DEBUG); + dol_syslog("RemiseCheque::Create", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { @@ -192,7 +192,7 @@ class RemiseCheque extends CommonObject $sql.= " AND b.fk_account='".$account_id."'"; if ($limit) $sql.= $this->db->plimit($limit); - dol_syslog("RemiseCheque::Create sql=".$sql, LOG_DEBUG); + dol_syslog("RemiseCheque::Create", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -225,7 +225,7 @@ class RemiseCheque extends CommonObject $sql.= " SET fk_bordereau = ".$this->id; $sql.= " WHERE rowid = ".$lineid; - dol_syslog("RemiseCheque::Create sql=".$sql, LOG_DEBUG); + dol_syslog("RemiseCheque::Create", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { @@ -351,7 +351,7 @@ class RemiseCheque extends CommonObject $sql.= " AND entity = ".$conf->entity; $sql.= " AND statut = 0"; - dol_syslog("RemiseCheque::Validate sql=".$sql, LOG_DEBUG); + dol_syslog("RemiseCheque::Validate", LOG_DEBUG); $resql = $this->db->query($sql); if ( $resql ) { @@ -410,7 +410,7 @@ class RemiseCheque extends CommonObject $sql.= " WHERE entity = ".$conf->entity; $sql.= " AND number not like '(%'"; - dol_syslog("Remisecheque::getNextNumber sql=".$sql); + dol_syslog("Remisecheque::getNextNumber", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -510,7 +510,7 @@ class RemiseCheque extends CommonObject $sql.= " AND bc.entity = ".$conf->entity; $sql.= " ORDER BY b.dateo ASC, b.rowid ASC"; - dol_syslog("RemiseCheque::generatePdf sql=".$sql, LOG_DEBUG); + dol_syslog("RemiseCheque::generatePdf", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 93f5f017c44..71c9dc44d81 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -81,7 +81,7 @@ class Paiement extends CommonObject $sql.= ' WHERE p.fk_paiement = c.id'; $sql.= ' AND p.rowid = '.$id; - dol_syslog(get_class($this)."::fetch sql=".$sql); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $result = $this->db->query($sql); if ($result) @@ -161,7 +161,7 @@ class Paiement extends CommonObject $sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement (entity, datec, datep, amount, fk_paiement, num_paiement, note, fk_user_creat)"; $sql.= " VALUES (".$conf->entity.", '".$this->db->idate($now)."', '".$this->db->idate($this->datepaye)."', '".$totalamount."', ".$this->paiementid.", '".$this->num_paiement."', '".$this->db->escape($this->note)."', ".$user->id.")"; - dol_syslog(get_class($this)."::Create insert paiement sql=".$sql); + dol_syslog(get_class($this)."::Create insert paiement", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -581,7 +581,7 @@ class Paiement extends CommonObject $sql.= " SET datep = '".$this->db->idate($date)."'"; $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::update_date sql=".$sql); + dol_syslog(get_class($this)."::update_date", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -613,7 +613,7 @@ class Paiement extends CommonObject $sql.= " SET num_paiement = '".$this->db->escape($num)."'"; $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::update_num sql=".$sql); + dol_syslog(get_class($this)."::update_num", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { diff --git a/htdocs/compta/payment_sc/fiche.php b/htdocs/compta/payment_sc/fiche.php index 3a010bcae37..5c6562b6fc0 100644 --- a/htdocs/compta/payment_sc/fiche.php +++ b/htdocs/compta/payment_sc/fiche.php @@ -211,7 +211,7 @@ $sql.= ' WHERE pf.fk_charge = f.rowid AND f.fk_type = pc.id'; $sql.= ' AND f.entity = '.$conf->entity; $sql.= ' AND pf.rowid = '.$paiement->id; -dol_syslog("compta/payment_sc/fiche.php sql=".$sql); +dol_syslog("compta/payment_sc/fiche.php", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 6840fcf139d..3d224bbe274 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -279,7 +279,7 @@ class BonPrelevement extends CommonObject $sql.= " WHERE p.rowid = ".$rowid; $sql.= " AND p.entity = ".$conf->entity; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $result=$this->db->query($sql); if ($result) { @@ -779,7 +779,7 @@ class BonPrelevement extends CommonObject //if ($banque) $sql.= " AND sr.code_banque = '".$conf->global->PRELEVEMENT_CODE_BANQUE."'"; //if ($agence) $sql.= " AND sr.code_guichet = '".$conf->global->PRELEVEMENT_CODE_GUICHET."'"; - dol_syslog(get_class($this)."::Create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::Create", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -896,7 +896,7 @@ class BonPrelevement extends CommonObject $sql.= " WHERE ref LIKE '".$ref."%'"; $sql.= " AND entity = ".$conf->entity; - dol_syslog(get_class($this)."::Create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::Create", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) @@ -922,7 +922,7 @@ class BonPrelevement extends CommonObject $sql.= ", '".$this->db->idate($now)."'"; $sql.= ")"; - dol_syslog(get_class($this)."::Create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::Create", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) @@ -983,7 +983,7 @@ class BonPrelevement extends CommonObject $sql.= ", fk_prelevement_bons = ".$prev_id; $sql.= " WHERE rowid = ".$fac[1]; - dol_syslog(get_class($this)."::Create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::Create", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -1040,7 +1040,7 @@ class BonPrelevement extends CommonObject $sql.= " WHERE rowid = ".$prev_id; $sql.= " AND entity = ".$conf->entity; - dol_syslog(get_class($this)."::Create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::Create", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -1411,32 +1411,32 @@ class BonPrelevement extends CommonObject fputs($this->file, ' '.$CrLf); fputs($this->file, ''.$CrLf); - $sql = "SELECT pl.amount"; - $sql.= " FROM"; - $sql.= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; - $sql.= " ".MAIN_DB_PREFIX."facture as f,"; - $sql.= " ".MAIN_DB_PREFIX."prelevement_facture as pf"; - $sql.= " WHERE pl.fk_prelevement_bons = ".$this->id; - $sql.= " AND pl.rowid = pf.fk_prelevement_lignes"; - $sql.= " AND pf.fk_facture = f.rowid"; - - //Lines - $i = 0; - $resql=$this->db->query($sql); - if ($resql) - { - $num = $this->db->num_rows($resql); - - while ($i < $num) - { - $obj = $this->db->fetch_object($resql); - $this->total = $this->total + $obj->amount; - $i++; - } - } - else - { - $result = -2; + $sql = "SELECT pl.amount"; + $sql.= " FROM"; + $sql.= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; + $sql.= " ".MAIN_DB_PREFIX."facture as f,"; + $sql.= " ".MAIN_DB_PREFIX."prelevement_facture as pf"; + $sql.= " WHERE pl.fk_prelevement_bons = ".$this->id; + $sql.= " AND pl.rowid = pf.fk_prelevement_lignes"; + $sql.= " AND pf.fk_facture = f.rowid"; + + //Lines + $i = 0; + $resql=$this->db->query($sql); + if ($resql) + { + $num = $this->db->num_rows($resql); + + while ($i < $num) + { + $obj = $this->db->fetch_object($resql); + $this->total = $this->total + $obj->amount; + $i++; + } + } + else + { + $result = -2; } } diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index d68aa528122..5dcd09814ad 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -190,7 +190,7 @@ if ($socid) $sql.= " AND f.fk_soc = ".$socid; $sql.= " GROUP BY s.nom, s.rowid"; $sql.= " ORDER BY s.nom, s.rowid"; -dol_syslog("get customer invoices sql=".$sql); +dol_syslog("get customer invoices", LOG_DEBUG); $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); @@ -235,7 +235,7 @@ if ($modecompta != 'CREANCES-DETTES') $sql.= " GROUP BY nom, idp"; $sql.= " ORDER BY nom"; - dol_syslog("get old customer payments not linked to invoices sql=".$sql); + dol_syslog("get old customer payments not linked to invoices", LOG_DEBUG); $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); @@ -320,7 +320,7 @@ print ''.$langs->trans("SuppliersInvoices").''; $subtotal_ht = 0; $subtotal_ttc = 0; -dol_syslog("get suppliers invoices sql=".$sql); +dol_syslog("get suppliers invoices", LOG_DEBUG); $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); @@ -401,7 +401,7 @@ $sql.= " AND cs.entity = ".$conf->entity; $sql.= " GROUP BY c.libelle, c.id"; $sql.= " ORDER BY c.libelle, c.id"; -dol_syslog("get social contributions deductible=0 sql=".$sql); +dol_syslog("get social contributions deductible=0", LOG_DEBUG); $result=$db->query($sql); $subtotal_ht = 0; $subtotal_ttc = 0; @@ -478,7 +478,7 @@ else $sql.= " ORDER BY c.libelle, c.id"; } -dol_syslog("get social contributions deductible=1 sql=".$sql); +dol_syslog("get social contributions deductible=1", LOG_DEBUG); $result=$db->query($sql); $subtotal_ht = 0; $subtotal_ttc = 0; @@ -564,7 +564,7 @@ if ($modecompta == 'CREANCES-DETTES') $sql.= " GROUP BY dm"; $sql.= " ORDER BY dm"; - dol_syslog("get vat to pay sql=".$sql); + dol_syslog("get vat to pay", LOG_DEBUG); $result=$db->query($sql); if ($result) { @@ -609,7 +609,7 @@ if ($modecompta == 'CREANCES-DETTES') $sql.= " GROUP BY dm"; $sql.= " ORDER BY dm"; - dol_syslog("get vat received back sql=".$sql); + dol_syslog("get vat received back", LOG_DEBUG); $result=$db->query($sql); if ($result) { @@ -653,7 +653,7 @@ else $sql.= " GROUP BY dm"; $sql.= " ORDER BY dm"; - dol_syslog("get vat really paid sql=".$sql); + dol_syslog("get vat really paid", LOG_DEBUG); $result=$db->query($sql); if ($result) { $num = $db->num_rows($result); @@ -694,7 +694,7 @@ else $sql.= " GROUP BY dm"; $sql.= " ORDER BY dm"; - dol_syslog("get vat really received back sql=".$sql); + dol_syslog("get vat really received back", LOG_DEBUG); $result=$db->query($sql); if ($result) { $num = $db->num_rows($result); diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index b3a42d85a6b..c61c8b76e08 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -123,7 +123,7 @@ $sql.= " GROUP BY dm"; $sql.= " ORDER BY dm"; //print $sql; -dol_syslog("get customers invoices sql=".$sql); +dol_syslog("get customers invoices", LOG_DEBUG); $result=$db->query($sql); if ($result) { @@ -157,7 +157,7 @@ if ($modecompta != 'CREANCES-DETTES') $sql.= " GROUP BY dm"; $sql.= " ORDER BY dm"; - dol_syslog("get old customers payments not linked to invoices sql=".$sql); + dol_syslog("get old customers payments not linked to invoices", LOG_DEBUG); $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); @@ -208,7 +208,7 @@ $sql.= " AND f.entity = ".$conf->entity; if ($socid) $sql.= " AND f.fk_soc = ".$socid; $sql.= " GROUP BY dm"; -dol_syslog("get suppliers invoices sql=".$sql); +dol_syslog("get suppliers invoices", LOG_DEBUG); $result=$db->query($sql); if ($result) { @@ -249,7 +249,7 @@ if ($modecompta == 'CREANCES-DETTES') $sql.= " AND f.entity = ".$conf->entity; $sql.= " GROUP BY dm"; - dol_syslog("get vat to pay sql=".$sql); + dol_syslog("get vat to pay", LOG_DEBUG); $result=$db->query($sql); if ($result) { $num = $db->num_rows($result); @@ -280,7 +280,7 @@ if ($modecompta == 'CREANCES-DETTES') $sql.= " AND f.entity = ".$conf->entity; $sql.= " GROUP BY dm"; - dol_syslog("get vat to receive back sql=".$sql); + dol_syslog("get vat to receive back", LOG_DEBUG); $result=$db->query($sql); if ($result) { $num = $db->num_rows($result); @@ -311,7 +311,7 @@ else { $sql.= " AND t.entity = ".$conf->entity; $sql.= " GROUP BY dm"; - dol_syslog("get vat really paid sql=".$sql); + dol_syslog("get vat really paid", LOG_DEBUG); $result=$db->query($sql); if ($result) { $num = $db->num_rows($result); @@ -340,7 +340,7 @@ else { $sql.= " AND t.entity = ".$conf->entity; $sql.= " GROUP BY dm"; - dol_syslog("get vat really received back sql=".$sql); + dol_syslog("get vat really received back", LOG_DEBUG); $result=$db->query($sql); if ($result) { $num = $db->num_rows($result); @@ -390,7 +390,7 @@ else $sql.= " AND cs.entity = ".$conf->entity; $sql.= " GROUP BY c.libelle, dm"; -dol_syslog("get social contributions deductible=0 sql=".$sql); +dol_syslog("get social contributions deductible=0 ", LOG_DEBUG); $result=$db->query($sql); if ($result) { $num = $db->num_rows($result); @@ -440,7 +440,7 @@ else $sql.= " AND cs.entity = ".$conf->entity; $sql.= " GROUP BY c.libelle, dm"; -dol_syslog("get social contributions paid deductible=1 sql=".$sql); +dol_syslog("get social contributions paid deductible=1", LOG_DEBUG); $result=$db->query($sql); if ($result) { $num = $db->num_rows($result); diff --git a/htdocs/compta/salaries/class/paymentsalary.class.php b/htdocs/compta/salaries/class/paymentsalary.class.php index ecf4b16212b..76a781bfe9b 100644 --- a/htdocs/compta/salaries/class/paymentsalary.class.php +++ b/htdocs/compta/salaries/class/paymentsalary.class.php @@ -114,7 +114,7 @@ class PaymentSalary extends CommonObject $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { @@ -174,7 +174,7 @@ class PaymentSalary extends CommonObject $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid"; $sql.= " WHERE s.rowid = ".$id; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -230,7 +230,7 @@ class PaymentSalary extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_salary"; $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { @@ -355,7 +355,7 @@ class PaymentSalary extends CommonObject $sql.= ", ".$conf->entity; $sql.= ")"; - dol_syslog(get_class($this)."::create sql=".$sql); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 6404d9f26c8..09e4ebaef0c 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -74,7 +74,7 @@ class ChargeSociales extends CommonObject $sql.= " WHERE cs.fk_type = c.id"; $sql.= " AND cs.rowid = ".$id; - dol_syslog(get_class($this)."::fetch sql=".$sql); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -137,7 +137,7 @@ class ChargeSociales extends CommonObject $sql.= " ".$conf->entity; $sql.= ")"; - dol_syslog(get_class($this)."::create sql=".$sql); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -192,7 +192,7 @@ class ChargeSociales extends CommonObject if (! $error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."paiementcharge where fk_charge='".$this->id."'"; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -204,7 +204,7 @@ class ChargeSociales extends CommonObject if (! $error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."chargesociales where rowid='".$this->id."'"; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -243,7 +243,7 @@ class ChargeSociales extends CommonObject $sql.= " periode='".$this->db->idate($this->periode)."'"; $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::update sql=".$sql); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -419,7 +419,7 @@ class ChargeSociales extends CommonObject $sql.= ' FROM '.MAIN_DB_PREFIX.$table; $sql.= ' WHERE '.$field.' = '.$this->id; - dol_syslog(get_class($this)."::getSommePaiement sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::getSommePaiement", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -449,7 +449,7 @@ class ChargeSociales extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as e"; $sql.= " WHERE e.rowid = ".$id; - dol_syslog(get_class($this)."::info sql=".$sql); + dol_syslog(get_class($this)."::info", LOG_DEBUG); $result=$this->db->query($sql); if ($result) { diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index e89f2a273f8..95e796f98a0 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -116,7 +116,7 @@ class PaymentSocialContribution extends CommonObject $sql.= " ".$this->paiementtype.", '".$this->db->escape($this->num_paiement)."', '".$this->db->escape($this->note)."', ".$user->id.","; $sql.= " 0)"; - dol_syslog(get_class($this)."::create sql=".$sql); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -173,7 +173,7 @@ class PaymentSocialContribution extends CommonObject $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid'; $sql.= " WHERE t.rowid = ".$id." AND t.fk_typepaiement = pt.id"; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -263,7 +263,7 @@ class PaymentSocialContribution extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -321,7 +321,7 @@ class PaymentSocialContribution extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_url"; $sql.= " WHERE type='payment_sc' AND url_id=".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } } @@ -331,7 +331,7 @@ class PaymentSocialContribution extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."paiementcharge"; $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } } @@ -560,7 +560,7 @@ class PaymentSocialContribution extends CommonObject { $sql = "UPDATE ".MAIN_DB_PREFIX."paiementcharge SET fk_bank = ".$id_bank." WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::update_fk_bank sql=".$sql); + dol_syslog(get_class($this)."::update_fk_bank", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index 2b2ad5be02f..1bc88e176d9 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -212,7 +212,7 @@ if ($modecompta == 'CREANCES-DETTES') $sql.= " GROUP BY p.rowid"; $sql.= " ORDER BY p.ref"; - dol_syslog("cabyprodserv sql=".$sql); + dol_syslog("cabyprodserv", LOG_DEBUG); $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index fd4afbfdf01..3535db5594a 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -250,7 +250,7 @@ $sql.= " GROUP BY s.rowid, s.nom"; $sql.= " ORDER BY s.rowid"; //echo $sql; -dol_syslog("casoc sql=".$sql); +dol_syslog("casoc", LOG_DEBUG); $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index c605c97fed9..386158d1c7e 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -115,7 +115,7 @@ class Tva extends CommonObject $sql.= ")"; - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -178,7 +178,7 @@ class Tva extends CommonObject $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { @@ -233,7 +233,7 @@ class Tva extends CommonObject $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON t.fk_bank = b.rowid"; $sql.= " WHERE t.rowid = ".$id; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -286,7 +286,7 @@ class Tva extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."tva"; $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { @@ -539,7 +539,7 @@ class Tva extends CommonObject $sql.= ", ".$conf->entity; $sql.= ")"; - dol_syslog(get_class($this)."::addPayment sql=".$sql); + dol_syslog(get_class($this)."::addPayment", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 4187de7136c..727fa6486a9 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -155,7 +155,7 @@ class Contact extends CommonObject $sql.= " ".(! empty($this->import_key)?"'".$this->import_key."'":"null"); $sql.= ")"; - dol_syslog(get_class($this)."::create sql=".$sql); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -276,7 +276,7 @@ class Contact extends CommonObject $sql .= ", no_email=".($this->no_email?"'".$this->no_email."'":"0"); $sql .= " WHERE rowid=".$this->db->escape($id); - dol_syslog(get_class($this)."::update sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -444,7 +444,7 @@ class Contact extends CommonObject if ($user) $sql .= ", fk_user_modif=".$user->id; $sql.= " WHERE rowid=".$this->db->escape($id); - dol_syslog(get_class($this)."::update_perso this->birthday=".$this->birthday." - sql=".$sql); + dol_syslog(get_class($this)."::update_perso this->birthday=".$this->birthday." -", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { @@ -523,7 +523,7 @@ class Contact extends CommonObject $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON c.fk_soc = s.rowid"; $sql.= " WHERE c.rowid = ". $id; - dol_syslog(get_class($this)."::fetch sql=".$sql); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -664,7 +664,7 @@ class Contact extends CommonObject $sql.=" AND fk_socpeople = ". $this->id; $sql.=" GROUP BY tc.element"; - dol_syslog(get_class($this)."::load_ref_elements sql=".$sql); + dol_syslog(get_class($this)."::load_ref_elements", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -716,7 +716,7 @@ class Contact extends CommonObject $sql.= " WHERE ec.fk_socpeople=".$this->id; $sql.= " AND ec.fk_c_type_contact=tc.rowid"; $sql.= " AND tc.source='external'"; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -751,7 +751,7 @@ class Contact extends CommonObject { // Remove category $sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_contact WHERE fk_socpeople = ".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -766,7 +766,7 @@ class Contact extends CommonObject { $sql = "DELETE FROM ".MAIN_DB_PREFIX."socpeople"; $sql .= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $result = $this->db->query($sql); if (! $result) { @@ -866,7 +866,7 @@ class Contact extends CommonObject $sql.= " WHERE mc.email = '".$this->db->escape($this->email)."'"; $sql.= " AND mc.statut NOT IN (-1,0)"; // -1 erreur, 0 non envoye, 1 envoye avec succes - dol_syslog(get_class($this)."::getNbOfEMailings sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::getNbOfEMailings", LOG_DEBUG); $resql=$this->db->query($sql); @@ -1070,7 +1070,7 @@ class Contact extends CommonObject $sql.= " WHERE rowid = ".$this->id; $result = $this->db->query($sql); - dol_syslog(get_class($this)."::setstatus sql=".$sql); + dol_syslog(get_class($this)."::setstatus", LOG_DEBUG); if ($result) { // Appel des triggers diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 8e1d54944c0..5c2b2f04938 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -239,7 +239,7 @@ else } //print $sql; -dol_syslog("contact/list.php sql=".$sql); +dol_syslog("contact/list.php", LOG_DEBUG); $result = $db->query($sql); if ($result) { diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index daf22e0af7c..140d64c2daf 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -154,7 +154,7 @@ class Contrat extends CommonObject $sql.= " commentaire = '".$this->db->escape($comment)."'"; $sql.= " WHERE rowid = ".$line_id . " AND (statut = 0 OR statut = 3 OR statut = 5)"; - dol_syslog(get_class($this)."::active_line sql=".$sql); + dol_syslog(get_class($this)."::active_line", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -315,7 +315,7 @@ class Contrat extends CommonObject //$sql.= ", fk_user_valid = ".$user->id.", date_valid = '".$this->db->idate($now)."'"; $sql .= " WHERE rowid = ".$this->id . " AND statut = 0"; - dol_syslog(get_class($this)."::validate sql=".$sql); + dol_syslog(get_class($this)."::validate", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { @@ -416,7 +416,7 @@ class Contrat extends CommonObject } else $sql.= " WHERE rowid=".$id; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -505,7 +505,7 @@ class Contrat extends CommonObject $sql.= " WHERE d.fk_contrat = ".$this->id ." AND d.fk_product = p.rowid"; $sql.= " ORDER by d.rowid ASC"; - dol_syslog(get_class($this)."::fetch_lines sql=".$sql); + dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -794,7 +794,7 @@ class Contrat extends CommonObject } else { - $this->error=$langs->trans("UnknownError: ".$this->db->error()." - sql=".$sql); + $this->error=$langs->trans("UnknownError: ".$this->db->error()." -", LOG_DEBUG); dol_syslog(get_class($this)."::create - 10 - ".$this->error, LOG_ERR); $this->db->rollback(); @@ -840,7 +840,7 @@ class Contrat extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."contratdet_log as cdl, ".MAIN_DB_PREFIX."contratdet as cd"; $sql.= " WHERE cdl.fk_contratdet=cd.rowid AND cd.fk_contrat=".$this->id; - dol_syslog(get_class($this)."::delete contratdet_log sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delete contratdet_log", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -861,7 +861,7 @@ class Contrat extends CommonObject $sql= "DELETE FROM ".MAIN_DB_PREFIX."contratdet_log "; $sql.= " WHERE ".MAIN_DB_PREFIX."contratdet_log.rowid IN (".implode(",",$tab_resql).")"; - dol_syslog(get_class($this)."::delete contratdet_log sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delete contratdet_log", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -877,7 +877,7 @@ class Contrat extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."contratdet"; $sql.= " WHERE fk_contrat=".$this->id; - dol_syslog(get_class($this)."::delete contratdet sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delete contratdet", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -892,7 +892,7 @@ class Contrat extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."contrat"; $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::delete contrat sql=".$sql); + dol_syslog(get_class($this)."::delete contrat", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -1067,7 +1067,7 @@ class Contrat extends CommonObject if ($date_end > 0) { $sql.= ",'".$this->db->idate($date_end)."'"; } $sql.= ")"; - dol_syslog(get_class($this)."::addline sql=".$sql); + dol_syslog(get_class($this)."::addline", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -1214,7 +1214,7 @@ class Contrat extends CommonObject else { $sql.=",date_cloture=null"; } $sql .= " WHERE rowid = ".$rowid; - dol_syslog(get_class($this)."::updateline sql=".$sql); + dol_syslog(get_class($this)."::updateline", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -1258,7 +1258,7 @@ class Contrat extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."contratdet"; $sql.= " WHERE rowid=".$idline; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { @@ -1468,7 +1468,7 @@ class Contrat extends CommonObject $sql.= " WHERE fk_contrat =".$this->id; if ($statut >= 0) $sql.= " AND statut = '$statut'"; - dol_syslog(get_class($this)."::array_detail() sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::array_detail()", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -1504,7 +1504,7 @@ class Contrat extends CommonObject $sql.= " WHERE fk_soc =".$this->socid; if ($option == 'others') $sql.= " AND c.rowid != ".$this->id; - dol_syslog(get_class($this)."::getOtherContracts() sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::getOtherContracts()", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -1944,7 +1944,7 @@ class ContratLigne if ($id) $sql.= " WHERE t.rowid = ".$id; if ($ref) $sql.= " WHERE t.rowid = '".$ref."'"; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -2099,7 +2099,7 @@ class ContratLigne $sql.= " commentaire='".$this->db->escape($this->commentaire)."'"; $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -2147,7 +2147,7 @@ class ContratLigne $sql.= ",total_ttc=".price2num($this->total_ttc,'MT').""; $sql.= " WHERE rowid = ".$this->rowid; - dol_syslog(get_class($this)."::update_total sql=".$sql); + dol_syslog(get_class($this)."::update_total", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php index 772b0e1ecdc..680ea9c201f 100644 --- a/htdocs/contrat/index.php +++ b/htdocs/contrat/index.php @@ -312,7 +312,7 @@ $sql.= " GROUP BY c.rowid, c.ref, c.datec, c.tms, c.statut, s.nom, s.rowid"; $sql.= " ORDER BY c.tms DESC"; $sql.= " LIMIT ".$max; -dol_syslog("contrat/index.php sql=".$sql, LOG_DEBUG); +dol_syslog("contrat/index.php", LOG_DEBUG); $result=$db->query($sql); if ($result) { diff --git a/htdocs/contrat/services.php b/htdocs/contrat/services.php index 382dcad5e93..2f656d14211 100644 --- a/htdocs/contrat/services.php +++ b/htdocs/contrat/services.php @@ -113,7 +113,7 @@ $sql .= $db->order($sortfield,$sortorder); $sql .= $db->plimit($limit + 1, $offset); //print $sql; -dol_syslog("contrat/services.php sql=".$sql); +dol_syslog("contrat/services.php", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/core/boxes/box_actions.php b/htdocs/core/boxes/box_actions.php index ff63927b526..9dcfc76016a 100644 --- a/htdocs/core/boxes/box_actions.php +++ b/htdocs/core/boxes/box_actions.php @@ -77,7 +77,7 @@ class box_actions extends ModeleBoxes $sql.= " ORDER BY a.datec DESC"; $sql.= $db->plimit($max, 0); - dol_syslog("Box_actions::loadBox sql=".$sql, LOG_DEBUG); + dol_syslog("Box_actions::loadBox", LOG_DEBUG); $result = $db->query($sql); if ($result) { diff --git a/htdocs/core/boxes/box_clients.php b/htdocs/core/boxes/box_clients.php index b2ad0a6b718..12145294d64 100644 --- a/htdocs/core/boxes/box_clients.php +++ b/htdocs/core/boxes/box_clients.php @@ -73,7 +73,7 @@ class box_clients extends ModeleBoxes $sql.= " ORDER BY s.tms DESC"; $sql.= $db->plimit($max, 0); - dol_syslog(get_class($this)."::loadBox sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::loadBox", LOG_DEBUG); $result = $db->query($sql); if ($result) { diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php index 8fdc4aff39e..c66326b27fb 100644 --- a/htdocs/core/boxes/box_comptes.php +++ b/htdocs/core/boxes/box_comptes.php @@ -90,7 +90,7 @@ class box_comptes extends ModeleBoxes $sql.= " ORDER BY label"; $sql.= $db->plimit($max, 0); - dol_syslog(get_class($this)."::loadBox sql=".$sql); + dol_syslog(get_class($this)."::loadBox", LOG_DEBUG); $result = $db->query($sql); if ($result) { diff --git a/htdocs/core/boxes/box_prospect.php b/htdocs/core/boxes/box_prospect.php index 9c7a666bc4a..c0234f97dc3 100644 --- a/htdocs/core/boxes/box_prospect.php +++ b/htdocs/core/boxes/box_prospect.php @@ -73,7 +73,7 @@ class box_prospect extends ModeleBoxes $sql.= " ORDER BY s.tms DESC"; $sql.= $db->plimit($max, 0); - dol_syslog(get_class($this)."::loadBox sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::loadBox", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 80d719decae..0bea45832e6 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -47,7 +47,7 @@ abstract class CommonInvoice extends CommonObject $sql.= ' FROM '.MAIN_DB_PREFIX.$table; $sql.= ' WHERE '.$field.' = '.$this->id; - dol_syslog(get_class($this)."::getSommePaiement sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::getSommePaiement", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index e2b79448ea8..2eb63db6d9b 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -78,7 +78,7 @@ abstract class CommonObject return -1; } - dol_syslog(get_class()."::isExistingObject sql=".$sql); + dol_syslog(get_class()."::isExistingObject", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { @@ -212,7 +212,7 @@ abstract class CommonObject $sql.= "'".$this->db->idate($datecreate)."'"; $sql.= ", 4, '". $id_type_contact . "' "; $sql.= ")"; - dol_syslog(get_class($this)."::add_contact sql=".$sql); + dol_syslog(get_class($this)."::add_contact", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -316,7 +316,7 @@ abstract class CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."element_contact"; $sql.= " WHERE rowid =".$rowid; - dol_syslog(get_class($this)."::delete_contact sql=".$sql); + dol_syslog(get_class($this)."::delete_contact", LOG_DEBUG); if ($this->db->query($sql)) { if (! $notrigger) @@ -361,7 +361,7 @@ abstract class CommonObject $sql.= " WHERE element_id =".$this->id; $sql.= " AND fk_c_type_contact IN (".$listId.")"; - dol_syslog(get_class($this)."::delete_linked_contact sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delete_linked_contact", LOG_DEBUG); if ($this->db->query($sql)) { return 1; @@ -406,7 +406,7 @@ abstract class CommonObject if ($statut >= 0) $sql.= " AND ec.statut = '".$statut."'"; $sql.=" ORDER BY t.lastname ASC"; - dol_syslog(get_class($this)."::liste_contact sql=".$sql); + dol_syslog(get_class($this)."::liste_contact", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -461,7 +461,7 @@ abstract class CommonObject $sql.= " AND ec.fk_c_type_contact=tc.rowid"; $sql.= " AND tc.element = '".$this->element."'"; - dol_syslog(get_class($this)."::swapContactStatus sql=".$sql); + dol_syslog(get_class($this)."::swapContactStatus", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -563,7 +563,7 @@ abstract class CommonObject $sql.= " AND tc.active = 1"; if ($status) $sql.= " AND ec.statut = ".$status; - dol_syslog(get_class($this)."::getIdContact sql=".$sql); + dol_syslog(get_class($this)."::getIdContact", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -805,7 +805,7 @@ abstract class CommonObject if (is_object($user)) $sql.=", fk_user_modif = ".$user->id; $sql.= " WHERE ".$id_field." = ".$id; - dol_syslog(get_class($this)."::".__FUNCTION__." sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::".__FUNCTION__."", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -931,7 +931,7 @@ abstract class CommonObject else $sql.= ' SET fk_projet = NULL'; $sql.= ' WHERE rowid = '.$this->id; - dol_syslog(get_class($this)."::setProject sql=".$sql); + dol_syslog(get_class($this)."::setProject", LOG_DEBUG); if ($this->db->query($sql)) { $this->fk_project = $projectid; @@ -1075,7 +1075,7 @@ abstract class CommonObject // if ($this->element == 'facture') $sql.= " AND fk_statut < 2"; // if ($this->element == 'propal') $sql.= " AND fk_statut = 0"; - dol_syslog(get_class($this)."::setDocModel sql=".$sql); + dol_syslog(get_class($this)."::setDocModel", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -1119,7 +1119,7 @@ abstract class CommonObject if (! $renum) $sql.= ' AND rang = 0'; if ($renum) $sql.= ' AND rang <> 0'; - dol_syslog(get_class($this)."::line_order sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::line_order", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1139,7 +1139,7 @@ abstract class CommonObject if ($fk_parent_line) $sql.= ' AND fk_parent_line IS NULL'; $sql.= ' ORDER BY rang ASC, rowid '.$rowidorder; - dol_syslog(get_class($this)."::line_order search all parent lines sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::line_order search all parent lines", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1191,7 +1191,7 @@ abstract class CommonObject $sql.= ' AND fk_parent_line = '.$id; $sql.= ' ORDER BY rang ASC'; - dol_syslog(get_class($this)."::getChildrenOfLine search children lines for line ".$id." sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::getChildrenOfLine search children lines for line ".$id."", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1259,7 +1259,7 @@ abstract class CommonObject $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element_line.' SET rang = '.$rang; $sql.= ' WHERE rowid = '.$rowid; - dol_syslog(get_class($this)."::updateRangOfLine sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::updateRangOfLine", LOG_DEBUG); if (! $this->db->query($sql)) { dol_print_error($this->db); @@ -1353,7 +1353,7 @@ abstract class CommonObject $sql = 'SELECT rang FROM '.MAIN_DB_PREFIX.$this->table_element_line; $sql.= ' WHERE rowid ='.$rowid; - dol_syslog(get_class($this)."::getRangOfLine sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::getRangOfLine", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1396,7 +1396,7 @@ abstract class CommonObject $sql.= ' WHERE '.$this->fk_element.' = '.$this->id; $sql.= ' AND fk_parent_line = '.$fk_parent_line; - dol_syslog(get_class($this)."::line_max sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::line_max", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1417,7 +1417,7 @@ abstract class CommonObject $sql = 'SELECT max(rang) FROM '.MAIN_DB_PREFIX.$this->table_element_line; $sql.= ' WHERE '.$this->fk_element.' = '.$this->id; - dol_syslog(get_class($this)."::line_max sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::line_max", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1445,7 +1445,7 @@ abstract class CommonObject $sql.= " SET ref_ext = '".$this->db->escape($ref_ext)."'"; $sql.= " WHERE ".(isset($this->table_rowid)?$this->table_rowid:'rowid')." = ". $this->id; - dol_syslog(get_class($this)."::update_ref_ext sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update_ref_ext", LOG_DEBUG); if ($this->db->query($sql)) { $this->ref_ext = $ref_ext; @@ -1483,7 +1483,7 @@ abstract class CommonObject $sql.= " SET note".$suffix." = ".(!empty($note)?("'".$this->db->escape($note)."'"):"NULL"); $sql.= " WHERE rowid =". $this->id; - dol_syslog(get_class($this)."::update_note sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update_note", LOG_DEBUG); if ($this->db->query($sql)) { if ($suffix == '_public') $this->note_public = $note; @@ -1558,7 +1558,7 @@ abstract class CommonObject } $sql.= ' ORDER by rowid'; // We want to be sure to always use same order of line to not change lines differently when option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND is used - dol_syslog(get_class($this)."::update_price sql=".$sql); + dol_syslog(get_class($this)."::update_price", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1658,7 +1658,7 @@ abstract class CommonObject $sql .= ' WHERE rowid = '.$this->id; //print "xx".$sql; - dol_syslog(get_class($this)."::update_price sql=".$sql); + dol_syslog(get_class($this)."::update_price", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -1710,7 +1710,7 @@ abstract class CommonObject $sql.= ", '".$this->element."'"; $sql.= ")"; - dol_syslog(get_class($this)."::add_object_linked sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::add_object_linked", LOG_DEBUG); if ($this->db->query($sql)) { $this->db->commit(); @@ -1787,7 +1787,7 @@ abstract class CommonObject $sql .= ' ORDER BY sourcetype'; //print $sql; - dol_syslog(get_class($this)."::fetchObjectLink sql=".$sql); + dol_syslog(get_class($this)."::fetchObjectLink", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1912,7 +1912,7 @@ abstract class CommonObject $sql.= " AND sourcetype = '".$this->element."'"; } - dol_syslog(get_class($this)."::updateObjectLinked sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::updateObjectLinked", LOG_DEBUG); if ($this->db->query($sql)) { return 1; @@ -1966,7 +1966,7 @@ abstract class CommonObject $sql.= " (fk_target = ".$this->id." AND targettype = '".$this->element."')"; } - dol_syslog(get_class($this)."::deleteObjectLinked sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::deleteObjectLinked", LOG_DEBUG); if ($this->db->query($sql)) { return 1; @@ -2001,7 +2001,7 @@ abstract class CommonObject $sql.= " SET ".$fieldstatus." = ".$status; $sql.= " WHERE rowid=".$elementId; - dol_syslog(get_class($this)."::setStatut sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::setStatut", LOG_DEBUG); if ($this->db->query($sql)) { $this->db->commit(); @@ -2110,7 +2110,7 @@ abstract class CommonObject $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields"; $sql.= " WHERE fk_object = ".$rowid; - dol_syslog(get_class($this)."::fetch_optionals sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch_optionals", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -2258,7 +2258,7 @@ abstract class CommonObject } $sql.=")"; - dol_syslog(get_class($this)."::insertExtraFields insert sql=".$sql); + dol_syslog(get_class($this)."::insertExtraFields insert", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { @@ -2527,7 +2527,7 @@ abstract class CommonObject $sql.= " SET extraparams = ".(! empty($extraparams) ? "'".$this->db->escape($extraparams)."'" : "null"); $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::setExtraParameters sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::setExtraParameters", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { @@ -3328,7 +3328,7 @@ abstract class CommonObject $sql.= ", '".$mandatory."'"; $sql.= ")"; - dol_syslog(get_class($this)."::add_element_resource sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::add_element_resource", LOG_DEBUG); if ($this->db->query($sql)) { $this->db->commit(); @@ -3359,7 +3359,7 @@ abstract class CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."element_resources"; $sql.= " WHERE rowid =".$rowid; - dol_syslog(get_class($this)."::delete_resource sql=".$sql); + dol_syslog(get_class($this)."::delete_resource", LOG_DEBUG); if ($this->db->query($sql)) { if (! $notrigger) diff --git a/htdocs/core/class/cpays.class.php b/htdocs/core/class/cpays.class.php index e6db8e4b2e9..5e32b9bad22 100644 --- a/htdocs/core/class/cpays.class.php +++ b/htdocs/core/class/cpays.class.php @@ -97,7 +97,7 @@ class Cpays // extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -158,7 +158,7 @@ class Cpays // extends CommonObject if ($id) $sql.= " WHERE t.rowid = ".$id; elseif ($code) $sql.= " WHERE t.code = '".$this->db->escape($code)."'"; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -217,7 +217,7 @@ class Cpays // extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -273,7 +273,7 @@ class Cpays // extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } diff --git a/htdocs/core/class/ctypent.class.php b/htdocs/core/class/ctypent.class.php index 33070f83412..057e23892b4 100644 --- a/htdocs/core/class/ctypent.class.php +++ b/htdocs/core/class/ctypent.class.php @@ -102,7 +102,7 @@ class Ctypent // extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -163,7 +163,7 @@ class Ctypent // extends CommonObject if ($id) $sql.= " WHERE t.id = ".$id; elseif ($code) $sql.= " WHERE t.code = '".$this->db->escape($code)."'"; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -222,7 +222,7 @@ class Ctypent // extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -278,7 +278,7 @@ class Ctypent // extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index 23ce9f97f6d..6d45f1034f4 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -85,7 +85,7 @@ class DiscountAbsolute if ($rowid) $sql.= " sr.rowid=".$rowid; if ($fk_facture_source) $sql.= " sr.fk_facture_source=".$fk_facture_source; - dol_syslog(get_class($this)."::fetch sql=".$sql); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -159,7 +159,7 @@ class DiscountAbsolute $sql.= " ".($this->fk_facture_source?"'".$this->fk_facture_source."'":"null"); $sql.= ")"; - dol_syslog(get_class($this)."::create sql=".$sql); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -195,7 +195,7 @@ class DiscountAbsolute $sql.=" AND fk_facture_source = ".$this->fk_facture_source; //$sql.=" AND rowid != ".$this->id; - dol_syslog(get_class($this)."::delete Check if we can remove discount sql=".$sql); + dol_syslog(get_class($this)."::delete Check if we can remove discount", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -222,7 +222,7 @@ class DiscountAbsolute $sql.= " AND (fk_facture_line IS NULL"; // Not used as absolute simple discount $sql.= " AND fk_facture IS NULL)"; // Not used as credit note and not used as deposit - dol_syslog(get_class($this)."::delete Delete discount sql=".$sql); + dol_syslog(get_class($this)."::delete Delete discount", LOG_DEBUG); $result=$this->db->query($sql); if ($result) { @@ -233,7 +233,7 @@ class DiscountAbsolute $sql.=" set paye=0, fk_statut=1"; $sql.=" WHERE (type = 2 or type = 3) AND rowid=".$this->fk_facture_source; - dol_syslog(get_class($this)."::delete Update credit note or deposit invoice statut sql=".$sql); + dol_syslog(get_class($this)."::delete Update credit note or deposit invoice statut", LOG_DEBUG); $result=$this->db->query($sql); if ($result) { @@ -291,7 +291,7 @@ class DiscountAbsolute if ($rowidinvoice) $sql.=" SET fk_facture = ".$rowidinvoice; $sql.=" WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::link_to_invoice sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::link_to_invoice", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -320,7 +320,7 @@ class DiscountAbsolute $sql.=" SET fk_facture_line = NULL, fk_facture = NULL"; $sql.=" WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::unlink_invoice sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::unlink_invoice", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -355,7 +355,7 @@ class DiscountAbsolute if ($filter) $sql.=' AND ('.$filter.')'; if ($maxvalue) $sql.=' AND rc.amount_ttc <= '.price2num($maxvalue); - dol_syslog(get_class($this)."::getAvailableDiscounts sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::getAvailableDiscounts", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -384,7 +384,7 @@ class DiscountAbsolute $sql.= ' WHERE rc.fk_facture_source=f.rowid AND rc.fk_facture = '.$invoice->id; $sql.= ' AND f.type = 2'; - dol_syslog(get_class($this)."::getSumCreditNotesUsed sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::getSumCreditNotesUsed", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -410,7 +410,7 @@ class DiscountAbsolute $sql.= ' WHERE rc.fk_facture_source=f.rowid AND rc.fk_facture = '.$invoice->id; $sql.= ' AND f.type = 3'; - dol_syslog(get_class($this)."::getSumDepositsUsed sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::getSumDepositsUsed", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/core/class/events.class.php b/htdocs/core/class/events.class.php index b344a0c4059..98e4b101669 100644 --- a/htdocs/core/class/events.class.php +++ b/htdocs/core/class/events.class.php @@ -132,7 +132,7 @@ class Events // extends CommonObject $sql.= " '".$this->db->escape($this->description)."'"; $sql.= ")"; - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -174,7 +174,7 @@ class Events // extends CommonObject $sql.= " description='".$this->db->escape($this->description)."'"; $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { @@ -209,7 +209,7 @@ class Events // extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."events as t"; $sql.= " WHERE t.rowid = ".$id; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -252,7 +252,7 @@ class Events // extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."events"; $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index df302f0ffad..df6d16767d6 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -255,7 +255,7 @@ class ExtraFields $sql.= " '".$params."'"; $sql.=')'; - dol_syslog(get_class($this)."::create_label sql=".$sql); + dol_syslog(get_class($this)."::create_label", LOG_DEBUG); if ($this->db->query($sql)) { return 1; @@ -318,7 +318,7 @@ class ExtraFields $sql.= " AND entity IN (0,".$conf->entity.')'; $sql.= " AND elementtype = '".$elementtype."'"; - dol_syslog(get_class($this)."::delete_label sql=".$sql); + dol_syslog(get_class($this)."::delete_label", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -480,7 +480,7 @@ class ExtraFields $sql.= " '".$pos."',"; $sql.= " '".$param."'"; $sql.= ")"; - dol_syslog(get_class($this)."::update_label sql=".$sql); + dol_syslog(get_class($this)."::update_label", LOG_DEBUG); $resql2=$this->db->query($sql); if ($resql1 && $resql2) @@ -537,7 +537,7 @@ class ExtraFields if ($elementtype) $sql.= " AND elementtype = '".$elementtype."'"; $sql.= " ORDER BY pos"; - dol_syslog(get_class($this)."::fetch_name_optionals_label sql=".$sql); + dol_syslog(get_class($this)."::fetch_name_optionals_label", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index bd4783282f2..c83bbf6864c 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -486,7 +486,7 @@ class Form $sql.= " WHERE active = 1"; //$sql.= " ORDER BY code ASC"; - dol_syslog(get_class($this)."::select_country sql=".$sql); + dol_syslog(get_class($this)."::select_country", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -795,7 +795,7 @@ class Form $sql.=$this->db->order("nom","ASC"); if ($limit > 0) $sql.=$this->db->plimit($limit); - dol_syslog(get_class($this)."::select_thirdparty_list sql=".$sql); + dol_syslog(get_class($this)."::select_thirdparty_list", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -889,7 +889,7 @@ class Form if ($filter) $sql.= " AND ".$filter; $sql.= " ORDER BY re.description ASC"; - dol_syslog(get_class($this)."::select_remises sql=".$sql); + dol_syslog(get_class($this)."::select_remises", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -995,7 +995,7 @@ class Form if (! empty($conf->global->CONTACT_HIDE_INACTIVE_IN_COMBOBOX)) $sql.= " AND sp.statut<>0 "; $sql.= " ORDER BY sp.lastname ASC"; - dol_syslog(get_class($this)."::select_contacts sql=".$sql); + dol_syslog(get_class($this)."::select_contacts", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -1162,7 +1162,7 @@ class Form if (! empty($conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX)) $sql.= " AND u.statut<>0 "; $sql.= " ORDER BY u.lastname ASC"; - dol_syslog(get_class($this)."::select_dolusers sql=".$sql); + dol_syslog(get_class($this)."::select_dolusers", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -1412,7 +1412,7 @@ class Form $sql.= $db->plimit($limit); // Build output string - dol_syslog(get_class($this)."::select_produits_list search product sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::select_produits_list search product", LOG_DEBUG); $result=$this->db->query($sql); if ($result) { @@ -1435,7 +1435,7 @@ class Form $sql.= " WHERE fk_product_price=".$objp->price_rowid; $sql.= " ORDER BY quantity ASC"; - dol_syslog(get_class($this)."::select_produits_list search price by qty sql=".$sql); + dol_syslog(get_class($this)."::select_produits_list search price by qty", LOG_DEBUG); $result2 = $this->db->query($sql); if ($result2) { @@ -1775,7 +1775,7 @@ class Form // Build output string - dol_syslog(get_class($this)."::select_produits_fournisseurs_list sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::select_produits_fournisseurs_list", LOG_DEBUG); $result=$this->db->query($sql); if ($result) { @@ -1921,7 +1921,7 @@ class Form $sql.= " AND p.rowid = ".$productid; $sql.= " ORDER BY s.nom, pfp.ref_fourn DESC"; - dol_syslog(get_class($this)."::select_product_fourn_price sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::select_product_fourn_price", LOG_DEBUG); $result=$this->db->query($sql); if ($result) @@ -2005,7 +2005,7 @@ class Form $sql .= " WHERE a.fk_soc = ".$socid; $sql .= " ORDER BY a.label ASC"; - dol_syslog(get_class($this)."::select_address sql=".$sql); + dol_syslog(get_class($this)."::select_address", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -2167,7 +2167,7 @@ class Form $sql.= " FROM ".MAIN_DB_PREFIX.'c_input_reason'; $sql.= " WHERE active=1"; $sql.= " ORDER BY rowid"; - dol_syslog(get_class($this)."::loadCacheInputReason sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::loadCacheInputReason", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -2248,7 +2248,7 @@ class Form $sql.= " FROM ".MAIN_DB_PREFIX."c_paiement"; $sql.= " WHERE active > 0"; $sql.= " ORDER BY id"; - dol_syslog(get_class($this)."::load_cache_types_paiements sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::load_cache_types_paiements", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -2437,7 +2437,7 @@ class Form if ($filtre) $sql.=" AND ".$filtre; $sql.= " ORDER BY label"; - dol_syslog(get_class($this)."::select_comptes sql=".$sql); + dol_syslog(get_class($this)."::select_comptes", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -4224,7 +4224,7 @@ class Form if (is_array($include) && $includeGroups) $sql.= " AND ug.rowid IN ('".$includeGroups."')"; $sql.= " ORDER BY ug.nom ASC"; - dol_syslog(get_class($this)."::select_dolgroups sql=".$sql); + dol_syslog(get_class($this)."::select_dolgroups", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index a22f0b38c10..2f1be6d7d56 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -229,7 +229,7 @@ class FormCompany if ($country_codeid && ! is_numeric($country_codeid)) $sql .= " AND p.code = '".$country_codeid."'"; $sql .= " ORDER BY p.code, d.code_departement"; - dol_syslog(get_class($this)."::select_departement sql=".$sql); + dol_syslog(get_class($this)."::select_departement", LOG_DEBUG); $result=$this->db->query($sql); if ($result) { @@ -306,7 +306,7 @@ class FormCompany $sql.= " WHERE r.fk_pays=p.rowid AND r.active = 1 and p.active = 1"; $sql.= " ORDER BY p.code, p.libelle ASC"; - dol_syslog(get_class($this)."::select_region sql=".$sql); + dol_syslog(get_class($this)."::select_region", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -369,7 +369,7 @@ class FormCompany $sql = "SELECT rowid, code, civilite as civility_label, active FROM ".MAIN_DB_PREFIX."c_civilite"; $sql.= " WHERE active = 1"; - dol_syslog("Form::select_civility sql=".$sql); + dol_syslog("Form::select_civility", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -447,7 +447,7 @@ class FormCompany if ($filter) $sql .= " ".$filter; $sql .= " ORDER BY p.code"; - dol_syslog(get_class($this)."::select_juridicalstatus sql=".$sql); + dol_syslog(get_class($this)."::select_juridicalstatus", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/core/class/html.formcontract.class.php b/htdocs/core/class/html.formcontract.class.php index cfc5be29b92..e0d550b4205 100644 --- a/htdocs/core/class/html.formcontract.class.php +++ b/htdocs/core/class/html.formcontract.class.php @@ -67,7 +67,7 @@ class FormContract if ($socid == 0) $sql.= " AND (c.fk_soc = 0 OR c.fk_soc IS NULL)"; else $sql.= " AND c.fk_soc = ".$socid; - dol_syslog(get_class($this)."::select_contract sql=".$sql); + dol_syslog(get_class($this)."::select_contract", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/core/class/html.formorder.class.php b/htdocs/core/class/html.formorder.class.php index 6bc626b13f3..5ea5b33c1f4 100644 --- a/htdocs/core/class/html.formorder.class.php +++ b/htdocs/core/class/html.formorder.class.php @@ -116,7 +116,7 @@ class FormOrder $sql.= " FROM ".MAIN_DB_PREFIX."c_input_method"; $sql.= " WHERE active = 1"; - dol_syslog(get_class($this)."::selectInputMethod sql=".$sql); + dol_syslog(get_class($this)."::selectInputMethod", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index b6065909ade..35ebe48e168 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -1122,7 +1122,7 @@ class FormOther $sql.= " FROM ".MAIN_DB_PREFIX.$dictionarytable; $sql.= " ORDER BY ".$labelfield; - dol_syslog(get_class($this)."::select_dictionary sql=".$sql); + dol_syslog(get_class($this)."::select_dictionary", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 2c371d4afcd..1ea498e19dd 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -79,7 +79,7 @@ class FormProjets if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)"; $sql.= " ORDER BY p.title ASC"; - dol_syslog(get_class($this)."::select_projects sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::select_projects", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/core/class/html.formpropal.class.php b/htdocs/core/class/html.formpropal.class.php index fcbe46ab51b..df0f2d644dd 100644 --- a/htdocs/core/class/html.formpropal.class.php +++ b/htdocs/core/class/html.formpropal.class.php @@ -56,7 +56,7 @@ class FormPropal $sql = "SELECT id, code, label, active FROM ".MAIN_DB_PREFIX."c_propalst"; $sql .= " WHERE active = 1"; - dol_syslog(get_class($this)."::selectProposalStatus sql=".$sql); + dol_syslog(get_class($this)."::selectProposalStatus", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/core/class/html.formsocialcontrib.class.php b/htdocs/core/class/html.formsocialcontrib.class.php index f84f14c1446..b3c5a4c7d9c 100644 --- a/htdocs/core/class/html.formsocialcontrib.class.php +++ b/htdocs/core/class/html.formsocialcontrib.class.php @@ -79,7 +79,7 @@ class FormSocialContrib $sql.= " ORDER BY c.libelle ASC"; } - dol_syslog("Form::select_type_socialcontrib sql=".$sql, LOG_DEBUG); + dol_syslog("Form::select_type_socialcontrib", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/core/class/infobox.class.php b/htdocs/core/class/infobox.class.php index c01d2d1f0f5..43c057ac859 100644 --- a/htdocs/core/class/infobox.class.php +++ b/htdocs/core/class/infobox.class.php @@ -73,7 +73,7 @@ class InfoBox } } - dol_syslog(get_class()."::listBoxes get default box list for mode=".$mode." userid=".(is_object($user)?$user->id:'')." sql=".$sql, LOG_DEBUG); + dol_syslog(get_class()."::listBoxes get default box list for mode=".$mode." userid=".(is_object($user)?$user->id:'')."", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { @@ -212,7 +212,7 @@ class InfoBox $sql.= " AND fk_user = ".$userid; $sql.= " AND position = ".$zone; - dol_syslog(get_class()."::saveboxorder sql=".$sql); + dol_syslog(get_class()."::saveboxorder", LOG_DEBUG); $result = $db->query($sql); if ($result) { @@ -243,7 +243,7 @@ class InfoBox $sql.= " ".$conf->entity; $sql.= ")"; - dol_syslog(get_class()."::saveboxorder sql=".$sql); + dol_syslog(get_class()."::saveboxorder", LOG_DEBUG); $result = $db->query($sql); if ($result < 0) { diff --git a/htdocs/core/class/link.class.php b/htdocs/core/class/link.class.php index 08d520d519e..e92aa273105 100644 --- a/htdocs/core/class/link.class.php +++ b/htdocs/core/class/link.class.php @@ -93,7 +93,7 @@ class Link extends CommonObject $sql .= ", '" . $this->objecttype . "'"; $sql .= ", " . $this->objectid . ")"; - dol_syslog(get_class($this)."::create sql=".$sql); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "links"); @@ -256,7 +256,7 @@ class Link extends CommonObject $sql .= " ORDER BY " . $sortfield . " " . $sortorder; } - dol_syslog(get_class($this)."::fetchAll sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetchAll", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -305,7 +305,7 @@ class Link extends CommonObject $sql .= " WHERE rowid = " . $rowid; if($conf->entity != 0) $sql .= " AND entity = " . $conf->entity; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php index 966b9ac7f77..60375f8c283 100644 --- a/htdocs/core/class/menubase.class.php +++ b/htdocs/core/class/menubase.class.php @@ -162,7 +162,7 @@ class Menubase $sql.= " '".$this->user."'"; $sql.= ")"; - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -232,7 +232,7 @@ class Menubase $sql.= " usertype='".$this->user."'"; $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { @@ -277,7 +277,7 @@ class Menubase $sql.= " FROM ".MAIN_DB_PREFIX."menu as t"; $sql.= " WHERE t.rowid = ".$id; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -330,7 +330,7 @@ class Menubase $sql = "DELETE FROM ".MAIN_DB_PREFIX."menu"; $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { @@ -516,7 +516,7 @@ class Menubase //$tmp1=dol_microtime_float(); //print '>>> 1 0
'; - dol_syslog(get_class($this)."::menuLoad mymainmenu=".$mymainmenu." myleftmenu=".$myleftmenu." type_user=".$type_user." menu_handler=".$menu_handler." tabMenu size=".count($tabMenu)." sql=".$sql); + dol_syslog(get_class($this)."::menuLoad mymainmenu=".$mymainmenu." myleftmenu=".$myleftmenu." type_user=".$type_user." menu_handler=".$menu_handler." tabMenu size=".count($tabMenu)."", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 317b00dd33a..03e2a641828 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -99,7 +99,7 @@ class Notify $sql.= " AND s.entity IN (".getEntity('societe', 1).")"; $sql.= " AND s.rowid = ".$socid; - dol_syslog("Notify.class::countDefinedNotifications ".$action.", ".$socid." sql=".$sql); + dol_syslog("Notify.class::countDefinedNotifications ".$action.", ".$socid."", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) @@ -147,7 +147,7 @@ class Notify else $sql.= " AND a.code = '".$action."'"; // New usage $sql .= " AND s.rowid = ".$socid; - dol_syslog("Notify::send sql=".$sql); + dol_syslog("Notify::send", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -226,7 +226,7 @@ class Notify $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_contact, objet_type, objet_id, email)"; $sql.= " VALUES ('".$this->db->idate($now)."', ".$actiondefid.", ".$obj->cid.", '".$objet_type."', ".$objet_id.", '".$this->db->escape($obj->email)."')"; - dol_syslog("Notify::send sql=".$sql); + dol_syslog("Notify::send", LOG_DEBUG); if (! $this->db->query($sql) ) { dol_print_error($this->db); diff --git a/htdocs/core/class/stats.class.php b/htdocs/core/class/stats.class.php index 5018d63cecf..b2e85b3113a 100644 --- a/htdocs/core/class/stats.class.php +++ b/htdocs/core/class/stats.class.php @@ -334,7 +334,7 @@ abstract class Stats { $result = array(); - dol_syslog(get_class($this).'::'.__FUNCTION__." sql=".$sql); + dol_syslog(get_class($this).'::'.__FUNCTION__."", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -364,7 +364,7 @@ abstract class Stats { $result = array(); - dol_syslog(get_class($this).'::'.__FUNCTION__." sql=".$sql); + dol_syslog(get_class($this).'::'.__FUNCTION__."", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -400,7 +400,7 @@ abstract class Stats $result=array(); $res=array(); - dol_syslog(get_class($this).'::'.__FUNCTION__." sql=".$sql); + dol_syslog(get_class($this).'::'.__FUNCTION__."", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -451,7 +451,7 @@ abstract class Stats $result=array(); $res=array(); - dol_syslog(get_class($this).'::'.__FUNCTION__." sql=".$sql); + dol_syslog(get_class($this).'::'.__FUNCTION__."", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -499,7 +499,7 @@ abstract class Stats $result=array(); $res=array(); - dol_syslog(get_class($this).'::'.__FUNCTION__." sql=".$sql); + dol_syslog(get_class($this).'::'.__FUNCTION__."", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -548,7 +548,7 @@ abstract class Stats $result=array(); $res=array(); - dol_syslog(get_class($this).'::'.__FUNCTION__." sql=".$sql); + dol_syslog(get_class($this).'::'.__FUNCTION__."", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php index 00cc3868cd6..5e5b4c360d0 100644 --- a/htdocs/core/db/mysql.class.php +++ b/htdocs/core/db/mysql.class.php @@ -849,7 +849,7 @@ class DoliDBMysql extends DoliDB $sql="FLUSH Privileges"; - dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql); + dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); $resql=$this->query($sql); if (! $resql) { diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 336780a1a09..16915dcd22d 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -853,7 +853,7 @@ class DoliDBMysqli extends DoliDB $sql="FLUSH Privileges"; - dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql); + dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); $resql=$this->query($sql); if (! $resql) { diff --git a/htdocs/core/db/sqlite.class.php b/htdocs/core/db/sqlite.class.php index f06a92c401f..45c1bbd182f 100644 --- a/htdocs/core/db/sqlite.class.php +++ b/htdocs/core/db/sqlite.class.php @@ -981,7 +981,7 @@ class DoliDBSqlite extends DoliDB $sql.= " VALUES ('".$this->escape($dolibarr_main_db_host)."','".$this->escape($dolibarr_main_db_name)."','".addslashes($dolibarr_main_db_user)."'"; $sql.= ",'Y','Y','Y','Y','Y','Y','Y','Y','Y')"; - dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql); + dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); $resql=$this->query($sql); if (! $resql) { @@ -991,7 +991,7 @@ class DoliDBSqlite extends DoliDB $sql="FLUSH Privileges"; - dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql); + dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); $resql=$this->query($sql); if (! $resql) { diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 2f5e217641f..9040d6a1caf 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -393,7 +393,7 @@ function dolibarr_del_const($db, $name, $entity=1) $sql.= ")"; if ($entity >= 0) $sql.= " AND entity = ".$entity; - dol_syslog("admin.lib::dolibarr_del_const sql=".$sql); + dol_syslog("admin.lib::dolibarr_del_const", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { @@ -427,7 +427,7 @@ function dolibarr_get_const($db, $name, $entity=1) $sql.= " WHERE name = ".$db->encrypt($name,1); $sql.= " AND entity = ".$entity; - dol_syslog("admin.lib::dolibarr_get_const sql=".$sql); + dol_syslog("admin.lib::dolibarr_get_const", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { @@ -474,7 +474,7 @@ function dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $not $sql.= " WHERE name = ".$db->encrypt($name,1); if ($entity >= 0) $sql.= " AND entity = ".$entity; - dol_syslog("admin.lib::dolibarr_set_const sql=".$sql, LOG_DEBUG); + dol_syslog("admin.lib::dolibarr_set_const", LOG_DEBUG); $resql=$db->query($sql); if (strcmp($value,'')) // true if different. Must work for $value='0' or $value=0 @@ -487,7 +487,7 @@ function dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $not //print "sql".$value."-".pg_escape_string($value)."-".$sql;exit; //print "xx".$db->escape($value); - dol_syslog("admin.lib::dolibarr_set_const sql=".$sql, LOG_DEBUG); + dol_syslog("admin.lib::dolibarr_set_const", LOG_DEBUG); $resql=$db->query($sql); } @@ -1041,7 +1041,7 @@ function form_constantes($tableau,$strictw3c=0) $sql.= " ORDER BY name ASC, entity DESC"; $result = $db->query($sql); - dol_syslog("List params sql=".$sql); + dol_syslog("List params", LOG_DEBUG); if ($result) { $obj = $db->fetch_object($result); // Take first result of select @@ -1215,7 +1215,7 @@ function addDocumentModel($name, $type, $label='', $description='') $sql.= (! empty($description)?"'".$db->escape($description)."'":"null"); $sql.= ")"; - dol_syslog("admin.lib::addDocumentModel sql=".$sql); + dol_syslog("admin.lib::addDocumentModel", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { @@ -1248,7 +1248,7 @@ function delDocumentModel($name, $type) $sql.= " AND type = '".$type."'"; $sql.= " AND entity = ".$conf->entity; - dol_syslog("admin.lib::delDocumentModel sql=".$sql); + dol_syslog("admin.lib::delDocumentModel", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 0851fb0b7c1..9bf8bead072 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -267,7 +267,7 @@ function getCountry($searchkey,$withcode='',$dbtouse=0,$outputlangs='',$entconv= elseif (! empty($searchkey)) $sql.= " WHERE code='".$db->escape($searchkey)."'"; else $sql.= " WHERE libelle='".$db->escape($searchlabel)."'"; - dol_syslog("Company.lib::getCountry sql=".$sql); + dol_syslog("Company.lib::getCountry", LOG_DEBUG); $resql=$dbtouse->query($sql); if ($resql) { @@ -317,7 +317,7 @@ function getState($id,$withcode='',$dbtouse=0) $sql = "SELECT rowid, code_departement as code, nom as label FROM ".MAIN_DB_PREFIX."c_departements"; $sql.= " WHERE rowid=".$id; - dol_syslog("Company.lib::getState sql=".$sql); + dol_syslog("Company.lib::getState", LOG_DEBUG); $resql=$dbtouse->query($sql); if ($resql) { @@ -394,7 +394,7 @@ function getFormeJuridiqueLabel($code) $sql = "SELECT libelle FROM ".MAIN_DB_PREFIX."c_forme_juridique"; $sql.= " WHERE code='$code'"; - dol_syslog("Company.lib::getFormeJuridiqueLabel sql=".$sql); + dol_syslog("Company.lib::getFormeJuridiqueLabel", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { @@ -953,7 +953,7 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0) $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))"; $sql.= " ORDER BY a.datep DESC, a.id DESC"; - dol_syslog("company.lib::show_actions_todo sql=".$sql); + dol_syslog("company.lib::show_actions_todo", LOG_DEBUG); $result=$db->query($sql); if ($result) { @@ -1089,7 +1089,7 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0) $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))"; $sql.= " ORDER BY a.datep DESC, a.id DESC"; - dol_syslog("company.lib::show_actions_done sql=".$sql, LOG_DEBUG); + dol_syslog("company.lib::show_actions_done", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { @@ -1141,7 +1141,7 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0) $sql.= " AND mc.fk_mailing=m.rowid"; $sql.= " ORDER BY mc.date_envoi DESC, m.rowid DESC"; - dol_syslog("company.lib::show_actions_done sql=".$sql, LOG_DEBUG); + dol_syslog("company.lib::show_actions_done", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index a22c38834cf..1cd4f582494 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2934,7 +2934,7 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="") $sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$thirdparty_seller->country_code."'"; $sql .= " AND t.taux = ".$tva." AND t.active = 1"; - dol_syslog("get_localtax sql=".$sql); + dol_syslog("get_localtax", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 2f2a313699a..606589971a9 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -744,7 +744,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m if ($sqlwhere) $sql.=' AND '.$sqlwhere; //print $sql.'
'; - dol_syslog("functions2::get_next_value mode=".$mode." sql=".$sql, LOG_DEBUG); + dol_syslog("functions2::get_next_value mode=".$mode."", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { @@ -783,7 +783,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m if ($where) $sql.=$where; if ($sqlwhere) $sql.=' AND '.$sqlwhere; - dol_syslog("functions2::get_next_value sql=".$sql); + dol_syslog("functions2::get_next_value", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { @@ -1168,7 +1168,7 @@ function dol_set_user_param($db, $conf, &$user, $tab) $i++; } $sql.= ")"; - dol_syslog("functions2.lib::dol_set_user_param sql=".$sql, LOG_DEBUG); + dol_syslog("functions2.lib::dol_set_user_param", LOG_DEBUG); $resql=$db->query($sql); if (! $resql) @@ -1187,7 +1187,7 @@ function dol_set_user_param($db, $conf, &$user, $tab) $sql.= " VALUES (".$user->id.",".$conf->entity.","; $sql.= " '".$key."','".$db->escape($value)."')"; - dol_syslog("functions2.lib::dol_set_user_param sql=".$sql, LOG_DEBUG); + dol_syslog("functions2.lib::dol_set_user_param", LOG_DEBUG); $result=$db->query($sql); if (! $result) { diff --git a/htdocs/core/lib/invoice2.lib.php b/htdocs/core/lib/invoice2.lib.php index 9309d083187..39405db4468 100644 --- a/htdocs/core/lib/invoice2.lib.php +++ b/htdocs/core/lib/invoice2.lib.php @@ -128,7 +128,7 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte if ($sqlorder) $sql.=$sqlorder; //print $sql; exit; - dol_syslog("scripts/invoices/rebuild_merge.php: sql=".$sql); + dol_syslog("scripts/invoices/rebuild_merge.php:", LOG_DEBUG); if ($usestdout) print '--- start'."\n"; @@ -139,7 +139,7 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte $result = 0; $files = array() ; // liste les fichiers - dol_syslog("scripts/invoices/rebuild_merge.php sql=".$sql); + dol_syslog("scripts/invoices/rebuild_merge.php", LOG_DEBUG); if ( $resql=$db->query($sql) ) { $num = $db->num_rows($resql); diff --git a/htdocs/core/lib/price.lib.php b/htdocs/core/lib/price.lib.php index ac9845f22a1..00144db74e5 100644 --- a/htdocs/core/lib/price.lib.php +++ b/htdocs/core/lib/price.lib.php @@ -111,7 +111,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt $sql.= " FROM ".MAIN_DB_PREFIX."c_tva as cv"; $sql.= " WHERE cv.taux = ".$txtva; $sql.= " AND cv.fk_pays = ".$countryid; - dol_syslog("calcul_price_total search vat information sql=".$sql); + dol_syslog("calcul_price_total search vat information", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index 2bfb2ba7c17..d2f3bf563c6 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -171,7 +171,7 @@ function show_list_sending_receive($origin,$origin_id,$filter='') $sql.= " ORDER BY obj.fk_product"; - dol_syslog("show_list_sending_receive sql=".$sql, LOG_DEBUG); + dol_syslog("show_list_sending_receive", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/core/lib/tax.lib.php b/htdocs/core/lib/tax.lib.php index a52aeb37345..164d346ac1c 100644 --- a/htdocs/core/lib/tax.lib.php +++ b/htdocs/core/lib/tax.lib.php @@ -194,7 +194,7 @@ function vat_by_thirdparty($db, $y, $date_start, $date_end, $modetax, $direction if ($sql == 'TODO') return -2; if ($sql != 'TODO') { - dol_syslog("Tax.lib:thirdparty sql=".$sql); + dol_syslog("Tax.lib:thirdparty", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { @@ -366,7 +366,7 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction, if ($sql == 'TODO') return -2; if ($sql != 'TODO') { - dol_syslog("Tax.lib.php::vat_by_date sql=".$sql); + dol_syslog("Tax.lib.php::vat_by_date", LOG_DEBUG); $resql = $db->query($sql); if ($resql) @@ -531,7 +531,7 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction, if ($sql == 'TODO') return -2; // -2 = Feature not yet available if ($sql != 'TODO') { - dol_syslog("Tax.lib.php::vat_by_date sql=".$sql); + dol_syslog("Tax.lib.php::vat_by_date", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/core/login/functions_dolibarr.php b/htdocs/core/login/functions_dolibarr.php index 400b5765719..d1555678313 100644 --- a/htdocs/core/login/functions_dolibarr.php +++ b/htdocs/core/login/functions_dolibarr.php @@ -58,7 +58,7 @@ function check_user_password_dolibarr($usertotest,$passwordtotest,$entitytotest= $sql.=' WHERE '.$usernamecol." = '".$db->escape($usertotest)."'"; $sql.=' AND '.$entitycol." IN (0," . ($entity ? $entity : 1) . ")"; - dol_syslog("functions_dolibarr::check_user_password_dolibarr sql=".$sql); + dol_syslog("functions_dolibarr::check_user_password_dolibarr", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/core/login/functions_openid.php b/htdocs/core/login/functions_openid.php index e183bc40795..3abb69be4f2 100644 --- a/htdocs/core/login/functions_openid.php +++ b/htdocs/core/login/functions_openid.php @@ -79,7 +79,7 @@ function check_user_password_openid($usertotest,$passwordtotest,$entitytotest) $sql.=" WHERE openid = '".$db->escape($_GET['openid_identity'])."'"; $sql.=" AND entity IN (0," . ($_SESSION["dol_entity"] ? $_SESSION["dol_entity"] : 1) . ")"; - dol_syslog("functions_openid::check_user_password_openid sql=".$sql); + dol_syslog("functions_openid::check_user_password_openid", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index e25f4d0c715..9809c418f0c 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -113,7 +113,7 @@ abstract class DolibarrModules // Add current entity id $sql=str_replace('__ENTITY__', $conf->entity, $sql); - dol_syslog(get_class($this)."::_init ignoreerror=".$ignoreerror." sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::_init ignoreerror=".$ignoreerror."", LOG_DEBUG); $result=$this->db->query($sql, $ignoreerror); if (! $result) { @@ -373,7 +373,7 @@ abstract class DolibarrModules $sql.= " WHERE ".$this->db->decrypt('name')." = '".$this->const_name."'"; $sql.= " AND entity IN (0, ".$entity.")"; - dol_syslog(get_class($this)."::_active sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::_active", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) $err++; @@ -382,7 +382,7 @@ abstract class DolibarrModules $sql.= ",".$this->db->encrypt('1',1); $sql.= ",0,".$entity.")"; - dol_syslog(get_class($this)."::_active sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::_active", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) $err++; @@ -408,7 +408,7 @@ abstract class DolibarrModules $sql.= " WHERE ".$this->db->decrypt('name')." = '".$this->const_name."'"; $sql.= " AND entity IN (0, ".$entity.")"; - dol_syslog(get_class($this)."::_unactive sql=".$sql); + dol_syslog(get_class($this)."::_unactive", LOG_DEBUG); $this->db->query($sql); return $err; @@ -540,7 +540,7 @@ abstract class DolibarrModules $sql.= " AND entity = ".$conf->entity; if ($note) $sql.=" AND note ='".$this->db->escape($note)."'"; - dol_syslog(get_class($this)."::insert_boxes sql=".$sql); + dol_syslog(get_class($this)."::insert_boxes", LOG_DEBUG); $result=$this->db->query($sql); if ($result) { @@ -557,7 +557,7 @@ abstract class DolibarrModules $sql.= $note?"'".$this->db->escape($note)."'":"null"; $sql.= ")"; - dol_syslog(get_class($this)."::insert_boxes sql=".$sql); + dol_syslog(get_class($this)."::insert_boxes", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) $err++; @@ -575,7 +575,7 @@ abstract class DolibarrModules $sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes (box_id,position,box_order,fk_user,entity)"; $sql.= " VALUES (".$lastid.", ".$key2.", '0', 0, ".$conf->entity.")"; - dol_syslog(get_class($this)."::insert_boxes onto page ".$key2."=".$val2." sql=".$sql); + dol_syslog(get_class($this)."::insert_boxes onto page ".$key2."=".$val2."", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) $err++; } @@ -634,7 +634,7 @@ abstract class DolibarrModules $sql.= " AND ".MAIN_DB_PREFIX."boxes_def.file = '".$this->db->escape($file)."'"; $sql.= " AND ".MAIN_DB_PREFIX."boxes.entity = ".$conf->entity; - dol_syslog(get_class($this)."::delete_boxes sql=".$sql); + dol_syslog(get_class($this)."::delete_boxes", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -647,7 +647,7 @@ abstract class DolibarrModules $sql.= " WHERE file = '".$this->db->escape($file)."'"; $sql.= " AND entity = ".$conf->entity; - dol_syslog(get_class($this)."::delete_boxes sql=".$sql); + dol_syslog(get_class($this)."::delete_boxes", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -676,7 +676,7 @@ abstract class DolibarrModules $sql.= " WHERE ".$this->db->decrypt('name')." like '".$this->const_name."_TABS_%'"; $sql.= " AND entity = ".$conf->entity; - dol_syslog(get_class($this)."::delete_tabs sql=".$sql); + dol_syslog(get_class($this)."::delete_tabs", LOG_DEBUG); if (! $this->db->query($sql)) { $this->error=$this->db->lasterror(); @@ -722,7 +722,7 @@ abstract class DolibarrModules $sql.= ", ".$conf->entity; $sql.= ")"; - dol_syslog(get_class($this)."::insert_tabs sql=".$sql); + dol_syslog(get_class($this)."::insert_tabs", LOG_DEBUG); $resql=$this->db->query($sql); /* Allow duplicate key if (! $resql) @@ -784,7 +784,7 @@ abstract class DolibarrModules $sql.= ")"; - dol_syslog(get_class($this)."::insert_const sql=".$sql); + dol_syslog(get_class($this)."::insert_const", LOG_DEBUG); if (! $this->db->query($sql) ) { dol_syslog(get_class($this)."::insert_const ".$this->db->lasterror(), LOG_ERR); @@ -826,7 +826,7 @@ abstract class DolibarrModules $sql = "DELETE FROM ".MAIN_DB_PREFIX."const"; $sql.= " WHERE ".$this->db->decrypt('name')." = '".$name."'"; $sql.= " AND entity in (0, ".$conf->entity.")"; - dol_syslog(get_class($this)."::delete_const sql=".$sql); + dol_syslog(get_class($this)."::delete_const", LOG_DEBUG); if (! $this->db->query($sql)) { $this->error=$this->db->lasterror(); @@ -904,7 +904,7 @@ abstract class DolibarrModules $sql .= "(".$r_id.",".$entity.",'".$this->db->escape($r_desc)."','".$r_modul."','".$r_type."',".$r_def.")"; } - dol_syslog(get_class($this)."::insert_permissions sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::insert_permissions", LOG_DEBUG); $resqlinsert=$this->db->query($sql,1); if (! $resqlinsert) { @@ -927,7 +927,7 @@ abstract class DolibarrModules require DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; } $sql="SELECT rowid FROM ".MAIN_DB_PREFIX."user WHERE admin = 1"; - dol_syslog(get_class($this)."::insert_permissions Search all admin users sql=".$sql); + dol_syslog(get_class($this)."::insert_permissions Search all admin users", LOG_DEBUG); $resqlseladmin=$this->db->query($sql,1); if ($resqlseladmin) { @@ -982,7 +982,7 @@ abstract class DolibarrModules $sql = "DELETE FROM ".MAIN_DB_PREFIX."rights_def"; $sql.= " WHERE module = '".$this->rights_class."'"; $sql.= " AND entity = ".$conf->entity; - dol_syslog(get_class($this)."::delete_permissions sql=".$sql); + dol_syslog(get_class($this)."::delete_permissions", LOG_DEBUG); if (! $this->db->query($sql)) { $this->error=$this->db->lasterror(); @@ -1113,7 +1113,7 @@ abstract class DolibarrModules $sql.= " WHERE module = '".$this->db->escape($this->rights_class)."'"; $sql.= " AND entity = ".$conf->entity; - dol_syslog(get_class($this)."::delete_menus sql=".$sql); + dol_syslog(get_class($this)."::delete_menus", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -1201,7 +1201,7 @@ abstract class DolibarrModules $sql.= " WHERE ".$this->db->decrypt('name')." = '".$name."'"; $sql.= " AND entity = ".$conf->entity; - dol_syslog(get_class($this)."::insert_dirs sql=".$sql); + dol_syslog(get_class($this)."::insert_dirs", LOG_DEBUG); $result=$this->db->query($sql); if ($result) { @@ -1212,7 +1212,7 @@ abstract class DolibarrModules $sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,type,value,note,visible,entity)"; $sql.= " VALUES (".$this->db->encrypt($name,1).",'chaine',".$this->db->encrypt($dir,1).",'Directory for module ".$this->name."','0',".$conf->entity.")"; - dol_syslog(get_class($this)."::insert_dirs sql=".$sql); + dol_syslog(get_class($this)."::insert_dirs", LOG_DEBUG); $resql=$this->db->query($sql); } } @@ -1242,7 +1242,7 @@ abstract class DolibarrModules $sql.= " WHERE ".$this->db->decrypt('name')." LIKE '".$this->const_name."_DIR_%'"; $sql.= " AND entity = ".$conf->entity; - dol_syslog(get_class($this)."::delete_dirs sql=".$sql); + dol_syslog(get_class($this)."::delete_dirs", LOG_DEBUG); if (! $this->db->query($sql)) { $this->error=$this->db->lasterror(); @@ -1319,7 +1319,7 @@ abstract class DolibarrModules $sql.= ", ".$entity; $sql.= ")"; - dol_syslog(get_class($this)."::insert_const_".$key." sql=".$sql); + dol_syslog(get_class($this)."::insert_const_".$key."", LOG_DEBUG); $resql=$this->db->query($sql,1); if (! $resql) { @@ -1362,7 +1362,7 @@ abstract class DolibarrModules $sql.= " WHERE ".$this->db->decrypt('name')." LIKE '".$this->const_name."_".strtoupper($key)."'"; $sql.= " AND entity = ".$entity; - dol_syslog(get_class($this)."::delete_const_".$key." sql=".$sql); + dol_syslog(get_class($this)."::delete_const_".$key."", LOG_DEBUG); if (! $this->db->query($sql)) { $this->error=$this->db->lasterror(); diff --git a/htdocs/core/modules/action/rapport.pdf.php b/htdocs/core/modules/action/rapport.pdf.php index b864205f2c9..7b539f92494 100644 --- a/htdocs/core/modules/action/rapport.pdf.php +++ b/htdocs/core/modules/action/rapport.pdf.php @@ -186,7 +186,7 @@ class CommActionRapport $sql.= " AND '".$this->db->idate(dol_get_last_day($this->year,$this->month,false))."'"; $sql.= " ORDER BY a.datep DESC"; - dol_syslog(get_class($this)."::_page sql=".$sql); + dol_syslog(get_class($this)."::_page", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/core/modules/commande/mod_commande_marbre.php b/htdocs/core/modules/commande/mod_commande_marbre.php index 8075099cdd6..92c8f55581c 100644 --- a/htdocs/core/modules/commande/mod_commande_marbre.php +++ b/htdocs/core/modules/commande/mod_commande_marbre.php @@ -119,7 +119,7 @@ class mod_commande_marbre extends ModeleNumRefCommandes } else { - dol_syslog("mod_commande_marbre::getNextValue sql=".$sql); + dol_syslog("mod_commande_marbre::getNextValue", LOG_DEBUG); return -1; } diff --git a/htdocs/core/modules/contract/mod_contract_serpis.php b/htdocs/core/modules/contract/mod_contract_serpis.php index a07f3261133..61ca01ae419 100644 --- a/htdocs/core/modules/contract/mod_contract_serpis.php +++ b/htdocs/core/modules/contract/mod_contract_serpis.php @@ -116,7 +116,7 @@ class mod_contract_serpis extends ModelNumRefContracts } else { - dol_syslog("mod_contract_serpis::getNextValue sql=".$sql); + dol_syslog("mod_contract_serpis::getNextValue", LOG_DEBUG); return -1; } diff --git a/htdocs/core/modules/expedition/mod_expedition_safor.php b/htdocs/core/modules/expedition/mod_expedition_safor.php index ba779658051..581657c6547 100644 --- a/htdocs/core/modules/expedition/mod_expedition_safor.php +++ b/htdocs/core/modules/expedition/mod_expedition_safor.php @@ -116,7 +116,7 @@ class mod_expedition_safor extends ModelNumRefExpedition } else { - dol_syslog("mod_expedition_safor::getNextValue sql=".$sql); + dol_syslog("mod_expedition_safor::getNextValue", LOG_DEBUG); return -1; } diff --git a/htdocs/core/modules/facture/mod_facture_mars.php b/htdocs/core/modules/facture/mod_facture_mars.php index f1a46913e25..100b9193fd5 100644 --- a/htdocs/core/modules/facture/mod_facture_mars.php +++ b/htdocs/core/modules/facture/mod_facture_mars.php @@ -144,7 +144,7 @@ class mod_facture_mars extends ModeleNumRefFactures $sql.= " AND entity = ".$conf->entity; $resql=$db->query($sql); - dol_syslog(get_class($this)."::getNextValue sql=".$sql); + dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG); if ($resql) { $obj = $db->fetch_object($resql); @@ -168,7 +168,7 @@ class mod_facture_mars extends ModeleNumRefFactures $sql.= " WHERE facnumber LIKE '".$prefix."____-".$num."'"; $sql.= " AND entity = ".$conf->entity; - dol_syslog(get_class($this)."::getNextValue sql=".$sql); + dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/core/modules/facture/mod_facture_terre.php b/htdocs/core/modules/facture/mod_facture_terre.php index 9a8b5feaed7..6270bb9ae9c 100644 --- a/htdocs/core/modules/facture/mod_facture_terre.php +++ b/htdocs/core/modules/facture/mod_facture_terre.php @@ -160,7 +160,7 @@ class mod_facture_terre extends ModeleNumRefFactures $sql.= " AND entity = ".$conf->entity; $resql=$db->query($sql); - dol_syslog(get_class($this)."::getNextValue sql=".$sql); + dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG); if ($resql) { $obj = $db->fetch_object($resql); @@ -184,7 +184,7 @@ class mod_facture_terre extends ModeleNumRefFactures $sql.= " WHERE facnumber LIKE '".$prefix."____-".$num."'"; $sql.= " AND entity = ".$conf->entity; - dol_syslog(get_class($this)."::getNextValue sql=".$sql); + dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index e83f812e8c4..cd3d82576ff 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -621,7 +621,7 @@ class ImportCsv extends ModeleImports } if (! empty($objimport->array_import_tables_creator[0][$alias])) $sql.=', '.$user->id; $sql.=')'; - dol_syslog("import_csv.modules sql=".$sql); + dol_syslog("import_csv.modules", LOG_DEBUG); //print '> '.join(',',$arrayrecord); //print 'sql='.$sql; diff --git a/htdocs/core/modules/livraison/mod_livraison_jade.php b/htdocs/core/modules/livraison/mod_livraison_jade.php index 77ca85f8e6c..e7cd8c926ac 100644 --- a/htdocs/core/modules/livraison/mod_livraison_jade.php +++ b/htdocs/core/modules/livraison/mod_livraison_jade.php @@ -118,7 +118,7 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder $sql.= " AND entity = ".$conf->entity; $resql=$db->query($sql); - dol_syslog("mod_livraison_jade::getNextValue sql=".$sql); + dol_syslog("mod_livraison_jade::getNextValue", LOG_DEBUG); if ($resql) { $obj = $db->fetch_object($resql); diff --git a/htdocs/core/modules/mailings/fraise.modules.php b/htdocs/core/modules/mailings/fraise.modules.php index 0e79a1f6e91..a9df6300f80 100644 --- a/htdocs/core/modules/mailings/fraise.modules.php +++ b/htdocs/core/modules/mailings/fraise.modules.php @@ -180,7 +180,7 @@ class mailing_fraise extends MailingTargets //print $sql; // Add targets into table - dol_syslog(get_class($this)."::add_to_target sql=".$sql); + dol_syslog(get_class($this)."::add_to_target", LOG_DEBUG); $result=$this->db->query($sql); if ($result) { diff --git a/htdocs/core/modules/project/mod_project_simple.php b/htdocs/core/modules/project/mod_project_simple.php index da1c914f484..17ae9f29ddf 100644 --- a/htdocs/core/modules/project/mod_project_simple.php +++ b/htdocs/core/modules/project/mod_project_simple.php @@ -122,7 +122,7 @@ class mod_project_simple extends ModeleNumRefProjects } else { - dol_syslog("mod_project_simple::getNextValue sql=".$sql); + dol_syslog("mod_project_simple::getNextValue", LOG_DEBUG); return -1; } diff --git a/htdocs/core/modules/project/task/mod_task_simple.php b/htdocs/core/modules/project/task/mod_task_simple.php index afc17d663c0..eb8928d3b8f 100644 --- a/htdocs/core/modules/project/task/mod_task_simple.php +++ b/htdocs/core/modules/project/task/mod_task_simple.php @@ -122,7 +122,7 @@ class mod_task_simple extends ModeleNumRefTask } else { - dol_syslog("mod_task_simple::getNextValue sql=".$sql); + dol_syslog("mod_task_simple::getNextValue", LOG_DEBUG); return -1; } diff --git a/htdocs/core/modules/propale/mod_propale_marbre.php b/htdocs/core/modules/propale/mod_propale_marbre.php index aa2959691e6..ff38bc5f9cb 100644 --- a/htdocs/core/modules/propale/mod_propale_marbre.php +++ b/htdocs/core/modules/propale/mod_propale_marbre.php @@ -124,7 +124,7 @@ class mod_propale_marbre extends ModeleNumRefPropales } else { - dol_syslog("mod_propale_marbre::getNextValue sql=".$sql); + dol_syslog("mod_propale_marbre::getNextValue", LOG_DEBUG); return -1; } diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php index d0defd260dd..78e8998f7d6 100644 --- a/htdocs/core/modules/rapport/pdf_paiement.class.php +++ b/htdocs/core/modules/rapport/pdf_paiement.class.php @@ -156,7 +156,7 @@ class pdf_paiement if (! empty($socid)) $sql .= " AND s.rowid = ".$socid; $sql.= " ORDER BY p.datep ASC, pf.fk_paiement ASC"; - dol_syslog(get_class($this)."::write_file sql=".$sql); + dol_syslog(get_class($this)."::write_file", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { diff --git a/htdocs/core/modules/societe/mod_codeclient_monkey.php b/htdocs/core/modules/societe/mod_codeclient_monkey.php index 8b31e581e26..8e2baa28c9f 100644 --- a/htdocs/core/modules/societe/mod_codeclient_monkey.php +++ b/htdocs/core/modules/societe/mod_codeclient_monkey.php @@ -225,7 +225,7 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode $sql.= " AND entity IN (".getEntity('societe', 1).")"; if ($soc->id > 0) $sql.= " AND rowid <> ".$soc->id; - dol_syslog(get_class($this)."::verif_dispo sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::verif_dispo", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php index 049c312e1ef..82961405825 100644 --- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php +++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php @@ -118,7 +118,7 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices $sql.= " AND entity = ".$conf->entity; $resql=$db->query($sql); - dol_syslog(get_class($this)."::getNextValue sql=".$sql); + dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG); if ($resql) { $obj = $db->fetch_object($resql); @@ -142,7 +142,7 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices $sql.= " WHERE ref LIKE '".$prefix."____-".$num."'"; $sql.= " AND entity = ".$conf->entity; - dol_syslog(get_class($this)."::getNextValue sql=".$sql); + dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php index c035acac207..aff6e526b93 100644 --- a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php +++ b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php @@ -238,7 +238,7 @@ class InterfaceNotification $sql = "SELECT rowid, code, label, description, elementtype"; $sql.= " FROM ".MAIN_DB_PREFIX."c_action_trigger"; $sql.= $this->db->order("elementtype, code"); - dol_syslog("Get list of notifications sql=".$sql); + dol_syslog("Get list of notifications", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index f1fc788a198..8b9704cfb83 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -224,7 +224,7 @@ class Cronjob extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -309,7 +309,7 @@ class Cronjob extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."cronjob as t"; $sql.= " WHERE t.rowid = ".$id; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -429,7 +429,7 @@ class Cronjob extends CommonObject $sql.= " WHERE ".implode(' AND ',$sqlwhere); } - dol_syslog(get_class($this)."::fetch_all sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch_all", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -609,7 +609,7 @@ class Cronjob extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -683,7 +683,7 @@ class Cronjob extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."cronjob"; $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } } @@ -816,7 +816,7 @@ class Cronjob extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."cronjob as f"; $sql.= " WHERE f.rowid = ".$this->id; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php index ea29d822102..d5b46b90c08 100644 --- a/htdocs/ecm/class/ecmdirectory.class.php +++ b/htdocs/ecm/class/ecmdirectory.class.php @@ -142,7 +142,7 @@ class EcmDirectory // extends CommonObject $sql.= " '".$this->fk_user_c."'"; $sql.= ")"; - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -210,7 +210,7 @@ class EcmDirectory // extends CommonObject $sql.= " description='".$this->db->escape($this->description)."'"; $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { @@ -257,7 +257,7 @@ class EcmDirectory // extends CommonObject $sql.= " cachenbofdoc = cachenbofdoc ".$sign." 1"; $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::changeNbOfFiles sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::changeNbOfFiles", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { @@ -291,7 +291,7 @@ class EcmDirectory // extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."ecm_directories as t"; $sql.= " WHERE t.rowid = ".$id; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -348,7 +348,7 @@ class EcmDirectory // extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."ecm_directories"; $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { @@ -499,7 +499,7 @@ class EcmDirectory // extends CommonObject $sql.= " WHERE fk_parent != 0"; $sql.= " AND entity = ".$conf->entity; - dol_syslog(get_class($this)."::load_motherof sql=".$sql); + dol_syslog(get_class($this)."::load_motherof", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -563,7 +563,7 @@ class EcmDirectory // extends CommonObject $sql.= " AND c.entity = ".$conf->entity; $sql.= " ORDER BY c.label, c.rowid"; - dol_syslog(get_class($this)."::get_full_arbo sql=".$sql); + dol_syslog(get_class($this)."::get_full_arbo", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -688,7 +688,7 @@ class EcmDirectory // extends CommonObject $sql.= " WHERE entity = ".$conf->entity; } - dol_syslog(get_class($this)."::refreshcachenboffile sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::refreshcachenboffile", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 5cf09642c68..585fb9f8a88 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -227,7 +227,7 @@ class Expedition extends CommonObject $sql.= ", ".(!empty($this->model_pdf)?"'".$this->db->escape($this->model_pdf)."'":"null"); $sql.= ")"; - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -237,7 +237,7 @@ class Expedition extends CommonObject $sql.= " SET ref = '(PROV".$this->id.")'"; $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); if ($this->db->query($sql)) { // Insertion des lignes @@ -334,7 +334,7 @@ class Expedition extends CommonObject $sql.= ", ".$qty; $sql.= ")"; - dol_syslog(get_class($this)."::create_line sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create_line", LOG_DEBUG); if (! $this->db->query($sql)) { $error++; @@ -399,7 +399,7 @@ class Expedition extends CommonObject if ($ref_ext) $sql.= " AND e.ref_ext='".$this->db->escape($ref_ext)."'"; if ($ref_int) $sql.= " AND e.ref_int='".$this->db->escape($ref_int)."'"; - dol_syslog(get_class($this)."::fetch sql=".$sql); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -545,7 +545,7 @@ class Expedition extends CommonObject $sql.= ", fk_user_valid = ".$user->id; $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::valid update expedition sql=".$sql); + dol_syslog(get_class($this)."::valid update expedition", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -569,7 +569,7 @@ class Expedition extends CommonObject $sql.= " WHERE ed.fk_expedition = ".$this->id; $sql.= " AND cd.rowid = ed.fk_origin_line"; - dol_syslog(get_class($this)."::valid select details sql=".$sql); + dol_syslog(get_class($this)."::valid select details", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -846,7 +846,7 @@ class Expedition extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -922,7 +922,7 @@ class Expedition extends CommonObject $sql.= " WHERE ed.fk_expedition = ".$this->id; $sql.= " AND cd.rowid = ed.fk_origin_line"; - dol_syslog(get_class($this)."::delete select details sql=".$sql); + dol_syslog(get_class($this)."::delete select details", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -1062,7 +1062,7 @@ class Expedition extends CommonObject $sql.= " WHERE ed.fk_expedition = ".$this->id; $sql.= " AND ed.fk_origin_line = cd.rowid"; - dol_syslog(get_class($this)."::fetch_lines sql=".$sql); + dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1324,7 +1324,7 @@ class Expedition extends CommonObject $sql.= " SET date_delivery = ".($date_livraison ? "'".$this->db->idate($date_livraison)."'" : 'null'); $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::set_date_livraison sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::set_date_livraison", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/expedition/class/expeditionbatch.class.php b/htdocs/expedition/class/expeditionbatch.class.php index 7bbd99706bd..a0a22fefdd6 100644 --- a/htdocs/expedition/class/expeditionbatch.class.php +++ b/htdocs/expedition/class/expeditionbatch.class.php @@ -69,7 +69,7 @@ class ExpeditionLigneBatch extends CommonObject $sql.= MAIN_DB_PREFIX."product_stock as e on t.fk_product_stock=e.rowid "; $sql.= " WHERE t.rowid = ".(int) $id_stockdluo; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -123,7 +123,7 @@ class ExpeditionLigneBatch extends CommonObject $sql.= " ".(! isset($this->fk_origin_stock)?'NULL':$this->fk_origin_stock); $sql.= ")"; - dol_syslog(__METHOD__ ." sql=".$sql, LOG_DEBUG); + dol_syslog(__METHOD__ ."", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -157,7 +157,7 @@ class ExpeditionLigneBatch extends CommonObject $sql="DELETE FROM ".MAIN_DB_PREFIX.self::$_table_element; $sql.=" WHERE fk_expeditiondet in (SELECT rowid FROM ".MAIN_DB_PREFIX."expeditiondet WHERE fk_expedition=".$id_expedition.")"; - dol_syslog(__METHOD__ ." sql=".$sql, LOG_DEBUG); + dol_syslog(__METHOD__ ."", LOG_DEBUG); if ( $db->query($sql) ) { return 1; @@ -185,7 +185,7 @@ class ExpeditionLigneBatch extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX.self::$_table_element; $sql.= " WHERE fk_expeditiondet=".(int) $id_line_expdet; - dol_syslog(__METHOD__ ." sql=".$sql, LOG_DEBUG); + dol_syslog(__METHOD__ ."", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index fce9c3bf6a5..d44a7d5f4a4 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -363,7 +363,7 @@ if ($id > 0 || ! empty($ref)) $sql.= " ORDER BY cd.rang, cd.rowid"; //print $sql; - dol_syslog("shipment.php sql=".$sql, LOG_DEBUG); + dol_syslog("shipment.php", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index fda062952d1..3c7f9a14902 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -519,7 +519,7 @@ class Export // Run the sql $this->sqlusedforexport=$sql; - dol_syslog(get_class($this)."::".__FUNCTION__." sql=".$sql); + dol_syslog(get_class($this)."::".__FUNCTION__."", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -628,7 +628,7 @@ class Export $sql.= (! empty($filter)?"'".$filter."'":"null"); $sql.= ")"; - dol_syslog("Export::create sql=".$sql, LOG_DEBUG); + dol_syslog("Export::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -657,7 +657,7 @@ class Export $sql.= ' FROM '.MAIN_DB_PREFIX.'export_model as em'; $sql.= ' WHERE em.rowid = '.$id; - dol_syslog("Export::fetch sql=".$sql, LOG_DEBUG); + dol_syslog("Export::fetch", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -706,7 +706,7 @@ class Export $this->db->begin(); - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 52585d29122..72d20443d8f 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -151,7 +151,7 @@ class Fichinter extends CommonObject $sql.= ", ".($this->note_public?"'".$this->db->escape($this->note_public)."'":"null"); $sql.= ")"; - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $result=$this->db->query($sql); if ($result) { @@ -162,7 +162,7 @@ class Fichinter extends CommonObject $this->ref='(PROV'.$this->id.')'; $sql = 'UPDATE '.MAIN_DB_PREFIX."fichinter SET ref='".$this->ref."' WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::create sql=".$sql); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) $error++; } @@ -234,7 +234,7 @@ class Fichinter extends CommonObject $sql.= ", note_public = ".($this->note_public?"'".$this->db->escape($this->note_public)."'":"null"); $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); if ($this->db->query($sql)) { @@ -280,7 +280,7 @@ class Fichinter extends CommonObject if ($ref) $sql.= " WHERE f.ref='".$this->db->escape($ref)."'"; else $sql.= " WHERE f.rowid=".$rowid; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -350,7 +350,7 @@ class Fichinter extends CommonObject $sql.= " WHERE rowid = ".$this->id; $sql.= " AND entity = ".$conf->entity; - dol_syslog("Fichinter::setDraft sql=".$sql); + dol_syslog("Fichinter::setDraft", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -405,7 +405,7 @@ class Fichinter extends CommonObject $sql.= " AND entity = ".$conf->entity; $sql.= " AND fk_statut = 0"; - dol_syslog(get_class($this)."::setValid sql=".$sql); + dol_syslog(get_class($this)."::setValid", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -723,14 +723,14 @@ class Fichinter extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."fichinterdet"; $sql.= " WHERE fk_fichinter = ".$this->id; - dol_syslog("Fichinter::delete sql=".$sql); + dol_syslog("Fichinter::delete", LOG_DEBUG); if ( $this->db->query($sql) ) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."fichinter"; $sql.= " WHERE rowid = ".$this->id; $sql.= " AND entity = ".$conf->entity; - dol_syslog("Fichinter::delete sql=".$sql); + dol_syslog("Fichinter::delete", LOG_DEBUG); if ( $this->db->query($sql) ) { @@ -982,7 +982,7 @@ class Fichinter extends CommonObject $sql.= ' FROM '.MAIN_DB_PREFIX.'fichinterdet'; $sql.= ' WHERE fk_fichinter = '.$this->id; - dol_syslog(get_class($this)."::fetch_lines sql=".$sql); + dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -1057,7 +1057,7 @@ class FichinterLigne $sql.= ' FROM '.MAIN_DB_PREFIX.'fichinterdet as ft'; $sql.= ' WHERE ft.rowid = '.$rowid; - dol_syslog("FichinterLigne::fetch sql=".$sql); + dol_syslog("FichinterLigne::fetch", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -1125,7 +1125,7 @@ class FichinterLigne $sql.= ' '.$rangToUse; $sql.= ')'; - dol_syslog("FichinterLigne::insert sql=".$sql); + dol_syslog("FichinterLigne::insert", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -1188,7 +1188,7 @@ class FichinterLigne $sql.= ",rang='".$this->rang."'"; $sql.= " WHERE rowid = ".$this->rowid; - dol_syslog("FichinterLigne::update sql=".$sql); + dol_syslog("FichinterLigne::update", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -1246,7 +1246,7 @@ class FichinterLigne $sql.= " FROM ".MAIN_DB_PREFIX."fichinterdet"; $sql.= " WHERE fk_fichinter=".$this->fk_fichinter; - dol_syslog("FichinterLigne::update_total sql=".$sql); + dol_syslog("FichinterLigne::update_total", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -1259,7 +1259,7 @@ class FichinterLigne $sql.= " WHERE rowid = ".$this->fk_fichinter; $sql.= " AND entity = ".$conf->entity; - dol_syslog("FichinterLigne::update_total sql=".$sql); + dol_syslog("FichinterLigne::update_total", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -1301,7 +1301,7 @@ class FichinterLigne $sql = "DELETE FROM ".MAIN_DB_PREFIX."fichinterdet WHERE rowid = ".$this->rowid; $resql = $this->db->query($sql); - dol_syslog(get_class($this)."::deleteline sql=".$sql); + dol_syslog(get_class($this)."::deleteline", LOG_DEBUG); if ($resql) { diff --git a/htdocs/fourn/ajax/getSupplierPrices.php b/htdocs/fourn/ajax/getSupplierPrices.php index bbe3aeba4dc..fc891af53a3 100644 --- a/htdocs/fourn/ajax/getSupplierPrices.php +++ b/htdocs/fourn/ajax/getSupplierPrices.php @@ -58,7 +58,7 @@ if (! empty($idprod)) $sql.= " AND s.fournisseur = 1"; $sql.= " ORDER BY s.nom, pfp.ref_fourn DESC"; - dol_syslog("Ajax::getSupplierPrices sql=".$sql, LOG_DEBUG); + dol_syslog("Ajax::getSupplierPrices", LOG_DEBUG); $result=$db->query($sql); if ($result) diff --git a/htdocs/fourn/class/fournisseur.class.php b/htdocs/fourn/class/fournisseur.class.php index f557573fdfc..71942a27f97 100644 --- a/htdocs/fourn/class/fournisseur.class.php +++ b/htdocs/fourn/class/fournisseur.class.php @@ -157,7 +157,7 @@ class Fournisseur extends Societe $sql.= " VALUES "; $sql.= " ('".$this->db->escape($name)."',1,1)"; - dol_syslog("Fournisseur::CreateCategory sql=".$sql); + dol_syslog("Fournisseur::CreateCategory", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 591fce671b1..a9b4a5b90b1 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -138,7 +138,7 @@ class CommandeFournisseur extends CommonOrder if ($ref) $sql.= " AND c.ref='".$ref."'"; else $sql.= " AND c.rowid=".$id; - dol_syslog(get_class($this)."::fetch sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -207,7 +207,7 @@ class CommandeFournisseur extends CommonOrder $sql.= " ORDER BY l.rowid"; //print $sql; - dol_syslog(get_class($this)."::fetch get lines sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::fetch get lines", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -288,7 +288,7 @@ class CommandeFournisseur extends CommonOrder $sql.= ($comment?"'".$this->db->escape($comment)."'":'null'); $sql.= ")"; - dol_syslog("FournisseurCommande::log sql=".$sql, LOG_DEBUG); + dol_syslog("FournisseurCommande::log", LOG_DEBUG); if ( $this->db->query($sql) ) { return 1; @@ -756,7 +756,7 @@ class CommandeFournisseur extends CommonOrder $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur SET fk_statut = ".$statut; $sql .= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::cancel sql=".$sql); + dol_syslog(get_class($this)."::cancel", LOG_DEBUG); if ($this->db->query($sql)) { $result = 0; @@ -815,7 +815,7 @@ class CommandeFournisseur extends CommonOrder $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur SET fk_statut = 3, fk_input_method=".$methode.",date_commande=".$this->db->idate("$date"); $sql .= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::commande sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::commande", LOG_DEBUG); if ($this->db->query($sql)) { $result = 1; @@ -889,7 +889,7 @@ class CommandeFournisseur extends CommonOrder $sql.= ", ".($this->cond_reglement_id > 0 ? $this->cond_reglement_id : 'null'); $sql.= ")"; - dol_syslog(get_class($this)."::create sql=".$sql); + dol_syslog(get_class($this)."::create", LOG_DEBUG); if ($this->db->query($sql)) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."commande_fournisseur"); @@ -928,7 +928,7 @@ class CommandeFournisseur extends CommonOrder $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur"; $sql.= " SET ref='(PROV".$this->id.")'"; $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::create sql=".$sql); + dol_syslog(get_class($this)."::create", LOG_DEBUG); if ($this->db->query($sql)) { // On logue creation pour historique @@ -1198,7 +1198,7 @@ class CommandeFournisseur extends CommonOrder $sql.= "'".price2num($total_ttc)."'"; $sql.= ")"; - dol_syslog(get_class($this)."::addline sql=".$sql); + dol_syslog(get_class($this)."::addline", LOG_DEBUG); $resql=$this->db->query($sql); //print $sql; if ($resql) @@ -1269,7 +1269,7 @@ class CommandeFournisseur extends CommonOrder $sql.= " (fk_commande,fk_product, qty, fk_entrepot, fk_user, datec) VALUES "; $sql.= " ('".$this->id."','".$product."','".$qty."',".($entrepot>0?"'".$entrepot."'":"null").",'".$user->id."','".$this->db->idate($now)."')"; - dol_syslog(get_class($this)."::DispatchProduct sql=".$sql); + dol_syslog(get_class($this)."::DispatchProduct", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1342,7 +1342,7 @@ class CommandeFournisseur extends CommonOrder $sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseurdet WHERE rowid = ".$idline; $resql=$this->db->query($sql); - dol_syslog(get_class($this)."::deleteline sql=".$sql); + dol_syslog(get_class($this)."::deleteline", LOG_DEBUG); if (!$notrigger && $resql) { @@ -1390,14 +1390,14 @@ class CommandeFournisseur extends CommonOrder $this->db->begin(); $sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseurdet WHERE fk_commande =". $this->id ; - dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); if (! $this->db->query($sql) ) { $error++; } $sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseur WHERE rowid =".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); if ($resql = $this->db->query($sql) ) { if ($this->db->affected_rows($resql) < 1) @@ -1540,7 +1540,7 @@ class CommandeFournisseur extends CommonOrder $sql.= " WHERE rowid = ".$this->id; $sql.= " AND fk_statut IN (3,4)"; // Process running or Partially received - dol_syslog(get_class($this)."::Livraison sql=".$sql); + dol_syslog(get_class($this)."::Livraison", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -1586,7 +1586,7 @@ class CommandeFournisseur extends CommonOrder $sql.= " SET date_livraison = ".($date_livraison ? "'".$this->db->idate($date_livraison)."'" : 'null'); $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::set_date_livraison sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::set_date_livraison", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -1666,7 +1666,7 @@ class CommandeFournisseur extends CommonOrder $sql.= ' SET fk_statut='.$status; $sql.= ' WHERE rowid = '.$this->id; - dol_syslog(get_class($this)."::setStatus sql=".$sql); + dol_syslog(get_class($this)."::setStatus", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1781,7 +1781,7 @@ class CommandeFournisseur extends CommonOrder $sql.= ",product_type=".$type; $sql.= " WHERE rowid = ".$rowid; - dol_syslog(get_class($this)."::updateline sql=".$sql); + dol_syslog(get_class($this)."::updateline", LOG_DEBUG); $result = $this->db->query($sql); if ($result > 0) { diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index a9619a33902..a5eb09f43f7 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -196,7 +196,7 @@ class FactureFournisseur extends CommonInvoice $sql.= $this->date_echeance!=''?"'".$this->db->idate($this->date_echeance)."'":"null"; $sql.= ")"; - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -206,7 +206,7 @@ class FactureFournisseur extends CommonInvoice $this->ref='(PROV'.$this->id.')'; $sql = 'UPDATE '.MAIN_DB_PREFIX."facture_fourn SET ref='".$this->ref."' WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::create sql=".$sql); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) $error++; @@ -226,7 +226,7 @@ class FactureFournisseur extends CommonInvoice $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det (fk_facture_fourn)'; $sql .= ' VALUES ('.$this->id.');'; - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql_insert=$this->db->query($sql); if ($resql_insert) { @@ -350,7 +350,7 @@ class FactureFournisseur extends CommonInvoice if ($id) $sql.= " WHERE t.rowid=".$id; if ($ref) $sql.= " WHERE t.ref='".$this->db->escape($ref)."'"; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -453,7 +453,7 @@ class FactureFournisseur extends CommonInvoice $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON f.fk_product = p.rowid'; $sql.= ' WHERE fk_facture_fourn='.$this->id; - dol_syslog(get_class($this)."::fetch_lines sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG); $resql_rows = $this->db->query($sql); if ($resql_rows) { @@ -591,7 +591,7 @@ class FactureFournisseur extends CommonInvoice $this->db->begin(); - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -647,12 +647,12 @@ class FactureFournisseur extends CommonInvoice $this->db->begin(); $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn_det WHERE fk_facture_fourn = '.$rowid.';'; - dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn WHERE rowid = '.$rowid; - dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql2 = $this->db->query($sql); if (! $resql2) { $error++; @@ -763,7 +763,7 @@ class FactureFournisseur extends CommonInvoice $sql.= ' SET paye = 1, fk_statut=2'; $sql.= ' WHERE rowid = '.$this->id; - dol_syslog("FactureFournisseur::set_paid sql=".$sql); + dol_syslog("FactureFournisseur::set_paid", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -813,7 +813,7 @@ class FactureFournisseur extends CommonInvoice $sql.= ' SET paye=0, fk_statut=1, close_code=null, close_note=null'; $sql.= ' WHERE rowid = '.$this->id; - dol_syslog("FactureFournisseur::set_unpaid sql=".$sql); + dol_syslog("FactureFournisseur::set_unpaid", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -891,7 +891,7 @@ class FactureFournisseur extends CommonInvoice $sql.= " SET ref='".$num."', fk_statut = 1, fk_user_valid = ".$user->id; $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::validate sql=".$sql); + dol_syslog(get_class($this)."::validate", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1011,7 +1011,7 @@ class FactureFournisseur extends CommonInvoice $sql.= " SET fk_statut = 0"; $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::set_draft sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::set_draft", LOG_DEBUG); $result=$this->db->query($sql); if ($result) { @@ -1110,7 +1110,7 @@ class FactureFournisseur extends CommonInvoice $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det (fk_facture_fourn)'; $sql.= ' VALUES ('.$this->id.')'; - dol_syslog(get_class($this)."::addline sql=".$sql); + dol_syslog(get_class($this)."::addline", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) @@ -1241,7 +1241,7 @@ class FactureFournisseur extends CommonInvoice $sql.= ", info_bits = ".$info_bits; $sql.= " WHERE rowid = ".$id; - dol_syslog(get_class($this)."::updateline sql=".$sql); + dol_syslog(get_class($this)."::updateline", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -1306,7 +1306,7 @@ class FactureFournisseur extends CommonInvoice // Supprime ligne $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn_det '; $sql.= ' WHERE rowid = '.$rowid; - dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index b642926f802..d72291c6038 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -83,7 +83,7 @@ class ProductFournisseur extends Product $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_fournisseur_price"; $sql.= " WHERE fk_product = ".$this->id." AND fk_soc = ".$id_fourn; - dol_syslog(get_class($this)."::remove_fournisseur sql=".$sql); + dol_syslog(get_class($this)."::remove_fournisseur", LOG_DEBUG); $resql2=$this->db->query($sql); if (! $resql2) { @@ -120,7 +120,7 @@ class ProductFournisseur extends Product $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_fournisseur_price"; $sql.= " WHERE rowid = ".$rowid; - dol_syslog(get_class($this)."::remove_product_fournisseur_price sql=".$sql); + dol_syslog(get_class($this)."::remove_product_fournisseur_price", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -263,7 +263,7 @@ class ProductFournisseur extends Product $sql.= $conf->entity; $sql.=")"; - dol_syslog(get_class($this)."::update_buyprice sql=".$sql); + dol_syslog(get_class($this)."::update_buyprice", LOG_DEBUG); if (! $this->db->query($sql)) { $error++; @@ -340,7 +340,7 @@ class ProductFournisseur extends Product $sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; $sql.= " WHERE pfp.rowid = ".$rowid; - dol_syslog(get_class($this)."::fetch_product_fournisseur_price sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch_product_fournisseur_price", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -399,7 +399,7 @@ class ProductFournisseur extends Product $sql.= " AND pfp.fk_product = ".$prodid; if (empty($sortfield)) $sql.= " ORDER BY s.nom, pfp.quantity, pfp.price"; else $sql.= $this->db->order($sortfield,$sortorder); - dol_syslog(get_class($this)."::list_product_fournisseur_price sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::list_product_fournisseur_price", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) @@ -488,7 +488,7 @@ class ProductFournisseur extends Product $sql.= " ORDER BY pfp.unitprice"; $sql.= $this->db->plimit(1); - dol_syslog(get_class($this)."::find_min_price_product_fournisseur sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::find_min_price_product_fournisseur", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index 69912e77cb0..3daee072886 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -149,7 +149,7 @@ class PaiementFourn extends Paiement $sql.= " VALUES ('".$this->db->idate($now)."',"; $sql.= " '".$this->db->idate($this->datepaye)."', '".$this->total."', ".$this->paiementid.", '".$this->num_paiement."', '".$this->db->escape($this->note)."', ".$user->id.", 0)"; - dol_syslog("PaiementFourn::create sql=".$sql); + dol_syslog("PaiementFourn::create", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/fourn/product/liste.php b/htdocs/fourn/product/liste.php index ffd413cbf2f..ec186cd8339 100644 --- a/htdocs/fourn/product/liste.php +++ b/htdocs/fourn/product/liste.php @@ -121,7 +121,7 @@ if ($fourn_id > 0) $sql .= " ORDER BY ".$sortfield." ".$sortorder; $sql .= $db->plimit($limit + 1, $offset); -dol_syslog("fourn/product/liste.php: sql=".$sql); +dol_syslog("fourn/product/liste.php:", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/ftp/admin/ftpclient.php b/htdocs/ftp/admin/ftpclient.php index 1ff142f7be7..3e9d2bfd590 100644 --- a/htdocs/ftp/admin/ftpclient.php +++ b/htdocs/ftp/admin/ftpclient.php @@ -218,7 +218,7 @@ else $sql.=" WHERE name like 'FTP_SERVER_%'"; $sql.=" ORDER BY name"; - dol_syslog("ftpclient select ftp setup sql=".$sql,LOG_DEBUG); + dol_syslog("ftpclient select ftp setup", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index dfa0e0d9b32..995f33e62ff 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -137,7 +137,7 @@ class Holiday extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); @@ -200,7 +200,7 @@ class Holiday extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."holiday as cp"; $sql.= " WHERE cp.rowid = ".$id; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -294,7 +294,7 @@ class Holiday extends CommonObject $sql.= $order; } - dol_syslog(get_class($this)."::fetchByUser sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetchByUser", LOG_DEBUG); $resql=$this->db->query($sql); // Si pas d'erreur SQL @@ -405,7 +405,7 @@ class Holiday extends CommonObject $sql.= $order; } - dol_syslog(get_class($this)."::fetchAll sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetchAll", LOG_DEBUG); $resql=$this->db->query($sql); // Si pas d'erreur SQL @@ -544,7 +544,7 @@ class Holiday extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); @@ -591,7 +591,7 @@ class Holiday extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); @@ -787,7 +787,7 @@ class Holiday extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."usergroup as u"; $sql.= " ORDER BY u.rowid"; - dol_syslog(get_class($this)."::selectUserGroup sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::selectUserGroup", LOG_DEBUG); $result = $this->db->query($sql); // Si pas d'erreur SQL @@ -1071,7 +1071,7 @@ class Holiday extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; $sql.= " WHERE statut > 0"; - dol_syslog(get_class($this)."::fetchUsers sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetchUsers", LOG_DEBUG); $resql=$this->db->query($sql); // Si pas d'erreur SQL @@ -1109,7 +1109,7 @@ class Holiday extends CommonObject $sql = "SELECT u.fk_user"; $sql.= " FROM ".MAIN_DB_PREFIX."holiday_users as u"; - dol_syslog(get_class($this)."::fetchUsers sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetchUsers", LOG_DEBUG); $resql=$this->db->query($sql); // Si pas d'erreur SQL @@ -1153,7 +1153,7 @@ class Holiday extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; $sql.= " WHERE statut > 0"; - dol_syslog(get_class($this)."::fetchUsers sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetchUsers", LOG_DEBUG); $resql=$this->db->query($sql); // Si pas d'erreur SQL @@ -1193,7 +1193,7 @@ class Holiday extends CommonObject $sql.= " ".MAIN_DB_PREFIX."user as u"; $sql.= " WHERE cpu.fk_user = u.rowid"; - dol_syslog(get_class($this)."::fetchUsers sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetchUsers", LOG_DEBUG); $resql=$this->db->query($sql); // Si pas d'erreur SQL @@ -1369,7 +1369,7 @@ class Holiday extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."holiday_events as cpe"; - dol_syslog(get_class($this)."::fetchEventsCP sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetchEventsCP", LOG_DEBUG); $resql=$this->db->query($sql); // Si pas d'erreur SQL @@ -1434,7 +1434,7 @@ class Holiday extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::createEventCP sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::createEventCP", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); @@ -1627,7 +1627,7 @@ class Holiday extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::addLogCP sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::addLogCP", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); @@ -1690,7 +1690,7 @@ class Holiday extends CommonObject $sql.= $order; } - dol_syslog(get_class($this)."::fetchLog sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetchLog", LOG_DEBUG); $resql=$this->db->query($sql); // Si pas d'erreur SQL diff --git a/htdocs/imports/class/import.class.php b/htdocs/imports/class/import.class.php index b1fa3552d9a..ff23bc12cc8 100644 --- a/htdocs/imports/class/import.class.php +++ b/htdocs/imports/class/import.class.php @@ -233,7 +233,7 @@ class Import $sql.= ')'; $sql.= " VALUES (".($user->id > 0 ? $user->id : 0).", '".$this->db->escape($this->model_name)."', '".$this->datatoimport."', '".$this->hexa."')"; - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -262,7 +262,7 @@ class Import $sql.= ' FROM '.MAIN_DB_PREFIX.'import_model as em'; $sql.= ' WHERE em.rowid = '.$id; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -306,7 +306,7 @@ class Import $this->db->begin(); - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } diff --git a/htdocs/install/upgrade.php b/htdocs/install/upgrade.php index 9b15d36ffe9..875f5974dd7 100644 --- a/htdocs/install/upgrade.php +++ b/htdocs/install/upgrade.php @@ -203,7 +203,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) $filles=array(); $sql = "SELECT fk_categorie_mere, fk_categorie_fille"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie_association"; - dolibarr_install_syslog("upgrade: search duplicate sql=".$sql); + dolibarr_install_syslog("upgrade: search duplicate", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { @@ -231,7 +231,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) // We delete all $sql="DELETE FROM ".MAIN_DB_PREFIX."categorie_association"; - dolibarr_install_syslog("upgrade: delete association sql=".$sql); + dolibarr_install_syslog("upgrade: delete association", LOG_DEBUG); $resqld=$db->query($sql); if ($resqld) { @@ -240,7 +240,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) { $sql ="INSERT INTO ".MAIN_DB_PREFIX."categorie_association(fk_categorie_mere,fk_categorie_fille)"; $sql.=" VALUES(".$val['mere'].", ".$val['fille'].")"; - dolibarr_install_syslog("upgrade: insert association sql=".$sql); + dolibarr_install_syslog("upgrade: insert association", LOG_DEBUG); $resqli=$db->query($sql); if (! $resqli) $error++; } diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 736346d0f72..23c9c311650 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -413,7 +413,7 @@ function migrate_paiements($db,$langs,$conf) $resql = $db->query($sql); - dolibarr_install_syslog("upgrade2::migrate_paiements sql=".$sql); + dolibarr_install_syslog("upgrade2::migrate_paiements", LOG_DEBUG); if ($resql) { $i = 0; @@ -513,7 +513,7 @@ function migrate_paiements_orphelins_1($db,$langs,$conf) $resql = $db->query($sql); - dolibarr_install_syslog("upgrade2::migrate_paiements_orphelins_1 sql=".$sql); + dolibarr_install_syslog("upgrade2::migrate_paiements_orphelins_1", LOG_DEBUG); $row = array(); if ($resql) { @@ -639,7 +639,7 @@ function migrate_paiements_orphelins_2($db,$langs,$conf) $resql = $db->query($sql); - dolibarr_install_syslog("upgrade2::migrate_paiements_orphelins_2 sql=".$sql); + dolibarr_install_syslog("upgrade2::migrate_paiements_orphelins_2", LOG_DEBUG); $row = array(); if ($resql) { @@ -779,7 +779,7 @@ function migrate_contracts_det($db,$langs,$conf) $sql.= " WHERE cd.rowid IS NULL AND p.rowid IS NOT NULL"; $resql = $db->query($sql); - dolibarr_install_syslog("upgrade2::migrate_contracts_det sql=".$sql); + dolibarr_install_syslog("upgrade2::migrate_contracts_det", LOG_DEBUG); if ($resql) { $i = 0; @@ -875,7 +875,7 @@ function migrate_links_transfert($db,$langs,$conf) $sql.= " AND bu.fk_bank IS NULL"; $resql = $db->query($sql); - dolibarr_install_syslog("upgrade2::migrate_links_transfert sql=".$sql); + dolibarr_install_syslog("upgrade2::migrate_links_transfert", LOG_DEBUG); if ($resql) { $i = 0; @@ -899,7 +899,7 @@ function migrate_links_transfert($db,$langs,$conf) $sql.= ")"; print $sql.'
'; - dolibarr_install_syslog("migrate_links_transfert sql=".$sql); + dolibarr_install_syslog("migrate_links_transfert", LOG_DEBUG); if (! $db->query($sql)) { @@ -950,7 +950,7 @@ function migrate_contracts_date1($db,$langs,$conf) print ''.$langs->trans('MigrationContractsEmptyDatesUpdate')."
\n"; $sql="update llx_contrat set date_contrat=tms where date_contrat is null"; - dolibarr_install_syslog("upgrade2::migrate_contracts_date1 sql=".$sql); + dolibarr_install_syslog("upgrade2::migrate_contracts_date1", LOG_DEBUG); $resql = $db->query($sql); if (! $resql) dol_print_error($db); if ($db->affected_rows($resql) > 0) @@ -959,7 +959,7 @@ function migrate_contracts_date1($db,$langs,$conf) print $langs->trans('MigrationContractsEmptyDatesNothingToUpdate')."
\n"; $sql="update llx_contrat set datec=tms where datec is null"; - dolibarr_install_syslog("upgrade2::migrate_contracts_date1 sql=".$sql); + dolibarr_install_syslog("upgrade2::migrate_contracts_date1", LOG_DEBUG); $resql = $db->query($sql); if (! $resql) dol_print_error($db); if ($db->affected_rows($resql) > 0) @@ -989,7 +989,7 @@ function migrate_contracts_date2($db,$langs,$conf) $sql.= " GROUP BY c.rowid, c.date_contrat"; $resql = $db->query($sql); - dolibarr_install_syslog("upgrade2::migrate_contracts_date2 sql=".$sql); + dolibarr_install_syslog("upgrade2::migrate_contracts_date2", LOG_DEBUG); if ($resql) { $i = 0; @@ -1050,7 +1050,7 @@ function migrate_contracts_date3($db,$langs,$conf) print ''.$langs->trans('MigrationContractsIncoherentCreationDateUpdate')."
\n"; $sql="update llx_contrat set datec=date_contrat where datec is null or datec > date_contrat"; - dolibarr_install_syslog("upgrade2::migrate_contracts_date3 sql=".$sql); + dolibarr_install_syslog("upgrade2::migrate_contracts_date3", LOG_DEBUG); $resql = $db->query($sql); if (! $resql) dol_print_error($db); if ($db->affected_rows($resql) > 0) @@ -1078,7 +1078,7 @@ function migrate_contracts_open($db,$langs,$conf) $sql = "SELECT c.rowid as cref FROM llx_contrat as c, llx_contratdet as cd"; $sql.= " WHERE cd.statut = 4 AND c.statut=2 AND c.rowid=cd.fk_contrat"; - dolibarr_install_syslog("upgrade2::migrate_contracts_open sql=".$sql); + dolibarr_install_syslog("upgrade2::migrate_contracts_open", LOG_DEBUG); $resql = $db->query($sql); if (! $resql) dol_print_error($db); if ($db->affected_rows($resql) > 0) { @@ -1264,7 +1264,7 @@ function migrate_price_facture($db,$langs,$conf) $sql.= " AND (((fd.total_ttc = 0 AND fd.remise_percent != 100) or fd.total_ttc IS NULL) or f.total_ttc IS NULL)"; //print $sql; - dolibarr_install_syslog("upgrade2::migrate_price_facture sql=".$sql); + dolibarr_install_syslog("upgrade2::migrate_price_facture", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { @@ -1377,7 +1377,7 @@ function migrate_price_propal($db,$langs,$conf) $sql.= " WHERE pd.fk_propal = p.rowid"; $sql.= " AND ((pd.total_ttc = 0 AND pd.remise_percent != 100) or pd.total_ttc IS NULL)"; - dolibarr_install_syslog("upgrade2::migrate_price_propal sql=".$sql); + dolibarr_install_syslog("upgrade2::migrate_price_propal", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { @@ -1486,7 +1486,7 @@ function migrate_price_contrat($db,$langs,$conf) $sql.= " WHERE cd.fk_contrat = c.rowid"; $sql.= " AND ((cd.total_ttc = 0 AND cd.remise_percent != 100 AND cd.subprice > 0) or cd.total_ttc IS NULL)"; - dolibarr_install_syslog("upgrade2::migrate_price_contrat sql=".$sql); + dolibarr_install_syslog("upgrade2::migrate_price_contrat", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { @@ -1571,7 +1571,7 @@ function migrate_price_commande($db,$langs,$conf) $sql.= " WHERE cd.fk_commande = c.rowid"; $sql.= " AND ((cd.total_ttc = 0 AND cd.remise_percent != 100) or cd.total_ttc IS NULL)"; - dolibarr_install_syslog("upgrade2::migrate_price_commande sql=".$sql); + dolibarr_install_syslog("upgrade2::migrate_price_commande", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { @@ -1685,7 +1685,7 @@ function migrate_price_commande_fournisseur($db,$langs,$conf) $sql.= " WHERE cd.fk_commande = c.rowid"; $sql.= " AND ((cd.total_ttc = 0 AND cd.remise_percent != 100) or cd.total_ttc IS NULL)"; - dolibarr_install_syslog("upgrade2::migrate_price_commande_fournisseur sql=".$sql); + dolibarr_install_syslog("upgrade2::migrate_price_commande_fournisseur", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { @@ -2406,7 +2406,7 @@ function migrate_restore_missing_links($db,$langs,$conf) $sql.= " (SELECT t2.rowid FROM ".MAIN_DB_PREFIX.$table2." as t2"; $sql.= " WHERE t1.rowid = t2.".$field2.")"; - dolibarr_install_syslog("upgrade2:migrate_restore_missing_links DIRECTION 1 sql=".$sql); + dolibarr_install_syslog("upgrade2:migrate_restore_missing_links DIRECTION 1", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { @@ -2472,7 +2472,7 @@ function migrate_restore_missing_links($db,$langs,$conf) $sql.= " (SELECT t2.rowid FROM ".MAIN_DB_PREFIX.$table2." as t2"; $sql.= " WHERE t1.rowid = t2.".$field2.")"; - dolibarr_install_syslog("upgrade2:migrate_restore_missing_links DIRECTION 2 sql=".$sql); + dolibarr_install_syslog("upgrade2:migrate_restore_missing_links DIRECTION 2", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php index 58ad4f1bc0d..1921ef1633d 100644 --- a/htdocs/livraison/class/livraison.class.php +++ b/htdocs/livraison/class/livraison.class.php @@ -128,7 +128,7 @@ class Livraison extends CommonObject $sql.= ", ".(!empty($this->model_pdf)?"'".$this->db->escape($this->model_pdf)."'":"null"); $sql.= ")"; - dol_syslog("Livraison::create sql=".$sql, LOG_DEBUG); + dol_syslog("Livraison::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -140,7 +140,7 @@ class Livraison extends CommonObject $sql.= "SET ref = '".$this->db->escape($numref)."'"; $sql.= " WHERE rowid = ".$this->id; - dol_syslog("Livraison::create sql=".$sql, LOG_DEBUG); + dol_syslog("Livraison::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -241,7 +241,7 @@ class Livraison extends CommonObject $sql.= " ".($description?"'".$this->db->escape($description)."'":"null").","; $sql.= $qty.")"; - dol_syslog(get_class($this)."::create_line sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create_line", LOG_DEBUG); if (! $this->db->query($sql) ) { $error++; @@ -271,7 +271,7 @@ class Livraison extends CommonObject $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = l.rowid AND el.targettype = '".$this->element."'"; $sql.= " WHERE l.rowid = ".$id; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -685,7 +685,7 @@ class Livraison extends CommonObject $sql.= " WHERE ld.fk_origin_line = cd.rowid"; $sql.= " AND ld.fk_livraison = ".$this->id; - dol_syslog(get_class($this)."::fetch_lines sql=".$sql); + dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -915,7 +915,7 @@ class Livraison extends CommonObject $sql.= " SET date_delivery = ".($date_livraison ? "'".$this->db->idate($date_livraison)."'" : 'null'); $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::set_date_livraison sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::set_date_livraison", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index 602f5405ca2..b6cc0a0e6fc 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -132,7 +132,7 @@ class Opensurveysondage extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -196,7 +196,7 @@ class Opensurveysondage extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."opensurvey_sondage as t"; $sql.= " WHERE t.id_sondage = '".$this->db->escape($numsurvey)."'"; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -281,7 +281,7 @@ class Opensurveysondage extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -352,16 +352,16 @@ class Opensurveysondage extends CommonObject { $sql='DELETE FROM '.MAIN_DB_PREFIX."opensurvey_comments WHERE id_sondage = '".$this->db->escape($numsondage)."'"; - dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql=$this->db->query($sql); $sql='DELETE FROM '.MAIN_DB_PREFIX."opensurvey_user_studs WHERE id_sondage = '".$this->db->escape($numsondage)."'"; - dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql=$this->db->query($sql); $sql = "DELETE FROM ".MAIN_DB_PREFIX."opensurvey_sondage"; $sql.= " WHERE id_sondage = '".$this->db->escape($numsondage)."'"; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index a2d2ee36d9c..1f320f28504 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -370,7 +370,7 @@ class Product extends CommonObject $sql.= ", ".((empty($this->status_batch) || $this->status_batch < 0)? '0':$this->status_batch); $sql.= ")"; - dol_syslog(get_class($this)."::Create sql=".$sql); + dol_syslog(get_class($this)."::Create", LOG_DEBUG); $result = $this->db->query($sql); if ( $result ) { @@ -628,7 +628,7 @@ class Product extends CommonObject $sql.= ", desiredstock = " . ((isset($this->desiredstock) && $this->desiredstock != '') ? $this->desiredstock : "null"); $sql.= " WHERE rowid = " . $id; - dol_syslog(get_class($this)."update sql=".$sql); + dol_syslog(get_class($this)."update", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -1000,7 +1000,7 @@ class Product extends CommonObject $sql.= " ".$this->localtax1_tx.",".$this->localtax2_tx.",".$this->price_min.",".$this->price_min_ttc.",".$this->price_by_qty.",".$conf->entity; $sql.= ")"; - dol_syslog(get_class($this)."_log_price sql=".$sql); + dol_syslog(get_class($this)."_log_price", LOG_DEBUG); $resql=$this->db->query($sql); if(! $resql) { @@ -1027,7 +1027,7 @@ class Product extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_price"; $sql.= " WHERE rowid=".$rowid; - dol_syslog(get_class($this)."log_price_delete sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."log_price_delete", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -1063,7 +1063,7 @@ class Product extends CommonObject $sql.= " WHERE pfp.rowid = ".$prodfournprice; if ($qty) $sql.= " AND pfp.quantity <= ".$qty; - dol_syslog(get_class($this)."::get_buyprice sql=".$sql); + dol_syslog(get_class($this)."::get_buyprice", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1089,7 +1089,7 @@ class Product extends CommonObject $sql.= " ORDER BY pfp.quantity DESC"; $sql.= " LIMIT 1"; - dol_syslog(get_class($this)."::get_buyprice sql=".$sql); + dol_syslog(get_class($this)."::get_buyprice", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1222,7 +1222,7 @@ class Product extends CommonObject $sql.= " recuperableonly='".$newnpr."'"; $sql.= " WHERE rowid = ".$id; - dol_syslog(get_class($this)."update_price sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."update_price", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -1303,7 +1303,7 @@ class Product extends CommonObject else if ($ref_ext) $sql.= " AND ref_ext = '".$this->db->escape($ref_ext)."'"; } - dol_syslog(get_class($this)."::fetch sql=".$sql); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql = $this->db->query($sql); if ( $resql ) { @@ -2152,7 +2152,7 @@ class Product extends CommonObject $sql.= " AND fk_product != ".$this->id; $sql.= " AND entity = ".$conf->entity; - dol_syslog(get_class($this)."::add_fournisseur sql=".$sql); + dol_syslog(get_class($this)."::add_fournisseur", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -2176,7 +2176,7 @@ class Product extends CommonObject $sql.= " AND fk_product = ".$this->id; $sql.= " AND entity = ".$conf->entity; - dol_syslog(get_class($this)."::add_fournisseur sql=".$sql); + dol_syslog(get_class($this)."::add_fournisseur", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -2205,7 +2205,7 @@ class Product extends CommonObject $sql.= ", 0"; $sql.= ")"; - dol_syslog(get_class($this)."::add_fournisseur sql=".$sql); + dol_syslog(get_class($this)."::add_fournisseur", LOG_DEBUG); if ($this->db->query($sql)) { $this->product_fourn_price_id = $this->db->last_insert_id(MAIN_DB_PREFIX."product_fournisseur_price"); @@ -2829,7 +2829,7 @@ class Product extends CommonObject $sql.= " AND w.rowid = ps.fk_entrepot"; $sql.= " AND ps.fk_product = ".$this->id; - dol_syslog(get_class($this)."::load_stock sql=".$sql); + dol_syslog(get_class($this)."::load_stock", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php index 9c92431c563..78af2b01037 100644 --- a/htdocs/product/class/productbatch.class.php +++ b/htdocs/product/class/productbatch.class.php @@ -97,7 +97,7 @@ class Productbatch extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } if (! $error) @@ -161,7 +161,7 @@ class Productbatch extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX.self::$_table_element." as t"; $sql.= " WHERE t.rowid = ".$id; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -217,7 +217,7 @@ class Productbatch extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } if (! $error) @@ -289,7 +289,7 @@ class Productbatch extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX.self::$_table_element.""; $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } } @@ -431,7 +431,7 @@ class Productbatch extends CommonObject if (! empty($where)) $sql.= " AND (".implode(" OR ",$where).")"; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -487,7 +487,7 @@ class Productbatch extends CommonObject $sql.= " WHERE fk_product_stock=".$fk_product_stock; if ($with_qty) $sql.= " AND qty<>0"; - dol_syslog("productbatch::findAll sql=".$sql, LOG_DEBUG); + dol_syslog("productbatch::findAll", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/product/liste.php b/htdocs/product/liste.php index 40e99a2d2ee..8d82b5548a5 100644 --- a/htdocs/product/liste.php +++ b/htdocs/product/liste.php @@ -199,7 +199,7 @@ else $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit + 1, $offset); - dol_syslog("product:list.php: sql=".$sql); + dol_syslog("product:list.php:", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index b28a8f9451f..b7061352fe6 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -89,7 +89,7 @@ class Entrepot extends CommonObject $sql = "INSERT INTO ".MAIN_DB_PREFIX."entrepot (entity, datec, fk_user_author, label)"; $sql .= " VALUES (".$conf->entity.",'".$this->db->idate($now)."',".$user->id.",'".$this->db->escape($this->libelle)."')"; - dol_syslog(get_class($this)."::create sql=".$sql); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $result=$this->db->query($sql); if ($result) { @@ -158,7 +158,7 @@ class Entrepot extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::update sql=".$sql); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -187,12 +187,12 @@ class Entrepot extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."stock_mouvement"; $sql.= " WHERE fk_entrepot = " . $this->id; - dol_syslog("Entrepot::delete sql=".$sql); + dol_syslog("Entrepot::delete", LOG_DEBUG); $resql1=$this->db->query($sql); $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_stock"; $sql.= " WHERE fk_entrepot = " . $this->id; - dol_syslog("Entrepot::delete sql=".$sql); + dol_syslog("Entrepot::delete", LOG_DEBUG); $resql2=$this->db->query($sql); if ($resql1 && $resql2) @@ -200,13 +200,13 @@ class Entrepot extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."entrepot"; $sql.= " WHERE rowid = " . $this->id; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql1=$this->db->query($sql); // Update denormalized fields because we change content of produt_stock $sql = "UPDATE ".MAIN_DB_PREFIX."product p SET p.stock= (SELECT SUM(ps.reel) FROM ".MAIN_DB_PREFIX."product_stock ps WHERE ps.fk_product = p.rowid)"; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql2=$this->db->query($sql); if ($resql1 && $resql2) @@ -258,7 +258,7 @@ class Entrepot extends CommonObject if ($ref) $sql.= " AND label = '".$this->db->escape($ref)."'"; } - dol_syslog(get_class($this)."::fetch sql=".$sql); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -309,7 +309,7 @@ class Entrepot extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e"; $sql.= " WHERE e.rowid = ".$id; - dol_syslog(get_class($this)."::info sql=".$sql); + dol_syslog(get_class($this)."::info", LOG_DEBUG); $result=$this->db->query($sql); if ($result) { diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index e8861d60ddb..2bdb24e355b 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -112,7 +112,7 @@ class MouvementStock $sql.= " '".$origintype."'"; $sql.= ")"; - dol_syslog(get_class($this)."::_create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::_create", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -138,7 +138,7 @@ class MouvementStock $sql = "SELECT rowid, reel, pmp FROM ".MAIN_DB_PREFIX."product_stock"; $sql.= " WHERE fk_entrepot = ".$entrepot_id." AND fk_product = ".$fk_product; - dol_syslog(get_class($this)."::_create sql=".$sql); + dol_syslog(get_class($this)."::_create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -203,7 +203,7 @@ class MouvementStock $sql.= " (".$newpmpwarehouse.", ".$qty.", ".$entrepot_id.", ".$fk_product.")"; } - dol_syslog(get_class($this)."::_create sql=".$sql); + dol_syslog(get_class($this)."::_create", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -230,7 +230,7 @@ class MouvementStock // May be this request is better: // UPDATE llx_product p SET p.stock= (SELECT SUM(ps.reel) FROM llx_product_stock ps WHERE ps.fk_product = p.rowid); - dol_syslog(get_class($this)."::_create sql=".$sql); + dol_syslog(get_class($this)."::_create", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -298,7 +298,7 @@ class MouvementStock $sql.= " FROM ".MAIN_DB_PREFIX."product_association"; $sql.= " WHERE fk_product_pere = ".$idProduct; - dol_syslog(get_class($this)."::_createSubProduct sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::_createSubProduct", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/product/stock/index.php b/htdocs/product/stock/index.php index da52a5aac58..1309da95a2a 100644 --- a/htdocs/product/stock/index.php +++ b/htdocs/product/stock/index.php @@ -124,7 +124,7 @@ if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) $sql.= " AND p.fk_product_typ $sql.= $db->order("datem","DESC"); $sql.= $db->plimit($max,0); -dol_syslog("Index:list stock movements sql=".$sql, LOG_DEBUG); +dol_syslog("Index:list stock movements", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 0a56b5253a9..ff2934eb970 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -123,7 +123,7 @@ class Task extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -212,7 +212,7 @@ class Task extends CommonObject $sql.="t.rowid = ".$id; } - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -295,7 +295,7 @@ class Task extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -386,7 +386,7 @@ class Task extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_task"; $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -457,7 +457,7 @@ class Task extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."projet_task"; $sql.= " WHERE fk_task_parent=".$this->id; - dol_syslog(get_class($this)."::hasChildren sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::hasChildren", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } else @@ -572,7 +572,7 @@ class Task extends CommonObject $sql.= " ORDER BY p.ref, t.rang, t.dateo"; //print $sql; - dol_syslog(get_class($this)."::getTasksArray sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::getTasksArray", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -686,7 +686,7 @@ class Task extends CommonObject } //print $sql; - dol_syslog(get_class($this)."::getUserRolesForProjectsOrTasks sql=".$sql); + dol_syslog(get_class($this)."::getUserRolesForProjectsOrTasks", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -764,7 +764,7 @@ class Task extends CommonObject $sql.= ", ".(isset($this->timespent_note)?"'".$this->db->escape($this->timespent_note)."'":"null"); $sql.= ")"; - dol_syslog(get_class($this)."::addTimeSpent sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::addTimeSpent", LOG_DEBUG); if ($this->db->query($sql) ) { $tasktime_id = $this->db->last_insert_id(MAIN_DB_PREFIX."projet_task_time"); @@ -793,7 +793,7 @@ class Task extends CommonObject $sql.= " SET duration_effective = duration_effective + '".price2num($this->timespent_duration)."'"; $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::addTimeSpent sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::addTimeSpent", LOG_DEBUG); if (! $this->db->query($sql) ) { $this->error=$this->db->lasterror(); @@ -808,7 +808,7 @@ class Task extends CommonObject $sql.= " SET thm = (SELECT thm FROM ".MAIN_DB_PREFIX."user WHERE rowid = ".$this->timespent_fk_user.")"; $sql.= " WHERE rowid = ".$tasktime_id; - dol_syslog(get_class($this)."::addTimeSpent sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::addTimeSpent", LOG_DEBUG); if (! $this->db->query($sql) ) { $this->error=$this->db->lasterror(); @@ -840,7 +840,7 @@ class Task extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; $sql.= " WHERE t.rowid = ".$id; - dol_syslog(get_class($this)."::fetchTimeSpent sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetchTimeSpent", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -892,7 +892,7 @@ class Task extends CommonObject $sql.= " note = ".(isset($this->timespent_note)?"'".$this->db->escape($this->timespent_note)."'":"null"); $sql.= " WHERE rowid = ".$this->timespent_id; - dol_syslog(get_class($this)."::updateTimeSpent sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::updateTimeSpent", LOG_DEBUG); if ($this->db->query($sql) ) { if (! $notrigger) @@ -921,7 +921,7 @@ class Task extends CommonObject $sql.= " SET duration_effective = duration_effective + '".$newDuration."'"; $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::updateTimeSpent sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::updateTimeSpent", LOG_DEBUG); if (! $this->db->query($sql) ) { $this->error=$this->db->lasterror(); @@ -951,7 +951,7 @@ class Task extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_task_time"; $sql.= " WHERE rowid = ".$this->timespent_id; - dol_syslog(get_class($this)."::delTimeSpent sql=".$sql); + dol_syslog(get_class($this)."::delTimeSpent", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -974,7 +974,7 @@ class Task extends CommonObject $sql.= " SET duration_effective = duration_effective - '".$this->timespent_duration."'"; $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::delTimeSpent sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delTimeSpent", LOG_DEBUG); if ($this->db->query($sql) ) { $result = 0; diff --git a/htdocs/projet/liste.php b/htdocs/projet/liste.php index 39fcdb64a01..3dab05c1826 100644 --- a/htdocs/projet/liste.php +++ b/htdocs/projet/liste.php @@ -100,7 +100,7 @@ if ($search_societe) $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($conf->liste_limit+1, $offset); -dol_syslog("list allowed project sql=".$sql); +dol_syslog("list allowed project", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/resource/class/resource.class.php b/htdocs/resource/class/resource.class.php index 6edeef201fb..33d7af532b2 100644 --- a/htdocs/resource/class/resource.class.php +++ b/htdocs/resource/class/resource.class.php @@ -106,7 +106,7 @@ class Resource extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); @@ -168,7 +168,7 @@ class Resource extends CommonObject $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_resource as ty ON ty.code=t.fk_code_type_resource"; $sql.= " WHERE t.rowid = ".$this->db->escape($id); - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -225,7 +225,7 @@ class Resource extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -285,7 +285,7 @@ class Resource extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."element_resources as t"; $sql.= " WHERE t.rowid = ".$this->db->escape($id); - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -336,12 +336,12 @@ class Resource extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."resource"; $sql.= " WHERE rowid =".$rowid; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); if ($this->db->query($sql)) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."element_resources"; $sql.= " WHERE element_type='resource' AND resource_id ='".$this->db->escape($rowid)."'"; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); if ($this->db->query($sql)) { if (! $notrigger) @@ -411,7 +411,7 @@ class Resource extends CommonObject $sql.= " GROUP BY t.rowid"; $sql.= " ORDER BY $sortfield $sortorder "; if ($limit) $sql.= $this->db->plimit($limit+1,$offset); - dol_syslog(get_class($this)."::fetch_all sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch_all", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -484,7 +484,7 @@ class Resource extends CommonObject } $sql.= " GROUP BY t.rowid"; $sql.= " ORDER BY $sortfield $sortorder " . $this->db->plimit($limit+1,$offset); - dol_syslog(get_class($this)."::fetch_all sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch_all", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -569,7 +569,7 @@ class Resource extends CommonObject } $sql.= " GROUP BY t.resource_id"; $sql.= " ORDER BY " . $sortfield . " " . $sortorder . " " . $this->db->plimit($limit+1,$offset); - dol_syslog(get_class($this)."::fetch_all sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch_all", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -729,7 +729,7 @@ class Resource extends CommonObject $this->db->begin(); - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -784,7 +784,7 @@ class Resource extends CommonObject $sql.=" AND resource_type LIKE '%".$resource_type."%'"; $sql .= ' ORDER BY resource_type'; - dol_syslog(get_class($this)."::getElementResources sql=".$sql); + dol_syslog(get_class($this)."::getElementResources", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -837,7 +837,7 @@ class Resource extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."c_type_resource"; $sql.= " WHERE active > 0"; $sql.= " ORDER BY rowid"; - dol_syslog(get_class($this)."::load_cache_code_type_resource sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::load_cache_code_type_resource", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/societe/ajaxcompanies.php b/htdocs/societe/ajaxcompanies.php index 32fbe2e2c00..36abbb909ad 100644 --- a/htdocs/societe/ajaxcompanies.php +++ b/htdocs/societe/ajaxcompanies.php @@ -84,7 +84,7 @@ if (GETPOST('newcompany') || GETPOST('socid','int') || GETPOST('id_fourn')) if (! empty($_GET["filter"])) $sql.= " AND ".$_GET["filter"]; // Add other filters $sql.= " ORDER BY nom ASC"; - //dol_syslog("ajaxcompanies sql=".$sql); + //dol_syslog("ajaxcompanies", LOG_DEBUG); $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/societe/class/address.class.php b/htdocs/societe/class/address.class.php index 174afbe5671..fe109b9137e 100644 --- a/htdocs/societe/class/address.class.php +++ b/htdocs/societe/class/address.class.php @@ -200,7 +200,7 @@ class Address if ($user) $sql .= ",fk_user_modif = '".$user->id."'"; $sql .= " WHERE fk_soc = '" . $socid ."' AND rowid = '" . $this->db->escape($id) ."'"; - dol_syslog(get_class($this)."::Update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::Update", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index 189556b186d..784b02ed930 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -227,7 +227,7 @@ class CompanyBankAccount extends Account $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_rib"; $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { return 1; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 9ffa0546782..5615961de86 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -418,7 +418,7 @@ class Societe extends CommonObject $sql.= ", 0"; $sql.= ", ".(! empty($this->import_key) ? "'".$this->import_key."'":"null").")"; - dol_syslog(get_class($this)."::create sql=".$sql); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $result=$this->db->query($sql); if ($result) { @@ -785,7 +785,7 @@ class Societe extends CommonObject $sql .= " WHERE rowid = '" . $id ."'"; - dol_syslog(get_class($this)."::Update sql=".$sql); + dol_syslog(get_class($this)."::Update", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -885,7 +885,7 @@ class Societe extends CommonObject else { - $this->error = $langs->trans("Error sql=".$sql); + $this->error = $langs->trans("Error", LOG_DEBUG); dol_syslog(get_class($this)."::Update fails update sql=".$sql, LOG_ERR); $result = -2; } @@ -1266,7 +1266,7 @@ class Societe extends CommonObject { $sql = "DELETE FROM ".MAIN_DB_PREFIX."socpeople"; $sql.= " WHERE fk_soc = " . $id; - dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); if (! $this->db->query($sql)) { $error++; @@ -1280,7 +1280,7 @@ class Societe extends CommonObject { $sql = "UPDATE ".MAIN_DB_PREFIX."adherent"; $sql.= " SET fk_soc = NULL WHERE fk_soc = " . $id; - dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); if (! $this->db->query($sql)) { $error++; @@ -1294,7 +1294,7 @@ class Societe extends CommonObject { $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_rib"; $sql.= " WHERE fk_soc = " . $id; - dol_syslog(get_class($this)."::Delete sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::Delete", LOG_DEBUG); if (! $this->db->query($sql)) { $error++; @@ -1319,7 +1319,7 @@ class Societe extends CommonObject { $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe"; $sql.= " WHERE rowid = " . $id; - dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); if (! $this->db->query($sql)) { $error++; @@ -2689,7 +2689,7 @@ class Societe extends CommonObject $sql.= " SET fk_soc=".$this->id; $sql.= " WHERE rowid=".$member->id; - dol_syslog(get_class($this)."::create_from_member sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create_from_member", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -2863,7 +2863,7 @@ class Societe extends CommonObject elseif ($localTaxNum == 1) $sql .= " AND t.localtax1_type <> '0'"; elseif ($localTaxNum == 2) $sql .= " AND t.localtax2_type <> '0'"; - dol_syslog("useLocalTax sql=".$sql); + dol_syslog("useLocalTax", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -2883,7 +2883,7 @@ class Societe extends CommonObject $sql .= " WHERE r.fk_pays = p.rowid AND p.code = '".$this->country_code."'"; $sql .= " AND r.active = 1"; - dol_syslog("useRevenueStamp sql=".$sql); + dol_syslog("useRevenueStamp", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -2944,7 +2944,7 @@ class Societe extends CommonObject $sql.= " fk_prospectlevel='".$this->fk_prospectlevel."'"; $sql.= ",fk_user_modif='".$user->id."'"; $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::set_prospect_level sql=".$sql); + dol_syslog(get_class($this)."::set_prospect_level", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -3027,7 +3027,7 @@ class Societe extends CommonObject $sql.= ",fk_user_modif='".$user->id."'"; $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::set_commnucation_level sql=".$sql); + dol_syslog(get_class($this)."::set_commnucation_level", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -3061,7 +3061,7 @@ class Societe extends CommonObject $sql.= " outstanding_limit= ".($outstanding!=''?$outstanding:'null'); $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::set_outstanding sql=".$sql); + dol_syslog(get_class($this)."::set_outstanding", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -3098,7 +3098,7 @@ class Societe extends CommonObject //$sql .= " AND (fk_statut <> 3 OR close_code <> 'abandon')"; // Not abandonned for undefined reason $sql .= " AND fk_statut <> 3"; // Not abandonned - dol_syslog("get_OutstandingBill sql=".$sql); + dol_syslog("get_OutstandingBill", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index f2d2e64791d..1ed5c1afc2c 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -432,7 +432,7 @@ if (empty($reshook)) $sql = "UPDATE ".MAIN_DB_PREFIX."adherent"; $sql.= " SET fk_soc = NULL WHERE fk_soc = " . $id; - dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); if (! $this->db->query($sql)) { $error++; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index d671322d0dc..7eac18240f0 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -181,7 +181,7 @@ class User extends CommonObject $sql.= " AND u.rowid = ".$id; } - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -664,7 +664,7 @@ class User extends CommonObject $sql.= " WHERE rowid = ".$this->id; $result = $this->db->query($sql); - dol_syslog(get_class($this)."::setstatus sql=".$sql); + dol_syslog(get_class($this)."::setstatus", LOG_DEBUG); if ($result) { // Appel des triggers @@ -748,7 +748,7 @@ class User extends CommonObject if (! $error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."user WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); if (! $this->db->query($sql)) { $error++; @@ -811,7 +811,7 @@ class User extends CommonObject $sql.= " WHERE login ='".$this->db->escape($this->login)."'"; $sql.= " AND entity IN (0,".$conf->entity.")"; - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -831,7 +831,7 @@ class User extends CommonObject $sql.= " VALUES('".$this->db->idate($this->datec)."','".$this->db->escape($this->login)."','".$this->ldap_sid."',".$this->entity.")"; $result=$this->db->query($sql); - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); if ($result) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."user"); @@ -950,7 +950,7 @@ class User extends CommonObject $sql.= " WHERE rowid=".$this->id; $resql=$this->db->query($sql); - dol_syslog(get_class($this)."::create_from_contact sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create_from_contact", LOG_DEBUG); if ($resql) { // Appel des triggers @@ -1025,7 +1025,7 @@ class User extends CommonObject $sql.= " SET fk_societe=".$member->fk_soc; $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::create_from_member sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create_from_member", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -1176,7 +1176,7 @@ class User extends CommonObject $sql.= ", entity = '".$this->entity."'"; $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1197,13 +1197,13 @@ class User extends CommonObject if ($this->fk_member > 0) { $sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member = NULL where fk_member = ".$this->fk_member; - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $this->error=$this->db->error(); $this->db->rollback(); return -5; } } // Set link to user $sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member =".($this->fk_member>0?$this->fk_member:'null')." where rowid = ".$this->id; - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $this->error=$this->db->error(); $this->db->rollback(); return -5; } @@ -2199,7 +2199,7 @@ class User extends CommonObject $sql.= " WHERE fk_user != 0"; $sql.= " AND entity = ".$conf->entity; - dol_syslog(get_class($this)."::load_parentof sql=".$sql); + dol_syslog(get_class($this)."::load_parentof", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -2249,7 +2249,7 @@ class User extends CommonObject { $sql.= " WHERE u.entity IN (".getEntity('user',1).")"; } - dol_syslog(get_class($this)."::get_full_tree get user list sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::get_full_tree get user list", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 72dc0b7cf48..84b0bd4cbb5 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -85,7 +85,7 @@ class UserGroup extends CommonObject $sql.= " WHERE g.rowid = ".$id; } - dol_syslog(get_class($this)."::fetch sql=".$sql); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -146,7 +146,7 @@ class UserGroup extends CommonObject } $sql.= " ORDER BY g.nom"; - dol_syslog(get_class($this)."::listGroupsForUser sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::listGroupsForUser", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -204,7 +204,7 @@ class UserGroup extends CommonObject } if (! empty($excludefilter)) $sql.=' AND ('.$excludefilter.')'; - dol_syslog(get_class($this)."::listUsersForGroup sql=".$sql,LOG_DEBUG); + dol_syslog(get_class($this)."::listUsersForGroup", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -592,7 +592,7 @@ class UserGroup extends CommonObject $sql.= ",".$entity; $sql.= ")"; - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $result=$this->db->query($sql); if ($result) { @@ -644,7 +644,7 @@ class UserGroup extends CommonObject $sql.= ", note = '" . $this->db->escape($this->note) . "'"; $sql.= " WHERE rowid = " . $this->id; - dol_syslog(get_class($this)."::update sql=".$sql); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index d78a512bf53..179214c1bc4 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -395,7 +395,7 @@ if ($action == 'update' && ! $_POST["cancel"]) $sql.= " WHERE rowid=".$object->id; } $resql=$db->query($sql); - dol_syslog("fiche::update sql=".$sql, LOG_DEBUG); + dol_syslog("fiche::update", LOG_DEBUG); if (! $resql) { $error++; diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index af7a95af74d..2be426bb571 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -191,7 +191,7 @@ else } $sql.= " AND ur.fk_user = ".$fuser->id; -dol_syslog("get user perms sql=".$sql); +dol_syslog("get user perms", LOG_DEBUG); $result=$db->query($sql); if ($result) { @@ -227,7 +227,7 @@ if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transv $sql.= " AND gr.fk_usergroup = gu.fk_usergroup"; $sql.= " AND gu.fk_user = ".$fuser->id; -dol_syslog("get user perms sql=".$sql); +dol_syslog("get user perms", LOG_DEBUG); $result=$db->query($sql); if ($result) { diff --git a/htdocs/webservices/server_productorservice.php b/htdocs/webservices/server_productorservice.php index c2eba3f9d1b..f866e197e15 100644 --- a/htdocs/webservices/server_productorservice.php +++ b/htdocs/webservices/server_productorservice.php @@ -867,7 +867,7 @@ function getProductsForCategory($authentication,$id,$lang='') $sql .= " ORDER BY fk_".$field." ASC" ; - dol_syslog("getProductsForCategory get id of product into category sql=".$sql); + dol_syslog("getProductsForCategory get id of product into category", LOG_DEBUG); $res = $db->query($sql); if ($res) { diff --git a/htdocs/webservices/server_thirdparty.php b/htdocs/webservices/server_thirdparty.php index c5ac0c8c686..632a4c164e5 100644 --- a/htdocs/webservices/server_thirdparty.php +++ b/htdocs/webservices/server_thirdparty.php @@ -660,7 +660,7 @@ function getListOfThirdParties($authentication,$filterthirdparty) if ($key == 'supplier' && $val != '') $sql.=" AND s.fournisseur = ".$db->escape($val); if ($key == 'category' && $val != '') $sql.=" AND s.rowid IN (SELECT fk_societe FROM ".MAIN_DB_PREFIX."categorie_societe WHERE fk_categorie=".$db->escape($val).") "; } - dol_syslog("Function: getListOfThirdParties sql=".$sql); + dol_syslog("Function: getListOfThirdParties", LOG_DEBUG); $extrafields=new ExtraFields($db); $extralabels=$extrafields->fetch_name_optionals_label('societe',true); diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index c271b6dd7a2..cf8dceb8f9e 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -226,7 +226,7 @@ if ($resql) { //Update status communication of thirdparty prospect $sqlx = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=2 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE rowid=".$obj2->rowid.")"; - dol_syslog("fiche.php: set prospect thirdparty status sql=".$sql, LOG_DEBUG); + dol_syslog("fiche.php: set prospect thirdparty status", LOG_DEBUG); $resqlx=$db->query($sqlx); if (! $resqlx) { @@ -236,7 +236,7 @@ if ($resql) //Update status communication of contact prospect $sqlx = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=2 WHERE rowid IN (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."socpeople AS sc INNER JOIN ".MAIN_DB_PREFIX."mailing_cibles AS mc ON mc.rowid=".$obj2->rowid." AND mc.source_type = 'contact' AND mc.source_id = sc.rowid)"; - dol_syslog("fiche.php: set prospect contact status sql=".$sql, LOG_DEBUG); + dol_syslog("fiche.php: set prospect contact status", LOG_DEBUG); $resqlx=$db->query($sqlx); if (! $resqlx) From d1d4c6d8a5e3dd33fadab0304784cdc76a07be8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Thu, 12 Jun 2014 11:45:32 +0200 Subject: [PATCH 03/68] Increased SQL Error to LOG_ERROR level --- htdocs/core/db/mssql.class.php | 2 +- htdocs/core/db/mysql.class.php | 2 +- htdocs/core/db/mysqli.class.php | 2 +- htdocs/core/db/pgsql.class.php | 2 +- htdocs/core/db/sqlite.class.php | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/db/mssql.class.php b/htdocs/core/db/mssql.class.php index 52c4fc85de1..02edeb7cf16 100644 --- a/htdocs/core/db/mssql.class.php +++ b/htdocs/core/db/mssql.class.php @@ -372,7 +372,7 @@ class DoliDBMssql extends DoliDB $this->lastqueryerror = $query; $this->lasterror = $this->error(); $this->lasterrno = $row["code"]; - dol_syslog(get_class($this)."::query SQL error: ".$query, LOG_WARNING); + dol_syslog(get_class($this)."::query SQL error: ".$query, LOG_ERROR); } $this->lastquery=$query; $this->_results = $ret; diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php index 5e5b4c360d0..18e40264495 100644 --- a/htdocs/core/db/mysql.class.php +++ b/htdocs/core/db/mysql.class.php @@ -273,7 +273,7 @@ class DoliDBMysql extends DoliDB $this->lastqueryerror = $query; $this->lasterror = $this->error(); $this->lasterrno = $this->errno(); - dol_syslog(get_class($this)."::query SQL error: ".$query." ".$this->lasterrno, LOG_WARNING); + dol_syslog(get_class($this)."::query SQL error: ".$query." ".$this->lasterrno, LOG_ERROR); } $this->lastquery=$query; $this->_results = $ret; diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 16915dcd22d..ed73d8621c0 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -275,7 +275,7 @@ class DoliDBMysqli extends DoliDB $this->lastqueryerror = $query; $this->lasterror = $this->error(); $this->lasterrno = $this->errno(); - dol_syslog(get_class($this)."::query SQL error: ".$query." ".$this->lasterrno, LOG_WARNING); + dol_syslog(get_class($this)."::query SQL error: ".$query." ".$this->lasterrno, LOG_ERROR); } $this->lastquery=$query; $this->_results = $ret; diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index b5959df1f63..8ce4e700d66 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -506,7 +506,7 @@ class DoliDBPgsql extends DoliDB $this->lasterror = $this->error(); $this->lasterrno = $this->errno(); } - dol_syslog(get_class($this)."::query SQL error usesavepoint = ".$usesavepoint." - ".$query." - ".pg_last_error($this->db)." => ".$this->errno(), LOG_WARNING); + dol_syslog(get_class($this)."::query SQL error usesavepoint = ".$usesavepoint." - ".$query." - ".pg_last_error($this->db)." => ".$this->errno(), LOG_ERROR); //print "\n>> ".$query."
\n"; //print '>> '.$this->lasterrno.' - '.$this->lasterror.' - '.$this->lastqueryerror."
\n"; diff --git a/htdocs/core/db/sqlite.class.php b/htdocs/core/db/sqlite.class.php index 45c1bbd182f..39f33341526 100644 --- a/htdocs/core/db/sqlite.class.php +++ b/htdocs/core/db/sqlite.class.php @@ -409,8 +409,8 @@ class DoliDBSqlite extends DoliDB $this->lastqueryerror = $query; $this->lasterror = $this->error(); $this->lasterrno = $this->errno(); - if (preg_match('/[0-9]/',$this->lasterrno)) dol_syslog(get_class($this)."::query SQL error: ".$query." ".$this->lasterrno." ".$this->lasterror, LOG_WARNING); - else dol_syslog(get_class($this)."::query SQL error: ".$query." ".$this->lasterrno, LOG_WARNING); + if (preg_match('/[0-9]/',$this->lasterrno)) dol_syslog(get_class($this)."::query SQL error: ".$query." ".$this->lasterrno." ".$this->lasterror, LOG_ERROR); + else dol_syslog(get_class($this)."::query SQL error: ".$query." ".$this->lasterrno, LOG_ERROR); } $this->lastquery=$query; $this->_results = $ret; From 7e7958cf73dfabee195616e50db43f9fac6e1cd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Thu, 12 Jun 2014 13:49:05 +0200 Subject: [PATCH 04/68] Removed SQL errors as they are logged by the database handler --- htdocs/categories/class/categorie.class.php | 11 +---------- htdocs/comm/propal/class/propal.class.php | 2 -- htdocs/commande/class/commande.class.php | 1 - htdocs/compta/bank/class/account.class.php | 2 -- .../compta/facture/class/facture-rec.class.php | 1 - htdocs/compta/facture/class/facture.class.php | 16 +++++++--------- .../prelevement/class/bonprelevement.class.php | 3 +-- htdocs/contact/class/contact.class.php | 2 +- htdocs/contrat/class/contrat.class.php | 2 -- htdocs/core/class/commonobject.class.php | 5 ++--- htdocs/core/class/extrafields.class.php | 2 +- htdocs/core/class/link.class.php | 1 - htdocs/core/lib/security.lib.php | 1 - htdocs/core/modules/DolibarrModules.class.php | 5 ++--- htdocs/core/modules/facture/mod_facture_mars.php | 1 - .../core/modules/facture/mod_facture_terre.php | 1 - .../modules/livraison/mod_livraison_jade.php | 1 - .../core/modules/mailings/contacts4.modules.php | 6 ++---- .../modules/societe/mod_codeclient_monkey.php | 3 ++- .../modules/societe/mod_codecompta_aquarium.php | 1 - .../mod_facture_fournisseur_cactus.php | 1 - htdocs/expedition/class/expedition.class.php | 1 - htdocs/exports/class/export.class.php | 1 - htdocs/fichinter/class/fichinter.class.php | 4 ---- .../fourn/class/fournisseur.commande.class.php | 3 --- htdocs/install/upgrade2.php | 2 +- htdocs/livraison/class/livraison.class.php | 3 --- htdocs/societe/class/address.class.php | 1 - htdocs/societe/class/societe.class.php | 4 ---- htdocs/user/class/user.class.php | 3 +-- scripts/emailings/mailing-send.php | 2 +- 31 files changed, 22 insertions(+), 70 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 2d657dc6e1c..e90e0fc626e 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -185,7 +185,7 @@ class Categorie extends CommonObject $sql.= $conf->entity; $sql.= ")"; - dol_syslog(get_class($this).'::create sql='.$sql); + dol_syslog(get_class($this).'::create', LOG_DEBUG); $res = $this->db->query($sql); if ($res) { @@ -232,7 +232,6 @@ class Categorie extends CommonObject else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::create error ".$this->error." sql=".$sql, LOG_ERR); $this->db->rollback(); return -1; } @@ -346,7 +345,6 @@ class Categorie extends CommonObject if (!$this->db->query($sql)) { $this->error=$this->db->lasterror(); - dol_syslog("Error sql=".$sql." ".$this->error, LOG_ERR); $error++; } } @@ -357,7 +355,6 @@ class Categorie extends CommonObject if (!$this->db->query($sql)) { $this->error=$this->db->lasterror(); - dol_syslog("Error sql=".$sql." ".$this->error, LOG_ERR); $error++; } } @@ -368,7 +365,6 @@ class Categorie extends CommonObject if (!$this->db->query($sql)) { $this->error=$this->db->lasterror(); - dol_syslog("Error sql=".$sql." ".$this->error, LOG_ERR); $error++; } } @@ -379,7 +375,6 @@ class Categorie extends CommonObject if (!$this->db->query($sql)) { $this->error=$this->db->lasterror(); - dol_syslog("Error sql=".$sql." ".$this->error, LOG_ERR); $error++; } } @@ -390,7 +385,6 @@ class Categorie extends CommonObject if (!$this->db->query($sql)) { $this->error=$this->db->lasterror(); - dol_syslog("Error sql=".$sql." ".$this->error, LOG_ERR); $error++; } } @@ -401,7 +395,6 @@ class Categorie extends CommonObject if (!$this->db->query($sql)) { $this->error=$this->db->lasterror(); - dol_syslog("Error sql=".$sql." ".$this->error, LOG_ERR); $error++; } } @@ -414,7 +407,6 @@ class Categorie extends CommonObject if (!$this->db->query($sql)) { $this->error=$this->db->lasterror(); - dol_syslog("Error sql=".$sql." ".$this->error, LOG_ERR); $error++; } else @@ -1006,7 +998,6 @@ class Categorie extends CommonObject else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::already_exists error ".$this->error." sql=".$sql, LOG_ERR); return -1; } } diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 5122bd15f51..31b6fc67468 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2955,7 +2955,6 @@ class PropaleLigne extends CommonObject else { $this->error=$this->db->error()." sql=".$sql; - dol_syslog(get_class($this).'::insert Error '.$this->error, LOG_ERR); $this->db->rollback(); return -1; } @@ -3006,7 +3005,6 @@ class PropaleLigne extends CommonObject else { $this->error=$this->db->error()." sql=".$sql; - dol_syslog("PropaleLigne::delete Error ".$this->error, LOG_ERR); $this->db->rollback(); return -1; } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 5af12ef11bb..e9f0ff9e43a 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -233,7 +233,6 @@ class Commande extends CommonOrder $resql=$this->db->query($sql); if (! $resql) { - dol_syslog(get_class($this)."::valid Echec update - 10 - sql=".$sql, LOG_ERR); dol_print_error($this->db); $error++; } diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 0179149e69f..48e175b0c2e 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -448,12 +448,10 @@ class Account extends CommonObject if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $this->error=$langs->trans("ErrorBankLabelAlreadyExists"); - dol_syslog($this->error, LOG_ERR); return -1; } else { $this->error=$this->db->error()." sql=".$sql; - dol_syslog($this->error, LOG_ERR); return -2; } } diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index f87e640d78e..39d5d7ca398 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -507,7 +507,6 @@ class FactureRec extends Facture else { $this->error=$this->db->lasterror(); - dol_syslog("FactureRec::addline sql=".$this->error, LOG_ERR); return -1; } } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 48d6e4d34e8..36ea7739652 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -516,7 +516,6 @@ class Facture extends CommonInvoice else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::create error ".$this->error." sql=".$sql, LOG_ERR); $this->db->rollback(); return -1; } @@ -1315,7 +1314,6 @@ class Facture extends CommonInvoice if (! $this->db->query($sql)) { $this->error=$this->db->error()." sql=".$sql; - dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); $this->db->rollback(); return -5; } @@ -1344,9 +1342,15 @@ class Facture extends CommonInvoice // Delete invoice line $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facturedet WHERE fk_facture = '.$rowid; + + dol_syslog(get_class($this)."::delete", LOG_DEBUG); + if ($this->db->query($sql) && $this->delete_linked_contact()) { $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture WHERE rowid = '.$rowid; + + dol_syslog(get_class($this)."::delete", LOG_DEBUG); + $resql=$this->db->query($sql); if ($resql) { @@ -1384,7 +1388,6 @@ class Facture extends CommonInvoice else { $this->error=$this->db->lasterror()." sql=".$sql; - dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); $this->db->rollback(); return -6; } @@ -1392,7 +1395,6 @@ class Facture extends CommonInvoice else { $this->error=$this->db->lasterror()." sql=".$sql; - dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); $this->db->rollback(); return -4; } @@ -1400,7 +1402,6 @@ class Facture extends CommonInvoice else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); $this->db->rollback(); return -2; } @@ -1771,7 +1772,6 @@ class Facture extends CommonInvoice $resql=$this->db->query($sql); if (! $resql) { - dol_syslog(get_class($this)."::validate Echec update - 10 - sql=".$sql, LOG_ERR); dol_print_error($this->db); $error++; } @@ -3255,7 +3255,7 @@ class Facture extends CommonInvoice $sql.= ' WHERE l.fk_facture = '.$this->id; $sql.= ' ORDER BY l.rang ASC, l.rowid'; - dol_syslog(get_class($this).'::getLinesArray sql='.$sql,LOG_DEBUG); + dol_syslog(get_class($this).'::getLinesArray',LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -3305,7 +3305,6 @@ class Facture extends CommonInvoice else { $this->error=$this->db->error(); - dol_syslog("Error sql=".$sql.", error=".$this->error,LOG_ERR); return -1; } } @@ -3802,7 +3801,6 @@ class FactureLigne extends CommonInvoiceLine else { $this->error=$this->db->error()." sql=".$sql; - dol_syslog(get_class($this)."::delete Error ".$this->error, LOG_ERR); $this->db->rollback(); return -1; } diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 3d224bbe274..759981b696e 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -314,7 +314,6 @@ class BonPrelevement extends CommonObject } else { - dol_syslog(get_class($this)."::Fetch Erreur sql=".$sql, LOG_ERR); return -2; } } @@ -705,6 +704,7 @@ class BonPrelevement extends CommonObject //if ($banque) $sql.= " AND sr.code_banque = '".$conf->global->PRELEVEMENT_CODE_BANQUE."'"; //if ($agence) $sql.= " AND sr.code_guichet = '".$conf->global->PRELEVEMENT_CODE_GUICHET."'"; + dol_syslog(get_class($this)."::SommeAPrelever"); $resql = $this->db->query($sql); if ( $resql ) @@ -718,7 +718,6 @@ class BonPrelevement extends CommonObject else { $this->error=get_class($this)."::SommeAPrelever Erreur -1 sql=".$this->db->error(); - dol_syslog($this->error, LOG_ERR); return -1; } } diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 727fa6486a9..26827a3d504 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -729,7 +729,7 @@ class Contact extends CommonObject $sqldel = "DELETE FROM ".MAIN_DB_PREFIX."element_contact"; $sqldel.=" WHERE rowid = ".$obj->rowid; - dol_syslog(get_class($this)."::delete sql=".$sqldel); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $result = $this->db->query($sqldel); if (! $result) { diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 140d64c2daf..173a7239e4e 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -319,7 +319,6 @@ class Contrat extends CommonObject $resql = $this->db->query($sql); if (! $resql) { - dol_syslog(get_class($this)."::validate Echec update - 10 - sql=".$sql, LOG_ERR); dol_print_error($this->db); $error++; } @@ -1089,7 +1088,6 @@ class Contrat extends CommonObject { $this->db->rollback(); $this->error=$this->db->error()." sql=".$sql; - dol_syslog(get_class($this)."::addline ".$this->error,LOG_ERR); return -1; } } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 2eb63db6d9b..0c366cb561f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2158,12 +2158,11 @@ abstract class CommonObject $this->db->begin(); $sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields WHERE fk_object = ".$this->id; - dol_syslog(get_class($this)."::deleteExtraFields delete sql=".$sql_del); + dol_syslog(get_class($this)."::deleteExtraFields delete", LOG_DEBUG); $resql=$this->db->query($sql_del); if (! $resql) { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::deleteExtraFields ".$this->error,LOG_ERR); $this->db->rollback(); return -1; } @@ -2229,7 +2228,7 @@ abstract class CommonObject $this->db->begin(); $sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields WHERE fk_object = ".$this->id; - dol_syslog(get_class($this)."::insertExtraFields delete sql=".$sql_del); + dol_syslog(get_class($this)."::insertExtraFields delete", LOG_DEBUG); $this->db->query($sql_del); $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."_extrafields (fk_object"; foreach($this->array_options as $key => $value) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index df6d16767d6..84279b7eb9e 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -454,7 +454,7 @@ class ExtraFields $sql_del.= " WHERE name = '".$attrname."'"; $sql_del.= " AND entity = ".$conf->entity; $sql_del.= " AND elementtype = '".$elementtype."'"; - dol_syslog(get_class($this)."::update_label sql=".$sql_del); + dol_syslog(get_class($this)."::update_label", LOG_DEBUG); $resql1=$this->db->query($sql_del); $sql = "INSERT INTO ".MAIN_DB_PREFIX."extrafields("; diff --git a/htdocs/core/class/link.class.php b/htdocs/core/class/link.class.php index e92aa273105..85c365d3443 100644 --- a/htdocs/core/class/link.class.php +++ b/htdocs/core/class/link.class.php @@ -136,7 +136,6 @@ class Link extends CommonObject else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::Create fails insert sql=".$sql, LOG_ERR); $result=-2; } $this->db->rollback(); diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 31e900f8e7e..c8cccefda7f 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -470,7 +470,6 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature } else { - dol_syslog("security.lib:restrictedArea sql=".$sql, LOG_ERR); accessforbidden(); } } diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 9809c418f0c..f8456b4cf23 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -188,12 +188,11 @@ abstract class DolibarrModules { if (! $err) { - dol_syslog(get_class($this)."::_remove sql=".$array_sql[$i], LOG_DEBUG); + dol_syslog(get_class($this)."::_remove", LOG_DEBUG); $result=$this->db->query($array_sql[$i]); if (! $result) { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::_remove Error ".$this->error, LOG_ERR); $err++; } } @@ -859,7 +858,7 @@ abstract class DolibarrModules $sql_del.= " WHERE ".$this->db->decrypt('name')." = '".$this->const_name."'"; $sql_del.= " AND entity IN (0,".$entity.")"; - dol_syslog(get_class($this)."::insert_permissions sql=".$sql_del); + dol_syslog(get_class($this)."::insert_permissions", LOG_DEBUG); $resql=$this->db->query($sql_del); if ($resql) { diff --git a/htdocs/core/modules/facture/mod_facture_mars.php b/htdocs/core/modules/facture/mod_facture_mars.php index 100b9193fd5..25c6d2cd2ad 100644 --- a/htdocs/core/modules/facture/mod_facture_mars.php +++ b/htdocs/core/modules/facture/mod_facture_mars.php @@ -153,7 +153,6 @@ class mod_facture_mars extends ModeleNumRefFactures } else { - dol_syslog(get_class($this)."::getNextValue sql=".$sql, LOG_ERR); return -1; } diff --git a/htdocs/core/modules/facture/mod_facture_terre.php b/htdocs/core/modules/facture/mod_facture_terre.php index 6270bb9ae9c..dc06c6202ec 100644 --- a/htdocs/core/modules/facture/mod_facture_terre.php +++ b/htdocs/core/modules/facture/mod_facture_terre.php @@ -169,7 +169,6 @@ class mod_facture_terre extends ModeleNumRefFactures } else { - dol_syslog(get_class($this)."::getNextValue sql=".$sql, LOG_ERR); return -1; } diff --git a/htdocs/core/modules/livraison/mod_livraison_jade.php b/htdocs/core/modules/livraison/mod_livraison_jade.php index e7cd8c926ac..3480bb6d609 100644 --- a/htdocs/core/modules/livraison/mod_livraison_jade.php +++ b/htdocs/core/modules/livraison/mod_livraison_jade.php @@ -127,7 +127,6 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder } else { - dol_syslog("mod_livraison_jade::getNextValue sql=".$sql, LOG_ERR); return -1; } diff --git a/htdocs/core/modules/mailings/contacts4.modules.php b/htdocs/core/modules/mailings/contacts4.modules.php index acf4a316660..eb14b3995f4 100644 --- a/htdocs/core/modules/mailings/contacts4.modules.php +++ b/htdocs/core/modules/mailings/contacts4.modules.php @@ -89,7 +89,7 @@ class mailing_contacts4 extends MailingTargets if ($filtersarray[0] <> 'all') $sql.= " AND c.label = '".$this->db->escape($filtersarray[0])."'"; $sql.= " ORDER BY sp.lastname, sp.firstname"; - dol_syslog(get_class($this).':: add_to_target sql='.$sql,LOG_DEBUG); + dol_syslog(get_class($this).':: add_to_target',LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -115,7 +115,6 @@ class mailing_contacts4 extends MailingTargets } }else { $this->error=$this->db->lasterrno(); - dol_syslog(get_class($this)."Error sql=".$sql." ".$this->error, LOG_ERR); return -1; } @@ -215,7 +214,7 @@ class mailing_contacts4 extends MailingTargets $resql = $this->db->query($sql); - dol_syslog(get_class($this).':: formFilter sql='.$sql,LOG_DEBUG); + dol_syslog(get_class($this).':: formFilter',LOG_DEBUG); if ($resql) { $s=''; $s.=''; - -print_liste_field_titre( - $langs->trans('Ref'), - $_SERVER["PHP_SELF"], - 'p.ref', - $param, - '', - '', - $sortfield, - $sortorder -); -print_liste_field_titre( - $langs->trans('Label'), - $_SERVER["PHP_SELF"], - 'p.label', - $param, - '', - '', - $sortfield, - $sortorder -); -if (!empty($conf->service->enabled) && $type == 1) -{ - print_liste_field_titre( - $langs->trans('Duration'), - $_SERVER["PHP_SELF"], - 'p.duration', - $param, - '', - 'align="center"', - $sortfield, - $sortorder - ); -} -print_liste_field_titre( - $langs->trans('DesiredStock'), - $_SERVER["PHP_SELF"], - 'p.desiredstock', - $param, - '', - 'align="right"', - $sortfield, - $sortorder -); - $stocklabel = $langs->trans('Stock'); if ($usevirtualstock == 1) $stocklabel = $langs->trans('VirtualStock'); if ($usevirtualstock == 0) $stocklabel = $langs->trans('PhysicalStock'); -print_liste_field_titre( - $stocklabel, - $_SERVER["PHP_SELF"], - 'stock_physique', - $param, - '', - 'align="right"', - $sortfield, - $sortorder -); -print_liste_field_titre( - $langs->trans('Ordered'), - $_SERVER["PHP_SELF"], - '', - $param, - '', - 'align="right"', - $sortfield, - $sortorder -); -print_liste_field_titre( - $langs->trans('StockToBuy'), - $_SERVER["PHP_SELF"], - '', - $param, - '', - 'align="right"', - $sortfield, - $sortorder -); -print_liste_field_titre( - $langs->trans('Supplier'), - $_SERVER["PHP_SELF"], - '', - $param, - '', - 'align="right"', - $sortfield, - $sortorder -); + +// Lines of title +print ''; + +print_liste_field_titre($langs->trans('Ref'), $_SERVER["PHP_SELF"], 'p.ref', $param, '', '', $sortfield, $sortorder); +print_liste_field_titre($langs->trans('Label'), $_SERVER["PHP_SELF"], 'p.label', $param, '', '', $sortfield, $sortorder); +if (!empty($conf->service->enabled) && $type == 1) print_liste_field_titre($langs->trans('Duration'), $_SERVER["PHP_SELF"], 'p.duration', $param, '', 'align="center"', $sortfield, $sortorder); +print_liste_field_titre($langs->trans('DesiredStock'), $_SERVER["PHP_SELF"], 'p.desiredstock', $param, '', 'align="right"', $sortfield, $sortorder); +print_liste_field_titre($langs->trans('StockLimitShort'), $_SERVER["PHP_SELF"], 'p.seuil_stock_alerte', $param, '', 'align="right"', $sortfield, $sortorder); +print_liste_field_titre($stocklabel, $_SERVER["PHP_SELF"], 'stock_physique', $param, '', 'align="right"', $sortfield, $sortorder); +print_liste_field_titre($langs->trans('Ordered'), $_SERVER["PHP_SELF"], '', $param, '', 'align="right"', $sortfield, $sortorder); +print_liste_field_titre($langs->trans('StockToBuy'), $_SERVER["PHP_SELF"], '', $param, '', 'align="right"', $sortfield, $sortorder); +print_liste_field_titre($langs->trans('Supplier'), $_SERVER["PHP_SELF"], '', $param, '', 'align="right"', $sortfield, $sortorder); + print ''; // Lignes des champs de filtre print ''. ' '. -''. -''. -''. -''. -''. -''; -if (!empty($conf->service->enabled) && $type == 1) -{ - print ' '; -} +''. +''; +if (!empty($conf->service->enabled) && $type == 1) print ' '; print ' '. - '' . $langs->trans('AlertOnly') . ' '. + ' '. + '' . $langs->trans('AlertOnly') . ' '. ' '. ' '. ''. ''. ''. - ''. - ''; + ''; +print ''; $prod = new Product($db); @@ -533,35 +462,21 @@ while ($i < ($limit ? min($num, $limit) : $num)) } $stock_commande_fournisseur = $prod->stats_commande_fournisseur['qty']; $stock = $objp->stock_physique - $stock_commande_client + $stock_commande_fournisseur; + var_dump($stock_commande_fournisseur); } else { $stock = $objp->stock_physique; } $warning=''; - if ($objp->seuil_stock_alerte && ($stock < $objp->seuil_stock_alerte)) + if ($objp->alertstock && ($stock < $objp->alertstock)) { $warning = img_warning($langs->trans('StockTooLow')) . ' '; } //depending on conf, use either physical stock or //virtual stock to compute the stock to buy value - $stocktobuy = max($objp->desiredstock - $stock - $ordered, 0); - /* - $disabled = ''; - if($ordered > 0) - { - if ($ordered + $stock >= $objp->desiredstock) - { - $picto = img_picto('', 'ok', ''); - $disabled = 'disabled="disabled"'; - } - else { - $picto = img_picto($langs->trans("NotEnough"), 'warning', ''); - } - } else { - $picto = img_picto('', 'info', ''); - }*/ + $stocktobuy = max(max($objp->desiredstock, $objp->alertstock) - $stock - $ordered, 0); print ''; @@ -590,6 +505,9 @@ while ($i < ($limit ? min($num, $limit) : $num)) // Desired stock print '' . $objp->desiredstock . ''; + // Limit stock for alerr + print '' . $objp->alertstock . ''; + // Current stock print ''. $warning . $stock. ''; From 2537a9d35fd2f4414c01a592487d571583e21ca5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 2 Jul 2014 19:44:25 +0200 Subject: [PATCH 14/68] Fix: Error if module multicompany was removed without being disabled. --- htdocs/user/fiche.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index 359b42856ab..f71cd7565fb 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -909,7 +909,7 @@ if (($action == 'create') || ($action == 'adduserldap')) // Multicompany if (! empty($conf->multicompany->enabled)) { - if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) + if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity && is_object($mc)) { print "".''.$langs->trans("Entity").''; print "".$mc->select_entities($conf->entity); From ea310efba50308f657dfe80d2148c2bdba10dd08 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 2 Jul 2014 19:57:18 +0200 Subject: [PATCH 15/68] Fix: [ bug #1471 ] Several PHP warnings when intercepting USER_CREATE trigger --- ChangeLog | 1 + htdocs/user/fiche.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index c908243a5fb..df3198a7bf5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -68,6 +68,7 @@ For users: - Fix: [ bug #1478 ] BILL_PAYED trigger action does not intercept failure under some circumstances - Fix: [ bug #1479 ] Several customer invoice triggers do not intercept trigger action - Fix: [ bug #1477 ] Several customer invoice triggers do not show trigger error messages +- Fix: [ bug #1471 ] Several PHP warnings when intercepting USER_CREATE trigger. TODO - New: Predefined product and free product use same form. diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index f71cd7565fb..13f890c6013 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -238,8 +238,8 @@ if ($action == 'add' && $canadduser) { $langs->load("errors"); $db->rollback(); - if (is_array($object->errors) && count($object->errors)) $message='
'.join('
',$langs->trans($object->errors)).'
'; - else $message='
'.$langs->trans($object->error).'
'; + if (is_array($object->errors) && count($object->errors)) setEventMessage($object->errors,'errors'); + else setEventMessage($object->error); $action="create"; // Go back to create page } From de527365a8bc4dc6cd4966d2981eadb7d8ef8ebc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 2 Jul 2014 20:10:44 +0200 Subject: [PATCH 16/68] Fix: [ bug #1517 ] Packages sizes --- htdocs/install/mysql/migration/3.5.0-3.6.0.sql | 11 ++++++++++- htdocs/install/mysql/tables/llx_expedition.sql | 10 +++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/htdocs/install/mysql/migration/3.5.0-3.6.0.sql b/htdocs/install/mysql/migration/3.5.0-3.6.0.sql index e9d24685027..b3d71fe5af7 100644 --- a/htdocs/install/mysql/migration/3.5.0-3.6.0.sql +++ b/htdocs/install/mysql/migration/3.5.0-3.6.0.sql @@ -18,6 +18,15 @@ -- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); + + + +ALTER TABLE llx_expedition MODIFY COLUMN height float; +ALTER TABLE llx_expedition MODIFY COLUMN width float; +ALTER TABLE llx_expedition MODIFY COLUMN size float; +ALTER TABLE llx_expedition MODIFY COLUMN weight float; + + ALTER TABLE llx_societe DROP COLUMN datea; ALTER TABLE llx_holiday ADD COLUMN fk_user_create integer; @@ -1663,4 +1672,4 @@ INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, -- Fix: Missing instruction not correctly done into 3.5 -- VPGSQL8.2 ALTER TABLE llx_facture_fourn ALTER fk_mode_reglement DROP NOT NULL; -- VPGSQL8.2 ALTER TABLE llx_facture_fourn ALTER fk_cond_reglement DROP NOT NULL; - + \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_expedition.sql b/htdocs/install/mysql/tables/llx_expedition.sql index 08ea9683281..0a152b13069 100644 --- a/htdocs/install/mysql/tables/llx_expedition.sql +++ b/htdocs/install/mysql/tables/llx_expedition.sql @@ -41,13 +41,13 @@ create table llx_expedition fk_shipping_method integer, tracking_number varchar(50), fk_statut smallint DEFAULT 0, - - height integer, -- height - width integer, -- with + + height float, -- height + width float, -- with size_units integer, -- unit of all sizes (height, width, depth) - size integer, -- depth + size float, -- depth weight_units integer, -- unit of weight - weight integer, -- weight + weight float, -- weight note_private text, note_public text, model_pdf varchar(255) From c1d33af50d3f968976778c03374e245389c4c8d0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 2 Jul 2014 20:11:08 +0200 Subject: [PATCH 17/68] - Fix: [ bug #1517 ] Packages sizes. --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index df3198a7bf5..fbc13e8ba77 100644 --- a/ChangeLog +++ b/ChangeLog @@ -69,6 +69,7 @@ For users: - Fix: [ bug #1479 ] Several customer invoice triggers do not intercept trigger action - Fix: [ bug #1477 ] Several customer invoice triggers do not show trigger error messages - Fix: [ bug #1471 ] Several PHP warnings when intercepting USER_CREATE trigger. +- Fix: [ bug #1517 ] Packages sizes. TODO - New: Predefined product and free product use same form. From d38bebf99064916053885424c8b1416b6b52a608 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Wed, 2 Jul 2014 21:04:34 +0200 Subject: [PATCH 18/68] Created foreign key relations for llx_product and llx_product_price table --- .../install/mysql/migration/3.6.0-3.7.0.sql | 33 +++++++++++++++++++ .../install/mysql/tables/llx_product.key.sql | 17 +++++++++- htdocs/install/mysql/tables/llx_product.sql | 7 ++-- .../mysql/tables/llx_product_price.key.sql | 28 ++++++++++++++++ 4 files changed, 81 insertions(+), 4 deletions(-) create mode 100644 htdocs/install/mysql/tables/llx_product_price.key.sql diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql index a8019d3af4c..2b98536fa95 100644 --- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql +++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql @@ -49,3 +49,36 @@ ALTER TABLE llx_user MODIFY COLUMN accountancy_code varchar(32); ALTER TABLE llx_bank_account ADD COLUMN accountancy_journal varchar(3) DEFAULT NULL AFTER account_number; + +-- Added missing relations of llx_product +-- fk_country +ALTER TABLE llx_product CHANGE fk_country fk_country INT( 11 ) NULL DEFAULT NULL; +ALTER TABLE llx_product ADD INDEX ( fk_country ); +ALTER TABLE llx_product ADD FOREIGN KEY ( fk_country ) REFERENCES llx_c_pays ( +rowid +) ON DELETE RESTRICT ON UPDATE RESTRICT ; +-- fk_user_author +ALTER TABLE llx_product CHANGE fk_user_author fk_user_author INT( 11 ) NULL DEFAULT NULL; +ALTER TABLE llx_product ADD INDEX ( fk_user_author ); +ALTER TABLE llx_product ADD FOREIGN KEY ( fk_user_author ) REFERENCES llx_user ( +rowid +) ON DELETE RESTRICT ON UPDATE RESTRICT ; +-- fk_barcode_type +ALTER TABLE llx_product CHANGE fk_barcode_type fk_barcode_type INT( 11 ) NULL DEFAULT NULL; +UPDATE llx_product SET fk_barcode_type = NULL WHERE fk_barcode_type = 0; +ALTER TABLE llx_product ADD INDEX ( fk_barcode_type ); +ALTER TABLE llx_product ADD FOREIGN KEY ( fk_barcode_type ) REFERENCES llx_c_barcode_type ( +rowid +) ON DELETE RESTRICT ON UPDATE RESTRICT ; + +-- Added missing relations of llx_product_price +-- fk_user_author +ALTER TABLE llx_product_price ADD INDEX ( fk_user_author ); +ALTER TABLE llx_product_price ADD FOREIGN KEY ( fk_user_author ) REFERENCES llx_user ( + rowid +) ON DELETE RESTRICT ON UPDATE RESTRICT ; +-- fk_user_author +ALTER TABLE llx_product_price ADD INDEX ( fk_product ); +ALTER TABLE llx_product_price ADD FOREIGN KEY ( fk_product ) REFERENCES llx_product ( + rowid +) ON DELETE RESTRICT ON UPDATE RESTRICT ; \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_product.key.sql b/htdocs/install/mysql/tables/llx_product.key.sql index a2cb0e539f9..4faa2bcb13c 100644 --- a/htdocs/install/mysql/tables/llx_product.key.sql +++ b/htdocs/install/mysql/tables/llx_product.key.sql @@ -2,6 +2,7 @@ -- Copyright (C) 2002-2004 Rodolphe Quiedeville -- Copyright (C) 2004-2013 Laurent Destailleur -- Copyright (C) 2005-2009 Regis Houssin +-- Copyright (C) 2014 Marcos García -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by @@ -25,6 +26,20 @@ ALTER TABLE llx_product ADD INDEX idx_product_label (label); ALTER TABLE llx_product ADD INDEX idx_product_barcode (barcode); ALTER TABLE llx_product ADD INDEX idx_product_import_key (import_key); ALTER TABLE llx_product ADD INDEX idx_product_seuil_stock_alerte (seuil_stock_alerte); - +ALTER TABLE llx_product ADD INDEX ( fk_country ); +ALTER TABLE llx_product ADD INDEX ( fk_user_author ); +ALTER TABLE llx_product ADD INDEX ( fk_barcode_type ); ALTER TABLE llx_product ADD UNIQUE INDEX uk_product_barcode (barcode, fk_barcode_type, entity); + +ALTER TABLE llx_product ADD FOREIGN KEY ( fk_country ) REFERENCES llx_c_pays ( +rowid +) ON DELETE RESTRICT ON UPDATE RESTRICT ; + +ALTER TABLE llx_product ADD FOREIGN KEY ( fk_user_author ) REFERENCES llx_user ( +rowid +) ON DELETE RESTRICT ON UPDATE RESTRICT ; + +ALTER TABLE llx_product ADD FOREIGN KEY ( fk_barcode_type ) REFERENCES llx_c_barcode_type ( +rowid +) ON DELETE RESTRICT ON UPDATE RESTRICT ; \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_product.sql b/htdocs/install/mysql/tables/llx_product.sql index 0ff94c19530..0ab9a24785c 100644 --- a/htdocs/install/mysql/tables/llx_product.sql +++ b/htdocs/install/mysql/tables/llx_product.sql @@ -4,6 +4,7 @@ -- Copyright (C) 2005-2010 Regis Houssin -- Copyright (C) 2010 juanjo Menent -- Copyright (C) 2013 Cédric Salvador +-- Copyright (C) 2014 Marcos García -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by @@ -37,7 +38,7 @@ create table llx_product description text, note text, customcode varchar(32), -- Optionnal custom code - fk_country integer, -- Optionnal id of original country + fk_country integer DEFAULT NULL, -- Optionnal id of original country price double(24,8) DEFAULT 0, price_ttc double(24,8) DEFAULT 0, price_min double(24,8) DEFAULT 0, @@ -47,7 +48,7 @@ create table llx_product recuperableonly integer NOT NULL DEFAULT '0', -- French NPR VAT localtax1_tx double(6,3) DEFAULT 0, -- Spanish local VAT 1 localtax2_tx double(6,3) DEFAULT 0, -- Spanish local VAT 2 - fk_user_author integer, + fk_user_author integer DEFAULT NULL, tosell tinyint DEFAULT 1, -- Product you sell tobuy tinyint DEFAULT 1, -- Product you buy tobatch tinyint DEFAULT 0 NOT NULL, -- Is it a product that need a batch or eat-by management @@ -56,7 +57,7 @@ create table llx_product seuil_stock_alerte integer DEFAULT 0, url varchar(255), barcode varchar(255) DEFAULT NULL, - fk_barcode_type integer DEFAULT 0, + fk_barcode_type integer DEFAULT NULL, accountancy_code_sell varchar(32), -- Selling accountancy code accountancy_code_buy varchar(32), -- Buying accountancy code partnumber varchar(32), -- Not used. Used by external modules. diff --git a/htdocs/install/mysql/tables/llx_product_price.key.sql b/htdocs/install/mysql/tables/llx_product_price.key.sql new file mode 100644 index 00000000000..a7e43d95d86 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_product_price.key.sql @@ -0,0 +1,28 @@ +-- ============================================================================ +-- Copyright (C) 2014 Marcos García +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- ============================================================================ + +ALTER TABLE llx_product_price ADD INDEX ( fk_user_author ); +ALTER TABLE llx_product_price ADD INDEX ( fk_product ); + +ALTER TABLE llx_product_price ADD FOREIGN KEY ( fk_product ) REFERENCES llx_product ( + rowid +) ON DELETE RESTRICT ON UPDATE RESTRICT ; + +ALTER TABLE llx_product_price ADD FOREIGN KEY ( fk_user_author ) REFERENCES llx_user ( + rowid +) ON DELETE RESTRICT ON UPDATE RESTRICT ; \ No newline at end of file From 460fb7a453f38f0a28ea1a72e4ea872cfbe8ed19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Wed, 2 Jul 2014 21:29:07 +0200 Subject: [PATCH 19/68] Removed new SQL double-debug --- htdocs/adherents/card_subscriptions.php | 4 ++-- htdocs/comm/propal/class/propal.class.php | 4 +--- htdocs/commande/class/commande.class.php | 6 +++--- htdocs/compta/bank/class/account.class.php | 2 +- htdocs/compta/facture/class/facture.class.php | 4 ++-- htdocs/compta/paiement/cheque/class/remisecheque.class.php | 4 ++-- htdocs/contrat/class/contrat.class.php | 1 - htdocs/core/class/commoninvoice.class.php | 2 +- htdocs/core/lib/functions2.lib.php | 2 +- htdocs/fourn/class/fournisseur.commande.class.php | 4 ++-- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- htdocs/opensurvey/public/studs.php | 1 - htdocs/opensurvey/results.php | 1 - htdocs/product/class/product.class.php | 2 +- htdocs/product/price.php | 1 - htdocs/societe/class/address.class.php | 5 +---- htdocs/user/class/user.class.php | 4 ++-- 17 files changed, 20 insertions(+), 29 deletions(-) diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index ff1abc8199c..e436fd5f694 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -454,8 +454,8 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ // Update fk_bank into subscription table $sql = 'UPDATE '.MAIN_DB_PREFIX.'cotisation SET fk_bank='.$bank_line_id; $sql.= ' WHERE rowid='.$crowid; - dol_syslog('sql='.$sql); - $result = $db->query($sql); + + $result = $db->query($sql); if (! $result) { $error++; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index aafe6d11d8a..27dd65e6217 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1594,7 +1594,6 @@ class Propal extends CommonObject else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::set_remise_percent Error sql=$sql"); return -1; } } @@ -1629,7 +1628,6 @@ class Propal extends CommonObject else { $this->error=$this->db->error(); - dol_syslog(get_class($this)."::set_remise_absolue Error sql=$sql"); return -1; } } @@ -3131,7 +3129,7 @@ class PropaleLigne extends CommonObject $sql.= ",total_ttc=".price2num($this->total_ttc,'MT').""; $sql.= " WHERE rowid = ".$this->rowid; - dol_syslog("PropaleLigne::update_total sql=$sql"); + dol_syslog("PropaleLigne::update_total", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 2d06fc135f3..a48dd0b9b43 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1888,7 +1888,7 @@ class Commande extends CommonOrder $sql.= ' SET remise_absolue = '.$remise; $sql.= ' WHERE rowid = '.$this->id.' AND fk_statut = 0 ;'; - dol_syslog(get_class($this)."::set_remise_absolue sql=$sql"); + dol_syslog(get_class($this)."::set_remise_absolue", LOG_DEBUG); if ($this->db->query($sql)) { @@ -1920,7 +1920,7 @@ class Commande extends CommonOrder $sql.= " SET date_commande = ".($date ? $this->db->idate($date) : 'null'); $sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0"; - dol_syslog(get_class($this)."::set_date sql=$sql",LOG_DEBUG); + dol_syslog(get_class($this)."::set_date",LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -3485,7 +3485,7 @@ class OrderLine extends CommonOrderLine $sql.= ",total_ttc='".price2num($this->total_ttc)."'"; $sql.= " WHERE rowid = ".$this->rowid; - dol_syslog("OrderLine::update_total sql=$sql"); + dol_syslog("OrderLine::update_total", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 8729c44e494..e50c7bb34f6 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -569,7 +569,7 @@ class Account extends CommonObject $sql.= " WHERE rowid = ".$this->id; $sql.= " AND entity = ".$conf->entity; - dol_syslog(get_class($this)."::update_bban sql=$sql"); + dol_syslog(get_class($this)."::update_bban", LOG_DEBUG); $result = $this->db->query($sql); if ($result) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index f08a2af3feb..477735ca9ec 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2346,7 +2346,7 @@ class Facture extends CommonInvoice $sql.= ' WHERE rowid = '.$this->id; $sql.= ' AND fk_statut = 0'; - dol_syslog(get_class($this)."::set_remise_absolue sql=$sql"); + dol_syslog(get_class($this)."::set_remise_absolue", LOG_DEBUG); if ($this->db->query($sql)) { @@ -2737,7 +2737,7 @@ class Facture extends CommonInvoice if ($socid > 0) $sql.=" AND f.fk_soc = ".$socid; $sql.= " ORDER BY f.facnumber"; - dol_syslog(get_class($this)."::list_replacable_invoices sql=$sql"); + dol_syslog(get_class($this)."::list_replacable_invoices", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 990238cf543..39b8f209247 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -704,7 +704,7 @@ class RemiseCheque extends CommonObject $sql.= " SET date_bordereau = ".($date ? $this->db->idate($date) : 'null'); $sql.= " WHERE rowid = ".$this->id; - dol_syslog("RemiseCheque::set_date sql=$sql",LOG_DEBUG); + dol_syslog("RemiseCheque::set_date", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -738,7 +738,7 @@ class RemiseCheque extends CommonObject $sql.= " SET number = '".$number."'" ; $sql.= " WHERE rowid = ".$this->id; - dol_syslog("RemiseCheque::set_number sql=$sql",LOG_DEBUG); + dol_syslog("RemiseCheque::set_number", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 049825578e7..8217749f260 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1075,7 +1075,6 @@ class Contrat extends CommonObject } else { - dol_syslog("Error sql=$sql, error=".$this->error,LOG_ERR); $this->db->rollback(); return -1; } diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index fa08ef5566a..fdc4a35a585 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -308,7 +308,7 @@ abstract class CommonInvoice extends CommonObject if (is_numeric($cond_reglement)) $sqltemp.= " WHERE c.rowid=".$cond_reglement; else $sqltemp.= " WHERE c.code='".$this->db->escape($cond_reglement)."'"; - dol_syslog(get_class($this).'::calculate_date_lim_reglement sql='.$sqltemp); + dol_syslog(get_class($this).'::calculate_date_lim_reglement', LOG_DEBUG); $resqltemp=$this->db->query($sqltemp); if ($resqltemp) { diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index e6a9e139109..4e9598d5e20 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -837,7 +837,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m if ($sqlwhere) $maskrefclient_sql.=' AND '.$sqlwhere; //use the same sqlwhere as general mask $maskrefclient_sql.=' AND (SUBSTRING('.$field.', '.(strpos($maskwithnocode,$maskrefclient)+1).', '.dol_strlen($maskrefclient_maskclientcode).")='".$maskrefclient_clientcode."')"; - dol_syslog("functions2::get_next_value maskrefclient_sql=".$maskrefclient_sql, LOG_DEBUG); + dol_syslog("functions2::get_next_value maskrefclient", LOG_DEBUG); $maskrefclient_resql=$db->query($maskrefclient_sql); if ($maskrefclient_resql) { diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 83681a3a4b9..8637364f578 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -145,7 +145,7 @@ class CommandeFournisseur extends CommonOrder $obj = $this->db->fetch_object($resql); if (! $obj) { - $this->error='Bill with id '.$id.' not found sql='.$sql; + $this->error='Bill with id '.$id.' not found'; dol_syslog(get_class($this).'::fetch '.$this->error); return 0; } @@ -2140,7 +2140,7 @@ class CommandeFournisseurLigne $sql.= ",total_ttc='".price2num($this->total_ttc)."'"; $sql.= " WHERE rowid = ".$this->rowid; - dol_syslog("CommandeFournisseurLigne.class.php::update_total sql=$sql"); + dol_syslog("CommandeFournisseurLigne.class.php::update_total", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 95aaeb16eea..a224f1fafb0 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -420,7 +420,7 @@ class FactureFournisseur extends CommonInvoice } else { - $this->error='Bill with id '.$id.' not found sql='.$sql; + $this->error='Bill with id '.$id.' not found'; dol_syslog(get_class($this).'::fetch '.$this->error); return 0; } diff --git a/htdocs/opensurvey/public/studs.php b/htdocs/opensurvey/public/studs.php index f970df5bc4d..c85a62ae61a 100644 --- a/htdocs/opensurvey/public/studs.php +++ b/htdocs/opensurvey/public/studs.php @@ -392,7 +392,6 @@ $compteur = 0; $sql ="SELECT id_users, nom, id_sondage, reponses"; $sql.=" FROM ".MAIN_DB_PREFIX."opensurvey_user_studs"; $sql.=" WHERE id_sondage = '".$db->escape($numsondage)."'"; -dol_syslog('sql='.$sql); $resql=$db->query($sql); if (! $resql) { diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php index 2d93dfd5de4..7dbdac8c2bc 100644 --- a/htdocs/opensurvey/results.php +++ b/htdocs/opensurvey/results.php @@ -286,7 +286,6 @@ for ($i = 0; $i < $nblignes; $i++) $sql ="SELECT id_users, nom, id_sondage, reponses"; $sql.=" FROM ".MAIN_DB_PREFIX."opensurvey_user_studs"; $sql.=" WHERE id_sondage = '".$db->escape($numsondage)."'"; - dol_syslog('sql='.$sql); $resql=$db->query($sql); if (! $resql) dol_print_error($db); $num=$db->num_rows($resql); diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index c00701fbdbb..0d4c884abf8 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -945,7 +945,7 @@ class Product extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_lang"; $sql.= " WHERE fk_product=".$this->id." AND lang='".$this->db->escape($langtodelete)."'"; - dol_syslog(get_class($this).'::delMultiLangs sql='.$sql); + dol_syslog(get_class($this).'::delMultiLangs', LOG_DEBUG); $result = $this->db->query($sql); if ($result) { diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 9268a3a59a4..f5db524ed27 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -686,7 +686,6 @@ if (! empty($socid) && ! empty($conf->global->PRODUIT_MULTIPRICES)) $sql .= " ORDER BY p.date_price DESC, p.price_level ASC"; // $sql .= $db->plimit(); -dol_syslog("sql=" . $sql); $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); diff --git a/htdocs/societe/class/address.class.php b/htdocs/societe/class/address.class.php index 14b1605fdd9..d8ef1565bbd 100644 --- a/htdocs/societe/class/address.class.php +++ b/htdocs/societe/class/address.class.php @@ -114,10 +114,7 @@ class Address $this->error=$langs->trans("ErrorCompanyNameAlreadyExists",$this->nom); } - else - { - dol_syslog(get_class($this)."::create echec insert sql=$sql"); - } + $this->db->rollback(); return -2; } diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 35ae30d0641..0a2ccf00638 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1370,7 +1370,7 @@ class User extends CommonObject } $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::setPassword sql=hidden", LOG_DEBUG); + dol_syslog(get_class($this)."::setPassword", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -1439,7 +1439,7 @@ class User extends CommonObject $sql.= " SET pass_temp = '".$this->db->escape($password)."'"; $sql.= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::setPassword sql=hidden", LOG_DEBUG); // No log + dol_syslog(get_class($this)."::setPassword", LOG_DEBUG); // No log $result = $this->db->query($sql); if ($result) { From e351657cc08d111e13680d971ab2425d3e4c4ff9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Thu, 3 Jul 2014 10:16:37 +0200 Subject: [PATCH 20/68] Removed key restrictions --- htdocs/install/mysql/migration/3.6.0-3.7.0.sql | 10 +++++----- htdocs/install/mysql/tables/llx_product.key.sql | 6 +++--- htdocs/install/mysql/tables/llx_product_price.key.sql | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql index 2b98536fa95..1a9c59b6275 100644 --- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql +++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql @@ -56,29 +56,29 @@ ALTER TABLE llx_product CHANGE fk_country fk_country INT( 11 ) NULL DEFAULT N ALTER TABLE llx_product ADD INDEX ( fk_country ); ALTER TABLE llx_product ADD FOREIGN KEY ( fk_country ) REFERENCES llx_c_pays ( rowid -) ON DELETE RESTRICT ON UPDATE RESTRICT ; +); -- fk_user_author ALTER TABLE llx_product CHANGE fk_user_author fk_user_author INT( 11 ) NULL DEFAULT NULL; ALTER TABLE llx_product ADD INDEX ( fk_user_author ); ALTER TABLE llx_product ADD FOREIGN KEY ( fk_user_author ) REFERENCES llx_user ( rowid -) ON DELETE RESTRICT ON UPDATE RESTRICT ; +); -- fk_barcode_type ALTER TABLE llx_product CHANGE fk_barcode_type fk_barcode_type INT( 11 ) NULL DEFAULT NULL; UPDATE llx_product SET fk_barcode_type = NULL WHERE fk_barcode_type = 0; ALTER TABLE llx_product ADD INDEX ( fk_barcode_type ); ALTER TABLE llx_product ADD FOREIGN KEY ( fk_barcode_type ) REFERENCES llx_c_barcode_type ( rowid -) ON DELETE RESTRICT ON UPDATE RESTRICT ; +); -- Added missing relations of llx_product_price -- fk_user_author ALTER TABLE llx_product_price ADD INDEX ( fk_user_author ); ALTER TABLE llx_product_price ADD FOREIGN KEY ( fk_user_author ) REFERENCES llx_user ( rowid -) ON DELETE RESTRICT ON UPDATE RESTRICT ; +); -- fk_user_author ALTER TABLE llx_product_price ADD INDEX ( fk_product ); ALTER TABLE llx_product_price ADD FOREIGN KEY ( fk_product ) REFERENCES llx_product ( rowid -) ON DELETE RESTRICT ON UPDATE RESTRICT ; \ No newline at end of file +); \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_product.key.sql b/htdocs/install/mysql/tables/llx_product.key.sql index 4faa2bcb13c..b692a2740b0 100644 --- a/htdocs/install/mysql/tables/llx_product.key.sql +++ b/htdocs/install/mysql/tables/llx_product.key.sql @@ -34,12 +34,12 @@ ALTER TABLE llx_product ADD UNIQUE INDEX uk_product_barcode (barcode, fk_barcode ALTER TABLE llx_product ADD FOREIGN KEY ( fk_country ) REFERENCES llx_c_pays ( rowid -) ON DELETE RESTRICT ON UPDATE RESTRICT ; +); ALTER TABLE llx_product ADD FOREIGN KEY ( fk_user_author ) REFERENCES llx_user ( rowid -) ON DELETE RESTRICT ON UPDATE RESTRICT ; +); ALTER TABLE llx_product ADD FOREIGN KEY ( fk_barcode_type ) REFERENCES llx_c_barcode_type ( rowid -) ON DELETE RESTRICT ON UPDATE RESTRICT ; \ No newline at end of file +); \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_product_price.key.sql b/htdocs/install/mysql/tables/llx_product_price.key.sql index a7e43d95d86..fbc5ee3f05f 100644 --- a/htdocs/install/mysql/tables/llx_product_price.key.sql +++ b/htdocs/install/mysql/tables/llx_product_price.key.sql @@ -21,8 +21,8 @@ ALTER TABLE llx_product_price ADD INDEX ( fk_product ); ALTER TABLE llx_product_price ADD FOREIGN KEY ( fk_product ) REFERENCES llx_product ( rowid -) ON DELETE RESTRICT ON UPDATE RESTRICT ; +); ALTER TABLE llx_product_price ADD FOREIGN KEY ( fk_user_author ) REFERENCES llx_user ( rowid -) ON DELETE RESTRICT ON UPDATE RESTRICT ; \ No newline at end of file +); \ No newline at end of file From 959c41e8db19c8577233042c9b2617630fc68f2d Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 3 Jul 2014 10:24:29 +0200 Subject: [PATCH 21/68] Fix : virtual stock was not correctly calculated because reception was not included. --- htdocs/product/class/product.class.php | 83 ++++++++++++++++++++++++++ htdocs/product/stock/product.php | 21 +------ 2 files changed, 85 insertions(+), 19 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index cee5c72abea..61b885f02c7 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1709,6 +1709,48 @@ class Product extends CommonObject } } + /** + * Charge tableau des stats réception fournisseur pour le produit/service + * + * @param int $socid Id societe pour filtrer sur une societe + * @param int $filtrestatut Id statut pour filtrer sur un statut + * @return array Tableau des stats + */ + function load_stats_reception($socid=0,$filtrestatut='') + { + global $conf,$user; + + $sql = "SELECT COUNT(DISTINCT cf.fk_soc) as nb_customers, COUNT(DISTINCT cf.rowid) as nb,"; + $sql.= " COUNT(fd.rowid) as nb_rows, SUM(fd.qty) as qty"; + $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as fd"; + $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as cf"; + $sql.= ", ".MAIN_DB_PREFIX."societe as s"; + if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql.= " WHERE cf.rowid = fd.fk_commande"; + $sql.= " AND cf.fk_soc = s.rowid"; + $sql.= " AND cf.entity = ".$conf->entity; + $sql.= " AND fd.fk_product = ".$this->id; + if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND cf.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; + if ($socid > 0) $sql.= " AND cf.fk_soc = ".$socid; + if ($filtrestatut <> '') $sql.= " AND cf.fk_statut in (".$filtrestatut.")"; + + $result = $this->db->query($sql); + if ( $result ) + { + $obj=$this->db->fetch_object($result); + $this->stats_reception['suppliers']=$obj->nb_customers; + $this->stats_reception['nb']=$obj->nb; + $this->stats_reception['rows']=$obj->nb_rows; + $this->stats_reception['qty']=$obj->qty?$obj->qty:0; + return 1; + } + else + { + $this->error=$this->db->error(); + return -1; + } + } + /** * Charge tableau des stats contrat pour le produit/service * @@ -2872,6 +2914,7 @@ class Product extends CommonObject } } $this->db->free($result); + $this->load_virtual_stock(); return 1; } else @@ -2881,6 +2924,46 @@ class Product extends CommonObject } } + /** + * Load information about virtual stock of a product + * + * @return int < 0 if KO, > 0 if OK + */ + function load_virtual_stock() + { + global $conf; + + if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)) + { + $stock_commande_client=$stock_commande_fournisseur=0; + $stock_sending_client=$stock_reception_fournisseur=0; + + if (! empty($conf->commande->enabled)) + { + $result=$this->load_stats_commande(0,'1,2'); + if ($result < 0) dol_print_error($db,$this->error); + $stock_commande_client=$this->stats_commande['qty']; + } + if (! empty($conf->expedition->enabled)) + { + $result=$this->load_stats_sending(0,''); + if ($result < 0) dol_print_error($db,$this->error); + $stock_sending_client=$this->stats_expedition['qty']; + } + if (! empty($conf->fournisseur->enabled)) + { + $result=$this->load_stats_commande_fournisseur(0,'3'); + if ($result < 0) dol_print_error($db,$this->error); + $stock_commande_fournisseur=$this->stats_commande_fournisseur['qty']; + + $result=$this->load_stats_reception(0,''); + if ($result < 0) dol_print_error($db,$this->error); + $stock_reception_fournisseur=$this->stats_reception['qty']; + } + + $this->stock_theorique=$this->stock_reel-($stock_commande_client-$stock_sending_client)+($stock_commande_fournisseur-$stock_reception_fournisseur); + } + } /** * Deplace fichier uploade sous le nom $files dans le repertoire sdir diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 3f26d8c0980..338169a6154 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -321,23 +321,6 @@ if ($id > 0 || $ref) // If stock if stock increment is done on real sending if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)) { - $stock_commande_client=$stock_commande_fournisseur=0; - - if (! empty($conf->commande->enabled)) - { - $result=$product->load_stats_commande(0,'1,2'); - if ($result < 0) dol_print_error($db,$product->error); - $stock_commande_client=$product->stats_commande['qty']; - } - if (! empty($conf->fournisseur->enabled)) - { - $result=$product->load_stats_commande_fournisseur(0,'3'); - if ($result < 0) dol_print_error($db,$product->error); - $stock_commande_fournisseur=$product->stats_commande_fournisseur['qty']; - } - - $product->stock_theorique=$product->stock_reel-($stock_commande_client+$stock_sending_client)+$stock_commande_fournisseur; - // Stock theorique print ''.$langs->trans("VirtualStock").''; print "".$product->stock_theorique; @@ -360,7 +343,7 @@ if ($id > 0 || $ref) if (! empty($conf->commande->enabled)) { if ($found) print '
'; else $found=1; - print $langs->trans("CustomersOrdersRunning").': '.($stock_commande_client+$stock_sending_client); + print $langs->trans("CustomersOrdersRunning").': '.($product->stats_commande['qty']-$product->stats_sendings['qty']); $result=$product->load_stats_commande(0,'0'); if ($result < 0) dol_print_error($db,$product->error); print ' ('.$langs->trans("Draft").': '.$product->stats_commande['qty'].')'; @@ -372,7 +355,7 @@ if ($id > 0 || $ref) if (! empty($conf->fournisseur->enabled)) { if ($found) print '
'; else $found=1; - print $langs->trans("SuppliersOrdersRunning").': '.$stock_commande_fournisseur; + print $langs->trans("SuppliersOrdersRunning").': '.($product->stats_commande_fournisseur['qty']-$product->stats_reception['qty']); $result=$product->load_stats_commande_fournisseur(0,'0,1,2'); if ($result < 0) dol_print_error($db,$product->error); print ' ('.$langs->trans("DraftOrWaitingApproved").': '.$product->stats_commande_fournisseur['qty'].')'; From b115e9b943c24a2408aedb8db3c835eddb19dfd4 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 3 Jul 2014 12:07:34 +0200 Subject: [PATCH 22/68] Fix : replenish function was not working with virtual stock --- htdocs/product/stock/replenish.php | 78 ++++++++++++++++++------------ 1 file changed, 46 insertions(+), 32 deletions(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 6aee0bada53..0bfdbfb9159 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -252,36 +252,58 @@ $sql.= ', s.fk_product'; if ($usevirtualstock) { - $sqlCommandesCli = "(SELECT SUM(cd.qty) as qty"; + $sqlCommandesCli = "(SELECT ".$db->ifsql("SUM(cd.qty) IS NULL", "0", "SUM(cd.qty)")." as qty"; $sqlCommandesCli.= " FROM ".MAIN_DB_PREFIX."commandedet as cd"; - $sqlCommandesCli.= ", ".MAIN_DB_PREFIX."commande as c"; - $sqlCommandesCli.= " WHERE c.rowid = cd.fk_commande"; - $sqlCommandesCli.= " AND c.entity = ".$conf->entity; + $sqlCommandesCli.= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON (c.rowid = cd.fk_commande)"; + $sqlCommandesCli.= " WHERE c.entity = ".$conf->entity; $sqlCommandesCli.= " AND cd.fk_product = p.rowid"; $sqlCommandesCli.= " AND c.fk_statut in (1,2))"; - - $sqlCommandesFourn = "(SELECT SUM(cd.qty) as qty"; + + $sqlExpeditionsCli = "(SELECT ".$db->ifsql("SUM(ed.qty) IS NULL", "0", "SUM(ed.qty)")." as qty"; + $sqlExpeditionsCli.= " FROM ".MAIN_DB_PREFIX."expedition as e"; + $sqlExpeditionsCli.= " LEFT JOIN ".MAIN_DB_PREFIX."expeditiondet as ed ON (ed.fk_expedition = e.rowid)"; + $sqlExpeditionsCli.= " LEFT JOIN ".MAIN_DB_PREFIX."commandedet as cd ON (cd.rowid = ed.fk_origin_line)"; + $sqlExpeditionsCli.= " WHERE e.entity = ".$conf->entity; + $sqlExpeditionsCli.= " AND cd.fk_product = p.rowid"; + $sqlExpeditionsCli.= " AND e.fk_statut > 0)"; + + $sqlCommandesFourn = "(SELECT ".$db->ifsql("SUM(cd.qty) IS NULL", "0", "SUM(cd.qty)")." as qty"; $sqlCommandesFourn.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd"; $sqlCommandesFourn.= ", ".MAIN_DB_PREFIX."commande_fournisseur as c"; $sqlCommandesFourn.= " WHERE c.rowid = cd.fk_commande"; $sqlCommandesFourn.= " AND c.entity = ".$conf->entity; $sqlCommandesFourn.= " AND cd.fk_product = p.rowid"; - $sqlCommandesFourn.= " AND c.fk_statut in (3))"; - - $sql.= ' HAVING ((p.desiredstock > 0 AND p.desiredstock > (SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; - $sql.= ' - '.$db->ifsql($sqlCommandesCli.' IS NULL', '0', $sqlCommandesCli).' + '.$db->ifsql($sqlCommandesFourn.' IS NULL', '0', $sqlCommandesFourn).'))'; - - $sql.= ' OR (p.seuil_stock_alerte > 0 AND p.seuil_stock_alerte > (SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; - $sql.= ' - '.$db->ifsql($sqlCommandesCli.' IS NULL', '0', $sqlCommandesCli).' + '.$db->ifsql($sqlCommandesFourn.' IS NULL', '0', $sqlCommandesFourn).'))'; - $sql.= " )"; + $sqlCommandesFourn.= " AND c.fk_statut in (2,3))"; + + $sqlReceptionFourn = "(SELECT ".$db->ifsql("SUM(fd.qty) IS NULL", "0", "SUM(fd.qty)")." as qty"; + $sqlReceptionFourn.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf"; + $sqlReceptionFourn.= " LEFT JOIN ".MAIN_DB_PREFIX."commande_fournisseurdet as cfd ON (cfd.fk_commande = cf.rowid)"; + $sqlReceptionFourn.= " LEFT JOIN ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as fd ON (fd.fk_commande = cf.rowid)"; + $sqlReceptionFourn.= " WHERE cf.entity = ".$conf->entity; + $sqlReceptionFourn.= " AND fd.fk_product = p.rowid)"; + + $sql.= ' HAVING ((p.desiredstock > 0 AND (p.desiredstock > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; + $sql.= ' - ('.$sqlCommandesCli.' - '.$sqlExpeditionsCli.') + ('.$sqlCommandesFourn.' - '.$sqlReceptionFourn.')))'; + $sql.= ' OR (p.seuil_stock_alerte > 0 AND (p.seuil_stock_alerte > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; + $sql.= ' - ('.$sqlCommandesCli.' - '.$sqlExpeditionsCli.') + ('.$sqlCommandesFourn.' - '.$sqlReceptionFourn.'))))'; + + if ($salert == 'on') // Option to see when stock is lower than alert + { + $sql.= ' AND (p.seuil_stock_alerte > 0 AND (p.seuil_stock_alerte > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; + $sql.= ' - ('.$sqlCommandesCli.' - '.$sqlExpeditionsCli.') + ('.$sqlCommandesFourn.' - '.$sqlReceptionFourn.')))'; + $alertchecked = 'checked="checked"'; + } } else { - $sql.= ' HAVING ((p.desiredstock > 0 AND (p.desiredstock > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").'))) OR (p.seuil_stock_alerte > 0 AND (seuil_stock_alerte > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").'))))'; -} -if ($salert == 'on') // Option to see when stock is lower than alert -{ - $sql .= ' AND SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").') < p.seuil_stock_alerte AND p.seuil_stock_alerte is not NULL'; - $alertchecked = 'checked="checked"'; + $sql.= ' HAVING ((p.desiredstock > 0 AND (p.desiredstock > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')))'; + $sql.= ' OR (p.seuil_stock_alerte > 0 AND (p.seuil_stock_alerte > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").'))))'; + + if ($salert == 'on') // Option to see when stock is lower than alert + { + $sql.= ' AND (p.seuil_stock_alerte > 0 AND (p.seuil_stock_alerte > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')))'; + $alertchecked = 'checked="checked"'; + } } + $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit, $offset); @@ -368,6 +390,7 @@ print '
' ''. ''. ''. + ''. ''; @@ -451,18 +474,9 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // If option to increase/decrease is not on an object validation, virtual stock may differs from physical stock. $prod->fetch($prod->id); - $result=$prod->load_stats_commande(0, '1,2'); - if ($result < 0) { - dol_print_error($db, $prod->error); - } - $stock_commande_client = $prod->stats_commande['qty']; - $result=$prod->load_stats_commande_fournisseur(0, '3'); - if ($result < 0) { - dol_print_error($db,$prod->error); - } - $stock_commande_fournisseur = $prod->stats_commande_fournisseur['qty']; - $stock = $objp->stock_physique - $stock_commande_client + $stock_commande_fournisseur; - var_dump($stock_commande_fournisseur); + $prod->load_stock(); + + $stock = $prod->stock_theorique; } else { From 830cc30f802c0569ac16a8e2bdf574724f5a6f36 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 3 Jul 2014 12:31:55 +0200 Subject: [PATCH 23/68] Fix : sendings and reception stock calculation must be on the same status than order and oreder supplier calculation --- htdocs/product/class/product.class.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 61b885f02c7..2bdc950495e 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1680,17 +1680,19 @@ class Product extends CommonObject $sql.= " COUNT(ed.rowid) as nb_rows, SUM(ed.qty) as qty"; $sql.= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed"; $sql.= ", ".MAIN_DB_PREFIX."commandedet as cd"; + $sql.= ", ".MAIN_DB_PREFIX."commande as c"; $sql.= ", ".MAIN_DB_PREFIX."expedition as e"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE e.rowid = ed.fk_expedition"; + $sql.= " AND c.rowid = cd.fk_commande"; $sql.= " AND e.fk_soc = s.rowid"; $sql.= " AND e.entity = ".$conf->entity; $sql.= " AND ed.fk_origin_line = cd.rowid"; $sql.= " AND cd.fk_product = ".$this->id; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND e.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid > 0) $sql.= " AND e.fk_soc = ".$socid; - if ($filtrestatut <> '') $sql.= " AND e.fk_statut in (".$filtrestatut.")"; + if ($filtrestatut <> '') $sql.= " AND c.fk_statut in (".$filtrestatut.")"; $result = $this->db->query($sql); if ( $result ) @@ -2946,7 +2948,7 @@ class Product extends CommonObject } if (! empty($conf->expedition->enabled)) { - $result=$this->load_stats_sending(0,''); + $result=$this->load_stats_sending(0,'1,2'); if ($result < 0) dol_print_error($db,$this->error); $stock_sending_client=$this->stats_expedition['qty']; } @@ -2956,12 +2958,13 @@ class Product extends CommonObject if ($result < 0) dol_print_error($db,$this->error); $stock_commande_fournisseur=$this->stats_commande_fournisseur['qty']; - $result=$this->load_stats_reception(0,''); + $result=$this->load_stats_reception(0,'3'); if ($result < 0) dol_print_error($db,$this->error); $stock_reception_fournisseur=$this->stats_reception['qty']; } $this->stock_theorique=$this->stock_reel-($stock_commande_client-$stock_sending_client)+($stock_commande_fournisseur-$stock_reception_fournisseur); + //echo $this->stock_theorique.' = '.$this->stock_reel.' - ('.$stock_commande_client.' - '.$stock_sending_client.') + ('.$stock_commande_fournisseur.' - '.$stock_reception_fournisseur.')'; } } From 1e5c35093ba6baa77e1842f118badb8d09184038 Mon Sep 17 00:00:00 2001 From: KreizIT Date: Thu, 3 Jul 2014 14:01:01 +0200 Subject: [PATCH 24/68] Review trigger for user module --- dev/skeletons/skeleton_class.class.php | 24 +++--- htdocs/user/class/user.class.php | 100 ++++++++++++------------- htdocs/user/class/usergroup.class.php | 49 +++++++----- 3 files changed, 84 insertions(+), 89 deletions(-) diff --git a/dev/skeletons/skeleton_class.class.php b/dev/skeletons/skeleton_class.class.php index c36dad4b4b5..49937c40314 100644 --- a/dev/skeletons/skeleton_class.class.php +++ b/dev/skeletons/skeleton_class.class.php @@ -105,10 +105,8 @@ class Skeleton_Class extends CommonObject // want this action calls a trigger. //// Call triggers - //include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - //$interface=new Interfaces($this->db); - //$result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf); - //if ($result < 0) { $error++; $this->errors=$interface->errors; } + //$result=$this->call_trigger('MYOBJECT_CREATE',$user); + //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} //// End call triggers } } @@ -216,12 +214,10 @@ class Skeleton_Class extends CommonObject // want this action calls a trigger. //// Call triggers - //include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - //$interface=new Interfaces($this->db); - //$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf); - //if ($result < 0) { $error++; $this->errors=$interface->errors; } + //$result=$this->call_trigger('MYOBJECT_MODIFY',$user); + //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} //// End call triggers - } + } } // Commit or rollback @@ -264,12 +260,10 @@ class Skeleton_Class extends CommonObject // Uncomment this and change MYOBJECT to your own tag if you // want this action calls a trigger. - //// Call triggers - //include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - //$interface=new Interfaces($this->db); - //$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf); - //if ($result < 0) { $error++; $this->errors=$interface->errors; } - //// End call triggers + //// Call triggers + //$result=$this->call_trigger('MYOBJECT_DELETE',$user); + //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} + //// End call triggers } } diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index ac4c830fed2..b7e492de58e 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -667,12 +667,10 @@ class User extends CommonObject dol_syslog(get_class($this)."::setstatus sql=".$sql); if ($result) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('USER_ENABLEDISABLE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('USER_ENABLEDISABLE',$user); + if ($result < 0) { $error++; } + // End call triggers } if ($error) @@ -759,13 +757,16 @@ class User extends CommonObject if (! $error) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('USER_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers - + // Call trigger + $result=$this->call_trigger('USER_DELETE',$user); + if ($result < 0) + { + $error++; + $this->db->rollback(); + return -1; + } + // End call triggers + $this->db->commit(); return 1; } @@ -866,12 +867,10 @@ class User extends CommonObject if (! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface = new Interfaces($this->db); - $result = $interface->run_triggers('USER_CREATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('USER_CREATE',$user); + if ($result < 0) { $error++; } + // End call triggers } if (! $error) @@ -881,7 +880,7 @@ class User extends CommonObject } else { - $this->error=$interface->error; + //$this->error=$interface->error; dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); $this->db->rollback(); return -3; @@ -953,13 +952,11 @@ class User extends CommonObject dol_syslog(get_class($this)."::create_from_contact sql=".$sql, LOG_DEBUG); if ($resql) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface = new Interfaces($this->db); - $result = $interface->run_triggers('USER_CREATE_FROM_CONTACT',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers - + // Call trigger + $result=$this->call_trigger('USER_CREATE_FROM_CONTACT',$user); + if ($result < 0) { $error++; $this->db->rollback(); return -1; } + // End call triggers + $this->db->commit(); return $this->id; } @@ -1271,12 +1268,10 @@ class User extends CommonObject if (! $error && ! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('USER_MODIFY',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('USER_MODIFY',$user); + if ($result < 0) { $error++; } + // End call triggers } if (! $error) @@ -1286,7 +1281,6 @@ class User extends CommonObject } else { - $this->error=$this->db->lasterror(); dol_syslog(get_class($this)."::update error=".$this->error,LOG_ERR); $this->db->rollback(); return -1; @@ -1367,6 +1361,8 @@ class User extends CommonObject { if (! is_object($this->oldcopy)) $this->oldcopy=dol_clone($this); + $this->db->begin(); + $sql = "UPDATE ".MAIN_DB_PREFIX."user"; $sql.= " SET pass_crypted = '".$this->db->escape($password_crypted)."',"; $sql.= " pass_temp = null"; @@ -1420,23 +1416,24 @@ class User extends CommonObject if (! $error && ! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('USER_NEW_PASSWORD',$this,$user,$langs,$conf); - if ($result < 0) $this->errors=$interface->errors; - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('USER_NEW_PASSWORD',$user); + if ($result < 0) { $error++; $this->db->rollback(); return -1; } + // End call triggers } - + + $this->db->commit(); return $this->pass; } else { + $this->db->rollback(); return 0; } } else { + $this->db->rollback(); dol_print_error($this->db); return -1; } @@ -1677,12 +1674,10 @@ class User extends CommonObject { $this->newgroupid=$group; - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('USER_SETINGROUP',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('USER_SETINGROUP',$user); + if ($result < 0) { $error++; } + // End call triggers } if (! $error) @@ -1692,7 +1687,6 @@ class User extends CommonObject } else { - $this->error=$interface->error; dol_syslog(get_class($this)."::SetInGroup ".$this->error, LOG_ERR); $this->db->rollback(); return -2; @@ -1735,12 +1729,10 @@ class User extends CommonObject { $this->oldgroupid=$group; - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('USER_REMOVEFROMGROUP',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('USER_REMOVEFROMGROUP',$user); + if ($result < 0) { $error++; } + // End call triggers } if (! $error) diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index b43794a4b64..7a94ccc0a0d 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -547,12 +547,10 @@ class UserGroup extends CommonObject $result=$this->db->query($sql); if ($result) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('GROUP_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('GROUP_DELETE',$user); + if ($result < 0) { $error++; $this->db->rollback(); return -1; } + // End call triggers $this->db->commit(); return 1; @@ -583,6 +581,8 @@ class UserGroup extends CommonObject $entity=$this->entity; if (! empty($conf->multicompany->enabled) && $conf->entity == 1) $entity=$this->entity; + $this->db->begin(); + $sql = "INSERT INTO ".MAIN_DB_PREFIX."usergroup ("; $sql.= "datec"; $sql.= ", nom"; @@ -603,18 +603,18 @@ class UserGroup extends CommonObject if (! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('GROUP_CREATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('GROUP_CREATE',$user); + if ($result < 0) { $error++; $this->db->rollback(); return -1; } + // End call triggers } + $this->db->commit(); return $this->id; } else { + $this->db->rollback(); $this->error=$this->db->lasterror(); dol_syslog(get_class($this)."::create ".$this->error,LOG_ERR); return -1; @@ -639,6 +639,8 @@ class UserGroup extends CommonObject $entity=$this->entity; } + $this->db->begin(); + $sql = "UPDATE ".MAIN_DB_PREFIX."usergroup SET "; $sql.= " nom = '" . $this->db->escape($this->nom) . "'"; $sql.= ", entity = " . $this->db->escape($entity); @@ -651,19 +653,26 @@ class UserGroup extends CommonObject { if (! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('GROUP_MODIFY',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('GROUP_MODIFY',$user); + if ($result < 0) { $error++; } + // End call triggers } - if (! $error) return 1; - else return -$error; + if (! $error) + { + $this->db->commit(); + return 1; + } + else + { + $this->db->rollback(); + return -$error; + } } else { + $this->db->rollback(); dol_print_error($this->db); return -1; } From 7d30df42a25c4d89fd35c4bd308e60df14e9872f Mon Sep 17 00:00:00 2001 From: KreizIT Date: Thu, 3 Jul 2014 14:15:15 +0200 Subject: [PATCH 25/68] ChangeLog modification --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index ec144c6534b..2ab4929bc68 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,7 @@ For users: - New: Can filter events on a group of users. - New: Add thirdparty to filter on events. - Fix: [ bug #1487 ] PAYMENT_DELETE trigger does not intercept trigger action +- Fix: [ bug #1470, #1472, #1473] User trigger problem For translators: - Update language files. From a22963e4329cf73be2a22874fbfd9c4ca02a1ec6 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 3 Jul 2014 14:37:30 +0200 Subject: [PATCH 26/68] Fix : filter by status + was not working if desiredstock not defined --- htdocs/product/stock/replenish.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 0bfdbfb9159..ec4a98d3d2e 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -257,15 +257,16 @@ if ($usevirtualstock) $sqlCommandesCli.= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON (c.rowid = cd.fk_commande)"; $sqlCommandesCli.= " WHERE c.entity = ".$conf->entity; $sqlCommandesCli.= " AND cd.fk_product = p.rowid"; - $sqlCommandesCli.= " AND c.fk_statut in (1,2))"; + $sqlCommandesCli.= " AND c.fk_statut IN (1,2))"; $sqlExpeditionsCli = "(SELECT ".$db->ifsql("SUM(ed.qty) IS NULL", "0", "SUM(ed.qty)")." as qty"; $sqlExpeditionsCli.= " FROM ".MAIN_DB_PREFIX."expedition as e"; $sqlExpeditionsCli.= " LEFT JOIN ".MAIN_DB_PREFIX."expeditiondet as ed ON (ed.fk_expedition = e.rowid)"; $sqlExpeditionsCli.= " LEFT JOIN ".MAIN_DB_PREFIX."commandedet as cd ON (cd.rowid = ed.fk_origin_line)"; + $sqlExpeditionsCli.= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON (c.rowid = cd.fk_commande)"; $sqlExpeditionsCli.= " WHERE e.entity = ".$conf->entity; $sqlExpeditionsCli.= " AND cd.fk_product = p.rowid"; - $sqlExpeditionsCli.= " AND e.fk_statut > 0)"; + $sqlExpeditionsCli.= " AND c.fk_statut IN (1,2))"; $sqlCommandesFourn = "(SELECT ".$db->ifsql("SUM(cd.qty) IS NULL", "0", "SUM(cd.qty)")." as qty"; $sqlCommandesFourn.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd"; @@ -273,18 +274,18 @@ if ($usevirtualstock) $sqlCommandesFourn.= " WHERE c.rowid = cd.fk_commande"; $sqlCommandesFourn.= " AND c.entity = ".$conf->entity; $sqlCommandesFourn.= " AND cd.fk_product = p.rowid"; - $sqlCommandesFourn.= " AND c.fk_statut in (2,3))"; + $sqlCommandesFourn.= " AND c.fk_statut IN (3,4))"; $sqlReceptionFourn = "(SELECT ".$db->ifsql("SUM(fd.qty) IS NULL", "0", "SUM(fd.qty)")." as qty"; $sqlReceptionFourn.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf"; - $sqlReceptionFourn.= " LEFT JOIN ".MAIN_DB_PREFIX."commande_fournisseurdet as cfd ON (cfd.fk_commande = cf.rowid)"; $sqlReceptionFourn.= " LEFT JOIN ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as fd ON (fd.fk_commande = cf.rowid)"; $sqlReceptionFourn.= " WHERE cf.entity = ".$conf->entity; - $sqlReceptionFourn.= " AND fd.fk_product = p.rowid)"; + $sqlReceptionFourn.= " AND fd.fk_product = p.rowid"; + $sqlReceptionFourn.= " AND cf.fk_statut IN (3,4))"; - $sql.= ' HAVING ((p.desiredstock > 0 AND (p.desiredstock > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; + $sql.= ' HAVING ((('.$db->ifsql("p.desiredstock IS NULL", "0", "p.desiredstock").' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; $sql.= ' - ('.$sqlCommandesCli.' - '.$sqlExpeditionsCli.') + ('.$sqlCommandesFourn.' - '.$sqlReceptionFourn.')))'; - $sql.= ' OR (p.seuil_stock_alerte > 0 AND (p.seuil_stock_alerte > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; + $sql.= ' OR (p.seuil_stock_alerte >= 0 AND (p.seuil_stock_alerte > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; $sql.= ' - ('.$sqlCommandesCli.' - '.$sqlExpeditionsCli.') + ('.$sqlCommandesFourn.' - '.$sqlReceptionFourn.'))))'; if ($salert == 'on') // Option to see when stock is lower than alert From a26db9ab524010e9ddf6b2da1aa9f10353584bf4 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 3 Jul 2014 14:47:28 +0200 Subject: [PATCH 27/68] Fix : qty ordered was not including qty already received --- htdocs/product/stock/replenish.php | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index ec4a98d3d2e..ca014e50cf0 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -446,6 +446,9 @@ while ($i < ($limit ? min($num, $limit) : $num)) if (! empty($conf->global->STOCK_SUPPORTS_SERVICES) || $objp->fk_product_type == 0) { + $prod->fetch($objp->rowid); + $prod->load_stock(); + // Multilangs if (! empty($conf->global->MAIN_MULTILANGS)) { @@ -462,27 +465,21 @@ while ($i < ($limit ? min($num, $limit) : $num)) if (!empty($objtp->label)) $objp->label = $objtp->label; } } + $form = new Form($db); $var =! $var; - $prod->ref = $objp->ref; - $prod->id = $objp->rowid; - $prod->type = $objp->fk_product_type; - // Get number already ordered. - $ordered = ordered($prod->id); - - // Defined current stock number and warning if required if ($usevirtualstock) { // If option to increase/decrease is not on an object validation, virtual stock may differs from physical stock. - $prod->fetch($prod->id); - $prod->load_stock(); - $stock = $prod->stock_theorique; } else { - $stock = $objp->stock_physique; + $stock = $prod->stock_reel; } + + $ordered = $prod->stats_commande_fournisseur['qty']-$prod->stats_reception['qty']; + $warning=''; if ($objp->alertstock && ($stock < $objp->alertstock)) { From 174edb6140f26ecc86ffa8d33d5ff987e9c5c93f Mon Sep 17 00:00:00 2001 From: KreizIT Date: Thu, 3 Jul 2014 14:57:16 +0200 Subject: [PATCH 28/68] FIX: Intervention trigger --- ChangeLog | 1 + htdocs/fichinter/class/fichinter.class.php | 91 ++++++++-------------- 2 files changed, 32 insertions(+), 60 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2ab4929bc68..3cf736d8edf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,7 @@ For users: - New: Add thirdparty to filter on events. - Fix: [ bug #1487 ] PAYMENT_DELETE trigger does not intercept trigger action - Fix: [ bug #1470, #1472, #1473] User trigger problem +- Fix: [ bug #1489, #1491 ] Intervention trigger problem For translators: - Update language files. diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index d7bb50682fe..1aff2964eea 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -176,13 +176,10 @@ class Fichinter extends CommonObject if (! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('FICHINTER_CREATE',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } + // Call trigger + $result=$this->call_trigger('FICHINTER_CREATE',$user); + if ($result < 0) { $error++; } + // End call triggers } if (! $error) @@ -240,14 +237,10 @@ class Fichinter extends CommonObject if (! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('FICHINTER_MODIFY',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('FICHINTER_MODIFY',$user); + if ($result < 0) { $error++; $this->db->rollback(); return -1; } + // End call triggers } $this->db->commit(); @@ -454,14 +447,10 @@ class Fichinter extends CommonObject if (! $error) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('FICHINTER_VALIDATE',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('FICHINTER_VALIDATE',$user); + if ($result < 0) { $error++; } + // End call triggers } if (! $error) @@ -762,14 +751,10 @@ class Fichinter extends CommonObject if (! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('FICHINTER_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('FICHINTER_DELETE',$user); + if ($result < 0) { $error++; $this->db->rollback(); return -1; } + // End call triggers } $this->db->commit(); @@ -1137,14 +1122,10 @@ class FichinterLigne if (! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $resulttrigger=$interface->run_triggers('LINEFICHINTER_CREATE',$this,$user,$langs,$conf); - if ($resulttrigger < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('LINEFICHINTER_CREATE',$user); + if ($result < 0) { $error++; } + // End call triggers } } @@ -1199,14 +1180,10 @@ class FichinterLigne if (! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $resulttrigger=$interface->run_triggers('LINEFICHINTER_UPDATE',$this,$user,$langs,$conf); - if ($resulttrigger < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('LINEFICHINTER_UPDATE',$user); + if ($result < 0) { $error++; } + // End call triggers } } @@ -1217,7 +1194,6 @@ class FichinterLigne } else { - $this->error=$this->db->lasterror(); dol_syslog("FichinterLigne::update Error ".$this->error, LOG_ERR); $this->db->rollback(); return -1; @@ -1309,21 +1285,16 @@ class FichinterLigne $result = $this->update_total(); if ($result > 0) { - $this->db->commit(); - if (! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $resulttrigger=$interface->run_triggers('LINEFICHINTER_DELETE',$this,$user,$langs,$conf); - if ($resulttrigger < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('LINEFICHINTER_DELETE',$user); + if ($result < 0) { $error++; $this->db->rollback(); return -1; } + // End call triggers } - - return $result; + + $this->db->commit(); + return $result; } else { From 685b7b23adfc6d4225be147042ccd3a50e84d7bc Mon Sep 17 00:00:00 2001 From: KreizIT Date: Thu, 3 Jul 2014 15:09:46 +0200 Subject: [PATCH 29/68] FIX: Member's trigger problem --- ChangeLog | 1 + htdocs/adherents/class/adherent.class.php | 75 ++++++++++------------- 2 files changed, 34 insertions(+), 42 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3cf736d8edf..20ac8a3dff5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,7 @@ For users: - Fix: [ bug #1487 ] PAYMENT_DELETE trigger does not intercept trigger action - Fix: [ bug #1470, #1472, #1473] User trigger problem - Fix: [ bug #1489, #1491 ] Intervention trigger problem +- Fix: [ bug #1492, #1493 ] Member trigger problem For translators: - Update language files. diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index b03bff940dd..99b4e7df1f4 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -347,12 +347,10 @@ class Adherent extends CommonObject if (! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('MEMBER_CREATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('MEMBER_CREATE',$user); + if ($result < 0) { $error++; } + // End call triggers } if (count($this->errors)) @@ -599,12 +597,10 @@ class Adherent extends CommonObject if (! $error && ! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('MEMBER_MODIFY',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('MEMBER_MODIFY',$user); + if ($result < 0) { $error++; } + // End call triggers } } @@ -782,12 +778,10 @@ class Adherent extends CommonObject if (! $error) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('MEMBER_DELETE',$this,$user,$langs,$conf); - if ($result < 0) {$error++; $this->errors=$interface->errors;} - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('MEMBER_DELETE',$user); + if ($result < 0) { $error++; } + // End call triggers } @@ -841,6 +835,8 @@ class Adherent extends CommonObject $password_indatabase = $password; } + $this->db->begin(); + // Mise a jour $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET pass = '".$this->db->escape($password_indatabase)."'"; $sql.= " WHERE rowid = ".$this->id; @@ -885,23 +881,24 @@ class Adherent extends CommonObject if (! $error && ! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('MEMBER_NEW_PASSWORD',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('MEMBER_NEW_PASSWORD',$user); + if ($result < 0) { $error++; $this->db->rollback(); return -1; } + // End call triggers } + $this->db->commit(); return $this->pass; } else { + $this->db->rollback(); return 0; } } else { + $this->db->rollback(); dol_print_error($this->db); return -1; } @@ -1301,12 +1298,10 @@ class Adherent extends CommonObject $this->last_subscription_date_start=$date; $this->last_subscription_date_end=$datefin; - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('MEMBER_SUBSCRIPTION',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('MEMBER_SUBSCRIPTION',$user); + if ($result < 0) { $error++; } + // End call triggers } if (! $error) @@ -1362,12 +1357,10 @@ class Adherent extends CommonObject { $this->statut=1; - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('MEMBER_VALIDATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('MEMBER_VALIDATE',$user); + if ($result < 0) { $error++; $this->db->rollback(); return -1; } + // End call triggers $this->db->commit(); return 1; @@ -1412,12 +1405,10 @@ class Adherent extends CommonObject { $this->statut=0; - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('MEMBER_RESILIATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('MEMBER_RESILIATE',$user); + if ($result < 0) { $error++; $this->db->rollback(); return -1; } + // End call triggers $this->db->commit(); return 1; From f0323e5b802a862b04aef0ed4ab922c55db7bf63 Mon Sep 17 00:00:00 2001 From: KreizIT Date: Thu, 3 Jul 2014 15:21:43 +0200 Subject: [PATCH 30/68] FIX: Contract's trigger problem --- ChangeLog | 1 + htdocs/contrat/class/contrat.class.php | 89 ++++++++++++-------------- 2 files changed, 41 insertions(+), 49 deletions(-) diff --git a/ChangeLog b/ChangeLog index 20ac8a3dff5..81ec4b5c1e5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,7 @@ For users: - Fix: [ bug #1470, #1472, #1473] User trigger problem - Fix: [ bug #1489, #1491 ] Intervention trigger problem - Fix: [ bug #1492, #1493 ] Member trigger problem +- Fix: [ bug #1474, #1475 ] Contract trigger problem For translators: - Update language files. diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index daf22e0af7c..960d84c65d6 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -158,12 +158,10 @@ class Contrat extends CommonObject $resql = $this->db->query($sql); if ($resql) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('CONTRACT_SERVICE_ACTIVATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('CONTRACT_SERVICE_ACTIVATE',$user); + if ($result < 0) { $error++; $this->db->rollback(); return -1; } + // End call triggers $this->db->commit(); return 1; @@ -206,12 +204,10 @@ class Contrat extends CommonObject $resql = $this->db->query($sql); if ($resql) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('CONTRACT_SERVICE_CLOSE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('CONTRACT_SERVICE_CLOSE',$user); + if ($result < 0) { $error++; $this->db->rollback(); return -1; } + // End call triggers $this->db->commit(); return 1; @@ -322,6 +318,7 @@ class Contrat extends CommonObject dol_syslog(get_class($this)."::validate Echec update - 10 - sql=".$sql, LOG_ERR); dol_print_error($this->db); $error++; + $this->error=$this->db->lasterror(); } if (! $error) @@ -365,12 +362,10 @@ class Contrat extends CommonObject // Trigger calls if (! $error) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('CONTRACT_VALIDATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('CONTRACT_VALIDATE',$user); + if ($result < 0) { $error++; } + // End call triggers } } else @@ -386,7 +381,6 @@ class Contrat extends CommonObject else { $this->db->rollback(); - $this->error=$this->db->lasterror(); return -1; } @@ -756,12 +750,10 @@ class Contrat extends CommonObject if (! $error) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('CONTRACT_CREATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('CONTRACT_CREATE',$user); + if ($result < 0) { $error++; } + // End call triggers if (! $error) { @@ -776,7 +768,6 @@ class Contrat extends CommonObject } else { - $this->error=$interface->error; dol_syslog(get_class($this)."::create - 30 - ".$this->error, LOG_ERR); $this->db->rollback(); @@ -903,14 +894,10 @@ class Contrat extends CommonObject if (! $error) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('CONTRACT_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('CONTRACT_DELETE',$user); + if ($result < 0) { $error++; } + // End call triggers } if (! $error) @@ -938,8 +925,7 @@ class Contrat extends CommonObject return 1; } else - { - $this->error=$this->db->error(); + { dol_syslog(get_class($this)."::delete ERROR ".$this->error, LOG_ERR); $this->db->rollback(); return -1; @@ -1255,6 +1241,9 @@ class Contrat extends CommonObject if ($this->statut >= 0) { + + $this->db->begin(); + $sql = "DELETE FROM ".MAIN_DB_PREFIX."contratdet"; $sql.= " WHERE rowid=".$idline; @@ -1264,16 +1253,16 @@ class Contrat extends CommonObject { $this->error="Error ".$this->db->lasterror(); dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); + $this->db->rollback(); return -1; } - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('LINECONTRACT_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('LINECONTRACT_DELETE',$user); + if ($result < 0) { $error++; $this->db->rollback(); return -1; } + // End call triggers + $this->db->commit(); return 1; } else @@ -2064,6 +2053,8 @@ class ContratLigne $this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100); } + $this->db->begin(); + // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET"; $sql.= " fk_contrat='".$this->fk_contrat."',"; @@ -2111,19 +2102,19 @@ class ContratLigne { $this->error="Error ".$this->db->lasterror(); dol_syslog(get_class($this)."::update ".$this->error, LOG_ERR); + $this->db->rollback(); return -1; } if (! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('LINECONTRACT_UPDATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('LINECONTRACT_UPDATE',$user); + if ($result < 0) { $error++; $this->db->rollback(); return -1; } + // End call triggers } - + + $this->db->commit(); return 1; } From 51e4fa0d3613629347a7df1a51c06441584412c2 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 3 Jul 2014 15:31:51 +0200 Subject: [PATCH 31/68] Fix : picto for already ordered product was missing --- htdocs/product/stock/replenish.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index ca014e50cf0..817ec5cbf7a 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -489,6 +489,19 @@ while ($i < ($limit ? min($num, $limit) : $num)) //depending on conf, use either physical stock or //virtual stock to compute the stock to buy value $stocktobuy = max(max($objp->desiredstock, $objp->alertstock) - $stock - $ordered, 0); + $disabled = ''; + if($ordered > 0) { + $compare = $usevirtualstock ? $stock : $stock + $ordered; + if($compare >= $objp->desiredstock) { + $picto = img_picto('', './img/yes', '', 1); + $disabled = 'disabled="disabled"'; + } + else { + $picto = img_picto('', './img/no', '', 1); + } + } else { + $picto = img_picto('', './img/no', '', 1); + } print ''; From 538cf90f5e8f550e0a9bd43568a34ec60291434f Mon Sep 17 00:00:00 2001 From: KreizIT Date: Thu, 3 Jul 2014 15:39:40 +0200 Subject: [PATCH 32/68] FIX : [ bug #1496 ] ACTION_DELETE trigger does not show trigger error -Add ACTION_* trigger in interface_90_all --- ChangeLog | 2 ++ htdocs/comm/action/class/actioncomm.class.php | 36 +++++++------------ htdocs/comm/action/fiche.php | 3 +- .../interface_90_all_Demo.class.php-NORUN | 16 +++++++++ 4 files changed, 31 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index 81ec4b5c1e5..02f58dedd5f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,8 @@ For users: - Fix: [ bug #1489, #1491 ] Intervention trigger problem - Fix: [ bug #1492, #1493 ] Member trigger problem - Fix: [ bug #1474, #1475 ] Contract trigger problem +- Fix: [ bug #1496 ] ACTION_DELETE trigger does not show trigger error + For translators: - Update language files. diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index ee9e4c032ee..139ab2d048a 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -227,14 +227,10 @@ class ActionComm extends CommonObject if (! $error && ! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('ACTION_CREATE',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('ACTION_CREATE',$user); + if ($result < 0) { $error++; } + // End call triggers } if (! $error) @@ -390,14 +386,10 @@ class ActionComm extends CommonObject { if (! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('ACTION_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('ACTION_DELETE',$user); + if ($result < 0) { $error++; } + // End call triggers } if (! $error) @@ -500,14 +492,10 @@ class ActionComm extends CommonObject if (! $notrigger) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('ACTION_MODIFY',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('ACTION_MODIFY',$user); + if ($result < 0) { $error++; } + // End call triggers } if (! $error) diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index 450d7475947..ca17c261680 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -283,8 +283,7 @@ if ($action == 'confirm_delete' && GETPOST("confirm") == 'yes') } else { - $mesg=$object->error; - setEventMessage($mesg,'errors'); + setEventMessage($object->error,'errors'); } } } diff --git a/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN b/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN index f0f96961b86..f3811afc45b 100644 --- a/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN +++ b/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN @@ -119,6 +119,8 @@ class InterfaceDemo } elseif ($action == 'USER_CREATE') { + $object->error=$action; + return -1; dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); } elseif ($action == 'USER_CREATE_FROM_CONTACT') @@ -154,6 +156,20 @@ class InterfaceDemo dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); } + // Action + elseif ($action == 'ACTION_MODIFY') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'ACTION_CREATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'ACTION_DELETE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + // Groups elseif ($action == 'GROUP_CREATE') { From 07f2d9474e6c158690a4f99de4661d6e948da1ed Mon Sep 17 00:00:00 2001 From: KreizIT Date: Thu, 3 Jul 2014 15:52:37 +0200 Subject: [PATCH 33/68] FIX: [ bug #1494 ] CATEGORY_CREATE and CATEGORY_MODIFY triggers do not intercept trigger action --- ChangeLog | 1 + htdocs/categories/class/categorie.class.php | 96 +++++++++++++-------- 2 files changed, 60 insertions(+), 37 deletions(-) diff --git a/ChangeLog b/ChangeLog index 02f58dedd5f..14f7129bb70 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,7 @@ For users: - Fix: [ bug #1492, #1493 ] Member trigger problem - Fix: [ bug #1474, #1475 ] Contract trigger problem - Fix: [ bug #1496 ] ACTION_DELETE trigger does not show trigger error +- Fix: [ bug #1494 ] CATEGORY_CREATE and CATEGORY_MODIFY triggers do not intercept trigger action For translators: diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 8d2c4ceed46..6eecb1370d6 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -212,16 +212,22 @@ class Categorie extends CommonObject } } else if ($reshook < 0) $error++; + + // Call trigger + $result=$this->call_trigger('CATEGORY_CREATE',$user); + if ($result < 0) { $error++; } + // End call triggers - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('CATEGORY_CREATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers - - $this->db->commit(); - return $id; + if ( ! $error ) + { + $this->db->rollback(); + return -3; + } + else + { + $this->db->commit(); + return $id; + } } else { @@ -303,12 +309,10 @@ class Categorie extends CommonObject $this->db->commit(); - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('CATEGORY_MODIFY',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('CATEGORY_MODIFY',$user); + if ($result < 0) { $error++; $this->db->rollback(); return -1; } + // End call triggers return 1; } @@ -432,12 +436,10 @@ class Categorie extends CommonObject } } } - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('CATEGORY_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; $this->error=join(',',$this->errors); } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('CATEGORY_DELETE',$user); + if ($result < 0) { $error++; } + // End call triggers } } @@ -477,6 +479,8 @@ class Categorie extends CommonObject if ($type=='contact') $column_name='socpeople'; if ($type=='fournisseur') $column_name='societe'; + $this->db->begin(); + $sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie_".$type." (fk_categorie, fk_".$column_name.")"; $sql .= " VALUES (".$this->id.", ".$obj->id.")"; @@ -517,6 +521,7 @@ class Categorie extends CommonObject if ($error) { + $this->db->rollback(); return -1; } } @@ -524,18 +529,26 @@ class Categorie extends CommonObject // Save object we want to link category to into category instance to provide information to trigger $this->linkto=$obj; - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('CATEGORY_LINK',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; $this->error=$interface->error; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('CATEGORY_LINK',$user); + if ($result < 0) { $error++; } + // End call triggers - if (! $error) return 1; - else return -2; + if (! $error) + { + $this->db->commit(); + return 1; + } + else + { + $this->db->rollback(); + return -2; + } + } else { + $this->db->rollback(); if ($this->db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $this->error=$this->db->lasterrno(); @@ -570,6 +583,8 @@ class Categorie extends CommonObject $column_name=$type; if ($type=='contact') $column_name='socpeople'; if ($type=='fournisseur') $column_name='societe'; + + $this->db->begin(); $sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_".$type; $sql .= " WHERE fk_categorie = ".$this->id; @@ -581,18 +596,25 @@ class Categorie extends CommonObject // Save object we want to unlink category off into category instance to provide information to trigger $this->unlinkoff=$obj; - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('CATEGORY_UNLINK',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('CATEGORY_UNLINK',$user); + if ($result < 0) { $error++; } + // End call triggers - if (! $error) return 1; - else return -2; + if (! $error) + { + $this->db->commit(); + return 1; + } + else + { + $this->db->rollback(); + return -2; + } } else { + $this->db->rollback(); $this->error=$this->db->lasterror(); return -1; } From 023e7ce8ce33935baeef2864a50467e8804749ec Mon Sep 17 00:00:00 2001 From: KreizIT Date: Thu, 3 Jul 2014 16:04:12 +0200 Subject: [PATCH 34/68] FIX : [ bug #1502 ] DON_CREATE trigger does not intercept trigger action - Add DON_CREATE in interface_90_all - Add new trigger DON_UPDATE, DON_DELETE --- ChangeLog | 2 ++ htdocs/compta/dons/class/don.class.php | 34 ++++++++++++++----- .../interface_90_all_Demo.class.php-NORUN | 16 +++++++++ 3 files changed, 44 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 14f7129bb70..26ded2e941d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,7 @@ For users: - Fix: [ bug #1474, #1475 ] Contract trigger problem - Fix: [ bug #1496 ] ACTION_DELETE trigger does not show trigger error - Fix: [ bug #1494 ] CATEGORY_CREATE and CATEGORY_MODIFY triggers do not intercept trigger action +- Fix: [ bug #1502 ] DON_CREATE trigger does not intercept trigger action For translators: @@ -23,6 +24,7 @@ For translators: For developers: - New: Add hook "searchAgendaFrom". +- New: Add trigger DON_UPDATE, DON_DELETE ***** ChangeLog for 3.6 compared to 3.5.* ***** diff --git a/htdocs/compta/dons/class/don.class.php b/htdocs/compta/dons/class/don.class.php index f7bd819d969..c9580fcf5c0 100644 --- a/htdocs/compta/dons/class/don.class.php +++ b/htdocs/compta/dons/class/don.class.php @@ -307,6 +307,8 @@ class Don extends CommonObject $this->country=($this->country?$this->country:$this->country); $now=dol_now(); + + $this->db->begin(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."don ("; $sql.= "datec"; @@ -360,19 +362,17 @@ class Don extends CommonObject { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."don"); - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('DON_CREATE',$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('DON_CREATE',$user); + if ($result < 0) { $error++; $this->db->rollback(); return -1; } + // End call triggers + $this->db->commit(); return $this->id; } else { + $this->db->rollback(); dol_print_error($this->db); return -1; } @@ -393,6 +393,8 @@ class Don extends CommonObject $this->country_id=($this->country_id>0?$this->country_id:$this->country_id); $this->country=($this->country?$this->country:$this->country); + $this->db->begin(); + $sql = "UPDATE ".MAIN_DB_PREFIX."don SET "; $sql .= "amount = " . price2num($this->amount); $sql .= ",fk_paiement = ".($this->modepaiementid?$this->modepaiementid:"null"); @@ -418,10 +420,17 @@ class Don extends CommonObject $result = $this->db->query($sql); if ($result) { + // Call trigger + $result=$this->call_trigger('DON_UPDATE',$user); + if ($result < 0) { $error++; $this->db->rollback(); return -1; } + // End call triggers + + $this->db->commit(); return 1; } else { + $this->db->rollback(); dol_print_error($this->db); return -1; } @@ -435,6 +444,8 @@ class Don extends CommonObject */ function delete($rowid) { + + $this->db-begin(); $sql = "DELETE FROM ".MAIN_DB_PREFIX."don WHERE rowid = $rowid AND fk_statut = 0;"; @@ -443,10 +454,17 @@ class Don extends CommonObject { if ( $this->db->affected_rows($resql) ) { + // Call trigger + $result=$this->call_trigger('DON_DELETE',$user); + if ($result < 0) { $error++; $this->db->rollback(); return -1; } + // End call triggers + + $this->db->commit(); return 1; } else { + $this->db->rollback(); return -1; } } diff --git a/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN b/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN index f3811afc45b..62b758739c7 100644 --- a/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN +++ b/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN @@ -503,6 +503,22 @@ class InterfaceDemo { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); } + + //Donation + elseif ($action == 'DON_CREATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'DON_UPDATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'DON_DELETE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + + // Interventions elseif ($action == 'FICHINTER_CREATE') From e0201535e26cb067e0cf3c9d2efffd3cf423b9c3 Mon Sep 17 00:00:00 2001 From: KreizIT Date: Thu, 3 Jul 2014 17:15:42 +0200 Subject: [PATCH 35/68] Fix: [ bug #1505, #1504] Project trigger problem --- ChangeLog | 1 + htdocs/projet/class/project.class.php | 84 ++++++++++++--------------- htdocs/projet/class/task.class.php | 68 +++++++++++----------- htdocs/projet/fiche.php | 3 +- htdocs/projet/tasks.php | 7 +++ htdocs/projet/tasks/task.php | 6 ++ htdocs/projet/tasks/time.php | 2 +- 7 files changed, 89 insertions(+), 82 deletions(-) diff --git a/ChangeLog b/ChangeLog index 26ded2e941d..b6c474f6f92 100644 --- a/ChangeLog +++ b/ChangeLog @@ -17,6 +17,7 @@ For users: - Fix: [ bug #1496 ] ACTION_DELETE trigger does not show trigger error - Fix: [ bug #1494 ] CATEGORY_CREATE and CATEGORY_MODIFY triggers do not intercept trigger action - Fix: [ bug #1502 ] DON_CREATE trigger does not intercept trigger action +- Fix: [ bug #1505, #1504] Project trigger problem For translators: diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index c2b8b95f608..82e9dd72874 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -130,15 +130,9 @@ class Project extends CommonObject if (!$notrigger) { - // Call triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface = new Interfaces($this->db); - $result = $interface->run_triggers('PROJECT_CREATE', $this, $user, $langs, $conf); - if ($result < 0) - { - $error++; - $this->errors = $interface->errors; - } + // Call trigger + $result=$this->call_trigger('PROJECT_CREATE',$user); + if ($result < 0) { $error++; } // End call triggers } } @@ -199,6 +193,8 @@ class Project extends CommonObject if (dol_strlen(trim($this->ref)) > 0) { + $this->db->begin(); + $sql = "UPDATE " . MAIN_DB_PREFIX . "projet SET"; $sql.= " ref='" . $this->db->escape($this->ref) . "'"; $sql.= ", title = '" . $this->db->escape($this->title) . "'"; @@ -216,15 +212,9 @@ class Project extends CommonObject { if (!$notrigger) { - // Call triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface = new Interfaces($this->db); - $result = $interface->run_triggers('PROJECT_MODIFY', $this, $user, $langs, $conf); - if ($result < 0) - { - $error++; - $this->errors = $interface->errors; - } + // Call trigger + $result=$this->call_trigger('PROJECT_MODIFY',$user); + if ($result < 0) { $error++; } // End call triggers } @@ -259,13 +249,24 @@ class Project extends CommonObject } } } + if (! $error ) + { + $this->db->commit(); + $result = 1; + } + else + { + $this->db->rollback(); + $result = -1; + } - $result = 1; + } else { $this->error = $this->db->lasterror(); dol_syslog(get_class($this)."::Update error -2 " . $this->error, LOG_ERR); + $this->db->rollback(); $result = -2; } } @@ -528,17 +529,18 @@ class Project extends CommonObject if (!$notrigger) { - // Call triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface = new Interfaces($this->db); - $result = $interface->run_triggers('PROJECT_DELETE', $this, $user, $langs, $conf); + // Call trigger + $result=$this->call_trigger('PROJECT_DELETE',$user); if ($result < 0) { $error++; - foreach ($interface->errors as $errmsg ) { - dol_syslog(get_class($this) . "::delete " . $errmsg, LOG_ERR); - $this->errors[] =$errmsg; - } + if (! empty($interface->errors)) + { + foreach ($interface->errors as $errmsg ) { + dol_syslog(get_class($this) . "::delete " . $errmsg, LOG_ERR); + $this->errors[] =$errmsg; + } + } } // End call triggers } @@ -587,16 +589,10 @@ class Project extends CommonObject $resql = $this->db->query($sql); if ($resql) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface = new Interfaces($this->db); - $result = $interface->run_triggers('PROJECT_VALIDATE', $this, $user, $langs, $conf); - if ($result < 0) - { - $error++; - $this->errors = $interface->errors; - } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('PROJECT_VALIDATE',$user); + if ($result < 0) { $error++; } + // End call triggers if (!$error) { @@ -648,16 +644,10 @@ class Project extends CommonObject $resql = $this->db->query($sql); if ($resql) { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface = new Interfaces($this->db); - $result = $interface->run_triggers('PROJECT_CLOSE', $this, $user, $langs, $conf); - if ($result < 0) - { - $error++; - $this->errors = $interface->errors; - } - // Fin appel triggers + // Call trigger + $result=$this->call_trigger('PROJECT_CLOSE',$user); + if ($result < 0) { $error++; } + // End call triggers if (!$error) { diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 697d773f02c..5dc3a6fd52e 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -133,11 +133,9 @@ class Task extends CommonObject if (! $notrigger) { - // Call triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('TASK_CREATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } + // Call trigger + $result=$this->call_trigger('TASK_CREATE',$user); + if ($result < 0) { $error++; } // End call triggers } } @@ -303,11 +301,9 @@ class Task extends CommonObject { if (! $notrigger) { - // Call triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('TASK_MODIFY',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } + // Call trigger + $result=$this->call_trigger('TASK_MODIFY',$user); + if ($result < 0) { $error++; } // End call triggers } } @@ -394,11 +390,9 @@ class Task extends CommonObject { if (! $notrigger) { - // Call triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('TASK_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } + // Call trigger + $result=$this->call_trigger('TASK_DELETE',$user); + if ($result < 0) { $error++; } // End call triggers } } @@ -744,11 +738,12 @@ class Task extends CommonObject { global $conf,$langs; - $error=0; $ret = 0; // Clean parameters if (isset($this->timespent_note)) $this->timespent_note = trim($this->timespent_note); + + $this->db->begin(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."projet_task_time ("; $sql.= "fk_task"; @@ -772,11 +767,9 @@ class Task extends CommonObject if (! $notrigger) { - // Call triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('TASK_TIMESPENT_CREATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } + // Call trigger + $result=$this->call_trigger('TASK_TIMESPENT_CREATE',$user); + if ($result < 0) { $this->db->rollback(); $ret=-1; } // End call triggers } } @@ -784,6 +777,7 @@ class Task extends CommonObject { $this->error=$this->db->lasterror(); dol_syslog(get_class($this)."::addTimeSpent error -1 ".$this->error,LOG_ERR); + $this->db->rollback(); $ret = -1; } @@ -798,6 +792,7 @@ class Task extends CommonObject { $this->error=$this->db->lasterror(); dol_syslog(get_class($this)."::addTimeSpent error -2 ".$this->error, LOG_ERR); + $this->db->rollback(); $ret = -2; } } @@ -813,10 +808,12 @@ class Task extends CommonObject { $this->error=$this->db->lasterror(); dol_syslog(get_class($this)."::addTimeSpent error -2 ".$this->error, LOG_ERR); + $this->db->rollback(); $ret = -2; } } + if ($ret >=0) $this->db->commit(); return $ret; } @@ -879,11 +876,12 @@ class Task extends CommonObject { global $conf,$langs; - $error=0; $ret = 0; // Clean parameters if (isset($this->timespent_note)) $this->timespent_note = trim($this->timespent_note); + + $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task_time SET"; $sql.= " task_date = '".$this->db->idate($this->timespent_date)."',"; @@ -897,19 +895,23 @@ class Task extends CommonObject { if (! $notrigger) { - // Call triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('TASK_TIMESPENT_MODIFY',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } + // Call trigger + $result=$this->call_trigger('TASK_TIMESPENT_MODIFY',$user); + if ($result < 0) + { + $this->db->rollback(); + $ret = -1; + } + else $ret = 1; // End call triggers } - $ret = 1; + else $ret = 1; } else { $this->error=$this->db->lasterror(); dol_syslog(get_class($this)."::updateTimeSpent error -1 ".$this->error,LOG_ERR); + $this->db->rollback(); $ret = -1; } @@ -925,11 +927,13 @@ class Task extends CommonObject if (! $this->db->query($sql) ) { $this->error=$this->db->lasterror(); + $this->db->rollback(); dol_syslog(get_class($this)."::addTimeSpent error -2 ".$this->error, LOG_ERR); $ret = -2; } } + if ($ret >= 0) $this->db->commit(); return $ret; } @@ -959,11 +963,9 @@ class Task extends CommonObject { if (! $notrigger) { - // Call triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('TASK_TIMESPENT_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } + // Call trigger + $result=$this->call_trigger('TASK_TIMESPENT_DELETE',$user); + if ($result < 0) { $error++; } // End call triggers } } diff --git a/htdocs/projet/fiche.php b/htdocs/projet/fiche.php index 123b4a611b4..00fdf65d15a 100644 --- a/htdocs/projet/fiche.php +++ b/htdocs/projet/fiche.php @@ -340,7 +340,8 @@ if (empty($reshook)) else { dol_syslog($object->error,LOG_DEBUG); - $mesg='
'.$langs->trans("CantRemoveProject").'
'; + setEventMessage($object->error,'errors'); + setEventMessage($object->errors,'errors'); } } diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 356eed55e6d..7c94401f861 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -130,6 +130,11 @@ if ($action == 'createtask' && $user->rights->projet->creer) if ($taskid > 0) { $result = $task->add_contact($_POST["userid"], 'TASKEXECUTIVE', 'internal'); + } + else + { + setEventMessage($task->error,'errors'); + setEventMessage($task->errors,'errors'); } } @@ -193,6 +198,8 @@ if ($id > 0 || ! empty($ref)) $head=project_prepare_head($object); dol_fiche_head($head, $tab, $langs->trans("Project"),0,($object->public?'projectpub':'project')); + + dol_htmloutput_mesg(); $param=($mode=='mine'?'&mode=mine':''); diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index dd83cf57d8f..14339291c4c 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -91,6 +91,12 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->projet->creer) $ret = $extrafields->setOptionalsFromPost($extralabels,$object); $result=$object->update($user); + + if ($result < 0) + { + setEventMessage($object->error,'errors'); + setEventMessage($object->errors,'errors'); + } } else { diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index f6c5a1840ea..f6430ff4f55 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -140,7 +140,7 @@ if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->projet->c $object->fetchTimeSpent($_GET['lineid']); $result = $object->delTimeSpent($user); - if (!$result) + if ($result < 0) { $langs->load("errors"); setEventMessage($langs->trans($object->error),'errors'); From f2248d5bc887b66b9254f315992d5c8eadc19952 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 3 Jul 2014 17:57:36 +0200 Subject: [PATCH 36/68] Fix : ordered should display qty in supplier order not yet send --- htdocs/product/stock/replenish.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 817ec5cbf7a..590260a7c99 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -478,21 +478,21 @@ while ($i < ($limit ? min($num, $limit) : $num)) $stock = $prod->stock_reel; } - $ordered = $prod->stats_commande_fournisseur['qty']-$prod->stats_reception['qty']; + $ordered = $prod->stats_commande_fournisseur['qty']; $warning=''; - if ($objp->alertstock && ($stock < $objp->alertstock)) + + if ($objp->seuil_stock_alerte && ($stock < $objp->seuil_stock_alerte)) { $warning = img_warning($langs->trans('StockTooLow')) . ' '; } - //depending on conf, use either physical stock or //virtual stock to compute the stock to buy value - $stocktobuy = max(max($objp->desiredstock, $objp->alertstock) - $stock - $ordered, 0); + //echo $objp->desiredstock." * ".$stock." * ".$ordered."
"; + $stocktobuy = max($objp->desiredstock - $stock - $ordered, 0); $disabled = ''; if($ordered > 0) { - $compare = $usevirtualstock ? $stock : $stock + $ordered; - if($compare >= $objp->desiredstock) { + if($stock + $ordered >= $objp->desiredstock) { $picto = img_picto('', './img/yes', '', 1); $disabled = 'disabled="disabled"'; } From 8eb8f33f28850a8f8be69c0d61540c33caf475ce Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 3 Jul 2014 18:14:26 +0200 Subject: [PATCH 37/68] =?UTF-8?q?Ajout=20qt=C3=A9=20dans=20=C3=A9cran=20co?= =?UTF-8?q?nsommation=20produit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/product/stats/commande.php | 4 +++- htdocs/product/stats/commande_fournisseur.php | 4 +++- htdocs/product/stats/facture.php | 4 +++- htdocs/product/stats/facture_fournisseur.php | 4 +++- htdocs/product/stats/propal.php | 4 +++- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php index b19c3c7fd68..97e9a612ae1 100644 --- a/htdocs/product/stats/commande.php +++ b/htdocs/product/stats/commande.php @@ -118,7 +118,7 @@ if ($id > 0 || ! empty($ref)) $sql = "SELECT distinct s.nom, s.rowid as socid, s.code_client, c.rowid, c.total_ht as total_ht, c.ref,"; - $sql.= " c.date_commande, c.fk_statut as statut, c.facture, c.rowid as commandeid"; + $sql.= " c.date_commande, c.fk_statut as statut, c.facture, c.rowid as commandeid, d.qty"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user "; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."commande as c"; @@ -148,6 +148,7 @@ if ($id > 0 || ! empty($ref)) print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&id=".$product->id,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("CustomerCode"),$_SERVER["PHP_SELF"],"s.code_client","","&id=".$product->id,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("OrderDate"),$_SERVER["PHP_SELF"],"c.date_commande","","&id=".$product->id,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Qty"),$_SERVER["PHP_SELF"],"d.qty","","&id=".$product->id,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"c.total_ht","","&id=".$product->id,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"c.fk_statut","","&id=".$product->id,'align="right"',$sortfield,$sortorder); print "
\n"; @@ -170,6 +171,7 @@ if ($id > 0 || ! empty($ref)) print "\n"; print ""; + print "\n"; print "\n"; print ''; print "\n"; diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php index 69845b4b264..22e3e2b30ba 100644 --- a/htdocs/product/stats/commande_fournisseur.php +++ b/htdocs/product/stats/commande_fournisseur.php @@ -111,7 +111,7 @@ if ($id > 0 || ! empty($ref)) $sql = "SELECT distinct s.nom, s.rowid as socid, s.code_client,"; $sql.= " c.rowid, c.total_ht as total_ht, c.ref,"; - $sql.= " c.date_commande, c.fk_statut as statut, c.rowid as commandeid"; + $sql.= " c.date_commande, c.fk_statut as statut, c.rowid as commandeid, d.qty"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as c"; @@ -141,6 +141,7 @@ if ($id > 0 || ! empty($ref)) print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&id=".$product->id,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("SupplierCode"),$_SERVER["PHP_SELF"],"s.code_client","","&id=".$product->id,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("OrderDate"),$_SERVER["PHP_SELF"],"c.date_commande","","&id=".$product->id,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Qty"),$_SERVER["PHP_SELF"],"d.qty","","&id=".$product->id,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"c.total_ht","","&id=".$product->id,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"c.fk_statut","","&id=".$product->id,'align="right"',$sortfield,$sortorder); print "\n"; @@ -165,6 +166,7 @@ if ($id > 0 || ! empty($ref)) print ''; print "\n"; print '"; + print "\n"; print '\n"; print ''; print "\n"; diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index cac2bccc45b..dc65764defd 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -122,7 +122,7 @@ if ($id > 0 || ! empty($ref)) $sql = "SELECT distinct s.nom, s.rowid as socid, s.code_client,"; $sql.= " f.facnumber, f.total as total_ht,"; - $sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid"; + $sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid, d.qty"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user "; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."facture as f"; @@ -152,6 +152,7 @@ if ($id > 0 || ! empty($ref)) print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&id=".$product->id,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("CustomerCode"),$_SERVER["PHP_SELF"],"s.code_client","","&id=".$product->id,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateInvoice"),$_SERVER["PHP_SELF"],"f.datef","","&id=".$product->id,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Qty"),$_SERVER["PHP_SELF"],"d.qty","","&id=".$product->id,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"f.total_ht","","&id=".$product->id,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.paye,f.fk_statut","","&id=".$product->id,'align="right"',$sortfield,$sortorder); print "\n"; @@ -174,6 +175,7 @@ if ($id > 0 || ! empty($ref)) print "\n"; print ""; + print "\n"; print "\n"; print ''; print "\n"; diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php index 2a06c30a496..4cbeaec7e76 100644 --- a/htdocs/product/stats/facture_fournisseur.php +++ b/htdocs/product/stats/facture_fournisseur.php @@ -123,7 +123,7 @@ if ($id > 0 || ! empty($ref)) $sql = "SELECT distinct s.nom, s.rowid as socid, s.code_client, f.ref, f.total_ht as total_ht,"; - $sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid"; + $sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid, d.qty"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user "; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."facture_fourn as f"; @@ -153,6 +153,7 @@ if ($id > 0 || ! empty($ref)) print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&id=".$product->id,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("SupplierCode"),$_SERVER["PHP_SELF"],"s.code_client","","&id=".$product->id,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateInvoice"),$_SERVER["PHP_SELF"],"f.datef","","&id=".$product->id,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Qty"),$_SERVER["PHP_SELF"],"d.qty","","&id=".$product->id,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"f.total_ht","","&id=".$product->id,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.paye,f.fk_statut","","&id=".$product->id,'align="right"',$sortfield,$sortorder); print "\n"; @@ -175,6 +176,7 @@ if ($id > 0 || ! empty($ref)) print "\n"; print ""; + print "\n"; print "\n"; print ''; print "\n"; diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php index a55673c62b0..e9a78f18b05 100644 --- a/htdocs/product/stats/propal.php +++ b/htdocs/product/stats/propal.php @@ -113,7 +113,7 @@ if ($id > 0 || ! empty($ref)) $sql = "SELECT DISTINCT s.nom, s.rowid as socid, p.rowid as propalid, p.ref, p.total_ht as amount,"; - $sql.= "p.datep, p.fk_statut as statut"; + $sql.= "p.datep, p.fk_statut as statut, d.qty"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user "; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ",".MAIN_DB_PREFIX."propal as p"; @@ -141,6 +141,7 @@ if ($id > 0 || ! empty($ref)) print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"p.rowid","","&id=".$product->id,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&id=".$product->id,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DatePropal"),$_SERVER["PHP_SELF"],"p.datep","","&id=".$product->id,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Qty"),$_SERVER["PHP_SELF"],"d.qty","","&id=".$product->id,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"p.total","","&id=".$product->id,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.fk_statut","","&id=".$product->id,'align="right"',$sortfield,$sortorder); print "\n"; @@ -162,6 +163,7 @@ if ($id > 0 || ! empty($ref)) print ''; print '"; + print "\n"; print ''."\n"; print ''; print ''."\n"; From db0fa0afd0ab803122f13b8172a72b552d18feea Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 3 Jul 2014 18:17:34 +0200 Subject: [PATCH 38/68] Revert "Fix : ordered should display qty in supplier order not yet send" This reverts commit f2248d5bc887b66b9254f315992d5c8eadc19952. --- htdocs/product/stock/replenish.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 590260a7c99..817ec5cbf7a 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -478,21 +478,21 @@ while ($i < ($limit ? min($num, $limit) : $num)) $stock = $prod->stock_reel; } - $ordered = $prod->stats_commande_fournisseur['qty']; + $ordered = $prod->stats_commande_fournisseur['qty']-$prod->stats_reception['qty']; $warning=''; - - if ($objp->seuil_stock_alerte && ($stock < $objp->seuil_stock_alerte)) + if ($objp->alertstock && ($stock < $objp->alertstock)) { $warning = img_warning($langs->trans('StockTooLow')) . ' '; } + //depending on conf, use either physical stock or //virtual stock to compute the stock to buy value - //echo $objp->desiredstock." * ".$stock." * ".$ordered."
"; - $stocktobuy = max($objp->desiredstock - $stock - $ordered, 0); + $stocktobuy = max(max($objp->desiredstock, $objp->alertstock) - $stock - $ordered, 0); $disabled = ''; if($ordered > 0) { - if($stock + $ordered >= $objp->desiredstock) { + $compare = $usevirtualstock ? $stock : $stock + $ordered; + if($compare >= $objp->desiredstock) { $picto = img_picto('', './img/yes', '', 1); $disabled = 'disabled="disabled"'; } From 8874e5928477c29a55e959dcd8e7944f50bfd231 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?FRANCE=20Fr=C3=A9d=C3=A9ric?= Date: Thu, 3 Jul 2014 20:31:25 +0200 Subject: [PATCH 39/68] Update .travis.yml With -p phphcs sends log output and if it take more than 10min it will continue --- .travis.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4de657bbe31..83e3cfe1457 100644 --- a/.travis.yml +++ b/.travis.yml @@ -91,14 +91,16 @@ script: - php upgrade2.php 3.4.0 3.5.0 > upgrade2.log - php upgrade.php 3.5.0 3.6.0 >> upgrade.log - php upgrade2.php 3.5.0 3.6.0 >> upgrade2.log - - cd ../.. + - php upgrade.php 3.6.0 3.7.0 >> upgrade.log + - php upgrade2.php 3.6.0 3.7.0 >> upgrade2.log # - cat upgrade.log # - cat upgrade2.log + - cd ../.. # - phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml --coverage-text test/phpunit/AllTests.php # - phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml --coverage-text test/phpunit/BuildDocTest.php # - phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/WebservicesOtherTest.php # - phpcs --warning-severity=0 -s --report-checkstyle --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/documents/,/includes/,/test/report/ htdocs/core/class/dolgraph.class.php - - phpcs --warning-severity=0 -s --report-checkstyle --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/documents/,/includes/,/test/report/ . + - phpcs --warning-severity=0 -s -p --extensions=php --report-checkstyle --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/documents/,/includes/,/test/report/ . # - phpcs --warning-severity=0 -s --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/documents/,/includes/,/test/report/ . - phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/AllTests.php From 8fc2d5ebb8c02bf1ce7d739f01e8b4010442e9ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?FRANCE=20Fr=C3=A9d=C3=A9ric?= Date: Thu, 3 Jul 2014 20:38:33 +0200 Subject: [PATCH 40/68] Update 3.6.0-3.7.0.sql llx_c_product doesn't exist --- htdocs/install/mysql/migration/3.6.0-3.7.0.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql index f5757a39754..c5563329272 100644 --- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql +++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql @@ -43,8 +43,8 @@ ALTER TABLE llx_c_revenuestamp MODIFY COLUMN accountancy_code_sell varchar(32); ALTER TABLE llx_c_revenuestamp MODIFY COLUMN accountancy_code_buy varchar(32); ALTER TABLE llx_c_tva MODIFY COLUMN accountancy_code_sell varchar(32); ALTER TABLE llx_c_tva MODIFY COLUMN accountancy_code_buy varchar(32); -ALTER TABLE llx_c_product MODIFY COLUMN accountancy_code_sell varchar(32); -ALTER TABLE llx_c_product MODIFY COLUMN accountancy_code_buy varchar(32); +ALTER TABLE llx_product MODIFY COLUMN accountancy_code_sell varchar(32); +ALTER TABLE llx_product MODIFY COLUMN accountancy_code_buy varchar(32); ALTER TABLE llx_user MODIFY COLUMN accountancy_code varchar(32); From 47cff4d407ed00389fe719af78d181b13289a4fd Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 4 Jul 2014 10:04:30 +0200 Subject: [PATCH 41/68] Fix: Unable to add lines in supplier orders --- htdocs/fourn/commande/fiche.php | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 5a0a77f3212..1cfc3e23e01 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -1753,24 +1753,20 @@ elseif (! empty($object->id)) } // Form to add new line - if ($object->statut == 0 && $user->rights->fournisseur->commande->creer && $action <> 'edit_line') + if ($object->statut == 0 && $user->rights->fournisseur->commande->creer && $action != 'edit_line') { // Add free products/services form global $forceall, $senderissupplier, $dateSelector; $forceall=1; $senderissupplier=1; $dateSelector=0; - if ($object->statut == 0 && $user->rights->propal->creer) - { - if ($action != 'editline') - { - $var = true; + + $var = true; - // Add free products/services - $object->formAddObjectLine(1, $societe, $mysoc); + // Add free products/services + $object->formAddObjectLine(1, $societe, $mysoc); - $parameters = array(); - $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - } - } + $parameters = array(); + $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + } print '
".$objp->code_client.""; print dol_print_date($db->jdate($objp->date_commande))."".$objp->qty."".price($objp->total_ht)."'.$commandestatic->LibStatut($objp->statut,$objp->facture,5).'
'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($objp->nom,44).'".$objp->code_client."'.dol_print_date($db->jdate($objp->date_commande))."".$objp->qty."'.price($objp->total_ht)."'.$commandestatic->getLibStatut(4).'
".$objp->code_client.""; print dol_print_date($db->jdate($objp->datef),'day')."".$objp->qty."".price($objp->total_ht)."'.$invoicestatic->LibStatut($objp->paye,$objp->statut,5).'
".$objp->code_client.""; print dol_print_date($db->jdate($objp->datef))."".$objp->qty."".price($objp->total_ht)."'.$supplierinvoicestatic->LibStatut($objp->paye,$objp->statut,5).'
'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($objp->nom,44).''; print dol_print_date($db->jdate($objp->datep))."".$objp->qty."'.price($objp->amount).''.$propalstatic->LibStatut($objp->statut,5).'
'; From c7e20c9a80c8535ad08f36607fbaa50dc7735fb6 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 4 Jul 2014 10:25:05 +0200 Subject: [PATCH 42/68] [ task #1063 ] Allow edit localtaxes rate for thirds. Works with Suppliers --- .../class/fournisseur.commande.class.php | 5 +- .../fourn/class/fournisseur.facture.class.php | 3 +- htdocs/fourn/commande/fiche.php | 62 +++++-------------- htdocs/fourn/facture/fiche.php | 53 +++++----------- 4 files changed, 35 insertions(+), 88 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index a70b71c7b5f..9c1bc20e560 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1178,7 +1178,7 @@ class CommandeFournisseur extends CommonOrder // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty); + $localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc,$this->thirdparty); $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $this->thirdparty, $localtaxes_type); $total_ht = $tabprice[0]; @@ -1755,6 +1755,7 @@ class CommandeFournisseur extends CommonOrder */ function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type=0, $notrigger=false) { + global $mysoc; dol_syslog(get_class($this)."::updateline $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $price_base_type, $info_bits, $type"); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; @@ -1787,7 +1788,7 @@ class CommandeFournisseur extends CommonOrder // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty); + $localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc, $this->thirdparty); $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type); $total_ht = $tabprice[0]; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 786d619665e..45939f9f6bd 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1180,6 +1180,7 @@ class FactureFournisseur extends CommonInvoice */ function updateline($id, $desc, $pu, $vatrate, $txlocaltax1=0, $txlocaltax2=0, $qty=1, $idproduct=0, $price_base_type='HT', $info_bits=0, $type=0, $remise_percent=0, $notrigger=false) { + global $mysoc; dol_syslog(get_class($this)."::updateline $id,$desc,$pu,$vatrate,$qty,$idproduct,$price_base_type,$info_bits,$type,$remise_percent", LOG_DEBUG); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; @@ -1204,7 +1205,7 @@ class FactureFournisseur extends CommonInvoice // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $localtaxes_type=getLocalTaxesFromRate($vatrate,0,$this->thirdparty); + $localtaxes_type=getLocalTaxesFromRate($vatrate,0,$mysoc, $this->thirdparty); $tabprice = calcul_price_total($qty, $pu, $remise_percent, $vatrate, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type); $total_ht = $tabprice[0]; diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 07d43231005..0df796024fa 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005 Eric Seigne * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2011 Philippe Grand * Copyright (C) 2012 Marcos García * Copyright (C) 2013 Florian Henry @@ -1288,17 +1288,9 @@ elseif (! empty($object->id)) if (! empty($conf->projet->enabled)) $nbrow++; //Local taxes - //TODO: Place into a function to control showing by country or study better option - if ($mysoc->country_code=='ES') - { - if($mysoc->localtax1_assuj=="1") $nbrow++; - if($object->thirdparty->localtax2_assuj=="1") $nbrow++; - } - else - { - if($mysoc->localtax1_assuj=="1") $nbrow++; - if($mysoc->localtax2_assuj=="1") $nbrow++; - } + if($mysoc->localtax1_assuj=="1") $nbrow++; + if($mysoc->localtax2_assuj=="1") $nbrow++; + print ''; $linkback = ''.$langs->trans("BackToList").''; @@ -1514,37 +1506,19 @@ elseif (! empty($object->id)) print ''; // Amount Local Taxes - //TODO: Place into a function to control showing by country or study better option - if ($mysoc->country_code=='ES') + if ($mysoc->localtax1_assuj=="1") //Localtax1 { - if ($mysoc->localtax1_assuj=="1") //Localtax1 RE - { - print ''; - print ''; - print ''; - } - if ($object->thirdparty->localtax2_assuj=="1") //Localtax2 IRPF - { - print ''; - print ''; - print ''; - } + print ''; + print ''; + print ''; } - else + if ($mysoc->localtax2_assuj=="1") //Localtax2 { - if ($mysoc->localtax1_assuj=="1") //Localtax1 - { - print ''; - print ''; - print ''; - } - if ($mysoc->localtax2_assuj=="1") //Localtax2 - { - print ''; - print ''; - print ''; - } + print ''; + print ''; + print ''; } + print ''; print ''; @@ -1753,15 +1727,12 @@ elseif (! empty($object->id)) } // Form to add new line - if ($object->statut == 0 && $user->rights->fournisseur->commande->creer && $action <> 'edit_line') + if ($object->statut == 0 && $user->rights->fournisseur->commande->creer && $action != 'edit_line') { // Add free products/services form global $forceall, $senderissupplier, $dateSelector; $forceall=1; $senderissupplier=1; $dateSelector=0; - if ($object->statut == 0 && $user->rights->propal->creer) - { - if ($action != 'editline') - { + $var = true; // Add free products/services @@ -1769,8 +1740,7 @@ elseif (! empty($object->id)) $parameters = array(); $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - } - } + } print '
'.$langs->trans("Currency".$conf->currency).'
'.$langs->transcountry("AmountLT1",$mysoc->country_code).''.price($object->total_localtax1).''.$langs->trans("Currency".$conf->currency).'
'.$langs->transcountry("AmountLT2",$mysoc->country_code).''.price($object->total_localtax2).''.$langs->trans("Currency".$conf->currency).'
'.$langs->transcountry("AmountLT1",$mysoc->country_code).''.price($object->total_localtax1).''.$langs->trans("Currency".$conf->currency).'
'.$langs->transcountry("AmountLT1",$mysoc->country_code).''.price($object->total_localtax1).''.$langs->trans("Currency".$conf->currency).'
'.$langs->transcountry("AmountLT2",$mysoc->country_code).''.price($object->total_localtax2).''.$langs->trans("Currency".$conf->currency).'
'.$langs->transcountry("AmountLT2",$mysoc->country_code).''.price($object->total_localtax2).''.$langs->trans("Currency".$conf->currency).'
'.$langs->trans("AmountTTC").''.price($object->total_ttc).''.$langs->trans("Currency".$conf->currency).'
'; diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index e929a6b548a..9d5670771cd 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -658,7 +658,7 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer) $price_base_type = 'HT'; //print $product_desc, $pu, $txtva, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0 - $result=$object->addline($product_desc, $ht, $tva_tx, $localtax1tx, $localtax2tx, $qty, 0, $remise_percent, $datestart, $dateend, 0, $npr, $price_base_type, $type); + $result=$object->addline($product_desc, $ht, $tva_tx, $localtax1_tx, $localtax2_tx, $qty, 0, $remise_percent, $datestart, $dateend, 0, $npr, $price_base_type, $type); } else { @@ -666,7 +666,7 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer) $ht = $ttc / (1 + ($tva_tx / 100)); $price_base_type = 'HT'; //print $product_desc, $pu, $txtva, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0 - $result=$object->addline($product_desc, $ht, $tva_tx,$localtax1tx, $localtax2tx, $qty, 0, $remise_percent, $datestart, $dateend, 0, $npr, $price_base_type, $type); + $result=$object->addline($product_desc, $ht, $tva_tx,$localtax1_tx, $localtax2_tx, $qty, 0, $remise_percent, $datestart, $dateend, 0, $npr, $price_base_type, $type); } } @@ -1634,16 +1634,9 @@ else if (! empty($conf->banque->enabled)) $nbcols++; // Local taxes - if ($mysoc->country_code=='ES') - { - if($mysoc->localtax1_assuj=="1") $nbrows++; - if($societe->localtax2_assuj=="1") $nbrows++; - } - else - { - if ($societe->localtax1_assuj=="1") $nbrows++; - if ($societe->localtax2_assuj=="1") $nbrows++; - } + if ($societe->localtax1_assuj=="1") $nbrows++; + if ($societe->localtax2_assuj=="1") $nbrows++; + print ''; $sql = 'SELECT p.datep as dp, p.num_paiement, p.rowid, p.fk_bank,'; @@ -1802,35 +1795,17 @@ else // Amount Local Taxes //TODO: Place into a function to control showing by country or study better option - if ($mysoc->country_code=='ES') + if ($societe->localtax1_assuj=="1") //Localtax1 { - if ($mysoc->localtax1_assuj=="1") //Localtax1 RE - { - print ''.$langs->transcountry("AmountLT1",$societe->country_code).''; - print ''.price($object->total_localtax1,1,$langs,0,-1,-1,$conf->currency).''; - print ' '; - } - if ($societe->localtax2_assuj=="1") //Localtax2 IRPF - { - print ''.$langs->transcountry("AmountLT2",$societe->country_code).''; - print ''.price($object->total_localtax2,1,$langs,0,-1,-1,$conf->currency).''; - print ' '; - } + print ''.$langs->transcountry("AmountLT1",$societe->country_code).''; + print ''.price($object->total_localtax1,1,$langs,0,-1,-1,$conf->currency).''; + print ' '; } - else - { - if ($societe->localtax1_assuj=="1") //Localtax1 RE - { - print ''.$langs->transcountry("AmountLT1",$societe->country_code).''; - print ''.price($object->total_localtax1,1,$langs,0,-1,-1,$conf->currency).''; - print ' '; - } - if ($societe->localtax2_assuj=="1") //Localtax2 IRPF - { - print ''.$langs->transcountry("AmountLT2",$societe->country_code).''; - print ''.price($object->total_localtax2,1,$langs,0,-1,-1,$conf->currency).''; - print ' '; - } + if ($societe->localtax2_assuj=="1") //Localtax2 + { + print ''.$langs->transcountry("AmountLT2",$societe->country_code).''; + print ''.price($object->total_localtax2,1,$langs,0,-1,-1,$conf->currency).''; + print ' '; } print ''.$langs->trans('AmountTTC').''.price($object->total_ttc,1,$langs,0,-1,-1,$conf->currency).' '; From 811ac6701a2f07394fe6abae12200a18ee64ea40 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 4 Jul 2014 11:02:41 +0200 Subject: [PATCH 43/68] [ task #1063 ] Allow edit localtaxes rate for thirds. Works with propals --- htdocs/comm/propal/class/propal.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 62205b21bdb..29884f297c7 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -6,7 +6,7 @@ * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2008 Raphael Bertrand - * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2010-2011 Philippe Grand * Copyright (C) 2012-214 Christophe Battarel * Copyright (C) 2013 Florian Henry @@ -355,7 +355,7 @@ class Propal extends CommonObject // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc); + $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty,$mysoc); $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, '', $localtaxes_type); $total_ht = $tabprice[0]; @@ -510,7 +510,7 @@ class Propal extends CommonObject // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc); + $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty,$mysoc); $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type,'', $localtaxes_type); $total_ht = $tabprice[0]; From 11c1bdecdfdf8350cf0d40285cbe8091ad0777f7 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 4 Jul 2014 11:07:10 +0200 Subject: [PATCH 44/68] [ task #1063 ] Allow edit localtaxes rate for thirds. Works with propals --- htdocs/comm/propal.php | 6 +++--- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 3630ef2be10..a687e1dff5b 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -5,7 +5,7 @@ * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2010-2011 Philippe Grand * Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2013-2014 Florian Henry @@ -1463,12 +1463,12 @@ if ($action == 'create') { print '' . $langs->trans($newclassname) . '' . $objectsrc->getNomUrl(1) . ''; print '' . $langs->trans('TotalHT') . '' . price($objectsrc->total_ht) . ''; print '' . $langs->trans('TotalVAT') . '' . price($objectsrc->total_tva) . ""; - if ($mysoc->localtax1_assuj == "1") // Localtax1 RE + if ($mysoc->localtax1_assuj == "1") // Localtax1 { print '' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '' . price($objectsrc->total_localtax1) . ""; } - if ($mysoc->localtax2_assuj == "1") // Localtax2 IRPF + if ($mysoc->localtax2_assuj == "1") // Localtax2 { print '' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($objectsrc->total_localtax2) . ""; } diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 9c1bc20e560..08f28eaa50e 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke - * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2010-2013 Philippe Grand * Copyright (C) 2012 Marcos García * Copyright (C) 2013 Florian Henry diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 45939f9f6bd..3ecd073f662 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2004 Christophe Combelles * Copyright (C) 2005 Marc Barilley * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2013 Philippe Grand * Copyright (C) 2013 Florian Henry * From 1631985d1150d08620bd950fb6d9ff9ea1ecf7ff Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 4 Jul 2014 11:38:08 +0200 Subject: [PATCH 45/68] [ task #1063 ] Allow edit localtaxes rate for thirds. Works with orders --- htdocs/commande/class/commande.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index f9626d6d3c8..a41b3f4ac5b 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2011 Jean Heimburger * Copyright (C) 2012 Christophe Battarel * Copyright (C) 2013 Florian Henry @@ -1122,7 +1122,7 @@ class Commande extends CommonOrder // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc); + $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty,$mysoc); $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type,'', $localtaxes_type); $total_ht = $tabprice[0]; @@ -2343,7 +2343,7 @@ class Commande extends CommonOrder // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc); + $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty, $mysoc); $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, '', $localtaxes_type); $total_ht = $tabprice[0]; From 416577a6aa568ad0908003cf5bc128bc83369e0e Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 4 Jul 2014 11:41:43 +0200 Subject: [PATCH 46/68] [ task #1063 ] Allow edit localtaxes rate for thirds. Works with invoices --- htdocs/compta/facture/class/facture.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 096fee84d6a..e41c0b39adb 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -7,7 +7,7 @@ * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2007 Franky Van Liedekerke - * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2012 Christophe Battarel * Copyright (C) 2012 Marcos García * Copyright (C) 2013 Cedric Gross @@ -1988,7 +1988,7 @@ class Facture extends CommonInvoice // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc); + $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty, $mysoc); $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type); @@ -2147,7 +2147,7 @@ class Facture extends CommonInvoice // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc); + $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty, $mysoc); $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type,'',$localtaxes_type); $total_ht = $tabprice[0]; From a432e57b123722c64ab9b6e6068d39230fd84eea Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 4 Jul 2014 11:45:40 +0200 Subject: [PATCH 47/68] [ task #1063 ] Allow edit localtaxes rate for thirds. Works with contracts --- htdocs/contrat/class/contrat.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index daf22e0af7c..9483c5e56df 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2008 Raphael Bertrand - * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2013 Christophe Battarel * Copyright (C) 2013 Florian Henry * @@ -1008,7 +1008,7 @@ class Contrat extends CommonObject // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc); + $localtaxes_type=getLocalTaxesFromRate($txtva,0, $this->societe ,$mysoc); $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, 1,'', $localtaxes_type); $total_ht = $tabprice[0]; @@ -1156,7 +1156,7 @@ class Contrat extends CommonObject // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $localtaxes_type=getLocalTaxesFromRate($tvatx,0,$mysoc); + $localtaxes_type=getLocalTaxesFromRate($tvatx,0, $this->societe ,$mysoc); $tabprice=calcul_price_total($qty, $pu, $remise_percent, $tvatx, $localtaxtx1, $txlocaltaxtx2, 0, $price_base_type, $info_bits, 1, '', $localtaxes_type); $total_ht = $tabprice[0]; From 11abba30b38041d96a2fa71b293d9db9983be067 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Jul 2014 11:58:41 +0200 Subject: [PATCH 48/68] Fix: Add information to help debug pb with TZ. --- htdocs/admin/system/dolibarr.php | 21 ++++++++++++++------- htdocs/langs/en_US/admin.lang | 2 ++ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index 59f3b3f3856..675638bf000 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -177,13 +177,20 @@ $var=!$var; print '  => dol_get_first_day(1970,1,false)'.dol_get_first_day(1970,1,false).'     (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970,1,false),'dayhour').')'; $var=!$var; print '  => dol_get_first_day(1970,1,true)'.dol_get_first_day(1970,1,true).'     (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970,1,true),'dayhour').')'; -// Parent company -/* -$var=!$var; -print ''.$langs->trans("CompanyTZ").''.$langs->trans("FeatureNotYetAvailable").''."\n"; -$var=!$var; -print '  => '.$langs->trans("CompanyHour").''.$langs->trans("FeatureNotYetAvailable").''."\n"; -*/ +// Database timezone +if ($conf->db->type == 'mysql' || $conf->db->type == 'mysqli') +{ + $var=!$var; + print ''.$langs->trans("MySQLTimeZone").' (database)'; // Timezone server base + $sql="SHOW VARIABLES where variable_name = 'system_time_zone'"; + $resql = $db->query($sql); + if ($resql) + { + $obj = $db->fetch_object($resql); + print $form->textwithtooltip($obj->Value,$langs->trans('TZHasNoEffect'),2,1,img_info('')); + } + print ''."\n"; +} // Client $var=!$var; $tz=(int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst']; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index b46f2c57be4..a5c2d1e19fe 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -63,6 +63,8 @@ ShowPreview=Show preview PreviewNotAvailable=Preview not available ThemeCurrentlyActive=Theme currently active CurrentTimeZone=TimeZone PHP (server) +MySQLTimeZone=TimeZone MySql (database) +TZHasNoEffect=Dates are stored and returned by database server as if they were kept as submited string. The timezone has effect only when using UNIX_TIMESTAMP function (that should not be used by Dolibarr, so database TZ should have no effect, even if changed after data was entered). Space=Space Table=Table Fields=Fields From 9fa3d8ddd183f225b9f01ff5817d31d87f367bc7 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 4 Jul 2014 12:27:53 +0200 Subject: [PATCH 49/68] Allow migration 3.6x to 3.7.0 --- htdocs/install/check.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/install/check.php b/htdocs/install/check.php index 486811f7157..a3d58458d43 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2013-2014 Juanjo Menent * Copyright (C) 2014 Marcos García * * This program is free software; you can redistribute it and/or modify @@ -393,7 +393,8 @@ else array('from'=>'3.2.0', 'to'=>'3.3.0'), array('from'=>'3.3.0', 'to'=>'3.4.0'), array('from'=>'3.4.0', 'to'=>'3.5.0'), - array('from'=>'3.5.0', 'to'=>'3.6.0') + array('from'=>'3.5.0', 'to'=>'3.6.0'), + array('from'=>'3.6.0', 'to'=>'3.7.0') ); $count=0; From 72243d4f3816b35d936076015b111f3a1f37bf4a Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 4 Jul 2014 12:32:57 +0200 Subject: [PATCH 50/68] fix: Timestamp with default null --- htdocs/install/mysql/migration/3.6.0-3.7.0.sql | 2 +- htdocs/install/mysql/tables/llx_accountingaccount.sql | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql index f5757a39754..b9ba0ce14a8 100644 --- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql +++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql @@ -23,7 +23,7 @@ ALTER TABLE llx_c_paiement ADD COLUMN accountancy_code varchar(32) DEFAULT NULL ALTER TABLE llx_accountingaccount add column entity integer DEFAULT 1 NOT NULL AFTER rowid; ALTER TABLE llx_accountingaccount add column datec datetime NOT NULL AFTER entity; -ALTER TABLE llx_accountingaccount add column tms timestamp DEFAULT NULL AFTER datec; +ALTER TABLE llx_accountingaccount add column tms timestamp AFTER datec; ALTER TABLE llx_accountingaccount add column fk_user_author integer DEFAULT NULL AFTER label; ALTER TABLE llx_accountingaccount add column fk_user_modif integer DEFAULT NULL AFTER fk_user_author; diff --git a/htdocs/install/mysql/tables/llx_accountingaccount.sql b/htdocs/install/mysql/tables/llx_accountingaccount.sql index a3fe0747238..f4e4d694471 100644 --- a/htdocs/install/mysql/tables/llx_accountingaccount.sql +++ b/htdocs/install/mysql/tables/llx_accountingaccount.sql @@ -1,5 +1,6 @@ -- ============================================================================ -- Copyright (C) 2004-2006 Laurent Destailleur +-- Copyright (C) 2014 Juanjo Menent -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by @@ -22,7 +23,7 @@ create table llx_accountingaccount rowid integer AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, datec datetime, - tms timestamp DEFAULT NULL, + tms timestamp, fk_pcg_version varchar(12) NOT NULL, pcg_type varchar(20) NOT NULL, pcg_subtype varchar(20) NOT NULL, From 747b6a9f94ce26d96b69237306fc8d70d0300088 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 4 Jul 2014 12:50:55 +0200 Subject: [PATCH 51/68] [ task #1063 ] Allow edit localtaxes rate for thirds. Works with reports and payments --- htdocs/compta/charges/index.php | 103 +++ htdocs/compta/journal/purchasesjournal.php | 6 +- htdocs/compta/journal/sellsjournal.php | 6 +- .../compta/localtax/class/localtax.class.php | 13 +- htdocs/compta/localtax/clients.php | 305 ++++---- htdocs/compta/localtax/fiche.php | 19 +- htdocs/compta/localtax/index.php | 134 +++- htdocs/compta/localtax/quadri_detail.php | 669 ++++++++++++++++++ htdocs/compta/localtax/reglement.php | 7 +- htdocs/core/menus/standard/eldy.lib.php | 25 +- 10 files changed, 1087 insertions(+), 200 deletions(-) create mode 100644 htdocs/compta/localtax/quadri_detail.php diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index f38f7e72aa2..70808920d49 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2011-2014 Alexandre Spangaro + * Copyright (C) 2011-2014 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -353,6 +354,108 @@ if ($conf->tax->enabled) } } } +//localtax +if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") +{ + $j=1; + $numlt=3; +} +elseif($mysoc->localtax1_assuj=="1") +{ + $j=1; + $numlt=2; +} +elseif($mysoc->localtax2_assuj=="1") +{ + $j=2; + $numlt=3; +} +else +{ + $j=0; + $numlt=0; +} + +while($j<$numlt) +{ + if (empty($_GET["mode"]) || $_GET["mode"] != 'sconly') + { + print "
"; + + $tva = new Tva($db); + + print_fiche_titre($langs->transcountry(($j==1?"LT1Payments":"LT2Payments"),$mysoc->country_code).($year?' ('.$langs->trans("Year").' '.$year.')':''), '', ''); + + + $sql = "SELECT pv.rowid, pv.amount, pv.label, pv.datev as dm, pv.datep as dp"; + $sql.= " FROM ".MAIN_DB_PREFIX."localtax as pv"; + $sql.= " WHERE pv.entity = ".$conf->entity." AND localtaxtype = ".$j ; + if ($year > 0) + { + // Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance, + // ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire + $sql.= " AND pv.datev between '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; + } + if (preg_match('/^pv/',$sortfield)) $sql.= $db->order($sortfield,$sortorder); + + $result = $db->query($sql); + if ($result) + { + $num = $db->num_rows($result); + $i = 0; + $total = 0 ; + print ''; + print ''; + print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="120"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"pv.datep","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder); + print "\n"; + $var=1; + while ($i < $num) + { + $obj = $db->fetch_object($result); + + $total = $total + $obj->amount; + + $var=!$var; + print ""; + print ''."\n"; + + print "\n"; + + print '"; + + // Ref payment + $tva_static->id=$obj->rowid; + $tva_static->ref=$obj->rowid; + print '\n"; + + print '\n"; + print '"; + print "\n"; + + $i++; + } + print ''; + print '"; + print ''; + print ''; + print '"; + print ""; + + print "
'.dol_print_date($db->jdate($obj->dm),'day').'".$obj->label."'.price($obj->amount)."'.$tva_static->getNomUrl(1)."'.dol_print_date($db->jdate($obj->dp),'day')."'.price($obj->amount)."
'.$langs->trans("Total").''.price($total)."  '.price($total)."
"; + $db->free($result); + } + else + { + dol_print_error($db); + } + } + $j++; +} llxFooter(); diff --git a/htdocs/compta/journal/purchasesjournal.php b/htdocs/compta/journal/purchasesjournal.php index 52562ed0244..7d1c9fa2777 100644 --- a/htdocs/compta/journal/purchasesjournal.php +++ b/htdocs/compta/journal/purchasesjournal.php @@ -1,7 +1,7 @@ * Copyright (C) 2007-2010 Jean Heimburger - * Copyright (C) 2011-2013 Juanjo Menent + * Copyright (C) 2011-2014 Juanjo Menent * Copyright (C) 2012 Regis Houssin * Copyright (C) 2011-2012 Alexandre spangaro * Copyright (C) 2013 Marcos García @@ -150,9 +150,9 @@ if ($result) $compta_localtax1 = (! empty($obj->account_localtax1)?$obj->account_localtax1:$langs->trans("CodeNotDef")); $compta_localtax2 = (! empty($obj->account_localtax2)?$obj->account_localtax2:$langs->trans("CodeNotDef")); - $account_localtax1=getLocalTaxesFromRate($obj->tva_tx, 1, $mysoc); + $account_localtax1=getLocalTaxesFromRate($obj->tva_tx, 1, $mysoc, $obj->thirdparty); $compta_localtax1= (! empty($account_localtax1[2])?$account_localtax1[2]:$langs->trans("CodeNotDef")); - $account_localtax2=getLocalTaxesFromRate($obj->tva_tx, 2, $mysoc); + $account_localtax2=getLocalTaxesFromRate($obj->tva_tx, 2, $mysoc, $obj->thirdparty); $compta_localtax2= (! empty($account_localtax2[2])?$account_localtax2[2]:$langs->trans("CodeNotDef")); $tabfac[$obj->rowid]["date"] = $obj->datef; diff --git a/htdocs/compta/journal/sellsjournal.php b/htdocs/compta/journal/sellsjournal.php index 931b8757470..c3f276ca956 100644 --- a/htdocs/compta/journal/sellsjournal.php +++ b/htdocs/compta/journal/sellsjournal.php @@ -1,7 +1,7 @@ * Copyright (C) 2007-2010 Jean Heimburger - * Copyright (C) 2011-2013 Juanjo Menent + * Copyright (C) 2011-2014 Juanjo Menent * Copyright (C) 2012 Regis Houssin * Copyright (C) 2011-2012 Alexandre Spangaro * Copyright (C) 2013 Marcos García @@ -153,9 +153,9 @@ if ($result) $cpttva = (! empty($conf->global->COMPTA_VAT_ACCOUNT)?$conf->global->COMPTA_VAT_ACCOUNT:$langs->trans("CodeNotDef")); $compta_tva = (! empty($obj->account_tva)?$obj->account_tva:$cpttva); - $account_localtax1=getLocalTaxesFromRate($obj->tva_tx, 1, $mysoc); + $account_localtax1=getLocalTaxesFromRate($obj->tva_tx, 1, $obj->thirdparty, $mysoc); $compta_localtax1= (! empty($account_localtax1[3])?$account_localtax1[3]:$langs->trans("CodeNotDef")); - $account_localtax2=getLocalTaxesFromRate($obj->tva_tx, 2, $mysoc); + $account_localtax2=getLocalTaxesFromRate($obj->tva_tx, 2, $obj->thirdparty, $mysoc); $compta_localtax2= (! empty($account_localtax2[3])?$account_localtax2[3]:$langs->trans("CodeNotDef")); //la ligne facture diff --git a/htdocs/compta/localtax/class/localtax.class.php b/htdocs/compta/localtax/class/localtax.class.php index b500a701254..bda3150937e 100644 --- a/htdocs/compta/localtax/class/localtax.class.php +++ b/htdocs/compta/localtax/class/localtax.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2011-2014 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,6 +31,7 @@ class Localtax extends CommonObject { var $id; var $ref; + var $ltt; var $tms; var $datep; var $datev; @@ -74,6 +75,7 @@ class Localtax extends CommonObject // Insert request $sql = "INSERT INTO ".MAIN_DB_PREFIX."localtax("; + $sql.= "localtaxtype,"; $sql.= "tms,"; $sql.= "datep,"; $sql.= "datev,"; @@ -84,6 +86,7 @@ class Localtax extends CommonObject $sql.= "fk_user_creat,"; $sql.= "fk_user_modif"; $sql.= ") VALUES ("; + $sql.= " ".$this->ltt.","; $sql.= " '".$this->db->idate($this->tms)."',"; $sql.= " '".$this->db->idate($this->datep)."',"; $sql.= " '".$this->db->idate($this->datev)."',"; @@ -141,6 +144,7 @@ class Localtax extends CommonObject // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."localtax SET"; + $sql.= " localtaxtype=".$this->ltt.","; $sql.= " tms=".$this->db->idate($this->tms).","; $sql.= " datep=".$this->db->idate($this->datep).","; $sql.= " datev=".$this->db->idate($this->datev).","; @@ -186,6 +190,7 @@ class Localtax extends CommonObject global $langs; $sql = "SELECT"; $sql.= " t.rowid,"; + $sql.= " t.localtaxtype,"; $sql.= " t.tms,"; $sql.= " t.datep,"; $sql.= " t.datev,"; @@ -212,6 +217,7 @@ class Localtax extends CommonObject $this->id = $obj->rowid; $this->ref = $obj->rowid; + $this->ltt = $obj->localtaxtype; $this->tms = $this->db->jdate($obj->tms); $this->datep = $this->db->jdate($obj->datep); $this->datev = $this->db->jdate($obj->datev); @@ -285,6 +291,7 @@ class Localtax extends CommonObject $this->id=0; $this->tms=''; + $this->ltt=0; $this->datep=''; $this->datev=''; $this->amount=''; @@ -476,12 +483,12 @@ class Localtax extends CommonObject } // Insertion dans table des paiement localtax - $sql = "INSERT INTO ".MAIN_DB_PREFIX."localtax (datep, datev, amount"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."localtax (localtaxtype, datep, datev, amount"; if ($this->note) $sql.=", note"; if ($this->label) $sql.=", label"; $sql.= ", fk_user_creat, fk_bank"; $sql.= ") "; - $sql.= " VALUES ('".$this->db->idate($this->datep)."',"; + $sql.= " VALUES (".$this->ltt.", '".$this->db->idate($this->datep)."',"; $sql.= "'".$this->db->idate($this->datev)."'," . $this->amount; if ($this->note) $sql.=", '".$this->db->escape($this->note)."'"; if ($this->label) $sql.=", '".$this->db->escape($this->label)."'"; diff --git a/htdocs/compta/localtax/clients.php b/htdocs/compta/localtax/clients.php index cc71b402060..a75d48385cb 100644 --- a/htdocs/compta/localtax/clients.php +++ b/htdocs/compta/localtax/clients.php @@ -1,6 +1,6 @@ - * Copyright (C) 2014 Ferran Marcet +/* Copyright (C) 2011-2014 Juanjo Menent + * Copyright (C) 2014 Ferran Marcet * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -33,6 +33,8 @@ $langs->load("compta"); $langs->load("companies"); $langs->load("products"); +$local=GETPOST('localTaxType', 'int'); + // Date range $year=GETPOST("year"); if (empty($year)) @@ -102,12 +104,14 @@ $fsearch.=' '; $fsearch.=' '.$langs->trans("SalesTurnoverMinimum").': '; $fsearch.=' '; +$calc=MAIN_INFO_LOCALTAX_CALC.$local; // Affiche en-tete du rapport -if ($modetax==1) // Calculate on invoice for goods and services +if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice for goods and services { - $nom=$langs->transcountry("LT2ReportByCustomersInInputOutputMode",$mysoc->country_code); + $nom=$langs->transcountry($local==1?"LT1ReportByCustomersInInputOutputMode":"LT2ReportByCustomersInInputOutputMode",$mysoc->country_code); + $calcmode=$calc==0?$langs->trans("CalcModeLT".$local):$langs->trans("CalcModeLT'.$local.'Rec"); + $calcmode.='
('.$langs->trans("TaxModuleSetupToModifyRulesLT",DOL_URL_ROOT.'/admin/taxes.php').')'; $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); - $description=$langs->trans("RulesVATDue"); if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='
'.$langs->trans("WarningDepositsNotIncluded"); $description.=$fsearch; $description.='
('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')'; @@ -120,11 +124,12 @@ if ($modetax==1) // Calculate on invoice for goods and services $productsup=$langs->trans("Description"); $amountsup=$langs->trans("AmountHT"); } -if ($modetax==0) // Invoice for goods, payment for services +if ($conf->global->$calc==2) // Invoice for goods, payment for services { - $nom=$langs->transcountry("LT2ReportByCustomersInInputOutputMode",$mysoc->country_code); + $nom=$langs->transcountry($local==1?"LT1ReportByCustomersInInputOutputMode":"LT2ReportByCustomersInInputOutputMode",$mysoc->country_code); + $calcmode=$langs->trans("CalcModeLT2Debt"); + $calcmode.='
('.$langs->trans("TaxModuleSetupToModifyRulesLT",DOL_URL_ROOT.'/admin/taxes.php').')'; $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); - $description=$langs->trans("RulesVATIn"); if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='
'.$langs->trans("WarningDepositsNotIncluded"); $description.=$fsearch; $description.='
('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')'; @@ -137,173 +142,179 @@ if ($modetax==0) // Invoice for goods, payment for services $productsup=$langs->trans("Description"); $amountsup=$langs->trans("AmountHT"); } -report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink); +report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode); -$vatcust=$langs->transcountry("LT2",$mysoc->country_code); -$vatsup=$langs->transcountry("LT2",$mysoc->country_code); + +$vatcust=$langs->transcountry($local==1?"LT1":"LT2",$mysoc->country_code); +$vatsup=$langs->transcountry($local==1?"LT1":"LT2",$mysoc->country_code); // IRPF that the customer has retained me +if($conf->global->$calc ==0 || $conf->global->$calc == 2){ + print ""; + print ""; + print '"; + print '"; + print ""; + print ""; + print ""; + print "\n"; -print "
'.$langs->trans("Num")."'.$langs->trans("Customer")."".$langs->transcountry("ProfId1",$mysoc->country_code)."".$langs->trans("TotalHT")."".$vatcust."
"; -print ""; -print '"; -print '"; -print ""; -print ""; -print ""; -print "\n"; - -$coll_list = vat_by_thirdparty($db,0,$date_start,$date_end,$modetax,'sell'); - -$action = "tvaclient"; -$object = &$coll_list; -$parameters["mode"] = $modetax; -$parameters["start"] = $date_start; -$parameters["end"] = $date_end; -$parameters["direction"] = 'sell'; -// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array -$hookmanager->initHooks(array('externalbalance')); -$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks - -if (is_array($coll_list)) -{ - $var=true; - $total = 0; $totalamount = 0; - $i = 1; - foreach($coll_list as $coll) + $coll_list = vat_by_thirdparty($db,0,$date_start,$date_end,$modetax,'sell'); + + $action = "tvaclient"; + $object = &$coll_list; + $parameters["mode"] = $modetax; + $parameters["start"] = $date_start; + $parameters["end"] = $date_end; + $parameters["direction"] = 'sell'; + // Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array + $hookmanager->initHooks(array('externalbalance')); + $reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks + + if (is_array($coll_list)) { - if(($min == 0 or ($min > 0 && $coll->amount > $min)) && $coll->localtax2!=0) + $var=true; + $total = 0; $totalamount = 0; + $i = 1; + foreach($coll_list as $coll) { - $var=!$var; - $intra = str_replace($find,$replace,$coll->tva_intra); - if(empty($intra)) + if(($min == 0 or ($min > 0 && $coll->amount > $min)) && ($local==1?$coll->localtax1:$coll->localtax2) !=0) { - if($coll->assuj == '1') + $var=!$var; + $intra = str_replace($find,$replace,$coll->tva_intra); + if(empty($intra)) { - $intra = $langs->trans('Unknown'); - } - else - { - $intra = ''; + if($coll->assuj == '1') + { + $intra = $langs->trans('Unknown'); + } + else + { + $intra = ''; + } } + print ""; + print '"; + $company_static->id=$coll->socid; + $company_static->nom=$coll->nom; + print ''; + $find = array(' ','.'); + $replace = array('',''); + print '"; + print ""; + print ""; + $totalamount = $totalamount + $coll->amount; + $total = $total + ($local==1?$coll->localtax1:$coll->localtax2); + print "\n"; + $i++; } - print ""; - print '"; - $company_static->id=$coll->socid; - $company_static->nom=$coll->nom; - print ''; - $find = array(' ','.'); - $replace = array('',''); - print '"; - print ""; - print ""; - $totalamount = $totalamount + $coll->amount; - $total = $total + $coll->localtax2; - print "\n"; - $i++; } + $x_coll_sum = $total; + + print ''; + print ''; + print ''; + print ''; } - $x_coll_sum = $total; - - print ''; - print ''; - print ''; - print ''; -} -else -{ - $langs->load("errors"); - if ($coll_list == -1) - print ''; - else if ($coll_list == -2) - print ''; else - print ''; + { + $langs->load("errors"); + if ($coll_list == -1) + print ''; + else if ($coll_list == -2) + print ''; + else + print ''; + } } // IRPF I retained my supplier +if($conf->global->$calc ==0 || $conf->global->$calc == 1){ + print "
'.$langs->trans("Num")."'.$langs->trans("Customer")."".$langs->transcountry("ProfId1",$mysoc->country_code)."".$langs->trans("TotalHT")."".$vatcust."
'.$i."'.$company_static->getNomUrl(1).''.$intra."".price($coll->amount)."".price($local==1?$coll->localtax1:$coll->localtax2)."
'.$i."'.$company_static->getNomUrl(1).''.$intra."".price($coll->amount)."".price($coll->localtax2)."
'.$langs->trans("Total").':'.price($totalamount).''.price($total).'
'.$langs->trans("Total").':'.price($totalamount).''.price($total).'
'.$langs->trans("ErrorNoAccountancyModuleLoaded").'
'.$langs->trans("FeatureNotYetAvailable").'
'.$langs->trans("Error").'
'.$langs->trans("ErrorNoAccountancyModuleLoaded").'
'.$langs->trans("FeatureNotYetAvailable").'
'.$langs->trans("Error").'
"; + print ""; + print '"; + print '"; + print ""; + print ""; + print ""; + print "\n"; -print ""; -print '"; -print '"; -print ""; -print ""; -print ""; -print "\n"; - -$company_static=new Societe($db); - -$coll_list = vat_by_thirdparty($db,0,$date_start,$date_end,$modetax,'buy'); -$parameters["direction"] = 'buy'; -$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks -if (is_array($coll_list)) -{ - $var=true; - $total = 0; $totalamount = 0; - $i = 1; - foreach($coll_list as $coll) + $company_static=new Societe($db); + + $coll_list = vat_by_thirdparty($db,0,$date_start,$date_end,$modetax,'buy'); + $parameters["direction"] = 'buy'; + $reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks + if (is_array($coll_list)) { - if(($min == 0 or ($min > 0 && $coll->amount > $min)) && $coll->localtax2!=0) + $var=true; + $total = 0; $totalamount = 0; + $i = 1; + foreach($coll_list as $coll) { - $var=!$var; - $intra = str_replace($find,$replace,$coll->tva_intra); - if(empty($intra)) + if(($min == 0 or ($min > 0 && $coll->amount > $min)) && ($local==1?$coll->localtax1:$coll->localtax2) != 0) { - if($coll->assuj == '1') + $var=!$var; + $intra = str_replace($find,$replace,$coll->tva_intra); + if(empty($intra)) { - $intra = $langs->trans('Unknown'); - } - else - { - $intra = ''; + if($coll->assuj == '1') + { + $intra = $langs->trans('Unknown'); + } + else + { + $intra = ''; + } } + print ""; + print '"; + $company_static->id=$coll->socid; + $company_static->nom=$coll->nom; + print ''; + $find = array(' ','.'); + $replace = array('',''); + print '"; + print ""; + print ""; + $totalamount = $totalamount + $coll->amount; + $total = $total + ($local==1?$coll->localtax1:$coll->localtax2); + print "\n"; + $i++; } - print ""; - print '"; - $company_static->id=$coll->socid; - $company_static->nom=$coll->nom; - print ''; - $find = array(' ','.'); - $replace = array('',''); - print '"; - print ""; - print ""; - $totalamount = $totalamount + $coll->amount; - $total = $total + $coll->localtax2; - print "\n"; - $i++; } + $x_paye_sum = $total; + + print ''; + print ''; + print ''; + print ''; + + print '
'.$langs->trans("Num")."'.$langs->trans("Supplier")."".$langs->transcountry("ProfId1",$mysoc->country_code)."".$langs->trans("TotalHT")."".$vatsup."
'.$langs->trans("Num")."'.$langs->trans("Supplier")."".$langs->transcountry("ProfId1",$mysoc->country_code)."".$langs->trans("TotalHT")."".$vatsup."
'.$i."'.$company_static->getNomUrl(1).''.$intra."".price($coll->amount)."".price($local==1?$coll->localtax1:$coll->localtax2)."
'.$i."'.$company_static->getNomUrl(1).''.$intra."".price($coll->amount)."".price($coll->localtax2)."
'.$langs->trans("Total").':'.price($totalamount).''.price($total).'
'; + } - $x_paye_sum = $total; - - print ''.$langs->trans("Total").':'; - print ''.price($totalamount).''; - print ''.price($total).''; - print ''; - - print ''; - - // Total to pay - print '

'; - print ''; - $diff = $x_paye_sum; - print ''; - print ''; - print '\n"; - print "\n"; - -} -else -{ - $langs->load("errors"); - if ($coll_list == -1) - print ''; - else if ($coll_list == -2) - print ''; else - print ''; + { + $langs->load("errors"); + if ($coll_list == -1) + print ''; + else if ($coll_list == -2) + print ''; + else + print ''; + } } +if($conf->global->$calc ==0){ + // Total to pay + print '

'; + print '
'.$langs->trans("TotalToPay").($q?', '.$langs->trans("Quadri").' '.$q:'').''.price(price2num($diff,'MT'))."
'.$langs->trans("ErrorNoAccountancyModuleLoaded").'
'.$langs->trans("FeatureNotYetAvailable").'
'.$langs->trans("Error").'
'.$langs->trans("ErrorNoAccountancyModuleLoaded").'
'.$langs->trans("FeatureNotYetAvailable").'
'.$langs->trans("Error").'
'; + $diff = $x_coll_sum - $x_paye_sum ; + print ''; + print ''; + print '\n"; + print "\n"; + +} print '
'.$langs->trans("TotalToPay").($q?', '.$langs->trans("Quadri").' '.$q:'').''.price(price2num($diff,'MT'))."
'; diff --git a/htdocs/compta/localtax/fiche.php b/htdocs/compta/localtax/fiche.php index c8849ba07f9..ec40eba55b9 100644 --- a/htdocs/compta/localtax/fiche.php +++ b/htdocs/compta/localtax/fiche.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2011-2014 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,7 +30,7 @@ $langs->load("banks"); $langs->load("bills"); $id=$_REQUEST["id"]; - +$lttype=GETPOST('localTaxType', 'int'); $mesg = ''; // Security check @@ -44,6 +44,11 @@ $result = restrictedArea($user, 'tax', '', '', 'charges'); */ //add payment of localtax +if($_POST["cancel"] == $langs->trans("Cancel")){ + header("Location: reglement.php?localTaxType=".$lttype); + exit; +} + if ($_POST["action"] == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) { $localtax = new Localtax($db); @@ -59,12 +64,13 @@ if ($_POST["action"] == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) $localtax->datep=$datep; $localtax->amount=$_POST["amount"]; $localtax->label=$_POST["label"]; + $localtax->ltt=$lttype; $ret=$localtax->addPayment($user); if ($ret > 0) { $db->commit(); - header("Location: reglement.php"); + header("Location: reglement.php?localTaxType=".$lttype); exit; } else @@ -145,10 +151,11 @@ if ($_GET["action"] == 'create') { print "\n"; print ''; + print ''; print ''; - print_fiche_titre($langs->transcountry("newLT2Payment",$mysoc->country_code)); - + print_fiche_titre($langs->transcountry($lttype==2?"newLT2Payment":"newLT1Payment",$mysoc->country_code)); + if ($mesg) print $mesg; print ''; @@ -163,7 +170,7 @@ if ($_GET["action"] == 'create') print ''; // Label - print ''; + print ''; // Amount print ''; diff --git a/htdocs/compta/localtax/index.php b/htdocs/compta/localtax/index.php index 5a832b7631b..67b33a65cec 100644 --- a/htdocs/compta/localtax/index.php +++ b/htdocs/compta/localtax/index.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2011-2014 Juanjo Menent * Copyright (C) 2014 Ferran Marcet * * This program is free software; you can redistribute it and/or modify @@ -27,6 +27,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $langs->load("other"); +$localTaxType=GETPOST('localTaxType', 'int'); $year=$_GET["year"]; if ($year == 0 ) @@ -95,13 +96,30 @@ function pt ($db, $sql, $date) llxHeader(); -$tva = new Tva($db); +if($localTaxType==1) +{ + $LT='LT1'; + $LTSummary='LT1Summary'; + $LTPaid='LT1Paid'; + $LTCustomer='LT1Customer'; + $LTSupplier='LT1Supplier'; + $CalcLT= $conf->global->MAIN_INFO_LOCALTAX_CALC1; +} +else +{ + $LT='LT2'; + $LTSummary='LT2Summary'; + $LTPaid='LT2Paid'; + $LTCustomer='LT2Customer'; + $LTSupplier='LT2Supplier'; + $CalcLT= $conf->global->MAIN_INFO_LOCALTAX_CALC2; +} -$textprevyear="".img_previous().""; -$textnextyear=" ".img_next().""; +$textprevyear="".img_previous().""; +$textnextyear=" ".img_next().""; -print_fiche_titre($langs->transcountry("LT2",$mysoc->country_code),"$textprevyear ".$langs->trans("Year")." $year_start $textnextyear"); +print_fiche_titre($langs->transcountry($LT,$mysoc->country_code),"$textprevyear ".$langs->trans("Year")." $year_start $textnextyear"); print $langs->trans("VATReportBuildWithOptionDefinedInModule").'
'; print '('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')
'; @@ -109,10 +127,10 @@ print '
'; print '
'.$langs->trans("Label").'transcountry("LT2Payment",$mysoc->country_code)).'">
'.$langs->trans("Label").'transcountry(($lttype==2?"LT2Payment":"LT1Payment"),$mysoc->country_code)).'">
'.$langs->trans("Amount").'
'; print ''; print ''; // Local Taxes - if($mysoc->country_code=='ES') + if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") { - if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") - { - print ''; - print ''; - } - elseif($mysoc->localtax1_assuj=="1") - { - print ''; - } - elseif($mysoc->localtax2_assuj=="1") - { - print ''; - } + print ''; + print ''; } + elseif($mysoc->localtax1_assuj=="1") + { + print ''; + } + elseif($mysoc->localtax2_assuj=="1") + { + print ''; + } + // TVA Intra print ''; // Local Taxes - //TODO: Place into a function to control showing by country or study better option - if($mysoc->country_code=='ES') + if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") { - if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") - { - print ''; - print ''; - } - elseif($mysoc->localtax1_assuj=="1") - { - print ''; - } - elseif($mysoc->localtax2_assuj=="1") - { - print ''; - } - - if ($mysoc->localtax2_assuj!="1") - { - print ''; - } - + print ''; + print ''; + } + elseif($mysoc->localtax1_assuj=="1") + { + print ''; + } + elseif($mysoc->localtax2_assuj=="1") + { + print ''; } // TVA Intra From fdb938af0fd047d0780cfcfebf8db4477fe0850e Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 4 Jul 2014 13:44:26 +0200 Subject: [PATCH 57/68] [ task #1063 ] Allow edit localtaxes rate for thirds. Remove country condition --- htdocs/compta/facture/prelevement.php | 26 ++++++++++++-------------- htdocs/langs/es_ES/companies.lang | 3 +++ 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index e579bc21640..8cc3ba278a4 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -3,7 +3,7 @@ * Copyright (C) 2004 Eric Seigne * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2010 Juanjo Menent + * Copyright (C) 2010-2014 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -384,21 +384,19 @@ if ($object->id > 0) print ''; // Amount Local Taxes - if ($mysoc->country_code=='ES') + if ($mysoc->localtax1_assuj=="1") //Localtax1 { - if ($mysoc->localtax1_assuj=="1") //Localtax1 RE - { - print ''; - print ''; - print ''; - } - if ($mysoc->localtax2_assuj=="1") //Localtax2 IRPF - { - print ''; - print ''; - print ''; - } + print ''; + print ''; + print ''; } + if ($mysoc->localtax2_assuj=="1") //Localtax2 + { + print ''; + print ''; + print ''; + } + print ''; print ''; diff --git a/htdocs/langs/es_ES/companies.lang b/htdocs/langs/es_ES/companies.lang index 89517bd8578..51b72ba0f51 100644 --- a/htdocs/langs/es_ES/companies.lang +++ b/htdocs/langs/es_ES/companies.lang @@ -91,6 +91,9 @@ LocalTax2IsUsedES= Sujeto a IRPF LocalTax2IsNotUsedES= No sujeto a IRPF LocalTax1ES=RE LocalTax2ES=IRPF +TypeLocaltax1ES= Tipo RE +TypeLocaltax2ES= Tipo IRPF +TypeES= Tipo ThirdPartyEMail=%s WrongCustomerCode=Código cliente incorrecto WrongSupplierCode=Código proveedor incorrecto From 8e2999f73f1da91bd6e9f851f9f9c75b1bb6c3da Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Jul 2014 14:19:03 +0200 Subject: [PATCH 58/68] Fix: phpcs --- htdocs/contrat/class/contrat.class.php | 4 +-- htdocs/core/class/html.formcompany.class.php | 30 ++++++++++-------- htdocs/core/lib/functions.lib.php | 33 ++++++++++---------- 3 files changed, 36 insertions(+), 31 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 57ddc994bf5..937fde076c1 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -990,7 +990,7 @@ class Contrat extends CommonObject // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $localtaxes_type=getLocalTaxesFromRate($txtva,0, $this->societe ,$mysoc); + $localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->societe, $mysoc); $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, 1,'', $localtaxes_type); $total_ht = $tabprice[0]; @@ -1136,7 +1136,7 @@ class Contrat extends CommonObject // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $localtaxes_type=getLocalTaxesFromRate($tvatx,0, $this->societe ,$mysoc); + $localtaxes_type=getLocalTaxesFromRate($tvatx, 0, $this->societe, $mysoc); $tabprice=calcul_price_total($qty, $pu, $remise_percent, $tvatx, $localtaxtx1, $txlocaltaxtx2, 0, $price_base_type, $info_bits, 1, '', $localtaxes_type); $total_ht = $tabprice[0]; diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index ad301f09d92..d71c26af29c 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -776,32 +776,37 @@ class FormCompany return $out; } - + /** - * Return a select with localtax values for thirds - * - * @param int $local LocalTax - * @param int $selected Preselected value - * @param varchar $htmlname HTML select name + * Return a HTML select with localtax values for thirdparties + * + * @param int $local LocalTax + * @param int $selected Preselected value + * @param varchar $htmlname HTML select name + * @return void */ function select_localtax($local, $selected, $htmlname) { $tax=get_localtax_by_third($local); - + $num = $this->db->num_rows($tax); $i = 0; if ($num) { $valors=explode(":", $tax); - - if(count($valors)>1) + + if (count($valors) > 1) { //montar select print ''; - } } } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index aa52be4d844..b1f11590bdc 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2894,7 +2894,7 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="") if (empty($thirdparty_seller) || ! is_object($thirdparty_seller)) $thirdparty_seller=$mysoc; dol_syslog("get_localtax tva=".$tva." local=".$local." thirdparty_buyer id=".(is_object($thirdparty_buyer)?$thirdparty_buyer->id:'')."/country_code=".(is_object($thirdparty_buyer)?$thirdparty_buyer->country_code:'')." thirdparty_seller id=".$thirdparty_seller->id."/country_code=".$thirdparty_seller->country_code." thirdparty_seller localtax1_assuj=".$thirdparty_seller->localtax1_assuj." thirdparty_seller localtax2_assuj=".$thirdparty_seller->localtax2_assuj); - + if($thirdparty_buyer->country_code!=$thirdparty_seller->country_code) { return 0; @@ -2911,7 +2911,7 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="") } else { - if (! $thirdparty_seller->localtax1_assuj) return 0; + if (! $thirdparty_seller->localtax1_assuj) return 0; } } @@ -2978,9 +2978,9 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="") } } } - - - + + + $sql = "SELECT t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type"; $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p"; $sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$thirdparty_seller->country_code."'"; @@ -3001,7 +3001,7 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="") /** * Return true if LocalTax is unique - * + * * @param int $local Local taxt to test * @return boolean True if LocalTax have multiple values, False if not */ @@ -3010,7 +3010,7 @@ function isOnlyOneLocalTax($local) $tax=get_localtax_by_third($local); $valors=explode(":", $tax); - + if(count($valors)>1) { return false; @@ -3023,7 +3023,7 @@ function isOnlyOneLocalTax($local) /** * Get values of localtaxes - * + * * @param int $local LocalTax to get * @return number Values of localtax */ @@ -3043,7 +3043,7 @@ function get_localtax_by_third($local) if ($local==1) return $obj->localtax1; elseif ($local==2) return $obj->localtax2; } - + return 0; } @@ -3058,7 +3058,8 @@ function get_localtax_by_third($local) * * @param float $vatrate VAT Rate * @param int $local Number of localtax (1 or 2, or 0 to return 1 & 2) - * @param int $thirdparty Company object + * @param int $buyer Company object + * @param int $seller Company object * @return array array(localtax_type1(1-6 / 0 if not found), rate of localtax1, ...) */ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller) @@ -3078,13 +3079,13 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller) { $obj = $db->fetch_object($resql); if ($local == 1) - { + { if (! isOnlyOneLocalTax(1)) { return array($obj->localtax1_type, get_localtax($vatrate, $local, $buyer, $seller), $obj->accountancy_code_sell,$obj->accountancy_code_buy); } else - { + { return array($obj->localtax1_type, $obj->localtax1,$obj->accountancy_code_sell,$obj->accountancy_code_buy); } } @@ -3095,7 +3096,7 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller) return array($obj->localtax2_type, get_localtax($vatrate, $local, $buyer, $seller),$obj->accountancy_code_sell,$obj->accountancy_code_buy); } else - { + { return array($obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell,$obj->accountancy_code_buy); } } @@ -3122,8 +3123,8 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller) { return array($obj->localtax1_type, $obj->localtax1, $obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell,$obj->accountancy_code_buy); } - } - + } + if(! isOnlyOneLocalTax(2)) { if(! isOnlyOneLocalTax(1)) @@ -3146,7 +3147,7 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller) return array($obj->localtax2_type, $obj->localtax2, $obj->localtax1_type, $obj->localtax1,$obj->accountancy_code_sell,$obj->accountancy_code_buy); } } - + } } From 3ea52a79679290b53651851ebe53f06dfa7f1ced Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Jul 2014 14:25:08 +0200 Subject: [PATCH 59/68] Reduce memory print of object thirdparty. --- htdocs/societe/class/societe.class.php | 28 ++++--------------- htdocs/societe/soc.php | 38 +++++++++++++------------- 2 files changed, 24 insertions(+), 42 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 4cb6fe8e973..2b519a686cd 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -598,24 +598,6 @@ class Societe extends CommonObject return $result; } - /** - * Update localtax value of third party - * @param int $id id societe - * @param int $local Localtax to update - * @param double $value value of localtax - */ - function update_localtax($id, $local, $value) - { - global $db; - $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET "; - if($local==1) $sql .= "localtax1_value = '" .$value."'"; - else $sql.="localtax2_value='".$value."'"; - $sql.="WHERE rowid=".$id; - - $resql=$this->db->query($sql); - - } - /** * Update parameters of third party * @@ -673,7 +655,7 @@ class Societe extends CommonObject // Local taxes $this->localtax1_assuj=trim($this->localtax1_assuj); $this->localtax2_assuj=trim($this->localtax2_assuj); - + $this->localtax1_value=trim($this->localtax1_value); $this->localtax2_value=trim($this->localtax2_value); @@ -782,10 +764,10 @@ class Societe extends CommonObject $sql .=",localtax1_value =".$this->localtax1_value; } else $sql .=",localtax1_value =0.000"; - + } else $sql .=",localtax1_value =0.000"; - + if($this->localtax2_assuj==1) { if($this->localtax2_value!='') @@ -793,7 +775,7 @@ class Societe extends CommonObject $sql .=",localtax2_value =".$this->localtax2_value; } else $sql .=",localtax2_value =0.000"; - + } else $sql .=",localtax2_value =0.000"; @@ -1074,7 +1056,7 @@ class Societe extends CommonObject // Local Taxes $this->localtax1_assuj = $obj->localtax1_assuj; $this->localtax2_assuj = $obj->localtax2_assuj; - + $this->localtax1_value = $obj->localtax1_value; $this->localtax2_value = $obj->localtax2_value; diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 7b92da19fd9..a0eec6ffbc8 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -101,22 +101,22 @@ if (empty($reshook)) // We defined value code_fournisseur $_POST["code_fournisseur"]="Acompleter"; } - + if($action=='set_localtax1') { //obtidre selected del combobox $value=GETPOST('lt1'); $object = new Societe($db); - $res=$object->update_localtax($socid, 1, $value); - + $object->fetch($socid); + $res=$object->setValueFrom('localtax1_value', $value); } if($action=='set_localtax2') { //obtidre selected del combobox $value=GETPOST('lt2'); $object = new Societe($db); - $res=$object->update_localtax($socid, 2, $value); - + $object->fetch($socid); + $res=$object->setValueFrom('localtax2_value', $value); } // Add new third party @@ -175,7 +175,7 @@ if (empty($reshook)) // Local Taxes $object->localtax1_assuj = GETPOST('localtax1assuj_value'); $object->localtax2_assuj = GETPOST('localtax2assuj_value'); - + $object->localtax1_value = GETPOST('lt1'); $object->localtax2_value = GETPOST('lt2'); @@ -679,7 +679,7 @@ else //Local Taxes $object->localtax1_assuj = GETPOST('localtax1assuj_value'); $object->localtax2_assuj = GETPOST('localtax2assuj_value'); - + $object->localtax1_value =GETPOST('lt1'); $object->localtax2_value =GETPOST('lt2'); @@ -1174,7 +1174,7 @@ else //Local Taxes $object->localtax1_assuj = GETPOST('localtax1assuj_value'); $object->localtax2_assuj = GETPOST('localtax2assuj_value'); - + $object->localtax1_value =GETPOST('lt1'); $object->localtax2_value =GETPOST('lt2'); @@ -1195,8 +1195,8 @@ else if($object->localtax2_assuj==0){ $sub2=0; }else{$sub2=1;} - - + + print "\n".''."\n"; - - + + if ($conf->use_javascript_ajax) { print "\n".'
'; -print_titre($langs->transcountry("LT2Summary",$mysoc->country_code)); +print_titre($langs->transcountry($LTSummary,$mysoc->country_code)); print ' '; -print_titre($langs->transcountry("LT2Paid",$mysoc->country_code)); +print_titre($langs->transcountry($LTPaid,$mysoc->country_code)); print '
'; @@ -120,8 +138,20 @@ print '
'; print ""; print ""; print ""; -print ""; -print ""; +if($CalcLT==0) +{ + print ""; + print ""; +} +if($CalcLT==1) +{ + print ""; +} +if($CalcLT==2) +{ + print ""; +} + print ""; print "\n"; print "\n"; @@ -160,24 +190,59 @@ for ($m = 1 ; $m < 13 ; $m++ ) $var=!$var; print ""; print ''; - - $x_coll = 0; - foreach($coll_listsell as $vatrate=>$val) + if($CalcLT==0) { - $x_coll+=$val['localtax2']; - } - $subtotalcoll = $subtotalcoll + $x_coll; - print ""; + $x_coll = 0; + foreach($coll_listsell as $vatrate=>$val) + { + $x_coll+=$val[$localTaxType==1?'localtax1':'localtax2']; + } + $subtotalcoll = $subtotalcoll + $x_coll; + print ""; - $x_paye = 0; - foreach($coll_listbuy as $vatrate=>$val) + $x_paye = 0; + foreach($coll_listbuy as $vatrate=>$val) + { + $x_paye+=$val[$localTaxType==1?'localtax1':'localtax2']; + } + $subtotalpaye = $subtotalpaye + $x_paye; + print ""; + } + elseif($CalcLT==1) { - $x_paye+=$val['localtax2']; + $x_paye = 0; + foreach($coll_listbuy as $vatrate=>$val) + { + $x_paye+=$val[$localTaxType==1?'localtax1':'localtax2']; + } + $subtotalpaye = $subtotalpaye + $x_paye; + print ""; } - $subtotalpaye = $subtotalpaye + $x_paye; - print ""; - - $diff = $x_coll - $x_paye; + elseif($CalcLT==2) + { + $x_coll = 0; + foreach($coll_listsell as $vatrate=>$val) + { + $x_coll+=$val[$localTaxType==1?'localtax1':'localtax2']; + } + $subtotalcoll = $subtotalcoll + $x_coll; + print ""; + + } + + if($CalcLT==0) + { + $diff= $x_coll - $x_paye; + } + elseif($CalcLT==1) + { + $diff= $x_paye; + } + elseif($CalcLT==2) + { + $diff= $x_coll; + } + $total = $total + $diff; $subtotal = $subtotal + $diff; @@ -186,12 +251,26 @@ for ($m = 1 ; $m < 13 ; $m++ ) print "\n"; $i++; - if ($i > 2) { + if ($i > 2) + { print ''; print ''; - print ''; - print ''; - print ''; + if($CalcLT==0) + { + print ''; + print ''; + print ''; + } + elseif($CalcLT==1) + { + print ''; + print ''; + } + elseif($CalcLT==2) + { + print ''; + print ''; + } print ''; $i = 0; $subtotalcoll=0; $subtotalpaye=0; $subtotal=0; @@ -214,6 +293,7 @@ $sql.= " FROM ".MAIN_DB_PREFIX."localtax as f"; $sql.= " WHERE f.entity = ".$conf->entity; $sql.= " AND f.datev >= '".$db->idate(dol_get_first_day($y,1,false))."'"; $sql.= " AND f.datev <= '".$db->idate(dol_get_last_day($y,12,false))."'"; +$sql.= " AND localtaxtype=".$localTaxType; $sql.= " GROUP BY dm ASC"; pt($db, $sql,$langs->trans("Year")." $y"); diff --git a/htdocs/compta/localtax/quadri_detail.php b/htdocs/compta/localtax/quadri_detail.php new file mode 100644 index 00000000000..a400d1b96a4 --- /dev/null +++ b/htdocs/compta/localtax/quadri_detail.php @@ -0,0 +1,669 @@ + + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2006-2007 Yannick Warnier + * Copyright (C) 2014 Rosana Romero + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/compta/tva/quadri_detail.php + * \ingroup tax + * \brief Trimestrial page - detailed version + * TODO Deal with recurrent invoices as well + */ +global $mysoc; + +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/localtax/class/localtax.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; + +$langs->load("bills"); +$langs->load("compta"); +$langs->load("companies"); +$langs->load("products"); + +$local=GETPOST('localTaxType', 'int'); +// Date range +$year=GETPOST("year"); +if (empty($year)) +{ + $year_current = strftime("%Y",dol_now()); + $year_start = $year_current; +} else { + $year_current = $year; + $year_start = $year; +} +$date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]); +$date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]); +// Quarter +if (empty($date_start) || empty($date_end)) // We define date_start and date_end +{ + $q=GETPOST("q"); + if (empty($q)) + { + if (isset($_REQUEST["month"])) { $date_start=dol_get_first_day($year_start,$_REQUEST["month"],false); $date_end=dol_get_last_day($year_start,$_REQUEST["month"],false); } + else + { + $month_current = strftime("%m",dol_now()); + if ($month_current >= 10) $q=4; + elseif ($month_current >= 7) $q=3; + elseif ($month_current >= 4) $q=2; + else $q=1; + } + } + if ($q==1) { $date_start=dol_get_first_day($year_start,1,false); $date_end=dol_get_last_day($year_start,3,false); } + if ($q==2) { $date_start=dol_get_first_day($year_start,4,false); $date_end=dol_get_last_day($year_start,6,false); } + if ($q==3) { $date_start=dol_get_first_day($year_start,7,false); $date_end=dol_get_last_day($year_start,9,false); } + if ($q==4) { $date_start=dol_get_first_day($year_start,10,false); $date_end=dol_get_last_day($year_start,12,false); } +} + +$min = GETPOST("min"); +if (empty($min)) $min = 0; + +// Define modetax (0 or 1) +// 0=normal, 1=option vat for services is on debit +$modetax = $conf->global->TAX_MODE; +if (isset($_REQUEST["modetax"])) $modetax=$_REQUEST["modetax"]; +if (empty($modetax)) $modetax=0; + +// Security check +$socid = GETPOST('socid','int'); +if ($user->societe_id) $socid=$user->societe_id; +$result = restrictedArea($user, 'tax', '', '', 'charges'); + + + +/* + * View + */ + +$morequerystring=''; +$listofparams=array('date_startmonth','date_startyear','date_startday','date_endmonth','date_endyear','date_endday'); +foreach($listofparams as $param) +{ + if (GETPOST($param)!='') $morequerystring.=($morequerystring?'&':'').$param.'='.GETPOST($param); +} + +llxHeader('','','','',0,0,'','',$morequerystring); + +$form=new Form($db); + +$company_static=new Societe($db); +$invoice_customer=new Facture($db); +$invoice_supplier=new FactureFournisseur($db); +$product_static=new Product($db); +$payment_static=new Paiement($db); +$paymentfourn_static=new PaiementFourn($db); + +//print_fiche_titre($langs->trans("VAT"),""); + +//$fsearch.='
'; +$fsearch.=' '; +$fsearch.=' '; +//$fsearch.=' '.$langs->trans("SalesTurnoverMinimum").': '; +//$fsearch.=' '; + +$calc=MAIN_INFO_LOCALTAX_CALC.$local; +// Affiche en-tete du rapport +if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice for goods and services +{ + $nom=$langs->trans($local==1?"LT1ReportByQuartersInDueDebtMode":"LT2ReportByQuartersInDueDebtMode"); + $calcmode=$calc==0?$langs->trans("CalcModeLT".$local):$langs->trans("CalcModeLT'.$local.'Rec"); + $calcmode.='
('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')'; + $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); + $prevyear=$year_start; $prevquarter=$q; + if ($prevquarter > 1) $prevquarter--; + else { $prevquarter=4; $prevyear--; } + $nextyear=$year_start; $nextquarter=$q; + if ($nextquarter < 4) $nextquarter++; + else { $nextquarter=1; $nextyear++; } + //$periodlink=($prevyear?"".img_previous()." ".img_next()."":""); + //if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='
'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite'); + //if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='
'.$langs->trans("WarningDepositsNotIncluded"); + if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.='
'.$langs->trans("DepositsAreNotIncluded"); + else $description.='
'.$langs->trans("DepositsAreIncluded"); + $description.=$fsearch; + $builddate=time(); + //$exportlink=$langs->trans("NotYetAvailable"); + + $elementcust=$langs->trans("CustomersInvoices"); + $productcust=$langs->trans("ProductOrService"); + $amountcust=$langs->trans("AmountHT"); + $vatcust=$langs->trans("VATReceived"); + if ($mysoc->tva_assuj) $vatcust.=' ('.$langs->trans("ToPay").')'; + $elementsup=$langs->trans("SuppliersInvoices"); + $productsup=$langs->trans("ProductOrService"); + $amountsup=$langs->trans("AmountHT"); + $vatsup=$langs->trans("VATPaid"); + if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')'; +} +if ($conf->global->$calc==2) // Invoice for goods, payment for services +{ + $nom=$langs->trans($local==1?"LT1ReportByQuartersInInputOutputMode":"LT2ReportByQuartersInInputOutputMode"); + $calcmode=$calc==0?$langs->trans("CalcModeLT".$local):$langs->trans("CalcModeLT'.$local.'Rec"); + $calcmode.='
('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')'; + $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); + $prevyear=$year_start; $prevquarter=$q; + if ($prevquarter > 1) $prevquarter--; + else { $prevquarter=4; $prevyear--; } + $nextyear=$year_start; $nextquarter=$q; + if ($nextquarter < 4) $nextquarter++; + else { $nextquarter=1; $nextyear++; } + //$periodlink=($prevyear?"".img_previous()." ".img_next()."":""); + if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.=' '.$langs->trans("DepositsAreNotIncluded"); + else $description.=' '.$langs->trans("DepositsAreIncluded"); + //if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='
'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite'); + //if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='
'.$langs->trans("WarningDepositsNotIncluded"); + $description.=$fsearch; + $builddate=time(); + //$exportlink=$langs->trans("NotYetAvailable"); + + $elementcust=$langs->trans("CustomersInvoices"); + $productcust=$langs->trans("ProductOrService"); + $amountcust=$langs->trans("AmountHT"); + $vatcust=$langs->trans("VATReceived"); + if ($mysoc->tva_assuj) $vatcust.=' ('.$langs->trans("ToPay").')'; + $elementsup=$langs->trans("SuppliersInvoices"); + $productsup=$langs->trans("ProductOrService"); + $amountsup=$langs->trans("AmountHT"); + $vatsup=$langs->trans("VATPaid"); + if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')'; +} +report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode); + + +if($local==1){ + $vatcust=$langs->transcountry("LocalTax1", $mysoc->country_code); + $vatsup=$langs->transcountry("LocalTax1", $mysoc->country_code); +}else{ + $vatcust=$langs->transcountry("LocalTax2", $mysoc->country_code); + $vatsup=$langs->transcountry("LocalTax2", $mysoc->country_code); +} + +// VAT Received and paid + + + +$y = $year_current; +$total = 0; +$i=0; + +// Load arrays of datas +$x_coll= local_by_date($db, 0, 0, $date_start, $date_end, $modetax, 'sell', $local); +//$x_coll = vat_by_date($db, 0, 0, $date_start, $date_end, $modetax, 'sell'); +$x_paye = local_by_date($db, 0, 0, $date_start, $date_end, $modetax, 'buy', $local); + + +echo '
".$langs->trans("Year")." $y".$langs->transcountry("LT2Customer",$mysoc->country_code)."".$langs->transcountry("LT2Supplier",$mysoc->country_code)."".$langs->transcountry($LTCustomer,$mysoc->country_code)."".$langs->transcountry($LTSupplier,$mysoc->country_code)."".$langs->transcountry($LTSupplier,$mysoc->country_code)."".$langs->transcountry($LTCustomer,$mysoc->country_code)."".$langs->trans("TotalToPay")." 
'.dol_print_date(dol_mktime(0,0,0,$m,1,$y),"%b %Y").'".price($x_coll)."".price($x_coll)."".price($x_paye)."".price($x_paye)."".price($x_paye)."".price($x_coll)."
'.$langs->trans("SubTotal").':'.price($subtotalcoll).''.price($subtotalpaye).''.price($subtotal).''.price($subtotalcoll).''.price($subtotalpaye).''.price($subtotal).''.price($subtotalpaye).''.price($subtotal).''.price($subtotalcoll).''.price($subtotal).' 
'; + +if (! is_array($x_coll) || ! is_array($x_paye)) +{ + $langs->load("errors"); + if ($x_coll == -1) + print ''; + else if ($x_coll == -2) + print ''; + else + print ''; +} +else +{ + $x_both = array(); + //now, from these two arrays, get another array with one rate per line + foreach(array_keys($x_coll) as $my_coll_rate) + { + //foreach($x_coll[$my_coll_rate][localtax1_list]){ + $x_both[$my_coll_rate]['coll']['totalht'] = $x_coll[$my_coll_rate]['totalht']; + $x_both[$my_coll_rate]['coll']['vat'] = $x_coll[$my_coll_rate]['vat']; + $x_both[$my_coll_rate]['paye']['totalht'] = 0; + $x_both[$my_coll_rate]['paye']['vat'] = 0; + $x_both[$my_coll_rate]['coll']['links'] = ''; + $x_both[$my_coll_rate]['coll']['detail'] = array(); + foreach($x_coll[$my_coll_rate]['facid'] as $id=>$dummy) + { + $invoice_customer->id=$x_coll[$my_coll_rate]['facid'][$id]; + $invoice_customer->ref=$x_coll[$my_coll_rate]['facnum'][$id]; + $invoice_customer->type=$x_coll[$my_coll_rate]['type'][$id]; + $x_both[$my_coll_rate]['coll']['detail'][] = array( + 'id' =>$x_coll[$my_coll_rate]['facid'][$id], + 'descr' =>$x_coll[$my_coll_rate]['descr'][$id], + 'pid' =>$x_coll[$my_coll_rate]['pid'][$id], + 'pref' =>$x_coll[$my_coll_rate]['pref'][$id], + 'ptype' =>$x_coll[$my_coll_rate]['ptype'][$id], + 'payment_id'=>$x_coll[$my_coll_rate]['payment_id'][$id], + 'payment_amount'=>$x_coll[$my_coll_rate]['payment_amount'][$id], + 'ftotal_ttc'=>$x_coll[$my_coll_rate]['ftotal_ttc'][$id], + 'dtotal_ttc'=>$x_coll[$my_coll_rate]['dtotal_ttc'][$id], + 'dtype' =>$x_coll[$my_coll_rate]['dtype'][$id], + 'ddate_start'=>$x_coll[$my_coll_rate]['ddate_start'][$id], + 'ddate_end' =>$x_coll[$my_coll_rate]['ddate_end'][$id], + 'totalht' =>$x_coll[$my_coll_rate]['totalht_list'][$id], + 'localtax1'=> $x_coll[$my_coll_rate]['localtax1_list'][$id], + 'localtax2'=> $x_coll[$my_coll_rate]['localtax2_list'][$id], + 'vat' =>$x_coll[$my_coll_rate]['vat_list'][$id], + 'link' =>$invoice_customer->getNomUrl(1,'',12)); + } + } + // tva paid + foreach(array_keys($x_paye) as $my_paye_rate){ + $x_both[$my_paye_rate]['paye']['totalht'] = $x_paye[$my_paye_rate]['totalht']; + $x_both[$my_paye_rate]['paye']['vat'] = $x_paye[$my_paye_rate]['vat']; + if(!isset($x_both[$my_paye_rate]['coll']['totalht'])){ + $x_both[$my_paye_rate]['coll']['totalht'] = 0; + $x_both[$my_paye_rate]['coll']['vat'] = 0; + } + $x_both[$my_paye_rate]['paye']['links'] = ''; + $x_both[$my_paye_rate]['paye']['detail'] = array(); + + foreach($x_paye[$my_paye_rate]['facid'] as $id=>$dummy) + { + $invoice_supplier->id=$x_paye[$my_paye_rate]['facid'][$id]; + $invoice_supplier->ref=$x_paye[$my_paye_rate]['facnum'][$id]; + $invoice_supplier->type=$x_paye[$my_paye_rate]['type'][$id]; + $x_both[$my_paye_rate]['paye']['detail'][] = array( + 'id' =>$x_paye[$my_paye_rate]['facid'][$id], + 'descr' =>$x_paye[$my_paye_rate]['descr'][$id], + 'pid' =>$x_paye[$my_paye_rate]['pid'][$id], + 'pref' =>$x_paye[$my_paye_rate]['pref'][$id], + 'ptype' =>$x_paye[$my_paye_rate]['ptype'][$id], + 'payment_id'=>$x_paye[$my_paye_rate]['payment_id'][$id], + 'payment_amount'=>$x_paye[$my_paye_rate]['payment_amount'][$id], + 'ftotal_ttc'=>price2num($x_paye[$my_paye_rate]['ftotal_ttc'][$id]), + 'dtotal_ttc'=>price2num($x_paye[$my_paye_rate]['dtotal_ttc'][$id]), + 'dtype' =>$x_paye[$my_paye_rate]['dtype'][$id], + 'ddate_start'=>$x_paye[$my_paye_rate]['ddate_start'][$id], + 'ddate_end' =>$x_paye[$my_paye_rate]['ddate_end'][$id], + 'totalht' =>price2num($x_paye[$my_paye_rate]['totalht_list'][$id]), + 'localtax1'=> $x_paye[$my_paye_rate]['localtax1_list'][$id], + 'localtax2'=> $x_paye[$my_paye_rate]['localtax2_list'][$id], + 'vat' =>$x_paye[$my_paye_rate]['vat_list'][$id], + 'link' =>$invoice_supplier->getNomUrl(1,'',12)); + } + } + //now we have an array (x_both) indexed by rates for coll and paye + + + //print table headers for this quadri - incomes first + + $x_coll_sum = 0; + $x_coll_ht = 0; + $x_paye_sum = 0; + $x_paye_ht = 0; + + $span=3; + if ($modetax == 0) $span+=2; + + //print ''; + + if($conf->global->$calc ==0 || $conf->global->$calc == 2){ + // Customers invoices + print ''; + print ''; + print ''; + if ($modetax == 0) + { + print ''; + print ''; + } + print ''; + print ''; + print ''; + + + $LT=0; + $sameLT=false; + foreach(array_keys($x_coll) as $rate) + { + $subtot_coll_total_ht = 0; + $subtot_coll_vat = 0; + + if (is_array($x_both[$rate]['coll']['detail'])) + { + // VAT Rate + $var=true; + + if($rate!=0){ + print ""; + //print ''; + /**/ + print ''; + print ''."\n"; + } + foreach($x_both[$rate]['coll']['detail'] as $index => $fields) + { + if(($local==1 && $fields['localtax1']!=0) || ($local==2 && $fields['localtax2']!=0)){ + // Define type + $type=($fields['dtype']?$fields['dtype']:$fields['ptype']); + // Try to enhance type detection using date_start and date_end for free lines where type + // was not saved. + if (! empty($fields['ddate_start'])) $type=1; + if (! empty($fields['ddate_end'])) $type=1; + + $var=!$var; + print ''; + + // Ref + print ''; + + // Description + print ''; + + // Total HT + if ($modetax == 0) + { + print ''; + } + + // Payment + $ratiopaymentinvoice=1; + if ($modetax == 0) + { + if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) $ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']); + print ''; + } + + // Total collected + print ''; + + // Localtax + print ''; + print ''; + + $subtot_coll_total_ht += $temp_ht; + $subtot_coll_vat += $temp_vat; + $x_coll_sum += $temp_vat; + } + } + } + if($rate!=0){ + // Total customers for this vat rate + print ''; + print ''; + print ''; + if ($modetax == 0) + { + print ''; + print ''; + } + print ''; + print ''; + print ''; + } + } + + if (count($x_coll) == 0) // Show a total ine if nothing shown + { + print ''; + print ''; + print ''; + if ($modetax == 0) + { + print ''; + print ''; + } + print ''; + print ''; + print ''; + } + + // Blank line + print ''; + print '
'.$langs->trans("ErrorNoAccountancyModuleLoaded").'
'.$langs->trans("FeatureNotYetAvailable").'
'.$langs->trans("Error").'
'..')
'.$elementcust.''.$productcust.''.$amountcust.''.$langs->trans("Payment").' ('.$langs->trans("PercentOfInvoice").')'.$langs->trans("BI").''.$vatcust.'
'.$langs->trans("Rate").': '.vatrate($rate).'%'.$langs->trans("Rate").': '.vatrate($rate).'%
'.$fields['link'].''; + if ($fields['pid']) + { + $product_static->id=$fields['pid']; + $product_static->ref=$fields['pref']; + $product_static->type=$fields['ptype']; + print $product_static->getNomUrl(1); + if (dol_string_nohtmltag($fields['descr'])) print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']),16); + } + else + { + if ($type) $text = img_object($langs->trans('Service'),'service'); + else $text = img_object($langs->trans('Product'),'product'); + if (preg_match('/^\((.*)\)$/',$fields['descr'],$reg)) + { + if ($reg[1]=='DEPOSIT') $fields['descr']=$langs->transnoentitiesnoconv('Deposit'); + elseif ($reg[1]=='CREDIT_NOTE') $fields['descr']=$langs->transnoentitiesnoconv('CreditNote'); + else $fields['descr']=$langs->transnoentitiesnoconv($reg[1]); + } + print $text.' '.dol_trunc(dol_string_nohtmltag($fields['descr']),16); + + // Show range + print_date_range($fields['ddate_start'],$fields['ddate_end']); + } + print ''; + print price($fields['totalht']); + if (price2num($fields['ftotal_ttc'])) + { + //print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - "; + $ratiolineinvoice=($fields['dtotal_ttc']/$fields['ftotal_ttc']); + //print ' ('.round($ratiolineinvoice*100,2).'%)'; + } + print ''; + //print $fields['totalht']."-".$fields['payment_amount']."-".$fields['ftotal_ttc']; + if ($fields['payment_amount'] && $fields['ftotal_ttc']) + { + $payment_static->id=$fields['payment_id']; + print $payment_static->getNomUrl(2); + } + if ($type == 0) + { + print $langs->trans("NotUsedForGoods"); + } + else { + print $fields['payment_amount']; + if (isset($fields['payment_amount'])) print ' ('.round($ratiopaymentinvoice*100,2).'%)'; + } + print ''; + $temp_ht=$fields['totalht']; + if ($type == 1) $temp_ht=$fields['totalht']*$ratiopaymentinvoice; + print price(price2num($temp_ht,'MT')); + print ''; + $temp_vat= $local==1?$fields['localtax1']:$fields['localtax2']; + print price(price2num($temp_vat,'MT')); + //print price($fields['vat']); + print '
'.$langs->trans("Total").':  '.price(price2num($subtot_coll_total_ht,'MT')).''.price(price2num($subtot_coll_vat,'MT')).'
 '.$langs->trans("Total").':  '.price(price2num(0,'MT')).''.price(price2num(0,'MT')).'
 
'; + $diff=$x_coll_sum; + } + + if($conf->global->$calc ==0 || $conf->global->$calc == 1){ + echo ''; + //print table headers for this quadri - expenses now + //imprime les en-tete de tables pour ce quadri - maintenant les d�penses + print ''; + print ''; + print ''; + if ($modetax == 0) + { + print ''; + print ''; + } + print ''; + print ''; + print ''."\n"; + + foreach(array_keys($x_paye) as $rate) + { + $subtot_paye_total_ht = 0; + $subtot_paye_vat = 0; + + if(is_array($x_both[$rate]['paye']['detail'])) + { + $var=true; + if($rate!=0){ + print ""; + print ''; + print ''."\n"; + } + foreach($x_both[$rate]['paye']['detail'] as $index=>$fields) + { + if(($local==1 && $fields['localtax1']!=0) || ($local==2 && $fields['localtax2']!=0)){ + // Define type + $type=($fields['dtype']?$fields['dtype']:$fields['ptype']); + // Try to enhance type detection using date_start and date_end for free lines where type + // was not saved. + if (! empty($fields['ddate_start'])) $type=1; + if (! empty($fields['ddate_end'])) $type=1; + + $var=!$var; + print ''; + + // Ref + print ''; + + // Description + print ''; + + // Total HT + if ($modetax == 0) + { + print ''; + } + + // Payment + $ratiopaymentinvoice=1; + if ($modetax == 0) + { + if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) $ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']); + print ''; + } + + // VAT paid + print ''; + + // Localtax + print ''; + print ''; + + $subtot_paye_total_ht += $temp_ht; + $subtot_paye_vat += $temp_vat; + $x_paye_sum += $temp_vat; + } + } + } + if($rate!=0){ + // Total suppliers for this vat rate + print ''; + print ''; + print ''; + if ($modetax == 0) + { + print ''; + print ''; + } + print ''; + print ''; + print ''; + } + } + + if (count($x_paye) == 0) // Show a total ine if nothing shown + { + print ''; + print ''; + print ''; + if ($modetax == 0) + { + print ''; + print ''; + } + print ''; + print ''; + print ''; + } + + print '
'.$elementsup.''.$productsup.''.$amountsup.''.$langs->trans("Payment").' ('.$langs->trans("PercentOfInvoice").')'.$langs->trans("BI").''.$vatsup.'
'.$langs->trans("Rate").': '.vatrate($rate).'%
'.$fields['link'].''; + if ($fields['pid']) + { + $product_static->id=$fields['pid']; + $product_static->ref=$fields['pref']; + $product_static->type=$fields['ptype']; + print $product_static->getNomUrl(1); + if (dol_string_nohtmltag($fields['descr'])) print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']),16); + } + else + { + if ($type) $text = img_object($langs->trans('Service'),'service'); + else $text = img_object($langs->trans('Product'),'product'); + print $text.' '.dol_trunc(dol_string_nohtmltag($fields['descr']),16); + + // Show range + print_date_range($fields['ddate_start'],$fields['ddate_end']); + } + print ''; + print price($fields['totalht']); + if (price2num($fields['ftotal_ttc'])) + { + //print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - "; + $ratiolineinvoice=($fields['dtotal_ttc']/$fields['ftotal_ttc']); + //print ' ('.round($ratiolineinvoice*100,2).'%)'; + } + print ''; + if ($fields['payment_amount'] && $fields['ftotal_ttc']) + { + $paymentfourn_static->id=$fields['payment_id']; + print $paymentfourn_static->getNomUrl(2); + } + if ($type == 0) + { + print $langs->trans("NotUsedForGoods"); + } + else + { + print $fields['payment_amount']; + if (isset($fields['payment_amount'])) print ' ('.round($ratiopaymentinvoice*100,2).'%)'; + } + print ''; + $temp_ht=$fields['totalht']; + if ($type == 1) $temp_ht=$fields['totalht']*$ratiopaymentinvoice; + print price(price2num($temp_ht,'MT')); + print ''; + $temp_vat= $local==1?$fields['localtax1']:$fields['localtax2']; + print price(price2num($temp_vat,'MT')); + //print price($fields['vat']); + print '
 '.$langs->trans("Total").':  '.price(price2num($subtot_paye_total_ht,'MT')).''.price(price2num($subtot_paye_vat,'MT')).'
 '.$langs->trans("Total").':  '.price(price2num(0,'MT')).''.price(price2num(0,'MT')).'
'; + $diff=$x_paye_sum; + } + + if($conf->global->$calc ==0){$diff=$x_coll_sum - $x_paye_sum;} + echo ''; + // Total to pay + print '

'; + print '
'; + //$diff = $local==1?$x_coll_sum:$x_paye_sum; + print ''; + print ''; + print '\n"; + print "\n"; + + echo '
'.$langs->trans("TotalToPay").($q?', '.$langs->trans("Quadri").' '.$q:'').''.price(price2num($diff,'MT'))."
'; + + $i++; +} + +$db->close(); + +llxFooter(); +?> diff --git a/htdocs/compta/localtax/reglement.php b/htdocs/compta/localtax/reglement.php index 00199dba36f..6d8c1bc7a9c 100644 --- a/htdocs/compta/localtax/reglement.php +++ b/htdocs/compta/localtax/reglement.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2011-2014 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,6 +31,7 @@ $langs->load("compta"); $socid = isset($_GET["socid"])?$_GET["socid"]:''; if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'tax', '', '', 'charges'); +$ltt=$_REQUEST["localTaxType"]; /* * View @@ -40,11 +41,11 @@ llxHeader(); $localtax_static = new Localtax($db); -print_fiche_titre($langs->transcountry("LT2Payments",$mysoc->country_code)); +print_fiche_titre($langs->transcountry($ltt==2?"LT2Payments":"LT1Payments",$mysoc->country_code)); $sql = "SELECT rowid, amount, label, f.datev as dm"; $sql.= " FROM ".MAIN_DB_PREFIX."localtax as f "; -$sql.= " WHERE f.entity = ".$conf->entity; +$sql.= " WHERE f.entity = ".$conf->entity." AND localtaxtype=".$ltt; $sql.= " ORDER BY dm DESC"; $result = $db->query($sql); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index ca3aea39a47..c97050371aa 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1,7 +1,7 @@ * Copyright (C) 2010 Regis Houssin - * Copyright (C) 2012-2013 Juanjo Menent + * Copyright (C) 2012-2014 Juanjo Menent * Copyright (C) 2013 Cédric Salvador * * This program is free software; you can redistribute it and/or modify @@ -834,15 +834,24 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu global $mysoc; //Local Taxes - if($mysoc->country_code=='ES' && (isset($mysoc->localtax2_assuj) && $mysoc->localtax2_assuj=="1")) + //Local Taxes 1 + if($mysoc->useLocalTax(1) && (isset($mysoc->localtax1_assuj) && $mysoc->localtax1_assuj=="1")) { - if (empty($leftmenu) || preg_match('/^tax_vat/i',$leftmenu)) $newmenu->add("/compta/localtax/index.php?leftmenu=tax_vat&mainmenu=accountancy",$langs->transcountry("LT2",$mysoc->country_code),1,$user->rights->tax->charges->lire); - if (empty($leftmenu) || preg_match('/^tax_vat/i',$leftmenu)) $newmenu->add("/compta/localtax/fiche.php?leftmenu=tax_vat&action=create",$langs->trans("NewPayment"),2,$user->rights->tax->charges->creer); - if (empty($leftmenu) || preg_match('/^tax_vat/i',$leftmenu)) $newmenu->add("/compta/localtax/reglement.php?leftmenu=tax_vat",$langs->trans("Payments"),2,$user->rights->tax->charges->lire); - if (empty($leftmenu) || preg_match('/^tax_vat/i',$leftmenu)) $newmenu->add("/compta/localtax/clients.php?leftmenu=tax_vat", $langs->trans("ReportByCustomers"), 2, $user->rights->tax->charges->lire); - //if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/quadri_detail.php?leftmenu=tax_vat", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire); + $newmenu->add("/compta/localtax/index.php?leftmenu=tax_vat&mainmenu=accountancy&localTaxType=1",$langs->transcountry("LT1",$mysoc->country_code),1,$user->rights->tax->charges->lire); + if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/fiche.php?leftmenu=tax_vat&action=create&localTaxType=1",$langs->trans("NewPayment"),2,$user->rights->tax->charges->creer); + if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/reglement.php?leftmenu=tax_vat&localTaxType=1",$langs->trans("Payments"),2,$user->rights->tax->charges->lire); + if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/clients.php?leftmenu=tax_vat&localTaxType=1", $langs->trans("ReportByCustomers"), 2, $user->rights->tax->charges->lire); + if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/quadri_detail.php?leftmenu=tax_vat&localTaxType=1", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire); + } + //Local Taxes 2 + if($mysoc->useLocalTax(2) && (isset($mysoc->localtax2_assuj) && $mysoc->localtax2_assuj=="1")) + { + $newmenu->add("/compta/localtax/index.php?leftmenu=tax_vat&mainmenu=accountancy&localTaxType=2",$langs->transcountry("LT2",$mysoc->country_code),1,$user->rights->tax->charges->lire); + if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/fiche.php?leftmenu=tax_vat&action=create&localTaxType=2",$langs->trans("NewPayment"),2,$user->rights->tax->charges->creer); + if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/reglement.php?leftmenu=tax_vat&localTaxType=2",$langs->trans("Payments"),2,$user->rights->tax->charges->lire); + if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/clients.php?leftmenu=tax_vat&localTaxType=2", $langs->trans("ReportByCustomers"), 2, $user->rights->tax->charges->lire); + if (empty($leftmenu) || preg_match('/^tax/i',$leftmenu)) $newmenu->add("/compta/localtax/quadri_detail.php?leftmenu=tax_vat&localTaxType=2", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire); } - } } } From bf96a78f630afe772a821ee063a37d9ace66c269 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Jul 2014 13:07:53 +0200 Subject: [PATCH 52/68] Try a fix when timezone string is not standard --- htdocs/core/js/dst.js | 21 +- htdocs/core/lib/functions.lib.php | 20 +- htdocs/includes/adodbtime/adodb-time.inc.php | 560 +++++++++---------- htdocs/main.inc.php | 3 + 4 files changed, 308 insertions(+), 296 deletions(-) diff --git a/htdocs/core/js/dst.js b/htdocs/core/js/dst.js index 5335906dc77..c22f83aec21 100644 --- a/htdocs/core/js/dst.js +++ b/htdocs/core/js/dst.js @@ -1,4 +1,4 @@ -// Copyright (C) 2011-2012 Laurent Destailleur +// Copyright (C) 2011-2014 Laurent Destailleur // Copyright (C) 2011-2012 Regis Houssin // // This program is free software; you can redistribute it and/or modify @@ -18,7 +18,8 @@ // // \file htdocs/core/js/dst.js -// \brief File that include javascript functions for detect user tz, dst_observed, dst_first, dst_second +// \brief File that include javascript functions for detect user tz, tz_string, dst_observed, dst_first, dst_second, +// screenwidth and screenheight // $(document).ready(function () { @@ -39,22 +40,22 @@ $(document).ready(function () { dst = "1"; // daylight savings time is observed } var now=new Date(); - var tz=now.toTimeString().match(/\(.*\)/); + var tz=now.toTimeString().match(/\(.*\)/); // now.toTimeString may return "12:39:59 GMT+0200 (CEST)" //alert('date=' + now + ' string=' + now.toTimeString()); var dst_first=DisplayDstSwitchDates('first'); var dst_second=DisplayDstSwitchDates('second'); //alert(dst); - $('#tz').val(std_time_offset); // returns TZ - // tz is null with IE + $('#tz').val(std_time_offset); // returns TZ + // tz is null with IE if (tz != null) { $('#tz_string').val(tz[0].replace('(','').replace(')','')); // returns TZ string } - $('#dst_observed').val(dst); // returns if DST is observed on summer - $('#dst_first').val(dst_first); // returns DST first switch in year - $('#dst_second').val(dst_second); // returns DST second switch in year + $('#dst_observed').val(dst); // returns if DST is observed on summer + $('#dst_first').val(dst_first); // returns DST first switch in year + $('#dst_second').val(dst_second); // returns DST second switch in year // Detect and save screen resolution - $('#screenwidth').val($(window).width()); // returns width of browser viewport - $('#screenheight').val($(window).height()); // returns width of browser viewport + $('#screenwidth').val($(window).width()); // returns width of browser viewport + $('#screenheight').val($(window).height()); // returns width of browser viewport }); function DisplayDstSwitchDates(firstsecond) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e81c8b3b2d9..e450650549e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -886,7 +886,7 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e if (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i',$time,$reg) || preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$/i',$time,$reg)) { - // This part of code should not be used. + // This part of code should not be used. TODO Remove this. dol_syslog("Functions.lib::dol_print_date function call with deprecated value of time in page ".$_SERVER["PHP_SELF"], LOG_WARNING); // Date has format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS' or 'YYYYMMDDHHMMSS' $syear = (! empty($reg[1]) ? $reg[1] : ''); @@ -904,7 +904,7 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e // Date is a timestamps if ($time < 100000000000) // Protection against bad date values { - $ret=adodb_strftime($format,$time+$offsettz+$offsetdst,$to_gmt); + $ret=adodb_strftime($format,$time+$offsettz+$offsetdst,$to_gmt); // TODO Remove this } else $ret='Bad value '.$time.' for date'; } @@ -912,7 +912,7 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e if (preg_match('/__b__/i',$format)) { // Here ret is string in PHP setup language (strftime was used). Now we convert to $outputlangs. - $month=adodb_strftime('%m',$time+$offsettz+$offsetdst); + $month=adodb_strftime('%m',$time+$offsettz+$offsetdst); // TODO Remove this if ($encodetooutput) { $monthtext=$outputlangs->transnoentities('Month'.$month); @@ -931,7 +931,7 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e } if (preg_match('/__a__/i',$format)) { - $w=adodb_strftime('%w',$time+$offsettz+$offsetdst); + $w=adodb_strftime('%w',$time+$offsettz+$offsetdst); // TODO Remove this $dayweek=$outputlangs->transnoentitiesnoconv('Day'.$w); $ret=str_replace('__A__',$dayweek,$ret); $ret=str_replace('__a__',dol_substr($dayweek,0,3),$ret); @@ -1037,8 +1037,16 @@ function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1) } else if ($gm === 'user') { - $default_timezone=(empty($_SESSION["dol_tz_string"])?'UTC':$_SESSION["dol_tz_string"]); - $localtz = new DateTimeZone($default_timezone); + // We use dol_tz_string first because it contains dst. + $default_timezone=(empty($_SESSION["dol_tz_string"])?@date_default_timezone_get():$_SESSION["dol_tz_string"]); + try { + $localtz = new DateTimeZone($default_timezone); + } + catch(Exception $e) + { + dol_syslog("Warning dol_tz_string contains an invalid value ".$_SESSION["dol_tz_string"], LOG_WARNING); + $default_timezone=@date_default_timezone_get(); + } } else $localtz = new DateTimeZone('UTC'); $dt = new DateTime(null,$localtz); diff --git a/htdocs/includes/adodbtime/adodb-time.inc.php b/htdocs/includes/adodbtime/adodb-time.inc.php index 1ae50767c67..1be5f4cd607 100644 --- a/htdocs/includes/adodbtime/adodb-time.inc.php +++ b/htdocs/includes/adodbtime/adodb-time.inc.php @@ -4,33 +4,33 @@ ADOdb Date Library, part of the ADOdb abstraction library Download: http://phplens.com/phpeverywhere/ PHP native date functions use integer timestamps for computations. -Because of this, dates are restricted to the years 1901-2038 on Unix -and 1970-2038 on Windows due to integer overflow for dates beyond -those years. This library overcomes these limitations by replacing the -native function's signed integers (normally 32-bits) with PHP floating +Because of this, dates are restricted to the years 1901-2038 on Unix +and 1970-2038 on Windows due to integer overflow for dates beyond +those years. This library overcomes these limitations by replacing the +native function's signed integers (normally 32-bits) with PHP floating point numbers (normally 64-bits). Dates from 100 A.D. to 3000 A.D. and later have been tested. The minimum is 100 A.D. as <100 will invoke the -2 => 4 digit year conversion. The maximum is billions of years in the -future, but this is a theoretical limit as the computation of that year +2 => 4 digit year conversion. The maximum is billions of years in the +future, but this is a theoretical limit as the computation of that year would take too long with the current implementation of adodb_mktime(). This library replaces native functions as follows: -
	
+
 	getdate()  with  adodb_getdate()
-	date()     with  adodb_date() 
+	date()     with  adodb_date()
 	gmdate()   with  adodb_gmdate()
 	mktime()   with  adodb_mktime()
 	gmmktime() with  adodb_gmmktime()
 	strftime() with  adodb_strftime()
 	strftime() with  adodb_gmstrftime()
 
- + The parameters are identical, except that adodb_date() accepts a subset -of date()'s field formats. Mktime() will convert from local time to GMT, -and date() will convert from GMT to local time, but daylight savings is +of date()'s field formats. Mktime() will convert from local time to GMT, +and date() will convert from GMT to local time, but daylight savings is not handled currently. This library is independant of the rest of ADOdb, and can be used @@ -39,25 +39,25 @@ as standalone code. PERFORMANCE For high speed, this library uses the native date functions where -possible, and only switches to PHP code when the dates fall outside +possible, and only switches to PHP code when the dates fall outside the 32-bit signed integer range. GREGORIAN CORRECTION -Pope Gregory shortened October of A.D. 1582 by ten days. Thursday, -October 4, 1582 (Julian) was followed immediately by Friday, October 15, -1582 (Gregorian). +Pope Gregory shortened October of A.D. 1582 by ten days. Thursday, +October 4, 1582 (Julian) was followed immediately by Friday, October 15, +1582 (Gregorian). Since 0.06, we handle this correctly, so: -adodb_mktime(0,0,0,10,15,1582) - adodb_mktime(0,0,0,10,4,1582) +adodb_mktime(0,0,0,10,15,1582) - adodb_mktime(0,0,0,10,4,1582) == 24 * 3600 (1 day) ============================================================================= COPYRIGHT -(c) 2003-2005 John Lim and released under BSD-style license except for code by +(c) 2003-2005 John Lim and released under BSD-style license except for code by jackbbs, which includes adodb_mktime, adodb_get_gmt_diff, adodb_is_leap_year and originally found at http://www.php.net/manual/en/function.mktime.php @@ -77,10 +77,10 @@ FUNCTION DESCRIPTIONS ** FUNCTION adodb_getdate($date=false) Returns an array containing date information, as getdate(), but supports -dates greater than 1901 to 2038. The local date/time format is derived from a -heuristic the first time adodb_getdate is called. - - +dates greater than 1901 to 2038. The local date/time format is derived from a +heuristic the first time adodb_getdate is called. + + ** FUNCTION adodb_date($fmt, $timestamp = false) Convert a timestamp to a formatted local date. If $timestamp is not defined, the @@ -90,45 +90,45 @@ outside the 1901 to 2038 range. The format fields that adodb_date supports:
-	a - "am" or "pm" 
-	A - "AM" or "PM" 
-	d - day of the month, 2 digits with leading zeros; i.e. "01" to "31" 
-	D - day of the week, textual, 3 letters; e.g. "Fri" 
-	F - month, textual, long; e.g. "January" 
-	g - hour, 12-hour format without leading zeros; i.e. "1" to "12" 
-	G - hour, 24-hour format without leading zeros; i.e. "0" to "23" 
-	h - hour, 12-hour format; i.e. "01" to "12" 
-	H - hour, 24-hour format; i.e. "00" to "23" 
-	i - minutes; i.e. "00" to "59" 
-	j - day of the month without leading zeros; i.e. "1" to "31" 
-	l (lowercase 'L') - day of the week, textual, long; e.g. "Friday"  
-	L - boolean for whether it is a leap year; i.e. "0" or "1" 
-	m - month; i.e. "01" to "12" 
-	M - month, textual, 3 letters; e.g. "Jan" 
-	n - month without leading zeros; i.e. "1" to "12" 
-	O - Difference to Greenwich time in hours; e.g. "+0200" 
-	Q - Quarter, as in 1, 2, 3, 4 
-	r - RFC 2822 formatted date; e.g. "Thu, 21 Dec 2000 16:01:07 +0200" 
-	s - seconds; i.e. "00" to "59" 
-	S - English ordinal suffix for the day of the month, 2 characters; 
-	   			i.e. "st", "nd", "rd" or "th" 
+	a - "am" or "pm"
+	A - "AM" or "PM"
+	d - day of the month, 2 digits with leading zeros; i.e. "01" to "31"
+	D - day of the week, textual, 3 letters; e.g. "Fri"
+	F - month, textual, long; e.g. "January"
+	g - hour, 12-hour format without leading zeros; i.e. "1" to "12"
+	G - hour, 24-hour format without leading zeros; i.e. "0" to "23"
+	h - hour, 12-hour format; i.e. "01" to "12"
+	H - hour, 24-hour format; i.e. "00" to "23"
+	i - minutes; i.e. "00" to "59"
+	j - day of the month without leading zeros; i.e. "1" to "31"
+	l (lowercase 'L') - day of the week, textual, long; e.g. "Friday"
+	L - boolean for whether it is a leap year; i.e. "0" or "1"
+	m - month; i.e. "01" to "12"
+	M - month, textual, 3 letters; e.g. "Jan"
+	n - month without leading zeros; i.e. "1" to "12"
+	O - Difference to Greenwich time in hours; e.g. "+0200"
+	Q - Quarter, as in 1, 2, 3, 4
+	r - RFC 2822 formatted date; e.g. "Thu, 21 Dec 2000 16:01:07 +0200"
+	s - seconds; i.e. "00" to "59"
+	S - English ordinal suffix for the day of the month, 2 characters;
+	   			i.e. "st", "nd", "rd" or "th"
 	t - number of days in the given month; i.e. "28" to "31"
-	T - Timezone setting of this machine; e.g. "EST" or "MDT" 
-	U - seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)  
-	w - day of the week, numeric, i.e. "0" (Sunday) to "6" (Saturday) 
-	Y - year, 4 digits; e.g. "1999" 
-	y - year, 2 digits; e.g. "99" 
-	z - day of the year; i.e. "0" to "365" 
-	Z - timezone offset in seconds (i.e. "-43200" to "43200"). 
-	   			The offset for timezones west of UTC is always negative, 
-				and for those east of UTC is always positive. 
+	T - Timezone setting of this machine; e.g. "EST" or "MDT"
+	U - seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)
+	w - day of the week, numeric, i.e. "0" (Sunday) to "6" (Saturday)
+	Y - year, 4 digits; e.g. "1999"
+	y - year, 2 digits; e.g. "99"
+	z - day of the year; i.e. "0" to "365"
+	Z - timezone offset in seconds (i.e. "-43200" to "43200").
+	   			The offset for timezones west of UTC is always negative,
+				and for those east of UTC is always positive.
 
Unsupported:
-	B - Swatch Internet time 
+	B - Swatch Internet time
 	I (capital i) - "1" if Daylight Savings Time, "0" otherwise.
-	W - ISO-8601 week number of year, weeks starting on Monday 
+	W - ISO-8601 week number of year, weeks starting on Monday
 
 
@@ -138,7 +138,7 @@ Same as adodb_date, but 2nd parameter accepts iso date, eg. adodb_date2('d-M-Y H:i','2003-12-25 13:01:34'); - + ** FUNCTION adodb_gmdate($fmt, $timestamp = false) Convert a timestamp to a formatted GMT date. If $timestamp is not defined, the @@ -163,7 +163,7 @@ Convert a timestamp to a formatted GMT date. ** FUNCTION adodb_strftime($fmt, $timestamp = false) -Convert a timestamp to a formatted local date. Internally converts $fmt into +Convert a timestamp to a formatted local date. Internally converts $fmt into adodb_date format, then echo result. For best results, you can define the local date format yourself. Define a global @@ -171,56 +171,56 @@ variable $ADODB_DATE_LOCALE which is an array, 1st element is date format using adodb_date syntax, and 2nd element is the time format, also in adodb_date syntax. eg. $ADODB_DATE_LOCALE = array('d/m/Y','H:i:s'); - + Supported format codes:
-	%a - abbreviated weekday name according to the current locale 
-	%A - full weekday name according to the current locale 
-	%b - abbreviated month name according to the current locale 
-	%B - full month name according to the current locale 
-	%c - preferred date and time representation for the current locale 
-	%d - day of the month as a decimal number (range 01 to 31) 
-	%D - same as %m/%d/%y 
-	%e - day of the month as a decimal number, a single digit is preceded by a space (range ' 1' to '31') 
+	%a - abbreviated weekday name according to the current locale
+	%A - full weekday name according to the current locale
+	%b - abbreviated month name according to the current locale
+	%B - full month name according to the current locale
+	%c - preferred date and time representation for the current locale
+	%d - day of the month as a decimal number (range 01 to 31)
+	%D - same as %m/%d/%y
+	%e - day of the month as a decimal number, a single digit is preceded by a space (range ' 1' to '31')
 	%h - same as %b
-	%H - hour as a decimal number using a 24-hour clock (range 00 to 23) 
-	%I - hour as a decimal number using a 12-hour clock (range 01 to 12) 
-	%m - month as a decimal number (range 01 to 12) 
-	%M - minute as a decimal number 
-	%n - newline character 
-	%p - either `am' or `pm' according to the given time value, or the corresponding strings for the current locale 
-	%r - time in a.m. and p.m. notation 
-	%R - time in 24 hour notation 
-	%S - second as a decimal number 
-	%t - tab character 
-	%T - current time, equal to %H:%M:%S 
-	%x - preferred date representation for the current locale without the time 
-	%X - preferred time representation for the current locale without the date 
-	%y - year as a decimal number without a century (range 00 to 99) 
-	%Y - year as a decimal number including the century 
-	%Z - time zone or name or abbreviation 
-	%% - a literal `%' character 
-
+ %H - hour as a decimal number using a 24-hour clock (range 00 to 23) + %I - hour as a decimal number using a 12-hour clock (range 01 to 12) + %m - month as a decimal number (range 01 to 12) + %M - minute as a decimal number + %n - newline character + %p - either `am' or `pm' according to the given time value, or the corresponding strings for the current locale + %r - time in a.m. and p.m. notation + %R - time in 24 hour notation + %S - second as a decimal number + %t - tab character + %T - current time, equal to %H:%M:%S + %x - preferred date representation for the current locale without the time + %X - preferred time representation for the current locale without the date + %y - year as a decimal number without a century (range 00 to 99) + %Y - year as a decimal number including the century + %Z - time zone or name or abbreviation + %% - a literal `%' character +
Unsupported codes:
-	%C - century number (the year divided by 100 and truncated to an integer, range 00 to 99) 
-	%g - like %G, but without the century. 
-	%G - The 4-digit year corresponding to the ISO week number (see %V). 
-	     This has the same format and value as %Y, except that if the ISO week number belongs 
-		 to the previous or next year, that year is used instead. 
-	%j - day of the year as a decimal number (range 001 to 366) 
-	%u - weekday as a decimal number [1,7], with 1 representing Monday 
-	%U - week number of the current year as a decimal number, starting 
-	    with the first Sunday as the first day of the first week 
-	%V - The ISO 8601:1988 week number of the current year as a decimal number, 
-	     range 01 to 53, where week 1 is the first week that has at least 4 days in the 
-		 current year, and with Monday as the first day of the week. (Use %G or %g for 
-		 the year component that corresponds to the week number for the specified timestamp.) 
-	%w - day of the week as a decimal, Sunday being 0 
-	%W - week number of the current year as a decimal number, starting with the 
-	     first Monday as the first day of the first week 
+	%C - century number (the year divided by 100 and truncated to an integer, range 00 to 99)
+	%g - like %G, but without the century.
+	%G - The 4-digit year corresponding to the ISO week number (see %V).
+	     This has the same format and value as %Y, except that if the ISO week number belongs
+		 to the previous or next year, that year is used instead.
+	%j - day of the year as a decimal number (range 001 to 366)
+	%u - weekday as a decimal number [1,7], with 1 representing Monday
+	%U - week number of the current year as a decimal number, starting
+	    with the first Sunday as the first day of the first week
+	%V - The ISO 8601:1988 week number of the current year as a decimal number,
+	     range 01 to 53, where week 1 is the first week that has at least 4 days in the
+		 current year, and with Monday as the first day of the week. (Use %G or %g for
+		 the year component that corresponds to the week number for the specified timestamp.)
+	%w - day of the week as a decimal, Sunday being 0
+	%W - week number of the current year as a decimal number, starting with the
+	     first Monday as the first day of the first week
 
============================================================================= @@ -230,10 +230,10 @@ NOTES Useful url for generating test timestamps: http://www.4webhelp.net/us/timestamp.php -Possible future optimizations include +Possible future optimizations include -a. Using an algorithm similar to Plauger's in "The Standard C Library" -(page 428, xttotm.c _Ttotm() function). Plauger's algorithm will not +a. Using an algorithm similar to Plauger's in "The Standard C Library" +(page 428, xttotm.c _Ttotm() function). Plauger's algorithm will not work outside 32-bit signed range, so i decided not to implement it. b. Implement daylight savings, which looks awfully complicated, see @@ -246,24 +246,24 @@ CHANGELOG * Bug in 0.32 fix for hour handling. Fixed. - 1 Feb 2008 0.32 -* Now adodb_mktime(0,0,0,12+$m,20,2040) works properly. +* Now adodb_mktime(0,0,0,12+$m,20,2040) works properly. - 10 Jan 2008 0.31 * Now adodb_mktime(0,0,0,24,1,2037) works correctly. - 15 July 2007 0.30 -Added PHP 5.2.0 compatability fixes. +Added PHP 5.2.0 compatability fixes. * gmtime behaviour for 1970 has changed. We use the actual date if it is between 1970 to 2038 to get the * timezone, otherwise we use the current year as the baseline to retrieve the timezone. - * Also the timezone's in php 5.2.* support historical data better, eg. if timezone today was +8, but + * Also the timezone's in php 5.2.* support historical data better, eg. if timezone today was +8, but in 1970 it was +7:30, then php 5.2 return +7:30, while this library will use +8. - * - + * + - 19 March 2006 0.24 Changed strftime() locale detection, because some locales prepend the day of week to the date when %c is used. - 10 Feb 2006 0.23 -PHP5 compat: when we detect PHP5, the RFC2822 format for gmt 0000hrs is changed from -0000 to +0000. +PHP5 compat: when we detect PHP5, the RFC2822 format for gmt 0000hrs is changed from -0000 to +0000. In PHP4, we will still use -0000 for 100% compat with PHP4. - 08 Sept 2005 0.22 @@ -277,7 +277,7 @@ Added support for negative months in adodb_mktime(). Added limited strftime/gmstrftime support. x10 improvement in performance of adodb_date(). - 21 Dec 2004 0.17 -In adodb_getdate(), the timestamp was accidentally converted to gmt when $is_gmt is false. +In adodb_getdate(), the timestamp was accidentally converted to gmt when $is_gmt is false. Also adodb_mktime(0,0,0) did not work properly. Both fixed thx Mauro. - 17 Nov 2004 0.16 @@ -286,7 +286,7 @@ Removed intval typecast in adodb_mktime() for secs, allowing: Suggested by Ryan. - 18 July 2004 0.15 -All params in adodb_mktime were formerly compulsory. Now only the hour, min, secs is compulsory. +All params in adodb_mktime were formerly compulsory. Now only the hour, min, secs is compulsory. This brings it more in line with mktime (still not identical). - 23 June 2004 0.14 @@ -304,21 +304,21 @@ function adodb_daylight_sv(&$arr, $is_gmt) if ($m == 6 || $m == 7) $arr['hours'] += 1; } -This is only called by adodb_date() and not by adodb_mktime(). +This is only called by adodb_date() and not by adodb_mktime(). The format of $arr is -Array ( - [seconds] => 0 - [minutes] => 0 - [hours] => 0 +Array ( + [seconds] => 0 + [minutes] => 0 + [hours] => 0 [mday] => 1 # day of month, eg 1st day of the month [mon] => 2 # month (eg. Feb) - [year] => 2102 + [year] => 2102 [yday] => 31 # days in current year [leap] => # true if leap year [ndays] => 28 # no of days in current month - ) - + ) + - 28 Apr 2004 0.13 Fixed adodb_date to properly support $is_gmt. Thx to Dimitar Angelov. @@ -327,11 +327,11 @@ Fixed adodb_date to properly support $is_gmt. Thx to Dimitar Angelov. Fixed month calculation error in adodb_date. 2102-June-01 appeared as 2102-May-32. - 26 Oct 2003 0.11 -Because of daylight savings problems (some systems apply daylight savings to +Because of daylight savings problems (some systems apply daylight savings to January!!!), changed adodb_get_gmt_diff() to ignore daylight savings. - 9 Aug 2003 0.10 -Fixed bug with dates after 2038. +Fixed bug with dates after 2038. See http://phplens.com/lens/lensforum/msgs.php?id=6980 - 1 July 2003 0.09 @@ -361,14 +361,14 @@ Day overflow for less than one month's days is supported. - 28 Jan 2003 0.04 -Gregorian correction handled. In PHP5, we might throw an error if +Gregorian correction handled. In PHP5, we might throw an error if mktime uses invalid dates around 5-14 Oct 1582. Released with ADOdb 3.10. Added limbo 5-14 Oct 1582 check, when we set to 15 Oct 1582. - 27 Jan 2003 0.03 Fixed some more month problems due to gmt issues. Added constant ADODB_DATE_VERSION. -Fixed calculation of days since start of year for <1970. +Fixed calculation of days since start of year for <1970. - 27 Jan 2003 0.02 @@ -391,13 +391,13 @@ define('ADODB_DATE_VERSION',0.33); $ADODB_DATETIME_CLASS = (PHP_VERSION >= 5.2); /* - This code was originally for windows. But apparently this problem happens + This code was originally for windows. But apparently this problem happens also with Linux, RH 7.3 and later! - + glibc-2.2.5-34 and greater has been changed to return -1 for dates < 1970. This used to work. The problem exists with RedHat 7.3 and 8.0 echo (mktime(0, 0, 0, 1, 1, 1960)); // prints -1 - + References: http://bugs.php.net/bug.php?id=20048&edit=2 http://lists.debian.org/debian-glibc/2002/debian-glibc-200205/msg00010.html @@ -411,7 +411,7 @@ function adodb_date_test_date($y1,$m,$d=13) $t = adodb_mktime($h,0,0,$m,$d,$y1); $rez = adodb_date('Y-n-j H:i:s',$t); if ($h == 0) $h = '00'; - else if ($h < 10) $h = '0'.$h; + else if ($h < 10) $h = '0'.$h; if ("$y1-$m-$d $h:00:00" != $rez) { print "$y1 error, expected=$y1-$m-$d $h:00:00, adodb=$rez
"; return false; @@ -423,74 +423,74 @@ function adodb_date_test_strftime($fmt) { $s1 = strftime($fmt); $s2 = adodb_strftime($fmt); - + if ($s1 == $s2) return true; - + echo "error for $fmt, strftime=$s1, adodb=$s2
"; return false; } /** Test Suite -*/ +*/ function adodb_date_test() { - + for ($m=-24; $m<=24; $m++) echo "$m :",adodb_date('d-m-Y',adodb_mktime(0,0,0,1+$m,20,2040)),"
"; - + error_reporting(E_ALL); print "

Testing adodb_date and adodb_mktime. version=".ADODB_DATE_VERSION.' PHP='.PHP_VERSION."

"; @set_time_limit(0); $fail = false; - + // This flag disables calling of PHP native functions, so we can properly test the code if (!defined('ADODB_TEST_DATES')) define('ADODB_TEST_DATES',1); - + $t = time(); - - + + $fmt = 'Y-m-d H:i:s'; echo '
';
 	echo 'adodb: ',adodb_date($fmt,$t),'
'; echo 'php : ',date($fmt,$t),'
'; echo '
'; - + adodb_date_test_strftime('%Y %m %x %X'); adodb_date_test_strftime("%A %d %B %Y"); adodb_date_test_strftime("%H %M S"); - + $t = adodb_mktime(0,0,0); if (!(adodb_date('Y-m-d') == date('Y-m-d'))) print 'Error in '.adodb_mktime(0,0,0).'
'; - + $t = adodb_mktime(0,0,0,6,1,2102); if (!(adodb_date('Y-m-d',$t) == '2102-06-01')) print 'Error in '.adodb_date('Y-m-d',$t).'
'; - + $t = adodb_mktime(0,0,0,2,1,2102); if (!(adodb_date('Y-m-d',$t) == '2102-02-01')) print 'Error in '.adodb_date('Y-m-d',$t).'
'; - - + + print "

Testing gregorian <=> julian conversion

"; $t = adodb_mktime(0,0,0,10,11,1492); //http://www.holidayorigins.com/html/columbus_day.html - Friday check if (!(adodb_date('D Y-m-d',$t) == 'Fri 1492-10-11')) print 'Error in Columbus landing
'; - + $t = adodb_mktime(0,0,0,2,29,1500); if (!(adodb_date('Y-m-d',$t) == '1500-02-29')) print 'Error in julian leap years
'; - + $t = adodb_mktime(0,0,0,2,29,1700); if (!(adodb_date('Y-m-d',$t) == '1700-03-01')) print 'Error in gregorian leap years
'; - + print adodb_mktime(0,0,0,10,4,1582).' '; print adodb_mktime(0,0,0,10,15,1582); $diff = (adodb_mktime(0,0,0,10,15,1582) - adodb_mktime(0,0,0,10,4,1582)); if ($diff != 3600*24) print " Error in gregorian correction = ".($diff/3600/24)." days
"; - + print " 15 Oct 1582, Fri=".(adodb_dow(1582,10,15) == 5 ? 'Fri' : 'Error')."
"; print " 4 Oct 1582, Thu=".(adodb_dow(1582,10,4) == 4 ? 'Thu' : 'Error')."
"; - + print "

Testing overflow

"; - + $t = adodb_mktime(0,0,0,3,33,1965); if (!(adodb_date('Y-m-d',$t) == '1965-04-02')) print 'Error in day overflow 1
'; $t = adodb_mktime(0,0,0,4,33,1971); @@ -503,7 +503,7 @@ function adodb_date_test() if (!(adodb_date('Y-m-d',$t) == '1966-02-01')) print 'Error in day overflow 5 '.adodb_date('Y-m-d',$t).'
'; $t = adodb_mktime(0,0,0,13,3,1965); if (!(adodb_date('Y-m-d',$t) == '1966-01-03')) print 'Error in mth overflow 1
'; - + print "Testing 2-digit => 4-digit year conversion

"; if (adodb_year_digit_check(00) != 2000) print "Err 2-digit 2000
"; if (adodb_year_digit_check(10) != 2010) print "Err 2-digit 2010
"; @@ -512,10 +512,10 @@ function adodb_date_test() if (adodb_year_digit_check(40) != 1940) print "Err 2-digit 1940
"; if (adodb_year_digit_check(50) != 1950) print "Err 2-digit 1950
"; if (adodb_year_digit_check(90) != 1990) print "Err 2-digit 1990
"; - + // Test string formating print "

Testing date formating

"; - + $fmt = '\d\a\t\e T Y-m-d H:i:s a A d D F g G h H i j l L m M n O \R\F\C2822 r s t U w y Y z Z 2003'; $s1 = date($fmt,0); $s2 = adodb_date($fmt,0); @@ -538,12 +538,12 @@ function adodb_date_test() break; } } - print "Error date(): $ts
 
+			print "Error date(): $ts
   \"$s1\" (date len=".strlen($s1).")
   \"$s2\" (adodb_date len=".strlen($s2).")

"; $fail = true; } - + $a1 = getdate($ts); $a2 = adodb_getdate($ts); $rez = array_diff($a1,$a2); @@ -556,7 +556,7 @@ function adodb_date_test() $fail = true; } } - + // Test generation of dates outside 1901-2038 print "

Testing random dates between 100 and 4000

"; adodb_date_test_date(100,1); @@ -564,7 +564,7 @@ function adodb_date_test() $y1 = 100+rand(0,1970-100); $m = rand(1,12); adodb_date_test_date($y1,$m); - + $y1 = 3000-rand(0,3000-1970); adodb_date_test_date($y1,$m); } @@ -575,7 +575,7 @@ function adodb_date_test() $offset = 36000+rand(10000,60000); $max = 365*$yrs*86400; $lastyear = 0; - + // we generate a timestamp, convert it to a date, and convert it back to a timestamp // and check if the roundtrip broke the original timestamp value. print "Testing $start to ".($start+$yrs).", or $max seconds, offset=$offset: "; @@ -602,58 +602,58 @@ function adodb_date_test() } /** - Returns day of week, 0 = Sunday,... 6=Saturday. + Returns day of week, 0 = Sunday,... 6=Saturday. Algorithm from PEAR::Date_Calc */ function adodb_dow($year, $month, $day) { /* -Pope Gregory removed 10 days - October 5 to October 14 - from the year 1582 and -proclaimed that from that time onwards 3 days would be dropped from the calendar +Pope Gregory removed 10 days - October 5 to October 14 - from the year 1582 and +proclaimed that from that time onwards 3 days would be dropped from the calendar every 400 years. -Thursday, October 4, 1582 (Julian) was followed immediately by Friday, October 15, 1582 (Gregorian). +Thursday, October 4, 1582 (Julian) was followed immediately by Friday, October 15, 1582 (Gregorian). */ if ($year <= 1582) { - if ($year < 1582 || + if ($year < 1582 || ($year == 1582 && ($month < 10 || ($month == 10 && $day < 15)))) $greg_correction = 3; else $greg_correction = 0; } else $greg_correction = 0; - + if($month > 2) $month -= 2; else { $month += 10; $year--; } - + $day = floor((13 * $month - 1) / 5) + $day + ($year % 100) + floor(($year % 100) / 4) + floor(($year / 100) / 4) - 2 * floor($year / 100) + 77 + $greg_correction; - + return $day - 7 * floor($day / 7); } /** - Checks for leap year, returns true if it is. No 2-digit year check. Also + Checks for leap year, returns true if it is. No 2-digit year check. Also handles julian calendar correctly. */ -function _adodb_is_leap_year($year) +function _adodb_is_leap_year($year) { if ($year % 4 != 0) return false; - + if ($year % 400 == 0) { return true; // if gregorian calendar (>1582), century not-divisible by 400 is not leap } else if ($year > 1582 && $year % 100 == 0 ) { return false; - } - + } + return true; } @@ -661,7 +661,7 @@ function _adodb_is_leap_year($year) /** checks for leap year, returns true if it is. Has 2-digit year check */ -function adodb_is_leap_year($year) +function adodb_is_leap_year($year) { return _adodb_is_leap_year(adodb_year_digit_check($year)); } @@ -670,13 +670,13 @@ function adodb_is_leap_year($year) Fix 2-digit years. Works for any century. Assumes that if 2-digit is more than 30 years in future, then previous century. */ -function adodb_year_digit_check($y) +function adodb_year_digit_check($y) { if ($y < 100) { - + $yr = (integer) date("Y"); $century = (integer) ($yr /100); - + if ($yr%100 > 50) { $c1 = $century + 1; $c0 = $century; @@ -693,24 +693,24 @@ function adodb_year_digit_check($y) return $y; } -function adodb_get_gmt_diff_ts($ts) +function adodb_get_gmt_diff_ts($ts) { if (0 <= $ts && $ts <= 0x7FFFFFFF) { // check if number in 32-bit signed range) { $arr = getdate($ts); $y = $arr['year']; $m = $arr['mon']; $d = $arr['mday']; - return adodb_get_gmt_diff($y,$m,$d); + return adodb_get_gmt_diff($y,$m,$d); } else { return adodb_get_gmt_diff(false,false,false); } - + } /** get local time zone offset from GMT. Does not handle historical timezones before 1970. */ -function adodb_get_gmt_diff($y,$m,$d) +function adodb_get_gmt_diff($y,$m,$d) { static $TZ,$tzo; global $ADODB_DATETIME_CLASS; @@ -729,9 +729,9 @@ global $ADODB_DATETIME_CLASS; } else { if (isset($TZ)) return $TZ; $y = date('Y'); - $TZ = mktime(0,0,0,12,2,$y,0) - gmmktime(0,0,0,12,2,$y,0); + $TZ = mktime(0,0,0,12,2,$y) - gmmktime(0,0,0,12,2,$y); } - + return $TZ; } @@ -757,7 +757,7 @@ function adodb_date_gentable($out=true) for ($i=1970; $i >= 1600; $i-=10) { $s = adodb_gmmktime(0,0,0,1,1,$i); - echo "$i => $s,
"; + echo "$i => $s,
"; } } adodb_date_gentable(); @@ -773,22 +773,22 @@ echo "
$i "; $_month_table_normal = array("",31,28,31,30,31,30,31,31,30,31,30,31); $_month_table_leaf = array("",31,29,31,30,31,30,31,31,30,31,30,31); - + function adodb_validdate($y,$m,$d) { global $_month_table_normal,$_month_table_leaf; if (_adodb_is_leap_year($y)) $marr = $_month_table_leaf; else $marr = $_month_table_normal; - + if ($m > 12 || $m < 1) return false; - + if ($d > 31 || $d < 1) return false; - + if ($marr[$m] < $d) return false; - + if ($y < 1000 && $y > 3000) return false; - + return true; } @@ -806,17 +806,17 @@ global $_month_table_normal,$_month_table_leaf; $_day_power = 86400; $_hour_power = 3600; $_min_power = 60; - - if ($d < -12219321600) $d -= 86400*10; // if 15 Oct 1582 or earlier, gregorian correction - + + if ($d < -12219321600) $d -= 86400*10; // if 15 Oct 1582 or earlier, gregorian correction + $_month_table_normal = array("",31,28,31,30,31,30,31,31,30,31,30,31); $_month_table_leaf = array("",31,29,31,30,31,30,31,31,30,31,30,31); - + $d366 = $_day_power * 366; $d365 = $_day_power * 365; - + if ($d < 0) { - + if (empty($YRS)) $YRS = array( 1970 => 0, 1960 => -315619200, @@ -858,28 +858,28 @@ global $_month_table_normal,$_month_table_leaf; 1600 => -11676096000); if ($is_gmt) $origd = $d; - // The valid range of a 32bit signed timestamp is typically from + // The valid range of a 32bit signed timestamp is typically from // Fri, 13 Dec 1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT // - + # old algorithm iterates through all years. new algorithm does it in # 10 year blocks - + /* # old algo for ($a = 1970 ; --$a >= 0;) { $lastd = $d; - + if ($leaf = _adodb_is_leap_year($a)) $d += $d366; else $d += $d365; - + if ($d >= 0) { $year = $a; break; } } */ - + $lastsecs = 0; $lastyear = 1970; foreach($YRS as $year => $secs) { @@ -890,27 +890,27 @@ global $_month_table_normal,$_month_table_leaf; $lastsecs = $secs; $lastyear = $year; } - + $d -= $lastsecs; if (!isset($a)) $a = $lastyear; - + //echo ' yr=',$a,' ', $d,'.'; - + for (; --$a >= 0;) { $lastd = $d; - + if ($leaf = _adodb_is_leap_year($a)) $d += $d366; else $d += $d365; - + if ($d >= 0) { $year = $a; break; } } /**/ - + $secsInYear = 86400 * ($leaf ? 366 : 365) + $lastd; - + $d = $lastd; $mtab = ($leaf) ? $_month_table_leaf : $_month_table_normal; for ($a = 13 ; --$a > 0;) { @@ -922,17 +922,17 @@ global $_month_table_normal,$_month_table_leaf; break; } } - + $d = $lastd; $day = $ndays + ceil(($d+1) / ($_day_power)); $d += ($ndays - $day+1)* $_day_power; $hour = floor($d/$_hour_power); - + } else { for ($a = 1970 ;; $a++) { $lastd = $d; - + if ($leaf = _adodb_is_leap_year($a)) $d -= $d366; else $d -= $d365; if ($d < 0) { @@ -957,7 +957,7 @@ global $_month_table_normal,$_month_table_leaf; $d = $d - ($day-1) * $_day_power; $hour = floor($d /$_hour_power); } - + $d -= $hour * $_hour_power; $min = floor($d/$_min_power); $secs = $d - $min * $_min_power; @@ -974,8 +974,8 @@ global $_month_table_normal,$_month_table_leaf; 'ndays' => $ndays ); } - - + + $dow = adodb_dow($year,$month,$day); return array( @@ -994,18 +994,18 @@ global $_month_table_normal,$_month_table_leaf; } /* if ($isphp5) - $dates .= sprintf('%s%04d',($gmt<=0)?'+':'-',abs($gmt)/36); + $dates .= sprintf('%s%04d',($gmt<=0)?'+':'-',abs($gmt)/36); else - $dates .= sprintf('%s%04d',($gmt<0)?'+':'-',abs($gmt)/36); + $dates .= sprintf('%s%04d',($gmt<0)?'+':'-',abs($gmt)/36); break;*/ function adodb_tz_offset($gmt,$isphp5) { $zhrs = abs($gmt)/3600; $hrs = floor($zhrs); - if ($isphp5) - return sprintf('%s%02d%02d',($gmt<=0)?'+':'-',floor($zhrs),($zhrs-$hrs)*60); + if ($isphp5) + return sprintf('%s%02d%02d',($gmt<=0)?'+':'-',floor($zhrs),($zhrs-$hrs)*60); else - return sprintf('%s%02d%02d',($gmt<0)?'+':'-',floor($zhrs),($zhrs-$hrs)*60); + return sprintf('%s%02d%02d',($gmt<0)?'+':'-',floor($zhrs),($zhrs-$hrs)*60); break; } @@ -1019,17 +1019,17 @@ function adodb_gmdate($fmt,$d=false) function adodb_date2($fmt, $d=false, $is_gmt=false) { if ($d !== false) { - if (!preg_match( - "|^([0-9]{4})[-/\.]?([0-9]{1,2})[-/\.]?([0-9]{1,2})[ -]?(([0-9]{1,2}):?([0-9]{1,2}):?([0-9\.]{1,4}))?|", + if (!preg_match( + "|^([0-9]{4})[-/\.]?([0-9]{1,2})[-/\.]?([0-9]{1,2})[ -]?(([0-9]{1,2}):?([0-9]{1,2}):?([0-9\.]{1,4}))?|", ($d), $rr)) return adodb_date($fmt,false,$is_gmt); if ($rr[1] <= 100 && $rr[2]<= 1) return adodb_date($fmt,false,$is_gmt); - + // h-m-s-MM-DD-YY if (!isset($rr[5])) $d = adodb_mktime(0,0,0,$rr[2],$rr[3],$rr[1],false,$is_gmt); else $d = @adodb_mktime($rr[5],$rr[6],$rr[7],$rr[2],$rr[3],$rr[1],false,$is_gmt); } - + return adodb_date($fmt,$d,$is_gmt); } @@ -1051,31 +1051,31 @@ global $ADODB_DATETIME_CLASS; } } $_day_power = 86400; - + $arr = _adodb_getdate($d,true,$is_gmt); - + if (!isset($daylight)) $daylight = function_exists('adodb_daylight_sv'); if ($daylight) adodb_daylight_sv($arr, $is_gmt); - + $year = $arr['year']; $month = $arr['mon']; $day = $arr['mday']; $hour = $arr['hours']; $min = $arr['minutes']; $secs = $arr['seconds']; - + $max = strlen($fmt); $dates = ''; - + $isphp5 = PHP_VERSION >= 5; - + /* at this point, we have the following integer vars to manipulate: $year, $month, $day, $hour, $min, $secs */ for ($i=0; $i < $max; $i++) { switch($fmt[$i]) { - case 'T': + case 'T': if ($ADODB_DATETIME_CLASS) { $dt = new DateTime(); $dt->SetDate($year,$month,$day); @@ -1086,23 +1086,23 @@ global $ADODB_DATETIME_CLASS; // YEAR case 'L': $dates .= $arr['leap'] ? '1' : '0'; break; case 'r': // Thu, 21 Dec 2000 16:01:07 +0200 - + // 4.3.11 uses '04 Jun 2004' // 4.3.8 uses ' 4 Jun 2004' - $dates .= gmdate('D',$_day_power*(3+adodb_dow($year,$month,$day))).', ' + $dates .= gmdate('D',$_day_power*(3+adodb_dow($year,$month,$day))).', ' . ($day<10?'0'.$day:$day) . ' '.date('M',mktime(0,0,0,$month,2,1971)).' '.$year.' '; - - if ($hour < 10) $dates .= '0'.$hour; else $dates .= $hour; - + + if ($hour < 10) $dates .= '0'.$hour; else $dates .= $hour; + if ($min < 10) $dates .= ':0'.$min; else $dates .= ':'.$min; - + if ($secs < 10) $dates .= ':0'.$secs; else $dates .= ':'.$secs; - + $gmt = adodb_get_gmt_diff($year,$month,$day); - + $dates .= ' '.adodb_tz_offset($gmt,$isphp5); break; - + case 'Y': $dates .= $year; break; case 'y': $dates .= substr($year,strlen($year)-2,2); break; // MONTH @@ -1119,47 +1119,47 @@ global $ADODB_DATETIME_CLASS; case 'D': $dates .= gmdate('D',$_day_power*(3+adodb_dow($year,$month,$day))); break; case 'j': $dates .= $day; break; case 'd': if ($day<10) $dates .= '0'.$day; else $dates .= $day; break; - case 'S': + case 'S': $d10 = $day % 10; if ($d10 == 1) $dates .= 'st'; else if ($d10 == 2 && $day != 12) $dates .= 'nd'; else if ($d10 == 3) $dates .= 'rd'; else $dates .= 'th'; break; - + // HOUR case 'Z': $dates .= ($is_gmt) ? 0 : -adodb_get_gmt_diff($year,$month,$day); break; - case 'O': + case 'O': $gmt = ($is_gmt) ? 0 : adodb_get_gmt_diff($year,$month,$day); - + $dates .= adodb_tz_offset($gmt,$isphp5); break; - - case 'H': - if ($hour < 10) $dates .= '0'.$hour; - else $dates .= $hour; + + case 'H': + if ($hour < 10) $dates .= '0'.$hour; + else $dates .= $hour; break; - case 'h': - if ($hour > 12) $hh = $hour - 12; + case 'h': + if ($hour > 12) $hh = $hour - 12; else { - if ($hour == 0) $hh = '12'; + if ($hour == 0) $hh = '12'; else $hh = $hour; } - + if ($hh < 10) $dates .= '0'.$hh; else $dates .= $hh; break; - - case 'G': + + case 'G': $dates .= $hour; break; - + case 'g': - if ($hour > 12) $hh = $hour - 12; + if ($hour > 12) $hh = $hour - 12; else { - if ($hour == 0) $hh = '12'; - else $hh = $hour; + if ($hour == 0) $hh = '12'; + else $hh = $hour; } $dates .= $hh; break; @@ -1181,7 +1181,7 @@ global $ADODB_DATETIME_CLASS; default: $dates .= $fmt[$i]; break; // ESCAPE - case "\\": + case "\\": $i++; if ($i < $max) $dates .= $fmt[$i]; break; @@ -1191,7 +1191,7 @@ global $ADODB_DATETIME_CLASS; } /** - Returns a timestamp given a GMT/UTC time. + Returns a timestamp given a GMT/UTC time. Note that $is_dst is not implemented and is ignored. */ function adodb_gmmktime($hr,$min,$sec,$mon=false,$day=false,$year=false,$is_dst=false) @@ -1202,33 +1202,33 @@ function adodb_gmmktime($hr,$min,$sec,$mon=false,$day=false,$year=false,$is_dst= /** Return a timestamp given a local time. Originally by jackbbs. Note that $is_dst is not implemented and is ignored. - + Not a very fast algorithm - O(n) operation. Could be optimized to O(1). */ -function adodb_mktime($hr,$min,$sec,$mon=false,$day=false,$year=false,$is_dst=false,$is_gmt=false) +function adodb_mktime($hr,$min,$sec,$mon=false,$day=false,$year=false,$is_dst=false,$is_gmt=false) { if (!defined('ADODB_TEST_DATES')) { if ($mon === false) { return $is_gmt? @gmmktime($hr,$min,$sec): @mktime($hr,$min,$sec); } - - // for windows, we don't check 1970 because with timezone differences, + + // for windows, we don't check 1970 because with timezone differences, // 1 Jan 1970 could generate negative timestamp, which is illegal $usephpfns = (1971 < $year && $year < 2038 || !defined('ADODB_NO_NEGATIVE_TS') && (1901 < $year && $year < 2038) - ); - - + ); + + if ($usephpfns && ($year + $mon/12+$day/365.25+$hr/(24*365.25) >= 2038)) $usephpfns = false; - + if ($usephpfns) { return $is_gmt ? @gmmktime($hr,$min,$sec,$mon,$day,$year): @mktime($hr,$min,$sec,$mon,$day,$year); } } - + $gmt_different = ($is_gmt) ? 0 : adodb_get_gmt_diff($year,$mon,$day); /* @@ -1241,8 +1241,8 @@ function adodb_mktime($hr,$min,$sec,$mon=false,$day=false,$year=false,$is_dst=fa $mon = intval($mon); $day = intval($day); $year = intval($year); - - + + $year = adodb_year_digit_check($year); if ($mon > 12) { @@ -1254,14 +1254,14 @@ function adodb_mktime($hr,$min,$sec,$mon=false,$day=false,$year=false,$is_dst=fa $year -= $y; $mon += $y*12; } - + $_day_power = 86400; $_hour_power = 3600; $_min_power = 60; - + $_month_table_normal = array("",31,28,31,30,31,30,31,31,30,31,30,31); $_month_table_leaf = array("",31,29,31,30,31,30,31,31,30,31,30,31); - + $_total_date = 0; if ($year >= 1970) { for ($a = 1970 ; $a <= $year; $a++) { @@ -1273,7 +1273,7 @@ function adodb_mktime($hr,$min,$sec,$mon=false,$day=false,$year=false,$is_dst=fa $loop_table = $_month_table_normal; $_add_date = 365; } - if ($a < $year) { + if ($a < $year) { $_total_date += $_add_date; } else { for($b=1;$b<$mon;$b++) { @@ -1283,7 +1283,7 @@ function adodb_mktime($hr,$min,$sec,$mon=false,$day=false,$year=false,$is_dst=fa } $_total_date +=$day-1; $ret = $_total_date * $_day_power + $hr * $_hour_power + $min * $_min_power + $sec + $gmt_different; - + } else { for ($a = 1969 ; $a >= $year; $a--) { $leaf = _adodb_is_leap_year($a); @@ -1302,13 +1302,13 @@ function adodb_mktime($hr,$min,$sec,$mon=false,$day=false,$year=false,$is_dst=fa } } $_total_date += $loop_table[$mon] - $day; - + $_day_time = $hr * $_hour_power + $min * $_min_power + $sec; $_day_time = $_day_power - $_day_time; $ret = -( $_total_date * $_day_power + $_day_time - $gmt_different); if ($ret < -12220185600) $ret += 10*86400; // if earlier than 5 Oct 1582 - gregorian correction else if ($ret < -12219321600) $ret = -12219321600; // if in limbo, reset to 15 Oct 1582. - } + } //print " dmy=$day/$mon/$year $hr:$min:$sec => " .$ret; return $ret; } @@ -1330,7 +1330,7 @@ global $ADODB_DATE_LOCALE; } } - + if (empty($ADODB_DATE_LOCALE)) { /* $tstr = strtoupper(gmstrftime('%c',31366800)); // 30 Dec 1970, 1 am @@ -1342,11 +1342,11 @@ global $ADODB_DATE_LOCALE; $sep = substr($dstr,2,1); $tstr = strtoupper(gmstrftime('%X',31366800)); // 30 Dec 1970, 1 am $hasAM = strrpos($tstr,'M') !== false; - + $ADODB_DATE_LOCALE = array(); - $ADODB_DATE_LOCALE[] = strncmp($tstr,'30',2) == 0 ? 'd'.$sep.'m'.$sep.'y' : 'm'.$sep.'d'.$sep.'y'; + $ADODB_DATE_LOCALE[] = strncmp($tstr,'30',2) == 0 ? 'd'.$sep.'m'.$sep.'y' : 'm'.$sep.'d'.$sep.'y'; $ADODB_DATE_LOCALE[] = ($hasAM) ? 'h:i:s a' : 'H:i:s'; - + } $inpct = false; $fmtdate = ''; @@ -1359,7 +1359,7 @@ global $ADODB_DATE_LOCALE; } else $inpct = true; } else if ($inpct) { - + $inpct = false; switch($ch) { case '0': @@ -1375,9 +1375,9 @@ global $ADODB_DATE_LOCALE; case 'E': case 'O': /* ignore format modifiers */ - $inpct = true; + $inpct = true; break; - + case 'a': $fmtdate .= 'D'; break; case 'A': $fmtdate .= 'l'; break; case 'h': diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 948f200349c..e1cb471b58d 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -447,6 +447,9 @@ if (! defined('NOLOGIN')) $dol_authmode=$conf->authmode; // This properties is defined only when logged, to say what mode was successfully used $dol_tz=$_POST["tz"]; $dol_tz_string=$_POST["tz_string"]; + $dol_tz_string=preg_replace('\s*\(.+\)$','',$dol_tz_string); + $dol_tz_string=preg_replace(',','/',$dol_tz_string); + $dol_tz_string=preg_replace('\s','_',$dol_tz_string); $dol_dst=0; if (isset($_POST["dst_first"]) && isset($_POST["dst_second"])) { From 105e7189ecd2e5abbbb3454d5fbca97b19dd8880 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Jul 2014 13:08:31 +0200 Subject: [PATCH 53/68] Add -p on phpcs to avoid timeout --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4de657bbe31..2366201ce2e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -97,9 +97,9 @@ script: # - phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml --coverage-text test/phpunit/AllTests.php # - phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml --coverage-text test/phpunit/BuildDocTest.php # - phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/WebservicesOtherTest.php -# - phpcs --warning-severity=0 -s --report-checkstyle --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/documents/,/includes/,/test/report/ htdocs/core/class/dolgraph.class.php - - phpcs --warning-severity=0 -s --report-checkstyle --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/documents/,/includes/,/test/report/ . -# - phpcs --warning-severity=0 -s --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/documents/,/includes/,/test/report/ . +# - phpcs -p --warning-severity=0 -s --report-checkstyle --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/documents/,/includes/,/test/report/ htdocs/core/class/dolgraph.class.php + - phpcs -p --warning-severity=0 -s --report-checkstyle --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/documents/,/includes/,/test/report/ . +# - phpcs -p --warning-severity=0 -s --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/documents/,/includes/,/test/report/ . - phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/AllTests.php after_script: From 3679a4ba909ae0c90ee81a9927ada2a97083df67 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 4 Jul 2014 13:11:51 +0200 Subject: [PATCH 54/68] [ task #1063 ] Allow edit localtaxes rate for thirds. Works documents pdf --- .../commande/doc/pdf_einstein.modules.php | 2 +- .../commande/doc/pdf_proforma.modules.php | 2 +- .../modules/facture/doc/pdf_crabe.modules.php | 4 ++-- .../modules/propale/doc/pdf_azur.modules.php | 4 ++-- .../pdf/pdf_muscadet.modules.php | 22 +++++++++++++------ 5 files changed, 21 insertions(+), 13 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 68266f2cef9..712dd0b765c 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -403,7 +403,7 @@ class pdf_einstein extends ModelePDFCommandes if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined && (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax { - $localtaxtmp_array=getLocalTaxesFromRate($vatrate,0,$mysoc); + $localtaxtmp_array=getLocalTaxesFromRate($vatrate,0,$object->thirdparty,$mysoc); $localtax1_type = $localtaxtmp_array[0]; $localtax2_type = $localtaxtmp_array[2]; } diff --git a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php index eb599c2a214..408fd543c93 100644 --- a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php @@ -402,7 +402,7 @@ class pdf_proforma extends ModelePDFCommandes if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined && (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax { - $localtaxtmp_array=getLocalTaxesFromRate($vatrate,0,$mysoc); + $localtaxtmp_array=getLocalTaxesFromRate($vatrate,0, $object->thirdparty,$mysoc); $localtax1_type = $localtaxtmp_array[0]; $localtax2_type = $localtaxtmp_array[2]; } diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 9186e51b954..d40d93fad36 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand - * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2012 Christophe Battarel * * This program is free software; you can redistribute it and/or modify @@ -404,7 +404,7 @@ class pdf_crabe extends ModelePDFFactures if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined && (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax { - $localtaxtmp_array=getLocalTaxesFromRate($vatrate,0,$mysoc); + $localtaxtmp_array=getLocalTaxesFromRate($vatrate,0, $object->thirdparty, $mysoc); $localtax1_type = $localtaxtmp_array[0]; $localtax2_type = $localtaxtmp_array[2]; } diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index fe952fb9903..4ac15330b42 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand - * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2012 Christophe Battarel * * This program is free software; you can redistribute it and/or modify @@ -458,7 +458,7 @@ class pdf_azur extends ModelePDFPropales if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined && (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax { - $localtaxtmp_array=getLocalTaxesFromRate($vatrate,0,$mysoc); + $localtaxtmp_array=getLocalTaxesFromRate($vatrate,0,$object->thirdparty,$mysoc); $localtax1_type = $localtaxtmp_array[0]; $localtax2_type = $localtaxtmp_array[2]; } diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index f15cab9cb6b..d601167c26d 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke - * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2010-2014 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -393,7 +393,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined && (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax { - $localtaxtmp_array=getLocalTaxesFromRate($vatrate,0,$mysoc); + $localtaxtmp_array=getLocalTaxesFromRate($vatrate,0,$mysoc,$object->thirdparty); $localtax1_type = $localtaxtmp_array[0]; $localtax2_type = $localtaxtmp_array[2]; } @@ -698,7 +698,11 @@ class pdf_muscadet extends ModelePDFSuppliersOrders //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ //Local tax 1 - foreach( $this->localtax1 as $tvakey => $tvaval ) + foreach( $this->localtax1 as $localtax_type => $localtax_rate ) + { + if (in_array((string) $localtax_type, array('2','4','6'))) continue; + + foreach( $localtax_rate as $tvakey => $tvaval ) { if ($tvakey != 0) // On affiche pas taux 0 { @@ -718,15 +722,19 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); } } - //} + } //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ //Local tax 2 - foreach( $this->localtax2 as $tvakey => $tvaval ) + foreach( $this->localtax2 as $localtax_type => $localtax_rate ) + { + if (in_array((string) $localtax_type, array('2','4','6'))) continue; + + foreach( $localtax_rate as $tvakey => $tvaval ) { if ($tvakey != 0) // On affiche pas taux 0 { @@ -749,7 +757,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); } } - //} + } } // Total TTC From cdfe8818da728aa7a81fed118e54a79cd42af26a Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 4 Jul 2014 13:16:48 +0200 Subject: [PATCH 55/68] avoid message Delimiter must not be alphanumeric or backslash in /home/bobby/Eclipse/workspace/dolibarr/htdocs/main.inc.php on line 450 on preg_replace --- htdocs/main.inc.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index e1cb471b58d..c24f9fc2036 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -447,9 +447,9 @@ if (! defined('NOLOGIN')) $dol_authmode=$conf->authmode; // This properties is defined only when logged, to say what mode was successfully used $dol_tz=$_POST["tz"]; $dol_tz_string=$_POST["tz_string"]; - $dol_tz_string=preg_replace('\s*\(.+\)$','',$dol_tz_string); - $dol_tz_string=preg_replace(',','/',$dol_tz_string); - $dol_tz_string=preg_replace('\s','_',$dol_tz_string); + $dol_tz_string=preg_replace('/\s*\(.+\)$/','',$dol_tz_string); + $dol_tz_string=preg_replace('/,/' ,'/',$dol_tz_string); + $dol_tz_string=preg_replace('/\s/','_',$dol_tz_string); $dol_dst=0; if (isset($_POST["dst_first"]) && isset($_POST["dst_second"])) { From 466086dca3d4cac677f8833082e2d1985d3b688b Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 4 Jul 2014 13:37:25 +0200 Subject: [PATCH 56/68] [ task #1063 ] Allow edit localtaxes rate for thirds. Remove country condition --- htdocs/comm/fiche.php | 44 +++++++++++++++++------------------ htdocs/fourn/fiche.php | 52 ++++++++++++++++-------------------------- 2 files changed, 41 insertions(+), 55 deletions(-) diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index 7a79b658a76..0f2888fc1a3 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -5,7 +5,7 @@ * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) - * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2013 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -288,30 +288,28 @@ if ($id > 0) print '
'.$langs->trans('LocalTax1IsUsedES').''; - print yn($object->localtax1_assuj); - print '
'.$langs->trans('LocalTax2IsUsedES').''; - print yn($object->localtax2_assuj); - print '
'.$langs->trans("LocalTax1IsUsedES").''; - print yn($object->localtax1_assuj); - print '
'.$langs->trans("LocalTax2IsUsedES").''; - print yn($object->localtax2_assuj); - print '
'.$langs->trans('LocalTax1IsUsedES').''; + print yn($object->localtax1_assuj); + print '
'.$langs->trans('LocalTax2IsUsedES').''; + print yn($object->localtax2_assuj); + print '
'.$langs->trans("LocalTax1IsUsedES").''; + print yn($object->localtax1_assuj); + print '
'.$langs->trans("LocalTax2IsUsedES").''; + print yn($object->localtax2_assuj); + print '
'.$langs->trans('VATIntra').''; diff --git a/htdocs/fourn/fiche.php b/htdocs/fourn/fiche.php index 127dcfdcc8c..8d8faa7d532 100644 --- a/htdocs/fourn/fiche.php +++ b/htdocs/fourn/fiche.php @@ -3,7 +3,7 @@ * Copyright (C) 2003 Eric Seigne * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin - * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2010-2014 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -166,38 +166,26 @@ if ($object->fetch($id)) print '
'.$langs->trans('LocalTax1IsUsedES').''; - print yn($object->localtax1_assuj); - print '
'.$langs->trans('LocalTax2IsUsedES').''; - print yn($object->localtax2_assuj); - print '
'.$langs->trans("LocalTax1IsUsedES").''; - print yn($object->localtax1_assuj); - print '
'.$langs->trans("LocalTax2IsUsedES").''; - print yn($object->localtax2_assuj); - print '
'.$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code).''; - print yn($object->localtax2_assuj); - print '
'.$langs->trans('LocalTax1IsUsedES').''; + print yn($object->localtax1_assuj); + print '
'.$langs->trans('LocalTax2IsUsedES').''; + print yn($object->localtax2_assuj); + print '
'.$langs->trans("LocalTax1IsUsedES").''; + print yn($object->localtax1_assuj); + print '
'.$langs->trans("LocalTax2IsUsedES").''; + print yn($object->localtax2_assuj); + print '
'.$langs->trans('Currency'.$conf->currency).'
'.$langs->transcountry("AmountLT1",$mysoc->country_code).''.price($object->total_localtax1).''.$langs->trans("Currency".$conf->currency).'
'.$langs->transcountry("AmountLT2",$mysoc->country_code).''.price($object->total_localtax2).''.$langs->trans("Currency".$conf->currency).'
'.$langs->transcountry("AmountLT1",$mysoc->country_code).''.price($object->total_localtax1).''.$langs->trans("Currency".$conf->currency).'
'.$langs->transcountry("AmountLT2",$mysoc->country_code).''.price($object->total_localtax2).''.$langs->trans("Currency".$conf->currency).'
'.$langs->trans('AmountTTC').''.price($object->total_ttc).''.$langs->trans('Currency'.$conf->currency).'