From b86684805c83da6b9eedadea1be47cb25203a35f Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 27 Apr 2009 20:37:50 +0000 Subject: [PATCH] New: early development of multi-company module --- htdocs/actioncomm.class.php | 10 +- htdocs/adherents/adherent.class.php | 2 + htdocs/admin/adherent.php | 6 +- htdocs/admin/agenda.php | 4 +- htdocs/admin/agenda_xcal.php | 2 +- htdocs/admin/barcode.php | 8 +- htdocs/admin/bookmark.php | 2 +- htdocs/admin/boutique.php | 38 +-- htdocs/admin/boxes.php | 116 +++++---- htdocs/admin/cashdesk.php | 6 +- htdocs/admin/clicktodial.php | 2 +- htdocs/admin/commande.php | 44 ++-- htdocs/admin/company.php | 58 ++--- htdocs/admin/compta.php | 16 +- htdocs/admin/comptaexpert.php | 6 +- htdocs/admin/confexped.php | 13 +- htdocs/admin/const.php | 6 +- htdocs/admin/delais.php | 23 +- htdocs/admin/dons.php | 2 +- htdocs/admin/droitpret.php | 4 +- htdocs/admin/editeur.php | 4 +- htdocs/admin/energie.php | 2 +- htdocs/admin/events.php | 4 +- htdocs/admin/expedition.php | 27 +- htdocs/admin/external_rss.php | 12 +- htdocs/admin/facture.php | 76 +++--- htdocs/admin/fckeditor.php | 6 +- htdocs/admin/fichinter.php | 50 ++-- htdocs/admin/fournisseur.php | 82 ++---- htdocs/admin/ihm.php | 32 +-- htdocs/admin/ldap.php | 24 +- htdocs/admin/ldap_contacts.php | 32 +-- htdocs/admin/ldap_groups.php | 12 +- htdocs/admin/ldap_members.php | 54 ++-- htdocs/admin/ldap_users.php | 34 +-- htdocs/admin/limits.php | 9 +- htdocs/admin/livraison.php | 26 +- htdocs/admin/mailing.php | 2 +- htdocs/admin/mails.php | 14 +- htdocs/admin/mantis.php | 10 +- htdocs/admin/menus.php | 8 +- htdocs/admin/menus/index.php | 50 +++- htdocs/admin/notification.php | 2 +- htdocs/admin/paybox.php | 16 +- htdocs/admin/perms.php | 18 +- htdocs/admin/phenix.php | 24 +- htdocs/admin/produit.php | 36 +-- htdocs/admin/propale.php | 138 ++++------ htdocs/admin/security.php | 16 +- htdocs/admin/security_other.php | 14 +- htdocs/admin/societe.php | 12 +- htdocs/admin/stock.php | 31 +-- htdocs/admin/syslog.php | 10 +- htdocs/admin/taxes.php | 7 +- htdocs/admin/tools/export.php | 2 +- htdocs/admin/tools/listevents.php | 6 +- htdocs/admin/webcalendar.php | 26 +- htdocs/ajaxbox.php | 6 +- htdocs/boxes.php | 16 +- htdocs/categories/categorie.php | 6 +- htdocs/client.class.php | 7 +- htdocs/comm/action/listactions.php | 24 +- htdocs/comm/clients.php | 28 +- htdocs/comm/contact.php | 40 ++- htdocs/comm/fiche.php | 4 +- htdocs/comm/index.php | 117 ++++----- htdocs/comm/propal.php | 29 ++- htdocs/comm/propal/apercu.php | 15 +- htdocs/comm/propal/note.php | 105 ++++---- htdocs/comm/propal/stats/index.php | 13 +- .../comm/propal/stats/propalestats.class.php | 42 +-- htdocs/comm/prospect/index.php | 36 +-- htdocs/comm/prospect/prospects.php | 29 +-- htdocs/commande/apercu.php | 33 +-- htdocs/commande/commande.class.php | 24 +- htdocs/commande/contact.php | 7 +- htdocs/commande/document.php | 15 +- htdocs/commande/fiche.php | 11 +- htdocs/commande/index.php | 59 +++-- htdocs/commande/info.php | 11 +- htdocs/commande/liste.php | 49 ++-- htdocs/commande/note.php | 16 +- htdocs/commande/stats/commandestats.class.php | 25 +- htdocs/commande/stats/month.php | 1 + htdocs/commonobject.class.php | 15 +- htdocs/compta/bank/account.class.php | 8 +- htdocs/compta/charges/index.php | 18 +- htdocs/compta/clients.php | 33 +-- htdocs/compta/commande/fiche.php | 18 +- htdocs/compta/commande/liste.php | 50 ++-- htdocs/compta/deplacement/fiche.php | 2 +- htdocs/compta/deplacement/index.php | 26 +- htdocs/compta/facture.php | 13 +- htdocs/compta/facture/fiche-rec.php | 17 +- htdocs/compta/facture/impayees.php | 2 + .../facture/stats/facturestats.class.php | 18 +- htdocs/compta/index.php | 65 ++--- .../paiement/cheque/remisecheque.class.php | 8 +- htdocs/compta/paiement/fiche.php | 22 +- htdocs/compta/paiement/liste.php | 6 +- htdocs/compta/prelevement/bons.php | 29 +-- htdocs/compta/prelevement/config.php | 36 +-- htdocs/compta/prelevement/create.php | 32 +-- htdocs/compta/prelevement/demandes.php | 28 +- htdocs/compta/prelevement/index.php | 20 +- htdocs/compta/prelevement/liste.php | 43 ++-- htdocs/compta/prelevement/liste_factures.php | 50 ++-- htdocs/compta/prelevement/rejets.php | 39 ++- htdocs/compta/prelevement/stats.php | 51 ++-- htdocs/compta/propal.php | 49 ++-- htdocs/compta/sociales/charges.php | 14 +- htdocs/compta/sociales/index.php | 5 +- htdocs/compta/tva/fiche.php | 1 + htdocs/compta/tva/index.php | 40 +-- htdocs/compta/tva/quadri.php | 27 +- htdocs/compta/tva/reglement.php | 6 +- htdocs/contact/index.php | 3 +- htdocs/contrat/contrat.class.php | 31 ++- htdocs/contrat/fiche.php | 10 +- htdocs/contrat/index.php | 60 +++-- htdocs/contrat/liste.php | 13 +- htdocs/contrat/services.php | 2 + htdocs/core/conf.class.php | 2 +- htdocs/core/events.class.php | 205 +++++++-------- htdocs/core/menubase.class.php | 67 ++++- htdocs/expedition/commande.php | 19 +- htdocs/expedition/fiche.php | 17 +- htdocs/expedition/index.php | 40 +-- htdocs/expedition/liste.php | 13 +- .../stats/expeditionstats.class.php | 110 ++++---- htdocs/expedition/stats/index.php | 14 +- htdocs/facture.class.php | 26 +- htdocs/fichinter/index.php | 11 +- htdocs/fourn/commande/contact.php | 6 +- htdocs/fourn/commande/dispatch.php | 20 +- htdocs/fourn/commande/document.php | 18 +- htdocs/fourn/commande/fiche.php | 22 +- htdocs/fourn/commande/history.php | 18 +- htdocs/fourn/commande/index.php | 28 +- htdocs/fourn/commande/liste.php | 22 +- htdocs/fourn/commande/note.php | 6 +- htdocs/fourn/facture/document.php | 18 +- htdocs/fourn/facture/fiche.php | 15 +- htdocs/fourn/facture/info.php | 11 +- htdocs/fourn/facture/note.php | 19 +- htdocs/fourn/fournisseur.class.php | 11 +- htdocs/fourn/fournisseur.commande.class.php | 17 +- htdocs/fourn/fournisseur.facture.class.php | 14 +- htdocs/html.form.class.php | 94 +++---- htdocs/html.formorder.class.php | 6 +- htdocs/html.formother.class.php | 2 +- htdocs/includes/boxes/box_actions.php | 21 +- htdocs/includes/boxes/box_clients.php | 27 +- htdocs/includes/boxes/box_commandes.php | 28 +- htdocs/includes/boxes/box_comptes.php | 15 +- htdocs/includes/boxes/box_factures.php | 29 +-- htdocs/includes/boxes/box_factures_fourn.php | 25 +- .../includes/boxes/box_factures_fourn_imp.php | 85 ++++--- htdocs/includes/boxes/box_factures_imp.php | 91 ++++--- htdocs/includes/boxes/box_fournisseurs.php | 21 +- htdocs/includes/boxes/box_produits.php | 31 ++- htdocs/includes/boxes/box_propales.php | 165 ++++++------ htdocs/includes/boxes/box_prospect.php | 131 +++++----- htdocs/includes/boxes/box_services_vendus.php | 29 ++- .../modules/DolibarrModules.class.php | 76 ++++-- htdocs/includes/modules/modAgenda.class.php | 2 + htdocs/includes/modules/modECM.class.php | 5 + .../interface_all_Logevents.class.php | 16 +- htdocs/index.php | 2 +- htdocs/install/etape5.php | 186 +++++++------- htdocs/langs/en_US/boxes.lang | 6 +- htdocs/langs/en_US/commercial.lang | 1 - htdocs/langs/fr_FR/boxes.lang | 5 +- htdocs/langs/fr_FR/commercial.lang | 1 - htdocs/lib/admin.lib.php | 18 +- htdocs/lib/agenda.lib.php | 48 ++-- htdocs/lib/functions.lib.php | 89 +++++-- htdocs/lib/functions2.lib.php | 7 +- htdocs/lib/product.lib.php | 1 + htdocs/lib/security.lib.php | 2 + htdocs/livraison/fiche.php | 16 +- htdocs/product.class.php | 239 +++++++++--------- htdocs/product/document.php | 20 +- htdocs/product/fiche.php | 59 +++-- htdocs/product/fournisseurs.php | 16 +- htdocs/product/index.php | 4 +- htdocs/product/liste.php | 34 +-- htdocs/product/photos.php | 10 +- htdocs/product/popuprop.php | 22 +- htdocs/product/price.php | 12 +- htdocs/product/reassort.php | 39 +-- htdocs/product/sousproduits/fiche.php | 26 +- htdocs/product/stats/commande.php | 39 ++- htdocs/product/stats/commande_fournisseur.php | 36 ++- htdocs/product/stats/contrat.php | 200 +++++++-------- htdocs/product/stats/facture.php | 208 ++++++++------- htdocs/product/stats/facture_fournisseur.php | 33 ++- htdocs/product/stats/fiche.php | 17 +- htdocs/product/stats/index.php | 50 ++-- htdocs/product/stats/propal.php | 41 ++- htdocs/product/stock/fiche.php | 14 +- htdocs/product/stock/index.php | 23 +- htdocs/product/stock/liste.php | 13 +- htdocs/product/stock/mouvement.php | 17 +- htdocs/product/stock/product.php | 26 +- htdocs/product/stock/valo.php | 19 +- htdocs/product/traduction.php | 9 +- htdocs/project.class.php | 15 +- htdocs/projet/activity/index.php | 21 +- htdocs/projet/fiche.php | 8 +- htdocs/projet/index.php | 39 ++- htdocs/projet/liste.php | 35 ++- htdocs/projet/tasks/fiche.php | 2 +- htdocs/propal.class.php | 26 +- htdocs/prospect.class.php | 8 +- htdocs/service.class.php | 1 + htdocs/societe.class.php | 84 +++--- htdocs/societe.php | 26 +- htdocs/telephonie/config/compta.php | 6 +- htdocs/telephonie/config/index.php | 8 +- htdocs/telephonie/config/mail.php | 8 +- htdocs/theme/auguria/img/redstar.png | Bin 0 -> 596 bytes htdocs/theme/bluelagoon/img/redstar.png | Bin 0 -> 596 bytes htdocs/theme/eldy/img/redstar.png | Bin 0 -> 596 bytes htdocs/theme/freelug/img/redstar.png | Bin 0 -> 596 bytes htdocs/theme/yellow/img/redstar.png | Bin 0 -> 596 bytes htdocs/user.class.php | 37 ++- htdocs/user/fiche.php | 44 +++- htdocs/user/group/fiche.php | 42 ++- htdocs/user/group/index.php | 12 +- htdocs/user/group/perms.php | 45 +++- htdocs/user/home.php | 33 ++- htdocs/user/index.php | 17 +- htdocs/user/logout.php | 6 + htdocs/user/perms.php | 33 ++- htdocs/usergroup.class.php | 108 ++++---- mysql/migration/2.5.0-2.6.0.sql | 31 +++ mysql/migration/2.6.0-2.7.0.sql | 42 +++ mysql/tables/llx_bank.sql | 12 +- mysql/tables/llx_bank_account.key.sql | 5 +- mysql/tables/llx_bank_account.sql | 12 +- mysql/tables/llx_boxes_def.key.sql | 22 ++ mysql/tables/llx_boxes_def.sql | 12 +- mysql/tables/llx_chargesociales.sql | 13 +- mysql/tables/llx_document_model.key.sql | 3 +- mysql/tables/llx_document_model.sql | 12 +- mysql/tables/llx_entrepot.key.sql | 22 ++ mysql/tables/llx_entrepot.sql | 16 +- mysql/tables/llx_events.sql | 26 +- mysql/tables/llx_menu.key.sql | 5 +- mysql/tables/llx_menu.sql | 54 ++-- mysql/tables/llx_product.key.sql | 5 +- mysql/tables/llx_product.sql | 13 +- mysql/tables/llx_rights_def.key.sql | 22 ++ mysql/tables/llx_rights_def.sql | 11 +- mysql/tables/llx_societe.key.sql | 6 +- mysql/tables/llx_societe.sql | 111 ++++---- mysql/tables/llx_socpeople.sql | 14 +- mysql/tables/llx_tva.sql | 18 +- mysql/tables/llx_user.sql | 4 +- mysql/tables/llx_user_param.key.sql | 22 ++ mysql/tables/llx_user_param.sql | 14 +- mysql/tables/llx_usergroup.sql | 2 +- 263 files changed, 4108 insertions(+), 3335 deletions(-) create mode 100644 htdocs/theme/auguria/img/redstar.png create mode 100644 htdocs/theme/bluelagoon/img/redstar.png create mode 100644 htdocs/theme/eldy/img/redstar.png create mode 100644 htdocs/theme/freelug/img/redstar.png create mode 100644 htdocs/theme/yellow/img/redstar.png create mode 100644 mysql/migration/2.6.0-2.7.0.sql create mode 100644 mysql/tables/llx_boxes_def.key.sql create mode 100644 mysql/tables/llx_entrepot.key.sql create mode 100644 mysql/tables/llx_rights_def.key.sql create mode 100644 mysql/tables/llx_user_param.key.sql diff --git a/htdocs/actioncomm.class.php b/htdocs/actioncomm.class.php index e7c7247e658..64d1007e46c 100644 --- a/htdocs/actioncomm.class.php +++ b/htdocs/actioncomm.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2005-2009 Regis Houssin * * 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 @@ -390,12 +391,15 @@ class ActionComm $this->nbtodo=$this->nbtodolate=0; $sql = "SELECT a.id, a.datep as dp"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user"; $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql.= ", ".MAIN_DB_PREFIX."societe as s"; + if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE a.percent < 100"; + $sql.= " AND a.fk_soc = s.rowid"; + $sql.= " AND s.entity = ".$conf->entity; if ($user->societe_id) $sql.=" AND a.fk_soc = ".$user->societe_id; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= " AND a.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; + if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND a.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; + $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/adherents/adherent.class.php b/htdocs/adherents/adherent.class.php index 7708318e6b8..0a6bda9600a 100644 --- a/htdocs/adherents/adherent.class.php +++ b/htdocs/adherents/adherent.class.php @@ -1721,9 +1721,11 @@ class Adherent extends CommonObject if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe $this->nbtodo=$this->nbtodolate=0; + $sql = "SELECT a.rowid, a.datefin"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as a"; $sql.= " WHERE a.statut=1"; + $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/admin/adherent.php b/htdocs/admin/adherent.php index 1cf51a46f59..c2ec209dec1 100644 --- a/htdocs/admin/adherent.php +++ b/htdocs/admin/adherent.php @@ -43,7 +43,7 @@ $typeconst=array('yesno','texte','chaine'); // Action mise a jour ou ajout d'une constante if ($_POST["action"] == 'update' || $_POST["action"] == 'add') { - $result=dolibarr_set_const($db, $_POST["constname"],$_POST["constvalue"],$typeconst[$_POST["consttype"]],0,isset($_POST["constnote"])?$_POST["constnote"]:''); + $result=dolibarr_set_const($db, $_POST["constname"],$_POST["constvalue"],$typeconst[$_POST["consttype"]],0,isset($_POST["constnote"])?$_POST["constnote"]:'',$conf->entity); if ($result < 0) { print $db->error(); @@ -53,7 +53,7 @@ if ($_POST["action"] == 'update' || $_POST["action"] == 'add') // Action activation d'un sous module du module adherent if ($_GET["action"] == 'set') { - $result=dolibarr_set_const($db, $_GET["name"],$_GET["value"]); + $result=dolibarr_set_const($db, $_GET["name"],$_GET["value"],'',0,'',$conf->entity); if ($result < 0) { print $db->error(); @@ -63,7 +63,7 @@ if ($_GET["action"] == 'set') // Action desactivation d'un sous module du module adherent if ($_GET["action"] == 'unset') { - $result=dolibarr_del_const($db,$_GET["name"]); + $result=dolibarr_del_const($db,$_GET["name"],$conf->entity); if ($result < 0) { print $db->error(); diff --git a/htdocs/admin/agenda.php b/htdocs/admin/agenda.php index e0dd2cbbd52..2c935fd5d2b 100644 --- a/htdocs/admin/agenda.php +++ b/htdocs/admin/agenda.php @@ -73,8 +73,8 @@ if ($action == "save") { $param='MAIN_AGENDA_ACTIONAUTO_'.$arr['id']; //print "param=".$param." - ".$_POST[$param]; - if (! empty($_POST[$param])) dolibarr_set_const($db,$param,$_POST[$param],'chaine',0); - else dolibarr_del_const($db,$param); + if (! empty($_POST[$param])) dolibarr_set_const($db,$param,$_POST[$param],'chaine',0,'',$conf->entity); + else dolibarr_del_const($db,$param,$conf->entity); } $db->commit(); diff --git a/htdocs/admin/agenda_xcal.php b/htdocs/admin/agenda_xcal.php index 4e2bea89d45..b5542297e38 100644 --- a/htdocs/admin/agenda_xcal.php +++ b/htdocs/admin/agenda_xcal.php @@ -45,7 +45,7 @@ if ($actionsave) $db->begin(); - $i+=dolibarr_set_const($db,'MAIN_AGENDA_XCAL_EXPORTKEY',trim($_POST["MAIN_AGENDA_XCAL_EXPORTKEY"]),'chaine',0); + $i+=dolibarr_set_const($db,'MAIN_AGENDA_XCAL_EXPORTKEY',trim($_POST["MAIN_AGENDA_XCAL_EXPORTKEY"]),'chaine',0,'',$conf->entity); if ($i > 0) { diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index afded12b260..d075b08b581 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -46,20 +46,20 @@ if ($_POST["action"] == 'setcoder') } else if ($_POST["action"] == 'setgenbarcodelocation') { - dolibarr_set_const($db, "GENBARCODE_LOCATION",$_POST["genbarcodelocation"]); + dolibarr_set_const($db, "GENBARCODE_LOCATION",$_POST["genbarcodelocation"],'chaine',0,'',$conf->entity); } else if ($_POST["action"] == 'setdefaultbarcodetype') { - dolibarr_set_const($db, "PRODUIT_DEFAULT_BARCODE_TYPE", $_POST["coder_id"]); + dolibarr_set_const($db, "PRODUIT_DEFAULT_BARCODE_TYPE", $_POST["coder_id"],'chaine',0,'',$conf->entity); } else if ($_POST["action"] == 'GENBARCODE_BARCODETYPE_THIRDPARTY') { - dolibarr_set_const($db, "GENBARCODE_BARCODETYPE_THIRDPARTY", $_POST["coder_id"]); + dolibarr_set_const($db, "GENBARCODE_BARCODETYPE_THIRDPARTY", $_POST["coder_id"],'chaine',0,'',$conf->entity); } /* else if ($_POST["action"] == 'setproductusebarcode') { - dolibarr_set_const($db, "PRODUIT_USE_BARCODE",$_POST["value"]); + dolibarr_set_const($db, "PRODUIT_USE_BARCODE",$_POST["value"],'chaine',0,'',$conf->entity); Header("Location: barcode.php"); exit; } diff --git a/htdocs/admin/bookmark.php b/htdocs/admin/bookmark.php index f8db67eaaac..b4ae3d904ac 100644 --- a/htdocs/admin/bookmark.php +++ b/htdocs/admin/bookmark.php @@ -34,7 +34,7 @@ if (!$user->admin) if ($_POST["action"] == 'setvalue' && $user->admin) { - $result=dolibarr_set_const($db, "BOOKMARKS_SHOW_IN_MENU",$_POST["BOOKMARKS_SHOW_IN_MENU"]); + $result=dolibarr_set_const($db, "BOOKMARKS_SHOW_IN_MENU",$_POST["BOOKMARKS_SHOW_IN_MENU"],'chaine',0,'',$conf->entity); if ($result >= 0) { $mesg='
'.$langs->trans("SetupSaved").'
'; diff --git a/htdocs/admin/boutique.php b/htdocs/admin/boutique.php index c7a63ce7f8e..13ed245f6b3 100644 --- a/htdocs/admin/boutique.php +++ b/htdocs/admin/boutique.php @@ -45,28 +45,28 @@ if (!$user->admin) if ($_POST["save"]) { - $db->begin(); + $db->begin(); - $i=0; + $i=0; - $i+=dolibarr_set_const($db,'OSC_DB_HOST',trim($_POST["oscommerce_dbhost"]),'chaine',0); - $i+=dolibarr_set_const($db,'OSC_DB_NAME',trim($_POST["oscommerce_dbname"]),'chaine',0); - $i+=dolibarr_set_const($db,'OSC_DB_USER',trim($_POST["oscommerce_dbuser"]),'chaine',0); - $i+=dolibarr_set_const($db,'OSC_DB_PASS',trim($_POST["oscommerce_dbpass"]),'chaine',0); - $i+=dolibarr_set_const($db,'OSC_DB_TABLE_PREFIX',trim($_POST["oscommerce_db_table_prefix"]),'chaine',0); - $i+=dolibarr_set_const($db,'OSC_LANGUAGE_ID',1,'chaine',0); + $i+=dolibarr_set_const($db,'OSC_DB_HOST',trim($_POST["oscommerce_dbhost"]),'chaine',0,'',$conf->entity); + $i+=dolibarr_set_const($db,'OSC_DB_NAME',trim($_POST["oscommerce_dbname"]),'chaine',0,'',$conf->entity); + $i+=dolibarr_set_const($db,'OSC_DB_USER',trim($_POST["oscommerce_dbuser"]),'chaine',0,'',$conf->entity); + $i+=dolibarr_set_const($db,'OSC_DB_PASS',trim($_POST["oscommerce_dbpass"]),'chaine',0,'',$conf->entity); + $i+=dolibarr_set_const($db,'OSC_DB_TABLE_PREFIX',trim($_POST["oscommerce_db_table_prefix"]),'chaine',0,'',$conf->entity); + $i+=dolibarr_set_const($db,'OSC_LANGUAGE_ID',1,'chaine',0,'',$conf->entity); - if ($i >= 4) - { - $db->commit(); - $mesg = "".$langs->trans("OSCommerceSetupSaved").""; - } - else - { - $db->rollback(); - header("Location: ".$_SERVER["PHP_SELF"]); - exit; - } + if ($i >= 4) + { + $db->commit(); + $mesg = "".$langs->trans("OSCommerceSetupSaved").""; + } + else + { + $db->rollback(); + header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } } elseif ($_POST["test"]) { diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php index 372d107ba21..a04c4c92904 100644 --- a/htdocs/admin/boxes.php +++ b/htdocs/admin/boxes.php @@ -42,39 +42,39 @@ $boxes = array(); */ if ((isset($_POST["action"]) && $_POST["action"] == 'addconst')) { - dolibarr_set_const($db, "MAIN_BOXES_MAXLINES",$_POST["MAIN_BOXES_MAXLINES"]); + dolibarr_set_const($db, "MAIN_BOXES_MAXLINES",$_POST["MAIN_BOXES_MAXLINES"],'',0,'',$conf->entity); } if ($_POST["action"] == 'add') { $sql = "SELECT rowid"; - $sql.= " FROM ".MAIN_DB_PREFIX."boxes"; - $sql.= " WHERE fk_user=0 AND box_id=".$_POST["boxid"]." AND position=".$_POST["pos"]; - $resql = $db->query($sql); - dol_syslog("boxes.php::search if box active sql=".$sql); + $sql.= " FROM ".MAIN_DB_PREFIX."boxes"; + $sql.= " WHERE fk_user=0 AND box_id=".$_POST["boxid"]." AND position=".$_POST["pos"]; + $resql = $db->query($sql); + dol_syslog("boxes.php::search if box active sql=".$sql); if ($resql) - { - $num = $db->num_rows($resql); - if ($num == 0) - { - $db->begin(); + { + $num = $db->num_rows($resql); + if ($num == 0) + { + $db->begin(); // Si la boite n'est pas deja active, insert with box_order='' - $sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes (box_id, position, box_order, fk_user) values (".$_POST["boxid"].",".$_POST["pos"].", '', 0)"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes (box_id, position, box_order, fk_user) values (".$_POST["boxid"].",".$_POST["pos"].", '', 0)"; dol_syslog("boxes.php activate box sql=".$sql); - $resql = $db->query($sql); + $resql = $db->query($sql); - // Remove all personalized setup when a box is activated or disabled + // Remove all personalized setup when a box is activated or disabled $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_param"; - $sql.= " WHERE param like 'MAIN_BOXES_%'"; + $sql.= " WHERE param like 'MAIN_BOXES_%'"; dol_syslog("boxes.php delete user_param sql=".$sql); - $resql = $db->query($sql); + $resql = $db->query($sql); $db->commit(); } - Header("Location: boxes.php"); - exit; + Header("Location: boxes.php"); + exit; } else { @@ -86,49 +86,49 @@ if ($_GET["action"] == 'delete') { $db->begin(); - $sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes"; - $sql.= " WHERE rowid=".$_GET["rowid"]; - $resql = $db->query($sql); + $sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes"; + $sql.= " WHERE rowid=".$_GET["rowid"]; + $resql = $db->query($sql); - // Remove all personalized setup when a box is activated or disabled - $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_param"; - $sql.= " WHERE param like 'MAIN_BOXES_%'"; - $resql = $db->query($sql); + // Remove all personalized setup when a box is activated or disabled + $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_param"; + $sql.= " WHERE param like 'MAIN_BOXES_%'"; + $resql = $db->query($sql); $db->commit(); } if ($_GET["action"] == 'switch') { - // On permute les valeur du champ box_order des 2 lignes de la table boxes - $db->begin(); + // On permute les valeur du champ box_order des 2 lignes de la table boxes + $db->begin(); - $objfrom=new ModeleBoxes($db); - $objfrom->fetch($_GET["switchfrom"]); - - $objto=new ModeleBoxes($db); - $objto->fetch($_GET["switchto"]); + $objfrom=new ModeleBoxes($db); + $objfrom->fetch($_GET["switchfrom"]); + + $objto=new ModeleBoxes($db); + $objto->fetch($_GET["switchto"]); - if (is_object($objfrom) && is_object($objto)) - { - $sql="UPDATE ".MAIN_DB_PREFIX."boxes set box_order='".$objto->box_order."' WHERE rowid=".$objfrom->rowid; + if (is_object($objfrom) && is_object($objto)) + { + $sql="UPDATE ".MAIN_DB_PREFIX."boxes set box_order='".$objto->box_order."' WHERE rowid=".$objfrom->rowid; //print "xx".$sql; - $resultupdatefrom = $db->query($sql); - if (! $resultupdatefrom) { dol_print_error($db); } - $sql="UPDATE ".MAIN_DB_PREFIX."boxes set box_order='".$objfrom->box_order."' WHERE rowid=".$objto->rowid; + $resultupdatefrom = $db->query($sql); + if (! $resultupdatefrom) { dol_print_error($db); } + $sql="UPDATE ".MAIN_DB_PREFIX."boxes set box_order='".$objfrom->box_order."' WHERE rowid=".$objto->rowid; //print "xx".$sql; - $resultupdateto = $db->query($sql); - if (! $resultupdateto) { dol_print_error($db); } - } + $resultupdateto = $db->query($sql); + if (! $resultupdateto) { dol_print_error($db); } + } - if ($resultupdatefrom && $resultupdateto) - { - $db->commit(); - } - else - { - $db->rollback(); - } + if ($resultupdatefrom && $resultupdateto) + { + $db->commit(); + } + else + { + $db->rollback(); + } } @@ -147,10 +147,12 @@ print $langs->trans("BoxesDesc")." ".$langs->trans("OnlyActiveElementsAreShown") $actives = array(); $sql = "SELECT b.rowid, b.box_id, b.position, b.box_order,"; -$sql.= " d.rowid as boxid"; -$sql.= " FROM ".MAIN_DB_PREFIX."boxes as b, ".MAIN_DB_PREFIX."boxes_def as d"; -$sql.= " WHERE b.box_id = d.rowid AND fk_user=0"; -$sql.= " ORDER by position, box_order"; +$sql.= " bd.rowid as boxid"; +$sql.= " FROM ".MAIN_DB_PREFIX."boxes as b, ".MAIN_DB_PREFIX."boxes_def as bd"; +$sql.= " WHERE b.box_id = bd.rowid"; +$sql.= " AND bd.entity = ".$conf->entity; +$sql.= " AND b.fk_user=0"; +$sql.= " ORDER by b.position, b.box_order"; $resql = $db->query($sql); if ($resql) @@ -243,6 +245,7 @@ print "\n"; $sql = "SELECT rowid, file, note, tms"; $sql.= " FROM ".MAIN_DB_PREFIX."boxes_def"; +$sql.= " WHERE entity = ".$conf->entity; $resql = $db->query($sql); $var=True; @@ -316,11 +319,12 @@ print ''.$langs->trans("Disable").''; print "\n"; $sql = "SELECT b.rowid, b.box_id, b.position,"; -$sql.= " d.file, d.note, d.tms"; -$sql.= " FROM ".MAIN_DB_PREFIX."boxes as b, ".MAIN_DB_PREFIX."boxes_def as d"; -$sql.= " WHERE b.box_id = d.rowid"; +$sql.= " bd.file, bd.note, bd.tms"; +$sql.= " FROM ".MAIN_DB_PREFIX."boxes as b, ".MAIN_DB_PREFIX."boxes_def as bd"; +$sql.= " WHERE b.box_id = bd.rowid"; +$sql.= " AND bd.entity = ".$conf->entity; $sql.= " AND b.fk_user=0"; -$sql.= " ORDER by position, box_order"; // Note box_order return A01,A03...,B02,B04... +$sql.= " ORDER by b.position, b.box_order"; // Note box_order return A01,A03...,B02,B04... $resql = $db->query($sql); diff --git a/htdocs/admin/cashdesk.php b/htdocs/admin/cashdesk.php index 10c513cd061..95d5c3f0929 100644 --- a/htdocs/admin/cashdesk.php +++ b/htdocs/admin/cashdesk.php @@ -43,9 +43,9 @@ if ($_POST["action"] == 'set') if ($_POST["CASHDESK_ID_WAREHOUSE"] < 0) $_POST["CASHDESK_ID_WAREHOUSE"]=''; if ($_POST["CASHDESK_ID_BANKACCOUNT"] < 0) $_POST["CASHDESK_ID_BANKACCOUNT"]=''; - dolibarr_set_const($db,"CASHDESK_ID_THIRDPARTY",$_POST["CASHDESK_ID_THIRDPARTY"]); - dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT",$_POST["CASHDESK_ID_BANKACCOUNT"]); - dolibarr_set_const($db,"CASHDESK_ID_WAREHOUSE",$_POST["CASHDESK_ID_WAREHOUSE"]); + dolibarr_set_const($db,"CASHDESK_ID_THIRDPARTY",$_POST["CASHDESK_ID_THIRDPARTY"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT",$_POST["CASHDESK_ID_BANKACCOUNT"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db,"CASHDESK_ID_WAREHOUSE",$_POST["CASHDESK_ID_WAREHOUSE"],'chaine',0,'',$conf->entity); dol_syslog("admin/cashdesk: level ".$_POST["level"]); } diff --git a/htdocs/admin/clicktodial.php b/htdocs/admin/clicktodial.php index 919a6c2c443..a3af735a1b7 100644 --- a/htdocs/admin/clicktodial.php +++ b/htdocs/admin/clicktodial.php @@ -34,7 +34,7 @@ if (!$user->admin) if ($_POST["action"] == 'setvalue' && $user->admin) { - $result=dolibarr_set_const($db, "CLICKTODIAL_URL",$_POST["url"]); + $result=dolibarr_set_const($db, "CLICKTODIAL_URL",$_POST["url"],'chaine',0,'',$conf->entity); if ($result >= 0) { $mesg='
'.$langs->trans("Success").'
'; diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index a1f58753dfa..be92b4aeb37 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -1,11 +1,11 @@ - * Copyright (C) 2004-2009 Laurent Destailleur - * Copyright (C) 2004 Sebastien Di Cintio - * Copyright (C) 2004 Benoit Mortier - * Copyright (C) 2004 Andre Cianfarani - * Copyright (C) 2005-2007 Regis Houssin - * Copyright (C) 2008 Raphael Bertrand (Resultic) +/* Copyright (C) 2003-2006 Rodolphe Quiedeville + * Copyright (C) 2004-2009 Laurent Destailleur + * Copyright (C) 2004 Sebastien Di Cintio + * Copyright (C) 2004 Benoit Mortier + * Copyright (C) 2004 Andre Cianfarani + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2008 Raphael Bertrand (Resultic) * * 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 @@ -49,7 +49,7 @@ if ($_POST["action"] == 'updateMask') { $maskconstorder=$_POST['maskconstorder']; $maskorder=$_POST['maskorder']; - if ($maskconstorder) dolibarr_set_const($db,$maskconstorder,$maskorder); + if ($maskconstorder) dolibarr_set_const($db,$maskconstorder,$maskorder,'chaine',0,'',$conf->entity); } if ($_GET["action"] == 'specimen') @@ -90,7 +90,7 @@ if ($_GET["action"] == 'specimen') if ($_GET["action"] == 'set') { $type='order'; - $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type) VALUES ('".$_GET["value"]."','".$type."')"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES ('".$_GET["value"]."','".$type."',".$conf->entity.")"; if ($db->query($sql)) { @@ -101,7 +101,10 @@ if ($_GET["action"] == 'del') { $type='order'; $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; - $sql .= " WHERE nom = '".$_GET["value"]."' AND type = '".$type."'"; + $sql.= " WHERE nom = '".$_GET["value"]; + $sql.= " AND type = '".$type."'"; + $sql.= " AND entity = ".$conf->entity; + if ($db->query($sql)) { @@ -112,7 +115,7 @@ if ($_GET["action"] == 'setdoc') { $db->begin(); - if (dolibarr_set_const($db, "COMMANDE_ADDON_PDF",$_GET["value"])) + if (dolibarr_set_const($db, "COMMANDE_ADDON_PDF",$_GET["value"],'chaine',0,'',$conf->entity)) { $conf->global->COMMANDE_ADDON_PDF = $_GET["value"]; } @@ -120,9 +123,11 @@ if ($_GET["action"] == 'setdoc') // On active le modele $type='order'; $sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; - $sql_del .= " WHERE nom = '".$_GET["value"]."' AND type = '".$type."'"; + $sql_del.= " WHERE nom = '".$_GET["value"]; + $sql_del.= " AND type = '".$type."'"; + $sql_del.= " AND entity = ".$conf->entity; $result1=$db->query($sql_del); - $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom,type) VALUES ('".$_GET["value"]."','".$type."')"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom,type,entity) VALUES ('".$_GET["value"]."','".$type."',".$conf->entity.")"; $result2=$db->query($sql); if ($result1 && $result2) { @@ -139,32 +144,32 @@ if ($_GET["action"] == 'setmod') // \todo Verifier si module numerotation choisi peut etre active // par appel methode canBeActivated - dolibarr_set_const($db, "COMMANDE_ADDON",$_GET["value"]); + dolibarr_set_const($db, "COMMANDE_ADDON",$_GET["value"],'chaine',0,'',$conf->entity); } if ($_POST["action"] == 'set_COMMANDE_DRAFT_WATERMARK') { - dolibarr_set_const($db, "COMMANDE_DRAFT_WATERMARK",trim($_POST["COMMANDE_DRAFT_WATERMARK"])); + dolibarr_set_const($db, "COMMANDE_DRAFT_WATERMARK",trim($_POST["COMMANDE_DRAFT_WATERMARK"]),'chaine',0,'',$conf->entity); } if ($_POST["action"] == 'set_COMMANDE_FREE_TEXT') { - dolibarr_set_const($db, "COMMANDE_FREE_TEXT",trim($_POST["COMMANDE_FREE_TEXT"])); + dolibarr_set_const($db, "COMMANDE_FREE_TEXT",trim($_POST["COMMANDE_FREE_TEXT"]),'chaine',0,'',$conf->entity); } if ($_POST["action"] == 'setvalidorder') { - dolibarr_set_const($db, "COMMANDE_VALID_AFTER_CLOSE_PROPAL",$_POST["validorder"]); + dolibarr_set_const($db, "COMMANDE_VALID_AFTER_CLOSE_PROPAL",$_POST["validorder"],'chaine',0,'',$conf->entity); } if ($_POST["action"] == 'deliverycostline') { - dolibarr_set_const($db, "COMMANDE_ADD_DELIVERY_COST_LINE",$_POST["addline"]); + dolibarr_set_const($db, "COMMANDE_ADD_DELIVERY_COST_LINE",$_POST["addline"],'chaine',0,'',$conf->entity); } if ($_POST["action"] == 'set_use_customer_contact_as_recipient') { - dolibarr_set_const($db, "COMMANDE_USE_CUSTOMER_CONTACT_AS_RECIPIENT",$_POST["use_customer_contact_as_recipient"]); + dolibarr_set_const($db, "COMMANDE_USE_CUSTOMER_CONTACT_AS_RECIPIENT",$_POST["use_customer_contact_as_recipient"],'chaine',0,'',$conf->entity); } @@ -288,6 +293,7 @@ $def = array(); $sql = "SELECT nom"; $sql.= " FROM ".MAIN_DB_PREFIX."document_model"; $sql.= " WHERE type = '".$type."'"; +$sql.= " AND entity = ".$conf->entity; $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 3fd0a12e70b..8de21f6b6de 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -41,18 +41,18 @@ accessforbidden(); if ( (isset($_POST["action"]) && $_POST["action"] == 'update') || (isset($_POST["action"]) && $_POST["action"] == 'updateedit') ) { - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM",$_POST["nom"]); - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADRESSE",$_POST["address"]); - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_VILLE",$_POST["ville"]); - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_CP",$_POST["cp"]); - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_PAYS",$_POST["pays_id"]); - dolibarr_set_const($db, "MAIN_MONNAIE",$_POST["currency"]); - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TEL",$_POST["tel"]); - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FAX",$_POST["fax"]); - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MAIL",$_POST["mail"]); - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_WEB",$_POST["web"]); - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOTE",$_POST["note"]); - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD",$_POST["gencod"]); + dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM",$_POST["nom"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADRESSE",$_POST["address"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_INFO_SOCIETE_VILLE",$_POST["ville"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_INFO_SOCIETE_CP",$_POST["cp"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_INFO_SOCIETE_PAYS",$_POST["pays_id"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_MONNAIE",$_POST["currency"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TEL",$_POST["tel"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FAX",$_POST["fax"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MAIL",$_POST["mail"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_INFO_SOCIETE_WEB",$_POST["web"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOTE",$_POST["note"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD",$_POST["gencod"],'chaine',0,'',$conf->entity); if ($_FILES["logo"]["tmp_name"]) { if (eregi('([^\\\/:]+)$',$_FILES["logo"]["name"],$reg)) @@ -69,7 +69,7 @@ if ( (isset($_POST["action"]) && $_POST["action"] == 'update') } if (dol_move_uploaded_file($_FILES["logo"]["tmp_name"],$conf->societe->dir_logos.'/'.$original_file,1) > 0) { - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO",$original_file); + dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO",$original_file,'chaine',0,'',$conf->entity); // Create thumbs of logo if ($isimage > 0) @@ -80,7 +80,7 @@ if ( (isset($_POST["action"]) && $_POST["action"] == 'update') if (eregi('([^\\\/:]+)$',$imgThumbSmall,$reg)) { $imgThumbSmall = $reg[1]; - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$imgThumbSmall); + dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$imgThumbSmall,'chaine',0,'',$conf->entity); } else dol_syslog($imgThumbSmall); @@ -89,7 +89,7 @@ if ( (isset($_POST["action"]) && $_POST["action"] == 'update') if (eregi('([^\\\/:]+)$',$imgThumbMini,$reg)) { $imgThumbMini = $reg[1]; - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$imgThumbMini); + dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$imgThumbMini,'chaine',0,'',$conf->entity); } else dol_syslog($imgThumbMini); } @@ -107,17 +107,17 @@ if ( (isset($_POST["action"]) && $_POST["action"] == 'update') } } - dolibarr_set_const($db, "MAIN_INFO_CAPITAL",$_POST["capital"]); - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FORME_JURIDIQUE",$_POST["forme_juridique_code"]); - dolibarr_set_const($db, "MAIN_INFO_SIREN",$_POST["siren"]); - dolibarr_set_const($db, "MAIN_INFO_SIRET",$_POST["siret"]); - dolibarr_set_const($db, "MAIN_INFO_APE",$_POST["ape"]); - dolibarr_set_const($db, "MAIN_INFO_RCS",$_POST["rcs"]); - dolibarr_set_const($db, "MAIN_INFO_TVAINTRA",$_POST["tva"]); + dolibarr_set_const($db, "MAIN_INFO_CAPITAL",$_POST["capital"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FORME_JURIDIQUE",$_POST["forme_juridique_code"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_INFO_SIREN",$_POST["siren"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_INFO_SIRET",$_POST["siret"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_INFO_APE",$_POST["ape"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_INFO_RCS",$_POST["rcs"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_INFO_TVAINTRA",$_POST["tva"],'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "SOCIETE_FISCAL_MONTH_START",$_POST["fiscalmonthstart"]); + dolibarr_set_const($db, "SOCIETE_FISCAL_MONTH_START",$_POST["fiscalmonthstart"],'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "FACTURE_TVAOPTION",$_POST["optiontva"]); + dolibarr_set_const($db, "FACTURE_TVAOPTION",$_POST["optiontva"],'chaine',0,'',$conf->entity); if ($_POST['action'] != 'updateedit' && ! $message) { @@ -140,7 +140,7 @@ if ($_GET["action"] == 'addthumb') if (image_format_supported($imgThumbSmall) >= 0 && eregi('([^\\\/:]+)$',$imgThumbSmall,$reg)) { $imgThumbSmall = $reg[1]; - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$imgThumbSmall); + dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$imgThumbSmall,'chaine',0,'',$conf->entity); } else dol_syslog($imgThumbSmall); @@ -149,7 +149,7 @@ if ($_GET["action"] == 'addthumb') if (image_format_supported($imgThumbSmall) >= 0 && eregi('([^\\\/:]+)$',$imgThumbMini,$reg)) { $imgThumbMini = $reg[1]; - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$imgThumbMini); + dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$imgThumbMini,'chaine',0,'',$conf->entity); } else dol_syslog($imgThumbMini); @@ -173,17 +173,17 @@ if ($_GET["action"] == 'removelogo') { $logofile=$conf->societe->dir_logos.'/'.$mysoc->logo; dol_delete_file($logofile); - dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO"); + dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO",$conf->entity); $mysoc->logo=''; $logosmallfile=$conf->societe->dir_logos.'/thumbs/'.$mysoc->logo_small; dol_delete_file($logosmallfile); - dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL"); + dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$conf->entity); $mysoc->logo_small=''; $logominifile=$conf->societe->dir_logos.'/thumbs/'.$mysoc->logo_mini; dol_delete_file($logominifile); - dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI"); + dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$conf->entity); $mysoc->logo_mini=''; } diff --git a/htdocs/admin/compta.php b/htdocs/admin/compta.php index 68ac2429f56..3b84fa61265 100644 --- a/htdocs/admin/compta.php +++ b/htdocs/admin/compta.php @@ -1,6 +1,7 @@ * Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2005-2009 Regis Houssin * * 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 @@ -42,7 +43,7 @@ $compta_mode = defined('COMPTA_MODE')?COMPTA_MODE:'RECETTES-DEPENSES'; if ($_POST['action'] == 'setcomptamode') { $compta_mode = $_POST['compta_mode']; - if (! dolibarr_set_const($db, 'COMPTA_MODE', $compta_mode)) { print $db->error(); } + if (! dolibarr_set_const($db, 'COMPTA_MODE', $compta_mode,'chaine',0,'',$conf->entity)) { print $db->error(); } // Note: This setup differs from TAX_MODE. // TAX_MODE is used with 0=normal, 1=option vat for services is on debit } @@ -54,7 +55,7 @@ $typeconst=array('yesno','texte','chaine'); if ($_POST['action'] == 'update' || $_POST['action'] == 'add') { - if (! dolibarr_set_const($db, $_POST['constname'], $_POST['constvalue'], $typeconst[$_POST['consttype']], 0, isset($_POST['constnote']) ? $_POST['constnote'] : '')); + if (! dolibarr_set_const($db, $_POST['constname'], $_POST['constvalue'], $typeconst[$_POST['consttype']], 0, isset($_POST['constnote']) ? $_POST['constnote'] : '',$conf->entity)); { print $db->error(); } @@ -63,7 +64,7 @@ if ($_POST['action'] == 'update' || $_POST['action'] == 'add') if ($_GET['action'] == 'delete') { - if (! dolibarr_del_const($db, $_GET['constname'])); + if (! dolibarr_del_const($db, $_GET['constname'],$conf->entity)); { print $db->error(); } @@ -113,9 +114,12 @@ print "\n"; print "
\n"; // Cas des autres parametres COMPTA_* -$sql ="SELECT rowid, name, value, type, note"; -$sql.=" FROM llx_const"; -$sql.=" WHERE name like 'COMPTA_%' and name not in ('COMPTA_MODE')"; +$sql = "SELECT rowid, name, value, type, note"; +$sql.= " FROM ".MAIN_DB_PREFIX."const"; +$sql.= " WHERE name LIKE 'COMPTA_%'"; +$sql.= " AND name NOT IN ('COMPTA_MODE')"; +$sql.= " AND entity = ".$conf->entity; + $result = $db->query($sql); if ($result) { diff --git a/htdocs/admin/comptaexpert.php b/htdocs/admin/comptaexpert.php index b3b3c94ce98..4dc5a0cf9c9 100644 --- a/htdocs/admin/comptaexpert.php +++ b/htdocs/admin/comptaexpert.php @@ -45,7 +45,7 @@ $compta_mode = defined('COMPTA_MODE')?COMPTA_MODE:'RECETTES-DEPENSES'; if ($_POST['action'] == 'setcomptamode') { $compta_mode = $_POST['compta_mode']; - if (! dolibarr_set_const($db, 'COMPTA_MODE', $compta_mode)) { print $db->error(); } + if (! dolibarr_set_const($db, 'COMPTA_MODE', $compta_mode,'chaine',0,'',$conf->entity)) { print $db->error(); } } @@ -55,7 +55,7 @@ $typeconst=array('yesno','texte','chaine'); if ($_POST['action'] == 'update' || $_POST['action'] == 'add') { - if (! dolibarr_set_const($db, $_POST['constname'], $_POST['constvalue'], $typeconst[$_POST['consttype']], 0, isset($_POST['constnote']) ? $_POST['constnote'] : '')); + if (! dolibarr_set_const($db, $_POST['constname'], $_POST['constvalue'], $typeconst[$_POST['consttype']], 0, isset($_POST['constnote']) ? $_POST['constnote'] : '',$conf->entity)); { print $db->error(); } @@ -64,7 +64,7 @@ if ($_POST['action'] == 'update' || $_POST['action'] == 'add') if ($_GET['action'] == 'delete') { - if (! dolibarr_del_const($db, $_GET['constname'])); + if (! dolibarr_del_const($db, $_GET['constname'],$conf->entity)); { print $db->error(); } diff --git a/htdocs/admin/confexped.php b/htdocs/admin/confexped.php index 14e0dbdaed4..55d228dea47 100644 --- a/htdocs/admin/confexped.php +++ b/htdocs/admin/confexped.php @@ -1,6 +1,7 @@ - * Copyright (C) 2006 Andre Cianfarani +/* Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2006 Andre Cianfarani * * 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 @@ -38,25 +39,25 @@ if (!$user->admin) if ($_GET["action"] == 'activate_sending') { - dolibarr_set_const($db, "MAIN_SUBMODULE_EXPEDITION", "1"); + dolibarr_set_const($db, "MAIN_SUBMODULE_EXPEDITION", "1",'chaine',0,'',$conf->entity); Header("Location: confexped.php"); exit; } else if ($_GET["action"] == 'disable_sending') { - dolibarr_del_const($db, "MAIN_SUBMODULE_EXPEDITION"); + dolibarr_del_const($db, "MAIN_SUBMODULE_EXPEDITION",$conf->entity); Header("Location: confexped.php"); exit; } else if ($_GET["action"] == 'activate_delivery') { - dolibarr_set_const($db, "MAIN_SUBMODULE_LIVRAISON", "1"); + dolibarr_set_const($db, "MAIN_SUBMODULE_LIVRAISON", "1",'chaine',0,'',$conf->entity); Header("Location: confexped.php"); exit; } else if ($_GET["action"] == 'disable_delivery') { - dolibarr_del_const($db, "MAIN_SUBMODULE_LIVRAISON"); + dolibarr_del_const($db, "MAIN_SUBMODULE_LIVRAISON",$conf->entity); Header("Location: confexped.php"); exit; } diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index 0104c6f7020..a0a23f0f068 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -1,6 +1,7 @@ * Copyright (C) 2004-2009 Laurent Destailleur + * Copyright (C) 2005-2009 Regis Houssin * * 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 @@ -107,12 +108,13 @@ print ''; if ($all==1){ $sql = "SELECT rowid, name, value, note, entity "; $sql.= "FROM llx_const "; - $sql.= "WHERE entity = 0 OR entity = ".$conf->entity." "; + $sql.= "WHERE entity IN (0,".$conf->entity.") "; $sql.= "ORDER BY name ASC"; }else{ $sql = "SELECT rowid, name, value, note, entity "; $sql.= "FROM llx_const "; - $sql.= "WHERE visible = 1 AND (entity = 0 OR entity = ".$conf->entity.") "; + $sql.= "WHERE visible = 1 "; + $sql.= "AND entity IN (0,".$conf->entity.") "; $sql.= "ORDER BY name ASC"; } dol_syslog("Const::listConstant sql=".$sql,LOG_DEBUG); diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index cd77ac98e05..4d050701b97 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -2,6 +2,7 @@ /* Copyright (C) 2001-2004 Rodolphe Quiedeville * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005 Simon Tosser + * Copyright (C) 2005-2009 Regis Houssin * * 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 @@ -40,17 +41,17 @@ if (!$user->admin) if ( (isset($_POST["action"]) && $_POST["action"] == 'update')) { //Conversion des jours en secondes - dolibarr_set_const($db, "MAIN_DELAY_ACTIONS_TODO",$_POST["ActionsToDo"]); - dolibarr_set_const($db, "MAIN_DELAY_ORDERS_TO_PROCESS",$_POST["OrdersToProcess"]); - dolibarr_set_const($db, "MAIN_DELAY_PROPALS_TO_CLOSE",$_POST["PropalsToClose"]); - dolibarr_set_const($db, "MAIN_DELAY_PROPALS_TO_BILL",$_POST["PropalsToBill"]); - dolibarr_set_const($db, "MAIN_DELAY_NOT_ACTIVATED_SERVICES",$_POST["BoardNotActivatedServices"]); - dolibarr_set_const($db, "MAIN_DELAY_RUNNING_SERVICES",$_POST["BoardRunningServices"]); - dolibarr_set_const($db, "MAIN_DELAY_SUPPLIER_BILLS_TO_PAY",$_POST["SupplierBillsToPay"]); - dolibarr_set_const($db, "MAIN_DELAY_CUSTOMER_BILLS_UNPAYED",$_POST["CustomerBillsUnpayed"]); - dolibarr_set_const($db, "MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE",$_POST["TransactionsToConciliate"]); - dolibarr_set_const($db, "MAIN_DELAY_CHEQUES_TO_DEPOSIT",$_POST["ChequesToDeposit"]); - dolibarr_set_const($db, "MAIN_DELAY_MEMBERS",$_POST["Members"]); + if ($_POST["ActionsToDo"]) dolibarr_set_const($db, "MAIN_DELAY_ACTIONS_TODO",$_POST["ActionsToDo"],'chaine',0,'',$conf->entity); + if ($_POST["OrdersToProcess"]) dolibarr_set_const($db, "MAIN_DELAY_ORDERS_TO_PROCESS",$_POST["OrdersToProcess"],'chaine',0,'',$conf->entity); + if ($_POST["PropalsToClose"]) dolibarr_set_const($db, "MAIN_DELAY_PROPALS_TO_CLOSE",$_POST["PropalsToClose"],'chaine',0,'',$conf->entity); + if ($_POST["PropalsToBill"]) dolibarr_set_const($db, "MAIN_DELAY_PROPALS_TO_BILL",$_POST["PropalsToBill"],'chaine',0,'',$conf->entity); + if ($_POST["BoardNotActivatedServices"]) dolibarr_set_const($db, "MAIN_DELAY_NOT_ACTIVATED_SERVICES",$_POST["BoardNotActivatedServices"],'chaine',0,'',$conf->entity); + if ($_POST["BoardRunningServices"]) dolibarr_set_const($db, "MAIN_DELAY_RUNNING_SERVICES",$_POST["BoardRunningServices"],'chaine',0,'',$conf->entity); + if ($_POST["SupplierBillsToPay"]) dolibarr_set_const($db, "MAIN_DELAY_SUPPLIER_BILLS_TO_PAY",$_POST["SupplierBillsToPay"],'chaine',0,'',$conf->entity); + if ($_POST["CustomerBillsUnpayed"]) dolibarr_set_const($db, "MAIN_DELAY_CUSTOMER_BILLS_UNPAYED",$_POST["CustomerBillsUnpayed"],'chaine',0,'',$conf->entity); + if ($_POST["TransactionsToConciliate"]) dolibarr_set_const($db, "MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE",$_POST["TransactionsToConciliate"],'chaine',0,'',$conf->entity); + if ($_POST["ChequesToDeposit"]) dolibarr_set_const($db, "MAIN_DELAY_CHEQUES_TO_DEPOSIT",$_POST["ChequesToDeposit"],'chaine',0,'',$conf->entity); + if ($_POST["Members"]) dolibarr_set_const($db, "MAIN_DELAY_MEMBERS",$_POST["Members"],'chaine',0,'',$conf->entity); } diff --git a/htdocs/admin/dons.php b/htdocs/admin/dons.php index 53e50f47099..8c558525619 100644 --- a/htdocs/admin/dons.php +++ b/htdocs/admin/dons.php @@ -77,7 +77,7 @@ if ($_GET["action"] == 'setdoc') { $db->begin(); - if (dolibarr_set_const($db, "DON_ADDON_MODEL",$_GET["value"])) + if (dolibarr_set_const($db, "DON_ADDON_MODEL",$_GET["value"],'chaine',0,'',$conf->entity)) { $conf->global->DON_ADDON_MODEL = $_GET["value"]; } diff --git a/htdocs/admin/droitpret.php b/htdocs/admin/droitpret.php index e39a56c3963..cf6e2be5df6 100644 --- a/htdocs/admin/droitpret.php +++ b/htdocs/admin/droitpret.php @@ -46,7 +46,7 @@ $var=True; if ($_POST["action"] == 'update' || $_POST["action"] == 'add') { - if (! dolibarr_set_const($db, $_POST["constname"],$_POST["constvalue"],$_POST["consttype"],0,isset($_POST["constnote"])?$_POST["constnote"]:'')) + if (! dolibarr_set_const($db, $_POST["constname"],$_POST["constvalue"],$_POST["consttype"],0,isset($_POST["constnote"])?$_POST["constnote"]:'',$conf->entity)) { print $db->error(); } @@ -80,7 +80,7 @@ print "\n"; $var=true; $form = new Form($db); -// Cat�gorie +// Categorie $var=!$var; print '
'; print ''; diff --git a/htdocs/admin/editeur.php b/htdocs/admin/editeur.php index c32d581c18a..a23e2c80c4d 100644 --- a/htdocs/admin/editeur.php +++ b/htdocs/admin/editeur.php @@ -33,11 +33,11 @@ if (!$user->admin) accessforbidden(); -// Action activation d'un sous module du module adh�rent +// Action activation d'un sous module du module adherent if ($_POST["action"] == 'set') { $name = "EDITEUR_LIVRE_FORMAT_".time(); - $result=dolibarr_set_const($db, $name, $_POST["format"]); + $result=dolibarr_set_const($db, $name, $_POST["format"],'chaine',0,'',$conf->entity); if ($result < 0) { print $db->error(); diff --git a/htdocs/admin/energie.php b/htdocs/admin/energie.php index bc8a41166dc..a35e314fc21 100644 --- a/htdocs/admin/energie.php +++ b/htdocs/admin/energie.php @@ -36,7 +36,7 @@ if (!$user->admin) if ($_POST["action"] == 'setvalue' && $user->admin) { - dolibarr_set_const($db, "JPGRAPH_DIR",$_POST["url"]); + dolibarr_set_const($db, "JPGRAPH_DIR",$_POST["url"],'chaine',0,'',$conf->entity); } diff --git a/htdocs/admin/events.php b/htdocs/admin/events.php index 247268177b8..c06d1a33200 100644 --- a/htdocs/admin/events.php +++ b/htdocs/admin/events.php @@ -88,8 +88,8 @@ if ($action == "save") { $param='MAIN_LOGEVENTS_'.$arr['id']; //print "param=".$param." - ".$_POST[$param]; - if (! empty($_POST[$param])) dolibarr_set_const($db,$param,$_POST[$param],'chaine',0); - else dolibarr_del_const($db,$param); + if (! empty($_POST[$param])) dolibarr_set_const($db,$param,$_POST[$param],'chaine',0,'',$conf->entity); + else dolibarr_del_const($db,$param,$conf->entity); } $db->commit(); diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index 3b1254e0086..4c3892a6e79 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -4,7 +4,7 @@ * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005-2007 Regis Houssin + * Copyright (C) 2005-2009 Regis Houssin * * 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 @@ -83,7 +83,7 @@ if ($_GET["action"] == 'specimen') if ($_GET["action"] == 'set') { $type='shipping'; - $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type) VALUES ('".$_GET["value"]."','".$type."')"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES ('".$_GET["value"]."','".$type."',".$conf->entity.")"; if ($db->query($sql)) { @@ -94,7 +94,10 @@ if ($_GET["action"] == 'del') { $type='shipping'; $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; - $sql .= " WHERE nom = '".$_GET["value"]."' AND type = '".$type."'"; + $sql.= " WHERE nom = '".$_GET["value"]; + $sql.= " AND type = '".$type."'"; + $sql.= " AND entity = ".$conf->entity; + if ($db->query($sql)) { @@ -105,7 +108,7 @@ if ($_GET["action"] == 'setdoc') { $db->begin(); - if (dolibarr_set_const($db, "EXPEDITION_ADDON_PDF",$_GET["value"])) + if (dolibarr_set_const($db, "EXPEDITION_ADDON_PDF",$_GET["value"],'chaine',0,'',$conf->entity)) { $conf->global->EXPEDITION_ADDON_PDF = $_GET["value"]; } @@ -113,9 +116,11 @@ if ($_GET["action"] == 'setdoc') // On active le modele $type='shipping'; $sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; - $sql_del .= " WHERE nom = '".$_GET["value"]."' AND type = '".$type."'"; + $sql_del.= " WHERE nom = '".$_GET["value"]; + $sql_del.= " AND type = '".$type."'"; + $sql_del.= " AND entity = ".$conf->entity; $result1=$db->query($sql_del); - $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom,type) VALUES ('".$_GET["value"]."','".$type."')"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom,type,entity) VALUES ('".$_GET["value"]."','".$type."',".$conf->entity.")"; $result2=$db->query($sql); if ($result1 && $result2) { @@ -139,7 +144,9 @@ if ($_GET["action"] == 'setmethod' || $_GET["action"] == 'setmod') $class = "methode_expedition_$module"; $expem = new $class($db); - $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."expedition_methode WHERE rowid = ".$moduleid; + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."expedition_methode"; + $sql.= " WHERE rowid = ".$moduleid; + $resql = $db->query($sql); if ($resql && ($statut == 1 || $_GET["action"] == 'setmod')) { @@ -148,6 +155,7 @@ if ($_GET["action"] == 'setmethod' || $_GET["action"] == 'setmod') $sqlu = "UPDATE ".MAIN_DB_PREFIX."expedition_methode"; $sqlu.= " SET statut=1"; $sqlu.= " WHERE rowid=".$moduleid; + $result=$db->query($sqlu); if ($result) { @@ -200,7 +208,7 @@ if ($_GET["action"] == 'setmod') // \todo Verifier si module numerotation choisi peut etre active // par appel methode canBeActivated - dolibarr_set_const($db, "EXPEDITION_ADDON",$_GET["module"]); + dolibarr_set_const($db, "EXPEDITION_ADDON",$_GET["module"],'chaine',0,'',$conf->entity); } @@ -253,9 +261,12 @@ print_titre($langs->trans("SendingsReceiptModel")); // Defini tableau def de modele invoice $type="shipping"; $def = array(); + $sql = "SELECT nom"; $sql.= " FROM ".MAIN_DB_PREFIX."document_model"; $sql.= " WHERE type = '".$type."'"; +$sql.= " AND entity = ".$conf->entity; + $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/admin/external_rss.php b/htdocs/admin/external_rss.php index 2c505444d05..f08f78b99a9 100644 --- a/htdocs/admin/external_rss.php +++ b/htdocs/admin/external_rss.php @@ -83,7 +83,7 @@ if ($_POST["action"] == 'add' || $_POST["modify"]) } else { - // Ajoute boite box_external_rss dans d�finition des boites + // Ajoute boite box_external_rss dans definition des boites $sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes_def (file, note)"; $sql.= " VALUES ('box_external_rss.php','".addslashes($_POST["norss"].' ('.$_POST[$external_rss_title]).")')"; if (! $db->query($sql)) @@ -93,8 +93,8 @@ if ($_POST["action"] == 'add' || $_POST["modify"]) } } - $result1=dolibarr_set_const($db, "EXTERNAL_RSS_TITLE_" . $_POST["norss"],$_POST[$external_rss_title]); - if ($result1) $result2=dolibarr_set_const($db, "EXTERNAL_RSS_URLRSS_" . $_POST["norss"],$_POST[$external_rss_urlrss]); + $result1=dolibarr_set_const($db, "EXTERNAL_RSS_TITLE_" . $_POST["norss"],$_POST[$external_rss_title],'chaine',0,'',$conf->entity); + if ($result1) $result2=dolibarr_set_const($db, "EXTERNAL_RSS_URLRSS_" . $_POST["norss"],$_POST[$external_rss_urlrss],'chaine',0,'',$conf->entity); if ($result1 && $result2) { @@ -117,7 +117,7 @@ if ($_POST["delete"]) { $db->begin(); - // Supprime boite box_external_rss de d�finition des boites + // Supprime boite box_external_rss de definition des boites $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."boxes_def"; $sql.= " WHERE file ='box_external_rss.php' AND note like '".$_POST["norss"]." %'"; @@ -158,8 +158,8 @@ if ($_POST["delete"]) } - $result1=dolibarr_del_const($db,"EXTERNAL_RSS_TITLE_" . $_POST["norss"]); - if ($result1) $result2=dolibarr_del_const($db,"EXTERNAL_RSS_URLRSS_" . $_POST["norss"]); + $result1=dolibarr_del_const($db,"EXTERNAL_RSS_TITLE_" . $_POST["norss"],$conf->entity); + if ($result1) $result2=dolibarr_del_const($db,"EXTERNAL_RSS_URLRSS_" . $_POST["norss"],$conf->entity); if ($result1 && $result2) { diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index ab028368db9..a3688e6b0ba 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -1,8 +1,8 @@ - * Copyright (C) 2004-2008 Laurent Destailleur - * Copyright (C) 2005 Eric Seigne - * Copyright (C) 2005-2007 Regis Houssin +/* Copyright (C) 2003-2004 Rodolphe Quiedeville + * Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2005 Eric Seigne + * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) * * This program is free software; you can redistribute it and/or modify @@ -52,8 +52,8 @@ if ($_POST["action"] == 'updateMask') $maskconstcredit=$_POST['maskconstcredit']; $maskinvoice=$_POST['maskinvoice']; $maskcredit=$_POST['maskcredit']; - if ($maskconstinvoice) dolibarr_set_const($db,$maskconstinvoice,$maskinvoice); - if ($maskconstcredit) dolibarr_set_const($db,$maskconstcredit,$maskcredit); + if ($maskconstinvoice) dolibarr_set_const($db,$maskconstinvoice,$maskinvoice,'chaine',0,'',$conf->entity); + if ($maskconstcredit) dolibarr_set_const($db,$maskconstcredit,$maskcredit,'chaine',0,'',$conf->entity); } if ($_GET["action"] == 'specimen') @@ -94,7 +94,7 @@ if ($_GET["action"] == 'specimen') if ($_GET["action"] == 'set') { $type='invoice'; - $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type) VALUES ('".$_GET["value"]."','".$type."')"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES ('".$_GET["value"]."','".$type."',".$conf->entity.")"; if ($db->query($sql)) { @@ -105,7 +105,10 @@ if ($_GET["action"] == 'del') { $type='invoice'; $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; - $sql .= " WHERE nom = '".$_GET["value"]."' AND type = '".$type."'"; + $sql.= " WHERE nom = '".$_GET["value"]; + $sql.= " AND type = '".$type."'"; + $sql.= " AND entity = ".$conf->entity; + if ($db->query($sql)) { @@ -116,7 +119,7 @@ if ($_GET["action"] == 'setdoc') { $db->begin(); - if (dolibarr_set_const($db, "FACTURE_ADDON_PDF",$_GET["value"])) + if (dolibarr_set_const($db, "FACTURE_ADDON_PDF",$_GET["value"],'chaine',0,'',$conf->entity)) { $conf->global->FACTURE_ADDON_PDF = $_GET["value"]; } @@ -124,9 +127,11 @@ if ($_GET["action"] == 'setdoc') // On active le modele $type='invoice'; $sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; - $sql_del.= " WHERE nom = '".$_GET["value"]."' AND type = '".$type."'"; + $sql_del.= " WHERE nom = '".$_GET["value"]; + $sql_del.= " AND type = '".$type."'"; + $sql_del.= " AND entity = ".$conf->entity; $result1=$db->query($sql_del); - $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom,type) VALUES ('".$_GET["value"]."','".$type."')"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom,type,entity) VALUES ('".$_GET["value"]."','".$type."',".$conf->entity.")"; $result2=$db->query($sql); if ($result1 && $result2) { @@ -143,43 +148,43 @@ if ($_GET["action"] == 'setmod') // \todo Verifier si module numerotation choisi peut etre activ� // par appel methode canBeActivated - dolibarr_set_const($db, "FACTURE_ADDON",$_GET["value"]); + dolibarr_set_const($db, "FACTURE_ADDON",$_GET["value"],'chaine',0,'',$conf->entity); } if ($_POST["action"] == 'setribchq') { - dolibarr_set_const($db, "FACTURE_RIB_NUMBER",$_POST["rib"]); - dolibarr_set_const($db, "FACTURE_CHQ_NUMBER",$_POST["chq"]); + dolibarr_set_const($db, "FACTURE_RIB_NUMBER",$_POST["rib"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "FACTURE_CHQ_NUMBER",$_POST["chq"],'chaine',0,'',$conf->entity); } if ($_POST["action"] == 'set_FACTURE_DRAFT_WATERMARK') { - dolibarr_set_const($db, "FACTURE_DRAFT_WATERMARK",trim($_POST["FACTURE_DRAFT_WATERMARK"])); + dolibarr_set_const($db, "FACTURE_DRAFT_WATERMARK",trim($_POST["FACTURE_DRAFT_WATERMARK"]),'chaine',0,'',$conf->entity); } if ($_POST["action"] == 'set_FACTURE_FREE_TEXT') { - dolibarr_set_const($db, "FACTURE_FREE_TEXT",trim($_POST["FACTURE_FREE_TEXT"])); + dolibarr_set_const($db, "FACTURE_FREE_TEXT",trim($_POST["FACTURE_FREE_TEXT"]),'chaine',0,'',$conf->entity); } if ($_POST["action"] == 'setforcedate') { - dolibarr_set_const($db, "FAC_FORCE_DATE_VALIDATION",$_POST["forcedate"]); + dolibarr_set_const($db, "FAC_FORCE_DATE_VALIDATION",$_POST["forcedate"],'chaine',0,'',$conf->entity); } if ($_POST["action"] == 'set_enable_editdelete') { - dolibarr_set_const($db, "FACTURE_ENABLE_EDITDELETE",$_POST["enable_editdelete"]); + dolibarr_set_const($db, "FACTURE_ENABLE_EDITDELETE",$_POST["enable_editdelete"],'chaine',0,'',$conf->entity); } if ($_POST["action"] == 'set_use_bill_contact_as_recipient') { - dolibarr_set_const($db, "FACTURE_USE_BILL_CONTACT_AS_RECIPIENT",$_POST["use_bill_contact_as_recipient"]); + dolibarr_set_const($db, "FACTURE_USE_BILL_CONTACT_AS_RECIPIENT",$_POST["use_bill_contact_as_recipient"],'chaine',0,'',$conf->entity); } if ($_POST["action"] == 'update' || $_POST["action"] == 'add') { - if (! dolibarr_set_const($db, $_POST["constname"],$_POST["constvalue"],$typeconst[$_POST["consttype"]],0,isset($_POST["constnote"])?$_POST["constnote"]:'')); + if (! dolibarr_set_const($db, $_POST["constname"],$_POST["constvalue"],$typeconst[$_POST["consttype"]],0,isset($_POST["constnote"])?$_POST["constnote"]:'',$conf->entity)); { dol_print_error($db); } @@ -187,20 +192,20 @@ if ($_POST["action"] == 'update' || $_POST["action"] == 'add') if ($_GET["action"] == 'delete') { - if (! dolibarr_del_const($db, $_GET["rowid"])); + if (! dolibarr_del_const($db, $_GET["rowid"],$conf->entity)); { dol_print_error($db); } } // defini les constantes du modele pluton -if ($_POST["action"] == 'updateMatrice') dolibarr_set_const($db, "FACTURE_NUM_MATRICE",$_POST["matrice"]); -if ($_POST["action"] == 'updatePrefixFacture') dolibarr_set_const($db, "FACTURE_NUM_PREFIX",$_POST["prefixfacture"]); -if ($_POST["action"] == 'updatePrefixAvoir') dolibarr_set_const($db, "AVOIR_NUM_PREFIX",$_POST["prefixavoir"]); -if ($_POST["action"] == 'setOffsetInvoice') dolibarr_set_const($db, "FACTURE_NUM_DELTA",$_POST["offsetinvoice"]); -if ($_POST["action"] == 'setOffsetCreditNote') dolibarr_set_const($db, "AVOIR_NUM_DELTA",$_POST["offsetcreditnote"]); -if ($_POST["action"] == 'setNumRestart') dolibarr_set_const($db, "FACTURE_NUM_RESTART_BEGIN_YEAR",$_POST["numrestart"]); -if ($_POST["action"] == 'setNumWithInvoice') dolibarr_set_const($db, "AVOIR_NUM_WITH_INVOICE",$_POST["numwithinvoice"]); +if ($_POST["action"] == 'updateMatrice') dolibarr_set_const($db, "FACTURE_NUM_MATRICE",$_POST["matrice"],'chaine',0,'',$conf->entity); +if ($_POST["action"] == 'updatePrefixFacture') dolibarr_set_const($db, "FACTURE_NUM_PREFIX",$_POST["prefixfacture"],'chaine',0,'',$conf->entity); +if ($_POST["action"] == 'updatePrefixAvoir') dolibarr_set_const($db, "AVOIR_NUM_PREFIX",$_POST["prefixavoir"],'chaine',0,'',$conf->entity); +if ($_POST["action"] == 'setOffsetInvoice') dolibarr_set_const($db, "FACTURE_NUM_DELTA",$_POST["offsetinvoice"],'chaine',0,'',$conf->entity); +if ($_POST["action"] == 'setOffsetCreditNote') dolibarr_set_const($db, "AVOIR_NUM_DELTA",$_POST["offsetcreditnote"],'chaine',0,'',$conf->entity); +if ($_POST["action"] == 'setNumRestart') dolibarr_set_const($db, "FACTURE_NUM_RESTART_BEGIN_YEAR",$_POST["numrestart"],'chaine',0,'',$conf->entity); +if ($_POST["action"] == 'setNumWithInvoice') dolibarr_set_const($db, "AVOIR_NUM_WITH_INVOICE",$_POST["numwithinvoice"],'chaine',0,'',$conf->entity); /* @@ -344,6 +349,7 @@ $def = array(); $sql = "SELECT nom"; $sql.= " FROM ".MAIN_DB_PREFIX."document_model"; $sql.= " WHERE type = 'invoice'"; +$sql.= " AND entity = ".$conf->entity; $resql=$db->query($sql); if ($resql) { @@ -392,7 +398,7 @@ while (($file = readdir($handle))!==false) print $module->description; print ''; - // Activ� + // Active if (in_array($name, $def)) { print "\n"; @@ -457,7 +463,7 @@ print ''; /* - * Modes de r�glement + * Modes de reglement * */ print '
'; @@ -481,8 +487,9 @@ if ($conf->banque->enabled) { $sql = "SELECT rowid, label"; $sql.= " FROM ".MAIN_DB_PREFIX."bank_account"; - $sql.= " where clos = 0"; - $sql.= " and courant = 1"; + $sql.= " WHERE clos = 0"; + $sql.= " AND courant = 1"; + $sql.= " AND entity = ".$conf->entity; $resql=$db->query($sql); if ($resql) { @@ -523,8 +530,9 @@ print '