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 '