From fb23364511fad2b8fff7b801a343cd5b90fffdd6 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 23 Jul 2012 16:10:54 +0200 Subject: [PATCH 01/17] Fix: uniformize code --- htdocs/admin/modules.php | 2 +- htdocs/comm/mailing/fiche.php | 2 +- .../{ => commissions}/admin/commissions.php | 57 +++---- htdocs/commissions/index.php | 150 ++++++++++-------- htdocs/commissions/lib/commissions.lib.php | 2 +- htdocs/core/class/html.form.class.php | 12 +- htdocs/core/modules/modCommissions.class.php | 18 +-- htdocs/core/modules/modMargin.class.php | 57 +------ htdocs/expedition/fiche.php | 6 +- htdocs/filefunc.inc.php | 2 +- htdocs/install/lib/repair.lib.php | 46 +++--- htdocs/langs/fr_FR/commissions.lang | 8 +- htdocs/{ => margin}/admin/margin.php | 8 +- htdocs/margin/agentMargins.php | 107 ++++++------- htdocs/margin/customerMargins.php | 80 +++++----- htdocs/margin/lib/margins.lib.php | 2 +- htdocs/margin/productMargins.php | 106 ++++++------- htdocs/margin/tabs/productMargins.php | 44 ++--- htdocs/margin/tabs/thirdpartyMargins.php | 18 +-- htdocs/product/ajaxproducts.php | 6 +- htdocs/theme/amarok/img/commissions.png | Bin 1676 -> 0 bytes htdocs/theme/amarok/img/marges.png | Bin 1851 -> 0 bytes .../{object_marges.png => object_margin.png} | Bin htdocs/theme/auguria/img/commissions.png | Bin 1676 -> 0 bytes htdocs/theme/auguria/img/marges.png | Bin 1851 -> 0 bytes .../{object_marges.png => object_margin.png} | Bin htdocs/theme/auguria/style.css.php | 4 +- htdocs/theme/bureau2crea/img/commissions.png | Bin 1676 -> 0 bytes htdocs/theme/bureau2crea/img/marges.png | Bin 1851 -> 0 bytes .../{object_marges.png => object_margin.png} | Bin htdocs/theme/bureau2crea/style.css.php | 4 +- htdocs/theme/cameleo/img/commissions.png | Bin 1676 -> 0 bytes htdocs/theme/cameleo/img/marges.png | Bin 1851 -> 0 bytes .../{object_marges.png => object_margin.png} | Bin htdocs/theme/cameleo/style.css.php | 4 +- htdocs/theme/eldy/img/commissions.png | Bin 1676 -> 0 bytes htdocs/theme/eldy/img/marges.png | Bin 1851 -> 0 bytes htdocs/theme/eldy/img/menus/marges.png | Bin 1851 -> 0 bytes .../{object_marges.png => object_margin.png} | Bin htdocs/theme/eldy/style.css.php | 4 +- htdocs/user/class/user.class.php | 4 +- htdocs/webservices/server_invoice.php | 2 +- 42 files changed, 352 insertions(+), 403 deletions(-) rename htdocs/{ => commissions}/admin/commissions.php (65%) rename htdocs/{ => margin}/admin/margin.php (97%) delete mode 100644 htdocs/theme/amarok/img/commissions.png delete mode 100644 htdocs/theme/amarok/img/marges.png rename htdocs/theme/amarok/img/{object_marges.png => object_margin.png} (100%) delete mode 100644 htdocs/theme/auguria/img/commissions.png delete mode 100644 htdocs/theme/auguria/img/marges.png rename htdocs/theme/auguria/img/{object_marges.png => object_margin.png} (100%) delete mode 100644 htdocs/theme/bureau2crea/img/commissions.png delete mode 100644 htdocs/theme/bureau2crea/img/marges.png rename htdocs/theme/bureau2crea/img/{object_marges.png => object_margin.png} (100%) delete mode 100644 htdocs/theme/cameleo/img/commissions.png delete mode 100644 htdocs/theme/cameleo/img/marges.png rename htdocs/theme/cameleo/img/{object_marges.png => object_margin.png} (100%) delete mode 100644 htdocs/theme/eldy/img/commissions.png delete mode 100644 htdocs/theme/eldy/img/marges.png delete mode 100644 htdocs/theme/eldy/img/menus/marges.png rename htdocs/theme/eldy/img/{object_marges.png => object_margin.png} (100%) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index e0eb74f6aca..8c39f3a8fe7 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -200,7 +200,7 @@ print $langs->trans("TotalNumberOfActivatedModules",($nbofactivatedmodules-1)); if ($nbofactivatedmodules <= 1) print ' '.img_warning($langs->trans("YouMustEnableOneModule")); print '
'."\n"; -print "
\n"; +print "
\n"; $h = 0; diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php index 7f070c07df5..f39c64d872d 100644 --- a/htdocs/comm/mailing/fiche.php +++ b/htdocs/comm/mailing/fiche.php @@ -928,7 +928,7 @@ else print '

'; } - if (! empty($mesgembedded)) dol_htmloutput_mesg($mesgembedded,'','warning',1); + if (! empty($mesgembedded)) dol_htmloutput_mesg($mesgembedded,'','warning',1); // Affichage formulaire de TEST if ($action == 'test') diff --git a/htdocs/admin/commissions.php b/htdocs/commissions/admin/commissions.php similarity index 65% rename from htdocs/admin/commissions.php rename to htdocs/commissions/admin/commissions.php index 64e618633ac..a48f6ead1ca 100644 --- a/htdocs/admin/commissions.php +++ b/htdocs/commissions/admin/commissions.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2012 Christophe Battarel * * 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 @@ -12,9 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * or see http://www.gnu.org/ + * along with this program. If not, see . */ /** @@ -23,33 +21,24 @@ * \brief Page to setup advanced commissions module */ -$res=@include("../main.inc.php"); // For root directory - +include("../../main.inc.php"); require_once(DOL_DOCUMENT_ROOT."/commissions/lib/commissions.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"); $langs->load("admin"); $langs->load("commissions"); -if (!$user->admin) -accessforbidden(); +if (! $user->admin) accessforbidden(); -// init -if ($conf->global->COMMISSION_BASE == "") { - if ($conf->marges->enabled) - $conf->global->COMMISSION_BASE = "MARGES"; - else - $conf->global->COMMISSION_BASE = "CA"; -} /* * Action */ -if (isset($_POST['commissionBase'])) +if (GETPOST('commissionBase')) { - if (dolibarr_set_const($db, 'COMMISSION_BASE', $_POST['commissionBase'], 'string', 0, '', $conf->entity) > 0) + if (dolibarr_set_const($db, 'COMMISSION_BASE', GETPOST('commissionBase'), 'string', 0, '', $conf->entity) > 0) { - $conf->global->COMMISSION_BASE = $_POST['commissionBase']; + $conf->global->COMMISSION_BASE = GETPOST('commissionBase'); } else { @@ -57,9 +46,9 @@ if (isset($_POST['commissionBase'])) } } -if (isset($_POST['productCommissionRate'])) +if (GETPOST('productCommissionRate')) { - if (dolibarr_set_const($db, 'PRODUCT_COMMISSION_RATE', $_POST['productCommissionRate'], 'rate', 0, '', $conf->entity) > 0) + if (dolibarr_set_const($db, 'PRODUCT_COMMISSION_RATE', GETPOST('productCommissionRate'), 'rate', 0, '', $conf->entity) > 0) { } else @@ -68,9 +57,9 @@ if (isset($_POST['productCommissionRate'])) } } -if (isset($_POST['serviceCommissionRate'])) +if (GETPOST('serviceCommissionRate')) { - if (dolibarr_set_const($db, 'SERVICE_COMMISSION_RATE', $_POST['serviceCommissionRate'], 'rate', 0, '', $conf->entity) > 0) + if (dolibarr_set_const($db, 'SERVICE_COMMISSION_RATE', GETPOST('serviceCommissionRate'), 'rate', 0, '', $conf->entity) > 0) { } else @@ -91,7 +80,7 @@ $linkback=''.$langs->trans("BackToM print_fiche_titre($langs->trans("commissionsSetup"),$linkback,'setup'); -$head = commissions_admin_prepare_head($adh); +$head = commissions_admin_prepare_head(); dol_fiche_head($head, 'parameters', $langs->trans("Commissions"), 0, 'commissions'); @@ -111,21 +100,21 @@ $form = new Form($db); print '
'; -// COMMISSION BASE (CA / MARGES) +// COMMISSION BASE (TURNOVER / MARGIN) $var=!$var; print ''; print ''.$langs->trans("CommissionBase").''; print ''; -print 'global->COMMISSION_BASE == "CA") +print 'global->COMMISSION_BASE) && $conf->global->COMMISSION_BASE == "TURNOVER") print 'checked'; print ' />'; -print $langs->trans("CommissionBasedOnCA"); +print $langs->trans("CommissionBasedOnTurnover"); print '
'; -print 'marges->enabled) +print 'margin->enabled)) print 'disabled'; -elseif ($conf->global->COMMISSION_BASE == "MARGES") +elseif (isset($conf->global->COMMISSION_BASE) && $conf->global->COMMISSION_BASE == "MARGIN") print 'checked'; print ' />'; print $langs->trans("CommissionBasedOnMargins"); @@ -141,7 +130,7 @@ $var=!$var; print ''; print ''.$langs->trans("ProductCommissionRate").''; print ''; -print '  %'; +print '  %'; print ''; print ''.$langs->trans('ProductCommissionRateDetails').''; print ''; @@ -151,7 +140,7 @@ $var=!$var; print ''; print ''.$langs->trans("ServiceCommissionRate").''; print ''; -print '  %'; +print '  %'; print ''; print ''.$langs->trans('ServiceCommissionRateDetails').''; print ''; @@ -169,7 +158,7 @@ print '
'; print '
'; -$db->close(); -llxFooter('$Date: 2011/07/31 22:23:21 $ - $Revision: 1.6 $'); +llxFooter(); +$db->close(); ?> diff --git a/htdocs/commissions/index.php b/htdocs/commissions/index.php index 65e2ad70b21..c6988f19b8d 100644 --- a/htdocs/commissions/index.php +++ b/htdocs/commissions/index.php @@ -48,10 +48,12 @@ $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; +$startdate=$enddate=''; + if (!empty($_POST['startdatemonth'])) - $startdate = date('Y-m-d', dol_mktime(12, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear'])); + $startdate = date('Y-m-d', dol_mktime(12, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear'])); if (!empty($_POST['enddatemonth'])) - $enddate = date('Y-m-d', dol_mktime(12, 0, 0, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear'])); + $enddate = date('Y-m-d', dol_mktime(12, 0, 0, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear'])); /* * View @@ -90,7 +92,7 @@ else { if (! $sortfield) $sortfield="u.login"; } -// Date d�but +// Start date print ''.$langs->trans('StartDate').''; print ''; $form->select_date($startdate,'startdate','','',1,"sel",1,1); @@ -106,22 +108,22 @@ print ''; // Include unpayed invoices print ''.$langs->trans("IncludeUnpayedInvoices").''; print ''; print ''; // Total Margin -if ($conf->global->COMMISSION_BASE == "MARGES") { - print ''.$langs->trans("TotalMargin").''; - print ''; // set by jquery (see below) - print ''; +if ($conf->global->COMMISSION_BASE == "MARGIN") { + print ''.$langs->trans("TotalMargin").''; + print ''; // set by jquery (see below) + print ''; } -elseif ($conf->global->COMMISSION_BASE == "CA") { - print ''.$langs->trans("CATotal").''; - print ''; // set by jquery (see below) - print ''; +elseif ($conf->global->COMMISSION_BASE == "TURNOVER") { + print ''.$langs->trans("TurnoverTotal").''; + print ''; // set by jquery (see below) + print ''; } // Total Commission @@ -135,13 +137,13 @@ print ''; $sql = "SELECT distinct s.nom, s.rowid as socid, s.code_client, s.client, sc.fk_user as agent,"; $sql.= " u.login,"; $sql.= " f.facnumber, f.total as total_ht,"; -if ($conf->global->COMMISSION_BASE == "MARGES") { - $sql.= " sum(case d.product_type when 1 then 0 else (((d.subprice * (1 - d.remise_percent / 100)) - d.buy_price_ht) * d.qty) end) as productBase," ; - $sql.= " sum(case d.product_type when 1 then (((d.subprice * (1 - d.remise_percent / 100)) - d.buy_price_ht) * d.qty) else 0 end) as serviceBase," ; +if ($conf->global->COMMISSION_BASE == "MARGIN") { + $sql.= " sum(case d.product_type when 1 then 0 else (((d.subprice * (1 - d.remise_percent / 100)) - d.buy_price_ht) * d.qty) end) as productBase," ; + $sql.= " sum(case d.product_type when 1 then (((d.subprice * (1 - d.remise_percent / 100)) - d.buy_price_ht) * d.qty) else 0 end) as serviceBase," ; } -elseif ($conf->global->COMMISSION_BASE == "CA") { - $sql.= " sum(case d.product_type when 1 then 0 else (((d.subprice * (1 - d.remise_percent / 100))) * d.qty) end) as productBase," ; - $sql.= " sum(case d.product_type when 1 then (((d.subprice * (1 - d.remise_percent / 100))) * d.qty) else 0 end) as serviceBase," ; +elseif ($conf->global->COMMISSION_BASE == "TURNOVER") { + $sql.= " sum(case d.product_type when 1 then 0 else (((d.subprice * (1 - d.remise_percent / 100))) * d.qty) end) as productBase," ; + $sql.= " sum(case d.product_type when 1 then (((d.subprice * (1 - d.remise_percent / 100))) * d.qty) else 0 end) as serviceBase," ; } $sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; @@ -152,13 +154,13 @@ $sql.= ", ".MAIN_DB_PREFIX."user as u"; $sql.= " WHERE f.fk_soc = s.rowid"; $sql.= " AND sc.fk_soc = f.fk_soc"; $sql.= " AND sc.fk_user = u.rowid"; -if ($_REQUEST['unpayed'] == 'on') +if (GETPOST('unpayed') == 'on') $sql.= " AND f.fk_statut > 0"; else $sql.= " AND f.fk_statut > 1"; $sql.= " AND s.entity = ".$conf->entity; $sql.= " AND d.fk_facture = f.rowid"; -if ($conf->global->COMMISSION_BASE == "MARGES") +if ($conf->global->COMMISSION_BASE == "MARGIN") $sql.= " AND d.buy_price_ht IS NOT NULL AND d.buy_price_ht <> 0"; if ($agentid > 0) $sql.= " AND sc.fk_user = $agentid"; @@ -178,37 +180,38 @@ if ($result) { $num = $db->num_rows($result); - print '
'; - print_barre_liste($langs->trans("CommissionDetails"),$page,$_SERVER["PHP_SELF"],"&socid=$societe->id",$sortfield,$sortorder,'',$num,0,''); + print '
'; + print_barre_liste($langs->trans("CommissionDetails"),$page,$_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'',$num,0,''); $i = 0; print ""; print ''; if ($agentid > 0) - print_liste_field_titre($langs->trans("Customer"),$_SERVER["PHP_SELF"],"s.nom","","&agentid=".$_REQUEST["agentid"],'align="center"',$sortfield,$sortorder); - else - print_liste_field_titre($langs->trans("CommercialAgent"),$_SERVER["PHP_SELF"],"u.login","","&agentid=".$_REQUEST["agentid"],'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Customer"),$_SERVER["PHP_SELF"],"s.nom","","&agentid=".$agentid,'align="center"',$sortfield,$sortorder); + else + print_liste_field_titre($langs->trans("CommercialAgent"),$_SERVER["PHP_SELF"],"u.login","","&agentid=".$agentid,'align="center"',$sortfield,$sortorder); - // product commission - if ($conf->global->COMMISSION_BASE == "MARGES") - print_liste_field_titre($langs->trans("ProductMargin"),$_SERVER["PHP_SELF"],"productBase","","&agentid=".$_REQUEST["agentid"],'align="right"',$sortfield,$sortorder); - elseif ($conf->global->COMMISSION_BASE == "CA") - print_liste_field_titre($langs->trans("ProductCA"),$_SERVER["PHP_SELF"],"productBase","","&agentid=".$_REQUEST["agentid"],'align="right"',$sortfield,$sortorder); + // product commission + if ($conf->global->COMMISSION_BASE == "MARGIN") + print_liste_field_titre($langs->trans("ProductMargin"),$_SERVER["PHP_SELF"],"productBase","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder); + elseif ($conf->global->COMMISSION_BASE == "TURNOVER") + print_liste_field_titre($langs->trans("ProductTurnover"),$_SERVER["PHP_SELF"],"productBase","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("CommissionRate"),$_SERVER["PHP_SELF"],"","","&agentid=".$_REQUEST["agentid"],'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("ProductCommission"),$_SERVER["PHP_SELF"],"","","&agentid=".$_REQUEST["agentid"],'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("CommissionRate"),$_SERVER["PHP_SELF"],"","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("ProductCommission"),$_SERVER["PHP_SELF"],"","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder); - // service commission - if ($conf->global->COMMISSION_BASE == "MARGES") - print_liste_field_titre($langs->trans("ServiceMargin"),$_SERVER["PHP_SELF"],"serviceBase","","&agentid=".$_REQUEST["agentid"],'align="right"',$sortfield,$sortorder); - elseif ($conf->global->COMMISSION_BASE == "CA") - print_liste_field_titre($langs->trans("ServiceCA"),$_SERVER["PHP_SELF"],"serviceBase","","&agentid=".$_REQUEST["agentid"],'align="right"',$sortfield,$sortorder); + // service commission + if ($conf->global->COMMISSION_BASE == "MARGIN") + print_liste_field_titre($langs->trans("ServiceMargin"),$_SERVER["PHP_SELF"],"serviceBase","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder); + elseif ($conf->global->COMMISSION_BASE == "TURNOVER") + print_liste_field_titre($langs->trans("ServiceTurnover"),$_SERVER["PHP_SELF"],"serviceBase","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder); + + print_liste_field_titre($langs->trans("CommissionRate"),$_SERVER["PHP_SELF"],"","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("ServiceCommission"),$_SERVER["PHP_SELF"],"","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("CommissionRate"),$_SERVER["PHP_SELF"],"","","&agentid=".$_REQUEST["agentid"],'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("ServiceCommission"),$_SERVER["PHP_SELF"],"","","&agentid=".$_REQUEST["agentid"],'align="right"',$sortfield,$sortorder); // total commission - print_liste_field_titre($langs->trans("TotalCommission"),$_SERVER["PHP_SELF"],"","","&agentid=".$_REQUEST["agentid"],'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("TotalCommission"),$_SERVER["PHP_SELF"],"","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder); print "\n"; @@ -227,32 +230,39 @@ if ($result) print ""; if ($agentid > 0) { - $companystatic->id=$objp->socid; - $companystatic->nom=$objp->nom; - $companystatic->client=$objp->client; - print "\n"; - } - else { - $userstatic->id=$objp->agent; - $userstatic->login=$objp->login; - print "\n"; - } - // product commission - $productCommission = $conf->global->PRODUCT_COMMISSION_RATE * $objp->productBase / 100; - print "\n"; - print "\n"; + $companystatic->id=$objp->socid; + $companystatic->nom=$objp->nom; + $companystatic->client=$objp->client; + print "\n"; + } + else { + $userstatic->id=$objp->agent; + $userstatic->login=$objp->login; + print "\n"; + } + + // product commission + $productCommissionRate=(! empty($conf->global->PRODUCT_COMMISSION_RATE)?$conf->global->PRODUCT_COMMISSION_RATE:0); + $productBase=(! empty($objp->productBase)?$objp->productBase:0); + $productCommission = (! empty($productBase)?($productCommissionRate * $productBase / 100):0); + print "\n"; + print "\n"; print "\n"; - // service commission - $serviceCommission = $conf->global->SERVICE_COMMISSION_RATE * $objp->serviceBase / 100; - print "\n"; - print "\n"; + + // service commission + $serviceCommissionRate=(! empty($conf->global->SERVICE_COMMISSION_RATE)?$conf->global->SERVICE_COMMISSION_RATE:0); + $serviceBase=(! empty($objp->serviceBase)?$objp->serviceBase:0); + $serviceCommission = (! empty($serviceBase)?($serviceCommissionRate * $serviceBase / 100):0); + print "\n"; + print "\n"; print "\n"; + // total commission print "\n"; print "\n"; $i++; - $cumul_base_produit += $objp->productBase; - $cumul_base_service += $objp->serviceBase; + $cumul_base_produit += $productBase; + $cumul_base_service += $serviceBase; $cumul_commission_produit += $productCommission; $cumul_commission_service += $serviceCommission; } @@ -261,25 +271,25 @@ if ($result) // affichage totaux commission $var=!$var; print ''; - if ($client) - print '"; - // product commission + if (! empty($client)) + print '"; + // product commission print "\n"; - print "\n"; + print "\n"; print "\n"; - // service commission + // service commission print "\n"; - print "\n"; + print "\n"; print "\n"; // total commission print "\n"; print "\n"; - print "
".$companystatic->getNomUrl(1,'customer')."".$userstatic->getLoginUrl(1)."".price($objp->productBase)."".price($conf->global->PRODUCT_COMMISSION_RATE)."".$companystatic->getNomUrl(1,'customer')."".$userstatic->getLoginUrl(1)."".price($productBase)."".price($productCommissionRate)."".price($productCommission)."".price($objp->serviceBase)."".price($conf->global->SERVICE_COMMISSION_RATE)."".price($serviceBase)."".price($serviceCommissionRate)."".price($serviceCommission)."".price($productCommission + $serviceCommission)."
'; - else - print ''; - print $langs->trans('TotalCommission')."'; + else + print ''; + print $langs->trans('TotalCommission')."".price($cumul_base_produit)."".price($conf->global->PRODUCT_COMMISSION_RATE)."".price((! empty($conf->global->PRODUCT_COMMISSION_RATE)?$conf->global->PRODUCT_COMMISSION_RATE:0))."".price($cumul_commission_produit)."".price($cumul_base_service)."".price($conf->global->SERVICE_COMMISSION_RATE)."".price((! empty($conf->global->SERVICE_COMMISSION_RATE)?$conf->global->SERVICE_COMMISSION_RATE:0))."".price($cumul_commission_service)."".price($cumul_commission_produit + $cumul_commission_service)."
"; + print ""; } else { diff --git a/htdocs/commissions/lib/commissions.lib.php b/htdocs/commissions/lib/commissions.lib.php index ca71d41536c..89fba20a60c 100644 --- a/htdocs/commissions/lib/commissions.lib.php +++ b/htdocs/commissions/lib/commissions.lib.php @@ -42,7 +42,7 @@ function commissions_admin_prepare_head() // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab - complete_head_from_modules($conf,$langs,$object,$head,$h,'commissionsadmin'); + complete_head_from_modules($conf,$langs,'',$head,$h,'commissionsadmin'); return $head; } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index f94797cb679..b1c7383e32c 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2184,7 +2184,7 @@ class Form $more.='dirs = array(); // Config pages. Put here list of php page names stored in admmin directory used to setup module. - $this->config_page_url = array("commissions.php"); + $this->config_page_url = array("commissions.php@commissions"); // Dependencies $this->depends = array("modFacture", "modMargin"); // List of modules id that must be enabled if this module is enabled @@ -77,7 +77,7 @@ class modCommissions extends DolibarrModules $this->langfiles = array("commissions"); // Constants - $this->const = array(); // List of particular constants to add when module is enabled + $this->const = array(0=>array('COMMISSION_BASE',"chaine","TURNOVER",'Default commission base',0)); // List of particular constants to add when module is enabled // New pages on tabs $this->tabs = array(); @@ -106,15 +106,15 @@ class modCommissions extends DolibarrModules // left menu entry $this->menu[$r]=array( - 'fk_menu'=>0, // Put 0 if this is a top menu - 'type'=>'top', // This is a Top menu entry + 'fk_menu'=>'fk_mainmenu=accountancy', // Put 0 if this is a top menu + 'type'=>'left', // This is a Top menu entry 'titre'=>'Commissions', - 'mainmenu'=>'commissions', - 'leftmenu'=>'0', // Use 1 if you also want to add left menu entries using this descriptor. Use 0 if left menu entries are defined in a file pre.inc.php (old school). + 'mainmenu'=>'accountancy', + 'leftmenu'=>'commissions', // Use 1 if you also want to add left menu entries using this descriptor. Use 0 if left menu entries are defined in a file pre.inc.php (old school). 'url'=>'/commissions/index.php', - 'langs'=>'commissions@commissions', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>110, - 'enabled'=>'1', // Define condition to show or hide menu entry. Use '$conf->monmodule->enabled' if entry must be visible if module is enabled. + 'langs'=>'commissions', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position'=>200, + 'enabled'=>'$conf->commissions->enabled', // Define condition to show or hide menu entry. Use '$conf->monmodule->enabled' if entry must be visible if module is enabled. 'perms'=>'1', // Use 'perms'=>'$user->rights->monmodule->level1->level2' if you want your menu with a permission rules 'target'=>'', 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both diff --git a/htdocs/core/modules/modMargin.class.php b/htdocs/core/modules/modMargin.class.php index a14068f348e..f94193393fc 100644 --- a/htdocs/core/modules/modMargin.class.php +++ b/htdocs/core/modules/modMargin.class.php @@ -59,13 +59,13 @@ class modMargin extends DolibarrModules $this->special = 0; // Name of png file (without png) used for this module. // Png file must be in theme/yourtheme/img directory under name object_pictovalue.png. - $this->picto='marges'; + $this->picto='margin'; // Data directories to create when module is enabled. $this->dirs = array('/margin/temp'); // Config pages. Put here list of php page names stored in admmin directory used to setup module. - $this->config_page_url = array("margin.php"); + $this->config_page_url = array("margin.php@margin"); // Dependencies $this->depends = array("modPropale", "modProduct"); // List of modules id that must be enabled if this module is enabled @@ -98,62 +98,19 @@ class modMargin extends DolibarrModules // left menu entry $this->menu[$r]=array( - 'fk_menu'=>0, // Put 0 if this is a top menu - 'type'=>'top', // This is a Top menu entry + 'fk_menu'=>'fk_mainmenu=accountancy', // Put 0 if this is a top menu + 'type'=>'left', // This is a Top menu entry 'titre'=>'Margins', - 'mainmenu'=>'margins', - 'leftmenu'=>'1', // Use 1 if you also want to add left menu entries using this descriptor. Use 0 if left menu entries are defined in a file pre.inc.php (old school). + 'mainmenu'=>'accountancy', + 'leftmenu'=>'margins', // Use 1 if you also want to add left menu entries using this descriptor. Use 0 if left menu entries are defined in a file pre.inc.php (old school). 'url'=>'/margin/index.php', 'langs'=>'margins', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'position'=>100, - 'enabled'=>'1', // Define condition to show or hide menu entry. Use '$conf->monmodule->enabled' if entry must be visible if module is enabled. + 'enabled'=>'$conf->margin->enabled', // Define condition to show or hide menu entry. Use '$conf->monmodule->enabled' if entry must be visible if module is enabled. 'perms'=>'1', // Use 'perms'=>'$user->rights->monmodule->level1->level2' if you want your menu with a permission rules 'target'=>'', 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both $r++; - - // top menu entry - $this->menu[$r]=array( - 'fk_menu'=>'r=0', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry) - 'type'=>'left', // This is a Left menu entry - 'titre'=>'ProductMargins', - 'mainmenu'=>'margins', - 'url'=>'/margin/productMargins.php', - 'langs'=>'margins', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>100, - 'enabled'=>'1', // Define condition to show or hide menu entry. Use '$conf->monmodule->enabled' if entry must be visible if module is enabled. - 'perms'=>'1', // Use 'perms'=>'$user->rights->monmodule->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2); // 0=Menu for internal users,1=external users, 2=both - $r++; - - $this->menu[$r]=array( - 'fk_menu'=>'r=0', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry) - 'type'=>'left', // This is a Left menu entry - 'titre'=>'CustomerMargins', - 'mainmenu'=>'margins', - 'url'=>'/margin/customerMargins.php', - 'langs'=>'margins', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>200, - 'enabled'=>'1', // Define condition to show or hide menu entry. Use '$conf->monmodule->enabled' if entry must be visible if module is enabled. - 'perms'=>'1', // Use 'perms'=>'$user->rights->monmodule->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2); // 0=Menu for internal users,1=external users, 2=both - $r++; - - $this->menu[$r]=array( - 'fk_menu'=>'r=0', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry) - 'type'=>'left', // This is a Left menu entry - 'titre'=>'AgentMargins', - 'mainmenu'=>'margins', - 'url'=>'/margin/agentMargins.php', - 'langs'=>'margins', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>300, - 'enabled'=>'1', // Define condition to show or hide menu entry. Use '$conf->monmodule->enabled' if entry must be visible if module is enabled. - 'perms'=>'1', // Use 'perms'=>'$user->rights->monmodule->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2); // 0=Menu for internal users,1=external users, 2=both - $r++; } /** diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index efa3d132d24..fc8c2ed7855 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -781,9 +781,9 @@ if ($action == 'create') if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) { // Show warehouse combo list - $ent = "entl".$indiceAsked; - $idl = "idl".$indiceAsked; - $tmpentrepot_id = is_numeric(GETPOST($ent,'int'))?GETPOST($ent,'int'):GETPOST('entrepot_id','int'); + $ent = "entl".$indiceAsked; + $idl = "idl".$indiceAsked; + $tmpentrepot_id = is_numeric(GETPOST($ent,'int'))?GETPOST($ent,'int'):GETPOST('entrepot_id','int'); print $formproduct->selectWarehouses($tmpentrepot_id,'entl'.$indiceAsked,'',1,0,$line->fk_product); if ($tmpentrepot_id && $tmpentrepot_id == GETPOST('entrepot_id','int')) { diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index ffa61de2c9c..f0471874ea4 100755 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -77,7 +77,7 @@ if (! $result && ! empty($_SERVER["GATEWAY_INTERFACE"])) // If install not do // Force PHP error_reporting setup (Dolibarr may report warning without this) if (! empty($dolibarr_strict_mode)) -{ +{ error_reporting(E_ALL | E_STRICT); } else diff --git a/htdocs/install/lib/repair.lib.php b/htdocs/install/lib/repair.lib.php index 05b06fda034..f7839e5dc49 100644 --- a/htdocs/install/lib/repair.lib.php +++ b/htdocs/install/lib/repair.lib.php @@ -117,30 +117,30 @@ function checkLinkedElements($sourcetype, $targettype) function clean_data_ecm_directories() { global $db, $langs; - - // Clean data from ecm_directories - $sql="SELECT rowid, label FROM ".MAIN_DB_PREFIX."ecm_directories"; - $resql=$db->query($sql); - if ($resql) - { - while($obj=$db->fetch_object($resql)) - { - $id=$obj->rowid; - $label=$obj->label; - $newlabel=dol_sanitizeFileName($label); - if ($label != $newlabel) - { - $sqlupdate="UPDATE ".MAIN_DB_PREFIX."ecm_directories set label='".$newlabel."' WHERE rowid=".$id; - print ''.$sqlupdate."\n"; - $resqlupdate=$db->query($sqlupdate); - if (! $resqlupdate) dol_print_error($db,'Failed to update'); - } - - } - } - else dol_print_error($db,'Failed to run request'); - return; + // Clean data from ecm_directories + $sql="SELECT rowid, label FROM ".MAIN_DB_PREFIX."ecm_directories"; + $resql=$db->query($sql); + if ($resql) + { + while($obj=$db->fetch_object($resql)) + { + $id=$obj->rowid; + $label=$obj->label; + $newlabel=dol_sanitizeFileName($label); + if ($label != $newlabel) + { + $sqlupdate="UPDATE ".MAIN_DB_PREFIX."ecm_directories set label='".$newlabel."' WHERE rowid=".$id; + print ''.$sqlupdate."\n"; + $resqlupdate=$db->query($sqlupdate); + if (! $resqlupdate) dol_print_error($db,'Failed to update'); + } + + } + } + else dol_print_error($db,'Failed to run request'); + + return; } ?> diff --git a/htdocs/langs/fr_FR/commissions.lang b/htdocs/langs/fr_FR/commissions.lang index 350b12a8099..97dd17d9cba 100644 --- a/htdocs/langs/fr_FR/commissions.lang +++ b/htdocs/langs/fr_FR/commissions.lang @@ -23,14 +23,14 @@ ProductCommission=Commission / produits ServiceCommission=Commission / services CommissionBase=Base de calcul des commissions -CommissionBasedOnCA=Commissions calculées sur le CA +CommissionBasedOnTurnover=Commissions calculées sur le CA CommissionBasedOnMargins=Commissions calculées sur les marges CommissionBaseDetails=Définit le mode de calcul des commissions CommissionBasedOnMarginsDetails=Le calcul basé sur les marges nécessite l'activation du module marges. -CATotal = Chiffre d'affaire réalisé HT -ProductCA=CA HT / produits -ServiceCA=CA HT / services +TurnoverTotal = Chiffre d'affaire réalisé HT +ProductTurnover=CA HT / produits +ServiceTurnover=CA HT / services CommercialAgent=Agent commercial diff --git a/htdocs/admin/margin.php b/htdocs/margin/admin/margin.php similarity index 97% rename from htdocs/admin/margin.php rename to htdocs/margin/admin/margin.php index 782d4df55e0..1396c8c13a0 100644 --- a/htdocs/admin/margin.php +++ b/htdocs/margin/admin/margin.php @@ -16,12 +16,12 @@ */ /** - * \file /htdocs/admin/margin.php + * \file /htdocs/margin/admin/margin.php * \ingroup margin * \brief Page to setup margin module */ -include("../main.inc.php"); +include("../../main.inc.php"); require_once(DOL_DOCUMENT_ROOT."/margin/lib/margins.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"); @@ -121,7 +121,7 @@ $form = new Form($db); // GLOBAL DISCOUNT MANAGEMENT $var=!$var; -print "
"; +print ''; print ''; print ""; print ''; @@ -219,7 +219,7 @@ print ''; // GLOBAL DISCOUNT MANAGEMENT $var=!$var; -print ""; +print ''; print ''; print ""; print ''; diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index f11db0f42f4..51327212ba7 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -39,12 +39,16 @@ $mesg = ''; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); +if (! $sortorder) $sortorder="ASC"; +if (! $sortfield) $sortfield="s.nom"; $page = GETPOST("page",'int'); if ($page == -1) { $page = 0; } $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; +$startdate=$enddate=''; + if (!empty($_POST['startdatemonth'])) $startdate = date('Y-m-d', dol_mktime(12, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear'])); if (!empty($_POST['enddatemonth'])) @@ -68,30 +72,16 @@ print_fiche_titre($text); // Show tabs $head=marges_prepare_head($user); $titre=$langs->trans("Margins"); -$picto='marges'; +$picto='margin'; dol_fiche_head($head, 'agentMargins', $titre, 0, $picto); print ''; print ''; -if ($agentid > 0) { - - print ''; - print ''; - - if (! $sortorder) $sortorder="ASC"; - if (! $sortfield) $sortfield="s.nom"; -} -else { - print ''; - print ''; - if (! $sortorder) $sortorder="ASC"; - if (! $sortfield) $sortfield="u.login"; -} +print ''; +print ''; // Start date print ''; @@ -112,14 +102,14 @@ print ''; // set by jquery (see below) print ''; // Margin Rate -if ($conf->global->DISPLAY_MARGIN_RATES) { +if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { print ''; } // Mark Rate -if ($conf->global->DISPLAY_MARK_RATES) { +if (! empty($conf->global->DISPLAY_MARK_RATES)) { print ''; @@ -163,24 +153,25 @@ if ($result) { $num = $db->num_rows($result); - print '
'; - print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"&socid=$societe->id",$sortfield,$sortorder,'',$num,0,''); + print '
'; + print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'',$num,0,''); $i = 0; print "
'.$langs->trans('CommercialAgent').''; - print $form->select_dolusers($selected=$agentid,$htmlname='agentid',$show_empty=1,$exclude='',$disabled=0,$include='',$enableonly=''); - print '
'.$langs->trans('CommercialAgent').''; - print $form->select_dolusers($selected='',$htmlname='agentid',$show_empty=1,$exclude='',$disabled=0,$include='',$enableonly=''); - print '
'.$langs->trans('CommercialAgent').''; +print $form->select_dolusers($agentid,'agentid',1); +print '
'.$langs->trans('StartDate').'
'.$langs->trans("MarginRate").''; print ''; // set by jquery (see below) print '
'.$langs->trans("MarkRate").''; print ''; // set by jquery (see below) print '
"; print ''; if ($agentid > 0) - print_liste_field_titre($langs->trans("Customer"),$_SERVER["PHP_SELF"],"s.nom","","&agentid=".$_REQUEST["agentid"],'align="center"',$sortfield,$sortorder); - else - print_liste_field_titre($langs->trans("CommercialAgent"),$_SERVER["PHP_SELF"],"u.login","","&agentid=".$_REQUEST["agentid"],'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&agentid=".$_REQUEST["agentid"],'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buyng_price","","&agentid=".$_REQUEST["agentid"],'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&agentid=".$_REQUEST["agentid"],'align="right"',$sortfield,$sortorder); - if ($conf->global->DISPLAY_MARGIN_RATES) - print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"d.marge_tx","","&agentid=".$_REQUEST["agentid"],'align="right"',$sortfield,$sortorder); - if ($conf->global->DISPLAY_MARK_RATES) - print_liste_field_titre($langs->trans("MarkRate"),$_SERVER["PHP_SELF"],"d.marque_tx","","&agentid=".$_REQUEST["agentid"],'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Customer"),$_SERVER["PHP_SELF"],"s.nom","","&agentid=".$agentid,'align="center"',$sortfield,$sortorder); + else + print_liste_field_titre($langs->trans("CommercialAgent"),$_SERVER["PHP_SELF"],"u.login","","&agentid=".$agentid,'align="center"',$sortfield,$sortorder); + + print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buyng_price","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder); + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) + print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"d.marge_tx","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder); + if (! empty($conf->global->DISPLAY_MARK_RATES)) + print_liste_field_titre($langs->trans("MarkRate"),$_SERVER["PHP_SELF"],"d.marque_tx","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder); print "\n"; $cumul_achat = 0; @@ -188,34 +179,34 @@ if ($result) $cumul_qty = 0; if ($num > 0) { - $var=True; + $var=true; while ($i < $num && $i < $conf->liste_limit) { $objp = $db->fetch_object($result); - $marginRate = ($objp->buying_price != 0)?(100 * round($objp->marge / $objp->buying_price ,5)):'' ; - $markRate = ($objp->selling_price != 0)?(100 * round($objp->marge / $objp->selling_price ,5)):'' ; + $marginRate = ($objp->buying_price != 0)?(100 * round($objp->marge / $objp->buying_price ,5)):''; + $markRate = ($objp->selling_price != 0)?(100 * round($objp->marge / $objp->selling_price ,5)):''; $var=!$var; print ""; if ($agentid > 0) { - $companystatic->id=$objp->socid; - $companystatic->nom=$objp->nom; - $companystatic->client=$objp->client; - print "\n"; - } - else { - $userstatic->id=$objp->agent; - $userstatic->login=$objp->login; - print "\n"; - } + $companystatic->id=$objp->socid; + $companystatic->nom=$objp->nom; + $companystatic->client=$objp->client; + print "\n"; + } + else { + $userstatic->id=$objp->agent; + $userstatic->login=$objp->login; + print "\n"; + } print "\n"; print "\n"; print "\n"; - if ($conf->global->DISPLAY_MARGIN_RATES) + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) print "\n"; - if ($conf->global->DISPLAY_MARK_RATES) + if (! empty($conf->global->DISPLAY_MARK_RATES)) print "\n"; print "\n"; $i++; @@ -227,24 +218,24 @@ if ($result) // affichage totaux marges $var=!$var; $totalMargin = $cumul_vente - $cumul_achat; - $marginRate = ($cumul_achat != 0)?(100 * round($totalMargin / $cumul_achat, 5)):'' ; - $markRate = ($cumul_vente != 0)?(100 * round($totalMargin / $cumul_vente, 5)):'' ; + $marginRate = ($cumul_achat != 0)?(100 * round($totalMargin / $cumul_achat, 5)):''; + $markRate = ($cumul_vente != 0)?(100 * round($totalMargin / $cumul_vente, 5)):''; print ''; - if ($client) - print '"; + if (! empty($client)) + print '"; print "\n"; print "\n"; print "\n"; - if ($conf->global->DISPLAY_MARGIN_RATES) + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) print "\n"; - if ($conf->global->DISPLAY_MARK_RATES) + if (! empty($conf->global->DISPLAY_MARK_RATES)) print "\n"; print "\n"; - print "
".$companystatic->getNomUrl(1,'customer')."".$userstatic->getLoginUrl(1)."".$companystatic->getNomUrl(1,'customer')."".$userstatic->getLoginUrl(1)."".price($objp->selling_price)."".price($objp->buying_price)."".price($objp->marge)."".(($marginRate === '')?'n/a':price($marginRate)."%")."".(($markRate === '')?'n/a':price($markRate)."%")."
'; - else - print ''; - print $langs->trans('TotalMargin')."'; + else + print ''; + print $langs->trans('TotalMargin')."".price($cumul_vente)."".price($cumul_achat)."".price($totalMargin)."".(($marginRate === '')?'n/a':price($marginRate)."%")."".(($markRate === '')?'n/a':price($markRate)."%")."
"; + print ""; } else { diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index 979e67b6345..27c1e230a2f 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -42,12 +42,16 @@ $mesg = ''; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); +if (! $sortorder) $sortorder="ASC"; +if (! $sortfield) $sortfield="s.nom"; $page = GETPOST("page",'int'); if ($page == -1) { $page = 0; } $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; +$startdate=$enddate=''; + if (!empty($_POST['startdatemonth'])) $startdate = date('Y-m-d', dol_mktime(12, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear'])); if (!empty($_POST['enddatemonth'])) @@ -70,37 +74,35 @@ print_fiche_titre($text); // Show tabs $head=marges_prepare_head($user); $titre=$langs->trans("Margins"); -$picto='marges'; +$picto='margin'; dol_fiche_head($head, 'customerMargins', $titre, 0, $picto); print ''; print ''; -$client = null; +$client = false; if ($socid > 0) { - $societe = new Societe($db, $socid); - $societe->fetch($socid); + $soc = new Societe($db, $socid); + $soc->fetch($socid); - if ($societe->client) - { - print ''; - print ''; + if ($soc->client) + { + print ''; + print ''; - $client = true; - if (! $sortorder) $sortorder="DESC"; - if (! $sortfield) $sortfield="f.datef"; - } + $client = true; + if (! $sortorder) $sortorder="DESC"; + if (! $sortfield) $sortfield="f.datef"; + } } -if (!$client) { - print ''; - print ''; - if (! $sortorder) $sortorder="ASC"; - if (! $sortfield) $sortfield="s.nom"; +else { + print ''; + print ''; } // Start date @@ -122,14 +124,14 @@ print ''; // set by jquery (see below) print ''; // Margin Rate -if ($conf->global->DISPLAY_MARGIN_RATES) { +if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { print ''; } // Mark Rate -if ($conf->global->DISPLAY_MARK_RATES) { +if (! empty($conf->global->DISPLAY_MARK_RATES)) { print ''; @@ -169,25 +171,25 @@ if ($result) $num = $db->num_rows($result); print '
'; - print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"&socid=$societe->id",$sortfield,$sortorder,'',$num,0,''); + print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'',$num,0,''); $i = 0; print "
'.$langs->trans('ThirdPartyName').''; - $form->form_thirdparty($_SERVER['PHP_SELF'].'?socid='.$socid,$socid,'socid', $filter='client=1',$showempty=1, $showtype=0, $forcecombo=1); - print '
'.$langs->trans('ThirdPartyName').''; + $form->form_thirdparty($_SERVER['PHP_SELF'].'?socid='.$socid,$socid,'socid','client=1',1,0,1); + print '
'.$langs->trans('ThirdPartyName').''; - $form->form_thirdparty($_SERVER['PHP_SELF'].'?socid='.$socid,null,'socid', $filter='client=1',$showempty=1, $showtype=0, $forcecombo=1); - print '
'.$langs->trans('ThirdPartyName').''; + $form->form_thirdparty($_SERVER['PHP_SELF'].'?socid='.$socid,null,'socid','client=1',1,0,1); + print '
'.$langs->trans("MarginRate").''; print ''; // set by jquery (see below) print '
'.$langs->trans("MarkRate").''; print ''; // set by jquery (see below) print '
"; print ''; - if ($client) { - print_liste_field_titre($langs->trans("Invoice"),$_SERVER["PHP_SELF"],"f.facnumber","","&socid=".$_REQUEST["socid"],'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateInvoice"),$_SERVER["PHP_SELF"],"f.datef","","&socid=".$_REQUEST["socid"],'align="center"',$sortfield,$sortorder); + if (! empty($client)) { + print_liste_field_titre($langs->trans("Invoice"),$_SERVER["PHP_SELF"],"f.facnumber","","&socid=".$socid,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DateInvoice"),$_SERVER["PHP_SELF"],"f.datef","","&socid=".$socid,'align="center"',$sortfield,$sortorder); } else - print_liste_field_titre($langs->trans("Customer"),$_SERVER["PHP_SELF"],"s.nom","","&socid=".$_REQUEST["socid"],'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buyng_price","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder); - if ($conf->global->DISPLAY_MARGIN_RATES) - print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"d.marge_tx","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder); - if ($conf->global->DISPLAY_MARK_RATES) - print_liste_field_titre($langs->trans("MarkRate"),$_SERVER["PHP_SELF"],"d.marque_tx","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Customer"),$_SERVER["PHP_SELF"],"s.nom","","&socid=".$socid,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&socid=".$socid,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buyng_price","","&socid=".$socid,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&socid=".$socid,'align="right"',$sortfield,$sortorder); + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) + print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"d.marge_tx","","&socid=".$socid,'align="right"',$sortfield,$sortorder); + if (! empty($conf->global->DISPLAY_MARK_RATES)) + print_liste_field_titre($langs->trans("MarkRate"),$_SERVER["PHP_SELF"],"d.marque_tx","","&socid=".$socid,'align="right"',$sortfield,$sortorder); print "\n"; $cumul_achat = 0; @@ -224,9 +226,9 @@ if ($result) print "\n"; print "\n"; print "\n"; - if ($conf->global->DISPLAY_MARGIN_RATES) + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) print "\n"; - if ($conf->global->DISPLAY_MARK_RATES) + if (! empty($conf->global->DISPLAY_MARK_RATES)) print "\n"; print "\n"; $i++; @@ -249,9 +251,9 @@ if ($result) print "\n"; print "\n"; print "\n"; - if ($conf->global->DISPLAY_MARGIN_RATES) + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) print "\n"; - if ($conf->global->DISPLAY_MARK_RATES) + if (! empty($conf->global->DISPLAY_MARK_RATES)) print "\n"; print "\n"; diff --git a/htdocs/margin/lib/margins.lib.php b/htdocs/margin/lib/margins.lib.php index 77368e80455..3456ee1e990 100644 --- a/htdocs/margin/lib/margins.lib.php +++ b/htdocs/margin/lib/margins.lib.php @@ -32,7 +32,7 @@ function marges_admin_prepare_head() $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT."/admin/margin.php"; + $head[$h][0] = DOL_URL_ROOT."/margin/admin/margin.php"; $head[$h][1] = $langs->trans("Parameters"); $head[$h][2] = 'parameters'; $h++; diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index e43341ef7fc..ca6de009da3 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -47,12 +47,16 @@ $mesg = ''; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); +if (! $sortorder) $sortorder="ASC"; +if (! $sortfield) $sortfield="p.ref"; $page = GETPOST("page",'int'); if ($page == -1) { $page = 0; } $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; +$startdate=$enddate=''; + if (!empty($_POST['startdatemonth'])) $startdate = date('Y-m-d', dol_mktime(12, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear'])); if (!empty($_POST['enddatemonth'])) @@ -76,7 +80,7 @@ print_fiche_titre($text); // Show tabs $head=marges_prepare_head($user); $titre=$langs->trans("Margins"); -$picto='marges'; +$picto='margin'; dol_fiche_head($head, 'productMargins', $titre, 0, $picto); print ''; @@ -84,12 +88,9 @@ print '
".price($objp->selling_price)."".price($objp->buying_price)."".price($objp->marge)."".(($marginRate === '')?'n/a':price($marginRate)."%")."".(($markRate === '')?'n/a':price($markRate)."%")."
".price($cumul_vente)."".price($cumul_achat)."".price($totalMargin)."".(($marginRate === '')?'n/a':price($marginRate)."%")."".(($markRate === '')?'n/a':price($markRate)."%")."
'; if ($id > 0) { - $societe = new Societe($db, $socid); - $societe->fetch($socid); - print ''; print ''; print ''; @@ -99,12 +100,11 @@ if ($id > 0) { if (! $sortfield) $sortfield="f.datef"; } else { - print ''; - print ''; - if (! $sortorder) $sortorder="ASC"; - if (! $sortfield) $sortfield="p.ref"; + print ''; + print ''; + } // Start date @@ -126,14 +126,14 @@ print ''; // set by jquery (see below) print ''; // Margin Rate -if ($conf->global->DISPLAY_MARGIN_RATES) { +if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { print ''; } // Mark Rate -if ($conf->global->DISPLAY_MARK_RATES) { +if (! empty($conf->global->DISPLAY_MARK_RATES)) { print ''; @@ -142,7 +142,7 @@ if ($conf->global->DISPLAY_MARK_RATES) { print "
'.$langs->trans('ChooseProduct/Service').''; - print $form->select_produits($selected=$id, $htmlname='id', $filtertype='', $limit=20, $price_level=0, $status=1, $finished=2, $selected_input_value='', $hidelabel=1); + print $form->select_produits($id,'id','',20,0,1,2,'',1); print '
'.$langs->trans('AllProducts').'
'.$langs->trans('ChooseProduct/Service').''; - print $form->select_produits($selected='', $htmlname='id', $filtertype='', $limit=20, $price_level=0, $status=1, $finished=2, $selected_input_value='', $hidelabel=1); - print '
'.$langs->trans('ChooseProduct/Service').''; + print $form->select_produits('','id','',20,0,1,2,'',1); + print '
'.$langs->trans("MarginRate").''; print ''; // set by jquery (see below) print '
'.$langs->trans("MarkRate").''; print ''; // set by jquery (see below) print '
"; print '
'; -$sql = "SELECT distinct d.fk_product, p.label, p.rowid, p.fk_product_type, p.ref,"; +$sql = "SELECT DISTINCT d.fk_product, p.label, p.rowid, p.fk_product_type, p.ref,"; $sql.= " f.facnumber, f.total as total_ht,"; $sql.= " sum(d.subprice * d.qty * (1 - d.remise_percent / 100)) as selling_price,"; $sql.= " sum(d.buy_price_ht * d.qty) as buying_price, sum(((d.subprice * (1 - d.remise_percent / 100)) - d.buy_price_ht) * d.qty) as marge," ; @@ -151,10 +151,10 @@ $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."product as p"; $sql.= ", ".MAIN_DB_PREFIX."facture as f"; $sql.= ", ".MAIN_DB_PREFIX."facturedet as d"; -$sql.= " WHERE f.fk_soc = s.rowid"; +$sql.= " WHERE f.entity = ".$conf->entity; +$sql.= " AND f.fk_soc = s.rowid"; $sql.= " AND d.fk_product = p.rowid"; $sql.= " AND f.fk_statut > 0"; -$sql.= " AND s.entity = ".$conf->entity; $sql.= " AND d.fk_facture = f.rowid"; if ($id > 0) $sql.= " AND d.fk_product =".$id; @@ -174,26 +174,26 @@ if ($result) { $num = $db->num_rows($result); - print '
'; - print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"&id=$product->id",$sortfield,$sortorder,'',$num,0,''); + print '
'; + print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"&id=".$id,$sortfield,$sortorder,'',$num,0,''); $i = 0; print ""; print ''; if ($id > 0) { - print_liste_field_titre($langs->trans("Invoice"),$_SERVER["PHP_SELF"],"f.facnumber","","&id=".$_REQUEST["id"],'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateInvoice"),$_SERVER["PHP_SELF"],"f.datef","","&id=".$_REQUEST["id"],'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Invoice"),$_SERVER["PHP_SELF"],"f.facnumber","","&id=".$id,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DateInvoice"),$_SERVER["PHP_SELF"],"f.datef","","",'align="center"',$sortfield,$sortorder); } else - print_liste_field_titre($langs->trans("ProductService"),$_SERVER["PHP_SELF"],"p.ref","","&id=".$_REQUEST["id"],'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&id=".$_REQUEST["id"],'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buyng_price","","&id=".$_REQUEST["id"],'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&id=".$_REQUEST["id"],'align="right"',$sortfield,$sortorder); - if ($conf->global->DISPLAY_MARGIN_RATES) - print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"d.marge_tx","","&id=".$_REQUEST["id"],'align="right"',$sortfield,$sortorder); - if ($conf->global->DISPLAY_MARK_RATES) - print_liste_field_titre($langs->trans("MarkRate"),$_SERVER["PHP_SELF"],"d.marque_tx","","&id=".$_REQUEST["id"],'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("ProductService"),$_SERVER["PHP_SELF"],"p.ref","","&id=".$id,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&id=".$id,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buyng_price","","&id=".$id,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&id=".$id,'align="right"',$sortfield,$sortorder); + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) + print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"d.marge_tx","","&id=".$id,'align="right"',$sortfield,$sortorder); + if (! empty($conf->global->DISPLAY_MARK_RATES)) + print_liste_field_titre($langs->trans("MarkRate"),$_SERVER["PHP_SELF"],"d.marque_tx","","&id=".$id,'align="right"',$sortfield,$sortorder); print "\n"; $cumul_achat = 0; @@ -213,29 +213,29 @@ if ($result) print ""; if ($id > 0) { - print '\n"; - print ""; - } - else { + print '\n"; + print ""; + } + else { $product_static->type=$objp->fk_product_type; - $product_static->id=$objp->fk_product; + $product_static->id=$objp->fk_product; $product_static->ref=$objp->ref; - $product_static->libelle=$objp->label; + $product_static->libelle=$objp->label; $text=$product_static->getNomUrl(1); $text.= ' - '.$objp->label; - print "\n"; - } + print "\n"; + } print "\n"; print "\n"; print "\n"; - if ($conf->global->DISPLAY_MARGIN_RATES) + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) print "\n"; - if ($conf->global->DISPLAY_MARK_RATES) + if (! empty($conf->global->DISPLAY_MARK_RATES)) print "\n"; print "\n"; $i++; @@ -251,20 +251,20 @@ if ($result) $markRate = ($cumul_vente != 0)?(100 * round($totalMargin / $cumul_vente, 5)):'' ; print ''; if ($id > 0) - print '"; + print '"; print "\n"; print "\n"; print "\n"; - if ($conf->global->DISPLAY_MARGIN_RATES) + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) print "\n"; - if ($conf->global->DISPLAY_MARK_RATES) + if (! empty($conf->global->DISPLAY_MARK_RATES)) print "\n"; print "\n"; - print "
'; - $invoicestatic->id=$objp->facid; - $invoicestatic->ref=$objp->facnumber; - print $invoicestatic->getNomUrl(1); - print ""; - print dol_print_date($db->jdate($objp->datef),'day')."'; + $invoicestatic->id=$objp->facid; + $invoicestatic->ref=$objp->facnumber; + print $invoicestatic->getNomUrl(1); + print ""; + print dol_print_date($db->jdate($objp->datef),'day')."".$product_static->getNomUrl(1)."".$product_static->getNomUrl(1)."".price($objp->selling_price)."".price($objp->buying_price)."".price($objp->marge)."".(($marginRate === '')?'n/a':price($marginRate)."%")."".(($markRate === '')?'n/a':price($markRate)."%")."
'; - else - print ''; - print $langs->trans('TotalMargin')."'; + else + print ''; + print $langs->trans('TotalMargin')."".price($cumul_vente)."".price($cumul_achat)."".price($totalMargin)."".(($marginRate === '')?'n/a':price($marginRate)."%")."".(($markRate === '')?'n/a':price($markRate)."%")."
"; + print ""; } else { @@ -287,9 +287,9 @@ $(document).ready(function() { $("div.fiche form").submit(); }); - $("#totalMargin").html(""); - $("#marginRate").html(""); - $("#markRate").html(""); + $("#totalMargin").html(""); + $("#marginRate").html(""); + $("#markRate").html(""); }); \ No newline at end of file diff --git a/htdocs/margin/tabs/productMargins.php b/htdocs/margin/tabs/productMargins.php index e13e6b036d8..9c452973710 100644 --- a/htdocs/margin/tabs/productMargins.php +++ b/htdocs/margin/tabs/productMargins.php @@ -80,7 +80,7 @@ if ($id > 0 || ! empty($ref)) $head=product_prepare_head($object, $user); $titre=$langs->trans("CardProduct".$object->type); $picto=($object->type==1?'service':'product'); - dol_fiche_head($head, 'marges', $titre, 0, $picto); + dol_fiche_head($head, 'margin', $titre, 0, $picto); print ''; @@ -111,14 +111,14 @@ if ($id > 0 || ! empty($ref)) print ''; // Margin Rate - if ($conf->global->DISPLAY_MARGIN_RATES) { + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { print ''; } // Mark Rate - if ($conf->global->DISPLAY_MARK_RATES) { + if (! empty($conf->global->DISPLAY_MARK_RATES)) { print ''; @@ -128,7 +128,7 @@ if ($id > 0 || ! empty($ref)) print ''; - $sql = "SELECT distinct s.nom, s.rowid as socid, s.code_client,"; + $sql = "SELECT DISTINCT s.nom, s.rowid as socid, s.code_client,"; $sql.= " f.facnumber, f.total as total_ht,"; $sql.= " (d.subprice * d.qty * (1 - d.remise_percent / 100)) as selling_price, (d.buy_price_ht * d.qty) as buying_price, d.qty, ((d.subprice - d.buy_price_ht) * d.qty) as marge," ; $sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid"; @@ -143,7 +143,7 @@ if ($id > 0 || ! empty($ref)) $sql.= " AND d.fk_facture = f.rowid"; $sql.= " AND d.fk_product =".$object->id; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($socid) $sql.= " AND f.fk_soc = $socid"; + if (! empty($socid)) $sql.= " AND f.fk_soc = $socid"; $sql.= " ORDER BY $sortfield $sortorder "; $sql.= $db->plimit($conf->liste_limit +1, $offset); @@ -158,19 +158,19 @@ if ($id > 0 || ! empty($ref)) print "
'.$langs->trans("MarginRate").''; print ''; // set by jquery (see below) print '
'.$langs->trans("MarkRate").''; print ''; // set by jquery (see below) print '
"; print ''; - print_liste_field_titre($langs->trans("Invoice"),$_SERVER["PHP_SELF"],"f.facnumber","","&id=".$_GET["id"],'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&id=".$_GET["id"],'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("CustomerCode"),$_SERVER["PHP_SELF"],"s.code_client","","&id=".$_GET["id"],'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateInvoice"),$_SERVER["PHP_SELF"],"f.datef","","&id=".$_GET["id"],'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&id=".$_GET["id"],'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buyng_price","","&id=".$_GET["id"],'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Qty"),$_SERVER["PHP_SELF"],"d.qty","","&id=".$_GET["id"],'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&id=".$_GET["id"],'align="right"',$sortfield,$sortorder); - if ($conf->global->DISPLAY_MARGIN_RATES) - print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"d.marge_tx","","&id=".$_GET["id"],'align="right"',$sortfield,$sortorder); - if ($conf->global->DISPLAY_MARK_RATES) - print_liste_field_titre($langs->trans("MarkRate"),$_SERVER["PHP_SELF"],"d.marque_tx","","&id=".$_GET["id"],'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.paye,f.fk_statut","","&id=".$_GET["id"],'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Invoice"),$_SERVER["PHP_SELF"],"f.facnumber","","&id=".$object->id,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&id=".$object->id,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("CustomerCode"),$_SERVER["PHP_SELF"],"s.code_client","","&id=".$object->id,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DateInvoice"),$_SERVER["PHP_SELF"],"f.datef","","&id=".$object->id,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&id=".$object->id,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buyng_price","","&id=".$object->id,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Qty"),$_SERVER["PHP_SELF"],"d.qty","","&id=".$object->id,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&id=".$object->id,'align="right"',$sortfield,$sortorder); + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) + print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"d.marge_tx","","&id=".$object->id,'align="right"',$sortfield,$sortorder); + if (! empty($conf->global->DISPLAY_MARK_RATES)) + print_liste_field_titre($langs->trans("MarkRate"),$_SERVER["PHP_SELF"],"d.marque_tx","","&id=".$object->id,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.paye,f.fk_statut","","&id=".$object->id,'align="right"',$sortfield,$sortorder); print "\n"; $cumul_achat = 0; @@ -200,9 +200,9 @@ if ($id > 0 || ! empty($ref)) print "\n"; print "\n"; print "\n"; - if ($conf->global->DISPLAY_MARGIN_RATES) + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) print "\n"; - if ($conf->global->DISPLAY_MARK_RATES) + if (! empty($conf->global->DISPLAY_MARK_RATES)) print "\n"; print ''; print "\n"; @@ -224,9 +224,9 @@ if ($id > 0 || ! empty($ref)) print "\n"; print "\n"; print "\n"; - if ($conf->global->DISPLAY_MARGIN_RATES) + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) print "\n"; - if ($conf->global->DISPLAY_MARK_RATES) + if (! empty($conf->global->DISPLAY_MARK_RATES)) print "\n"; print ''; print "\n"; diff --git a/htdocs/margin/tabs/thirdpartyMargins.php b/htdocs/margin/tabs/thirdpartyMargins.php index 2e94ed9b1e0..0ea0f42acad 100644 --- a/htdocs/margin/tabs/thirdpartyMargins.php +++ b/htdocs/margin/tabs/thirdpartyMargins.php @@ -71,7 +71,7 @@ if ($socid > 0) $head = societe_prepare_head($societe); - dol_fiche_head($head, 'marges', $langs->trans("ThirdParty"),0,'company'); + dol_fiche_head($head, 'margin', $langs->trans("ThirdParty"),0,'company'); print '
".price($objp->buying_price)."".price($objp->qty)."".price($objp->marge)."".(($marginRate === '')?'n/a':price($marginRate)."%")."".(($markRate === '')?'n/a':price($markRate)."%")."'.$invoicestatic->LibStatut($objp->paye,$objp->statut,5).'
".price($cumul_achat)."".price($cumul_qty)."".price($totalMargin)."".(($marginRate === '')?'n/a':price($marginRate)."%")."".(($markRate === '')?'n/a':price($markRate)."%")." 
'; @@ -109,14 +109,14 @@ if ($socid > 0) print ''; // Margin Rate - if ($conf->global->DISPLAY_MARGIN_RATES) { + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { print ''; } // Mark Rate - if ($conf->global->DISPLAY_MARK_RATES) { + if (! empty($conf->global->DISPLAY_MARK_RATES)) { print ''; @@ -158,9 +158,9 @@ if ($socid > 0) print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buyng_price","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder); - if ($conf->global->DISPLAY_MARGIN_RATES) + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"d.marge_tx","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder); - if ($conf->global->DISPLAY_MARK_RATES) + if (! empty($conf->global->DISPLAY_MARK_RATES)) print_liste_field_titre($langs->trans("MarkRate"),$_SERVER["PHP_SELF"],"d.marque_tx","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.paye,f.fk_statut","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder); print "\n"; @@ -191,9 +191,9 @@ if ($socid > 0) print "\n"; print "\n"; print "\n"; - if ($conf->global->DISPLAY_MARGIN_RATES) + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) print "\n"; - if ($conf->global->DISPLAY_MARK_RATES) + if (! empty($conf->global->DISPLAY_MARK_RATES)) print "\n"; print ''; print "\n"; @@ -213,9 +213,9 @@ if ($socid > 0) print "\n"; print "\n"; print "\n"; - if ($conf->global->DISPLAY_MARGIN_RATES) + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) print "\n"; - if ($conf->global->DISPLAY_MARK_RATES) + if (! empty($conf->global->DISPLAY_MARK_RATES)) print "\n"; print ''; print "\n"; diff --git a/htdocs/product/ajaxproducts.php b/htdocs/product/ajaxproducts.php index 7f209839da5..1e99dcb7a8c 100644 --- a/htdocs/product/ajaxproducts.php +++ b/htdocs/product/ajaxproducts.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2007-2011 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify @@ -60,12 +60,12 @@ if (! isset($_GET['htmlname'])) return; $htmlname = $_GET['htmlname']; $match = preg_grep('/('.$htmlname.'[0-9]+)/',array_keys($_GET)); sort($match); -$idprod = $match[0]; +$idprod = (! empty($match[0]) ? $match[0] : ''); if (! isset($_GET[$htmlname]) && ! isset($_GET[$idprod])) return; // When used from jQuery, the search term is added as GET param "term". -$searchkey=$_GET[$idprod]; +$searchkey=(! empty($_GET[$idprod])?$_GET[$idprod]:''); if (empty($searchkey)) $searchkey=$_GET[$htmlname]; $outjson=isset($_GET['outjson'])?$_GET['outjson']:0; diff --git a/htdocs/theme/amarok/img/commissions.png b/htdocs/theme/amarok/img/commissions.png deleted file mode 100644 index b1e139e3fbad0fd57430b5f2e9e2639a7ef92a8c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1676 zcmV;726Op|P)F!yWy~l%DCIe%H$N?#mv2w8@CGy1*CvwjvNT&;0}HbkuFY?MDBfYyDd3WT&vZ*KWD5?NoP%j7mD34H@p1>-M111D@lCTF+m$=s@?X}TJP@OzV zW*F>QPzLBM{hjsuH|YiO?+z5;@!x(W`=&=3oSgwNK-_JkWQI|KbqK07Hfq>;2h+Cb zHR@RT95U!3TU9_sjLnfYSGaTS7TQ4q=(ixK@sKxQDKlv9`} zm-%q2NZNe#jtqo7L;%9O2k{g#H-|oYhT)+mX?p=x+0H=a1p_|5SLNonw_eY{n`kv| z)miUKvKvi=y+rEVBM}<1>tm)(g08oh0bQY(-^qY&DbE8ORIAly3)u`&y*iyc3`DPB;K#HoUuZRap;gP&vC9)Mvs0_G-6oV0PiA=dv`5X0C?B1sf5O;e zU}$8LBOeseI*+#)5Rd-)OIbKP_Rd=U_x0P@xiYPKg-$0%rjovr$>3!F76Toxy2Asj zwE~)981F@^%gZf}l%GO<4S&O9-3{rbF-9)=aR%O(R;SPY{CSsSiS@=BQofpj}2QO||}$cy{&tmzu8qT2YNDB|Gv$t7}Mq71^z@ zS@T)h@OZirQ)_k+iiv4D=!U~kf0h$-M>#n&NOSEWD~pRfd1m9St*~D4skZ|%xtM%T z-3qN44!yX5leKn^WJ^~*m!&?92n(+Zt{1Vo+MwAAalH^tw?H*fWe5>lirAO# zk4_G9_xs1(nqS3o6wHkEGW2c+{=Z}@Z?yd6T*eU$j*T!nJIJhjUXHl7h`*~G-+uG2 zeY@Ond64o?pR;i1QABB|!1#C{gCmoiI9l52f!&&YcJ=(1s-|92HIuh3M`pg(7 zjyVuST>a*Mh*V`-xg zZ#VJmb2Wo7BGvmjG-T0VvN=BY6OMe)Pd0wC|2$xtCWZV692uj#vP7`4{N@wSHq&J- zgF{7!oDuTz=^^ZV0Spr*ZgTJYyRV-IMD+oRRw6rc8fR>Z#9JU~b?AC^I&s8?Yf@_r zY_X7-G2_QaF_jRT4f2LZt7B1la*ui|q}~o*GB9e9cV3>5uFCnn0d{NInnBf?WQ+xz zA<5*--rDc>K&t~tkP>2aQpKQ)#b!H4BXY=?x@()_k3#U(?f~-@S3UKvwKoiv{IOG{ zUWo7lTJ7jYno7Ef_)eAL#&7;~=f)Oy+jmzK<&zZUVi1JCjW*W`Z(IA9UlxCL{twsP z-KV?XdgZ@i_49I4U&(WUWnTY&beN=rDb>9ml>M)E^9LX#h>q9d6P}IuO9%B WL$*wD{RmJ10000mh diff --git a/htdocs/theme/amarok/img/marges.png b/htdocs/theme/amarok/img/marges.png deleted file mode 100644 index 4746f0fc7798c5e9341eacd320f00214a0cf887f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1851 zcmV-B2gLY^P)oVY zDi`e)Qprs&Pz#8(6$K=q1*av2#Om6P6Mw9|>-Fw>XLfdG4i~!#74@c#InwByIrH&* z&hMRf-Xqwiy?*WbY2YI80+1g}H-MQze|<3b&Y+)p>C9t|?cViSO$-6hg{;Tni4w)E zhiMvE%3!Ur1;9qjrx(RE+CIG~VapHM3PL^sIIp!{&{{X*IG%~4sB!V!shNiYI5b|O z+38}N3d4{%mcq3amiq6xAtknDAOPD`Yy}~0KP2o$)SDfGZjZH%7WIt=%PZBHSAP8B z7ynmF4YMZJnnpY5Qwo6;0wD#iWulaUV=0tj+;_)R64NlSErqKT6P^nQrp8Cu*l6(6 zYj2&{PG=~9l#(#GfiOBGv4g-y8V+%k#V|~wcmye93`1f_iIft$_ zxV1pw``hXa2M`h=TNK7zAOU>3ehZzf5{40eGbV{8f)q-+m{tnUE#TN$(z1jm!Amsr zi>q|Q-Y}Wr0EQF@1QHVfjmB{e0Nj)w+@eU)i+`w^c zlrk`s!f~DZ4lwXQqsixY0UCiqh=INk2r-=G0U?m&atD9|0K}0`6#E3hIzcC-7d1(A z2c;xRDQw$DCju!I5)*+y>(4gf0a+mEHdY9mRgelT6^50QMW@cXwuyZ>BKR$g&x8%F_eXq$&<+z zF&vx8@h<}ctuPjXXtF)n0WXuMn=j$FTck2sW@i@Z^?Fn)70$i%GB^JEHnwf! zrt^F$Utqkt$XE7^vgz0aTBFfODF!LM0|)ZiG~?xCNafH9Vjln6Gx$M3c4VAXCX18K zv%YeN?rM!MWNP?VUk9M!q?r8qt7zR{$j$(SU~P4of8L%YNfJh<9wlk5;&~p&j~>F# zWO?rS3k1EmUy_$s(1|8lui_<|L~GD`P$P_o2hbYaY?0F5n9X_>+fDJ&hYJLLhf1Zw z^WS@!-~Rdc6pKZK=`b;Mg!trfviSl^SZLjcxL2ee8X(aLo+T;m9mP6ykos24Q_ozW zzP?In;x@LM!pjy|S*_CQbTRA{vmd_K7nT;!efNg|7>0pi43&A11Da}emGwIx6NVw9 zQ^)D7%~39w8O_@lwI-N#2Y4#nQW+dk@v1gh{x`SE(N|~5u zvNM3*R)d_a8JQTR-j$sC`qOl}5tH+Cc$pmK@hMu38q14|c-aDT|N2M&Ic;$E!Vmgk zG)=5n50iN?fFE>Oo~sasA-VBsZoc<6*=!cevM@(RdFsipqHK?PD`2zLK^ltIW}UDX zqmzCXn3jn(Tz`9jIPSl|&W=!WvxI&dG)+u5!-2z( zQc5c(_fFHrzMqDcWs&HI{1J6J9dr^?&bjnrn_ebOH;NfQ@;F*+_D(;6n@Te}d6@QQ zo#mw^GKDg?Z(c`hO*a-ieg6As=mQMjdTtL;uW!8bi&uYjx?CzSIX*@%lcqdUWNf5B zoFwc@+w`IY=aG~2qL`zJChCP)wnw{Jr_%{Y1|bkY7=}XuhVB%8^vcijz=^@}7_c8W zz3&r1qay{%r2W%d5;U%%hWJ{>tS`2mWt>2Y{U(Kur$% p(*RM_n{PGhKe=-G(rep2_aA=tCs>aR@GJlT002ovPDHLkV1m{eb36b5 diff --git a/htdocs/theme/amarok/img/object_marges.png b/htdocs/theme/amarok/img/object_margin.png similarity index 100% rename from htdocs/theme/amarok/img/object_marges.png rename to htdocs/theme/amarok/img/object_margin.png diff --git a/htdocs/theme/auguria/img/commissions.png b/htdocs/theme/auguria/img/commissions.png deleted file mode 100644 index b1e139e3fbad0fd57430b5f2e9e2639a7ef92a8c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1676 zcmV;726Op|P)F!yWy~l%DCIe%H$N?#mv2w8@CGy1*CvwjvNT&;0}HbkuFY?MDBfYyDd3WT&vZ*KWD5?NoP%j7mD34H@p1>-M111D@lCTF+m$=s@?X}TJP@OzV zW*F>QPzLBM{hjsuH|YiO?+z5;@!x(W`=&=3oSgwNK-_JkWQI|KbqK07Hfq>;2h+Cb zHR@RT95U!3TU9_sjLnfYSGaTS7TQ4q=(ixK@sKxQDKlv9`} zm-%q2NZNe#jtqo7L;%9O2k{g#H-|oYhT)+mX?p=x+0H=a1p_|5SLNonw_eY{n`kv| z)miUKvKvi=y+rEVBM}<1>tm)(g08oh0bQY(-^qY&DbE8ORIAly3)u`&y*iyc3`DPB;K#HoUuZRap;gP&vC9)Mvs0_G-6oV0PiA=dv`5X0C?B1sf5O;e zU}$8LBOeseI*+#)5Rd-)OIbKP_Rd=U_x0P@xiYPKg-$0%rjovr$>3!F76Toxy2Asj zwE~)981F@^%gZf}l%GO<4S&O9-3{rbF-9)=aR%O(R;SPY{CSsSiS@=BQofpj}2QO||}$cy{&tmzu8qT2YNDB|Gv$t7}Mq71^z@ zS@T)h@OZirQ)_k+iiv4D=!U~kf0h$-M>#n&NOSEWD~pRfd1m9St*~D4skZ|%xtM%T z-3qN44!yX5leKn^WJ^~*m!&?92n(+Zt{1Vo+MwAAalH^tw?H*fWe5>lirAO# zk4_G9_xs1(nqS3o6wHkEGW2c+{=Z}@Z?yd6T*eU$j*T!nJIJhjUXHl7h`*~G-+uG2 zeY@Ond64o?pR;i1QABB|!1#C{gCmoiI9l52f!&&YcJ=(1s-|92HIuh3M`pg(7 zjyVuST>a*Mh*V`-xg zZ#VJmb2Wo7BGvmjG-T0VvN=BY6OMe)Pd0wC|2$xtCWZV692uj#vP7`4{N@wSHq&J- zgF{7!oDuTz=^^ZV0Spr*ZgTJYyRV-IMD+oRRw6rc8fR>Z#9JU~b?AC^I&s8?Yf@_r zY_X7-G2_QaF_jRT4f2LZt7B1la*ui|q}~o*GB9e9cV3>5uFCnn0d{NInnBf?WQ+xz zA<5*--rDc>K&t~tkP>2aQpKQ)#b!H4BXY=?x@()_k3#U(?f~-@S3UKvwKoiv{IOG{ zUWo7lTJ7jYno7Ef_)eAL#&7;~=f)Oy+jmzK<&zZUVi1JCjW*W`Z(IA9UlxCL{twsP z-KV?XdgZ@i_49I4U&(WUWnTY&beN=rDb>9ml>M)E^9LX#h>q9d6P}IuO9%B WL$*wD{RmJ10000mh diff --git a/htdocs/theme/auguria/img/marges.png b/htdocs/theme/auguria/img/marges.png deleted file mode 100644 index 4746f0fc7798c5e9341eacd320f00214a0cf887f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1851 zcmV-B2gLY^P)oVY zDi`e)Qprs&Pz#8(6$K=q1*av2#Om6P6Mw9|>-Fw>XLfdG4i~!#74@c#InwByIrH&* z&hMRf-Xqwiy?*WbY2YI80+1g}H-MQze|<3b&Y+)p>C9t|?cViSO$-6hg{;Tni4w)E zhiMvE%3!Ur1;9qjrx(RE+CIG~VapHM3PL^sIIp!{&{{X*IG%~4sB!V!shNiYI5b|O z+38}N3d4{%mcq3amiq6xAtknDAOPD`Yy}~0KP2o$)SDfGZjZH%7WIt=%PZBHSAP8B z7ynmF4YMZJnnpY5Qwo6;0wD#iWulaUV=0tj+;_)R64NlSErqKT6P^nQrp8Cu*l6(6 zYj2&{PG=~9l#(#GfiOBGv4g-y8V+%k#V|~wcmye93`1f_iIft$_ zxV1pw``hXa2M`h=TNK7zAOU>3ehZzf5{40eGbV{8f)q-+m{tnUE#TN$(z1jm!Amsr zi>q|Q-Y}Wr0EQF@1QHVfjmB{e0Nj)w+@eU)i+`w^c zlrk`s!f~DZ4lwXQqsixY0UCiqh=INk2r-=G0U?m&atD9|0K}0`6#E3hIzcC-7d1(A z2c;xRDQw$DCju!I5)*+y>(4gf0a+mEHdY9mRgelT6^50QMW@cXwuyZ>BKR$g&x8%F_eXq$&<+z zF&vx8@h<}ctuPjXXtF)n0WXuMn=j$FTck2sW@i@Z^?Fn)70$i%GB^JEHnwf! zrt^F$Utqkt$XE7^vgz0aTBFfODF!LM0|)ZiG~?xCNafH9Vjln6Gx$M3c4VAXCX18K zv%YeN?rM!MWNP?VUk9M!q?r8qt7zR{$j$(SU~P4of8L%YNfJh<9wlk5;&~p&j~>F# zWO?rS3k1EmUy_$s(1|8lui_<|L~GD`P$P_o2hbYaY?0F5n9X_>+fDJ&hYJLLhf1Zw z^WS@!-~Rdc6pKZK=`b;Mg!trfviSl^SZLjcxL2ee8X(aLo+T;m9mP6ykos24Q_ozW zzP?In;x@LM!pjy|S*_CQbTRA{vmd_K7nT;!efNg|7>0pi43&A11Da}emGwIx6NVw9 zQ^)D7%~39w8O_@lwI-N#2Y4#nQW+dk@v1gh{x`SE(N|~5u zvNM3*R)d_a8JQTR-j$sC`qOl}5tH+Cc$pmK@hMu38q14|c-aDT|N2M&Ic;$E!Vmgk zG)=5n50iN?fFE>Oo~sasA-VBsZoc<6*=!cevM@(RdFsipqHK?PD`2zLK^ltIW}UDX zqmzCXn3jn(Tz`9jIPSl|&W=!WvxI&dG)+u5!-2z( zQc5c(_fFHrzMqDcWs&HI{1J6J9dr^?&bjnrn_ebOH;NfQ@;F*+_D(;6n@Te}d6@QQ zo#mw^GKDg?Z(c`hO*a-ieg6As=mQMjdTtL;uW!8bi&uYjx?CzSIX*@%lcqdUWNf5B zoFwc@+w`IY=aG~2qL`zJChCP)wnw{Jr_%{Y1|bkY7=}XuhVB%8^vcijz=^@}7_c8W zz3&r1qay{%r2W%d5;U%%hWJ{>tS`2mWt>2Y{U(Kur$% p(*RM_n{PGhKe=-G(rep2_aA=tCs>aR@GJlT002ovPDHLkV1m{eb36b5 diff --git a/htdocs/theme/auguria/img/object_marges.png b/htdocs/theme/auguria/img/object_margin.png similarity index 100% rename from htdocs/theme/auguria/img/object_marges.png rename to htdocs/theme/auguria/img/object_margin.png diff --git a/htdocs/theme/auguria/style.css.php b/htdocs/theme/auguria/style.css.php index 40d0578c68e..b7340ef3e2b 100644 --- a/htdocs/theme/auguria/style.css.php +++ b/htdocs/theme/auguria/style.css.php @@ -320,7 +320,7 @@ $moduletomainmenu=array('user'=>'','syslog'=>'','societe'=>'companies','projet'= 'barcode'=>'','fckeditor'=>'','categorie'=>'', ); $mainmenuused='home'; -foreach($conf->modules as $key => $val) +foreach($conf->modules as $val) { $mainmenuused.=','.(isset($moduletomainmenu[$val])?$moduletomainmenu[$val]:$val); } @@ -331,7 +331,7 @@ $mainmenuusedarray=array(); // Disable $generic=1; $divalreadydefined=array('home','companies','products','commercial','accountancy','project','tools','members','shop','agenda','ecm','cashdesk'); -foreach($mainmenuusedarray as $key => $val) +foreach($mainmenuusedarray as $val) { if (empty($val) || in_array($val,$divalreadydefined)) continue; //print "XXX".$val; diff --git a/htdocs/theme/bureau2crea/img/commissions.png b/htdocs/theme/bureau2crea/img/commissions.png deleted file mode 100644 index b1e139e3fbad0fd57430b5f2e9e2639a7ef92a8c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1676 zcmV;726Op|P)F!yWy~l%DCIe%H$N?#mv2w8@CGy1*CvwjvNT&;0}HbkuFY?MDBfYyDd3WT&vZ*KWD5?NoP%j7mD34H@p1>-M111D@lCTF+m$=s@?X}TJP@OzV zW*F>QPzLBM{hjsuH|YiO?+z5;@!x(W`=&=3oSgwNK-_JkWQI|KbqK07Hfq>;2h+Cb zHR@RT95U!3TU9_sjLnfYSGaTS7TQ4q=(ixK@sKxQDKlv9`} zm-%q2NZNe#jtqo7L;%9O2k{g#H-|oYhT)+mX?p=x+0H=a1p_|5SLNonw_eY{n`kv| z)miUKvKvi=y+rEVBM}<1>tm)(g08oh0bQY(-^qY&DbE8ORIAly3)u`&y*iyc3`DPB;K#HoUuZRap;gP&vC9)Mvs0_G-6oV0PiA=dv`5X0C?B1sf5O;e zU}$8LBOeseI*+#)5Rd-)OIbKP_Rd=U_x0P@xiYPKg-$0%rjovr$>3!F76Toxy2Asj zwE~)981F@^%gZf}l%GO<4S&O9-3{rbF-9)=aR%O(R;SPY{CSsSiS@=BQofpj}2QO||}$cy{&tmzu8qT2YNDB|Gv$t7}Mq71^z@ zS@T)h@OZirQ)_k+iiv4D=!U~kf0h$-M>#n&NOSEWD~pRfd1m9St*~D4skZ|%xtM%T z-3qN44!yX5leKn^WJ^~*m!&?92n(+Zt{1Vo+MwAAalH^tw?H*fWe5>lirAO# zk4_G9_xs1(nqS3o6wHkEGW2c+{=Z}@Z?yd6T*eU$j*T!nJIJhjUXHl7h`*~G-+uG2 zeY@Ond64o?pR;i1QABB|!1#C{gCmoiI9l52f!&&YcJ=(1s-|92HIuh3M`pg(7 zjyVuST>a*Mh*V`-xg zZ#VJmb2Wo7BGvmjG-T0VvN=BY6OMe)Pd0wC|2$xtCWZV692uj#vP7`4{N@wSHq&J- zgF{7!oDuTz=^^ZV0Spr*ZgTJYyRV-IMD+oRRw6rc8fR>Z#9JU~b?AC^I&s8?Yf@_r zY_X7-G2_QaF_jRT4f2LZt7B1la*ui|q}~o*GB9e9cV3>5uFCnn0d{NInnBf?WQ+xz zA<5*--rDc>K&t~tkP>2aQpKQ)#b!H4BXY=?x@()_k3#U(?f~-@S3UKvwKoiv{IOG{ zUWo7lTJ7jYno7Ef_)eAL#&7;~=f)Oy+jmzK<&zZUVi1JCjW*W`Z(IA9UlxCL{twsP z-KV?XdgZ@i_49I4U&(WUWnTY&beN=rDb>9ml>M)E^9LX#h>q9d6P}IuO9%B WL$*wD{RmJ10000mh diff --git a/htdocs/theme/bureau2crea/img/marges.png b/htdocs/theme/bureau2crea/img/marges.png deleted file mode 100644 index 4746f0fc7798c5e9341eacd320f00214a0cf887f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1851 zcmV-B2gLY^P)oVY zDi`e)Qprs&Pz#8(6$K=q1*av2#Om6P6Mw9|>-Fw>XLfdG4i~!#74@c#InwByIrH&* z&hMRf-Xqwiy?*WbY2YI80+1g}H-MQze|<3b&Y+)p>C9t|?cViSO$-6hg{;Tni4w)E zhiMvE%3!Ur1;9qjrx(RE+CIG~VapHM3PL^sIIp!{&{{X*IG%~4sB!V!shNiYI5b|O z+38}N3d4{%mcq3amiq6xAtknDAOPD`Yy}~0KP2o$)SDfGZjZH%7WIt=%PZBHSAP8B z7ynmF4YMZJnnpY5Qwo6;0wD#iWulaUV=0tj+;_)R64NlSErqKT6P^nQrp8Cu*l6(6 zYj2&{PG=~9l#(#GfiOBGv4g-y8V+%k#V|~wcmye93`1f_iIft$_ zxV1pw``hXa2M`h=TNK7zAOU>3ehZzf5{40eGbV{8f)q-+m{tnUE#TN$(z1jm!Amsr zi>q|Q-Y}Wr0EQF@1QHVfjmB{e0Nj)w+@eU)i+`w^c zlrk`s!f~DZ4lwXQqsixY0UCiqh=INk2r-=G0U?m&atD9|0K}0`6#E3hIzcC-7d1(A z2c;xRDQw$DCju!I5)*+y>(4gf0a+mEHdY9mRgelT6^50QMW@cXwuyZ>BKR$g&x8%F_eXq$&<+z zF&vx8@h<}ctuPjXXtF)n0WXuMn=j$FTck2sW@i@Z^?Fn)70$i%GB^JEHnwf! zrt^F$Utqkt$XE7^vgz0aTBFfODF!LM0|)ZiG~?xCNafH9Vjln6Gx$M3c4VAXCX18K zv%YeN?rM!MWNP?VUk9M!q?r8qt7zR{$j$(SU~P4of8L%YNfJh<9wlk5;&~p&j~>F# zWO?rS3k1EmUy_$s(1|8lui_<|L~GD`P$P_o2hbYaY?0F5n9X_>+fDJ&hYJLLhf1Zw z^WS@!-~Rdc6pKZK=`b;Mg!trfviSl^SZLjcxL2ee8X(aLo+T;m9mP6ykos24Q_ozW zzP?In;x@LM!pjy|S*_CQbTRA{vmd_K7nT;!efNg|7>0pi43&A11Da}emGwIx6NVw9 zQ^)D7%~39w8O_@lwI-N#2Y4#nQW+dk@v1gh{x`SE(N|~5u zvNM3*R)d_a8JQTR-j$sC`qOl}5tH+Cc$pmK@hMu38q14|c-aDT|N2M&Ic;$E!Vmgk zG)=5n50iN?fFE>Oo~sasA-VBsZoc<6*=!cevM@(RdFsipqHK?PD`2zLK^ltIW}UDX zqmzCXn3jn(Tz`9jIPSl|&W=!WvxI&dG)+u5!-2z( zQc5c(_fFHrzMqDcWs&HI{1J6J9dr^?&bjnrn_ebOH;NfQ@;F*+_D(;6n@Te}d6@QQ zo#mw^GKDg?Z(c`hO*a-ieg6As=mQMjdTtL;uW!8bi&uYjx?CzSIX*@%lcqdUWNf5B zoFwc@+w`IY=aG~2qL`zJChCP)wnw{Jr_%{Y1|bkY7=}XuhVB%8^vcijz=^@}7_c8W zz3&r1qay{%r2W%d5;U%%hWJ{>tS`2mWt>2Y{U(Kur$% p(*RM_n{PGhKe=-G(rep2_aA=tCs>aR@GJlT002ovPDHLkV1m{eb36b5 diff --git a/htdocs/theme/bureau2crea/img/object_marges.png b/htdocs/theme/bureau2crea/img/object_margin.png similarity index 100% rename from htdocs/theme/bureau2crea/img/object_marges.png rename to htdocs/theme/bureau2crea/img/object_margin.png diff --git a/htdocs/theme/bureau2crea/style.css.php b/htdocs/theme/bureau2crea/style.css.php index 6183a246a83..d8ab2f33920 100644 --- a/htdocs/theme/bureau2crea/style.css.php +++ b/htdocs/theme/bureau2crea/style.css.php @@ -383,7 +383,7 @@ $moduletomainmenu=array('user'=>'','syslog'=>'','societe'=>'companies','projet'= 'barcode'=>'','fckeditor'=>'','categorie'=>'', ); $mainmenuused='home'; -foreach($conf->modules as $key => $val) +foreach($conf->modules as $val) { $mainmenuused.=','.(isset($moduletomainmenu[$val])?$moduletomainmenu[$val]:$val); } @@ -394,7 +394,7 @@ $mainmenuusedarray=array(); // Disable $generic=1; $divalreadydefined=array('home','companies','products','commercial','accountancy','project','tools','members','shop','agenda','ecm','cashdesk'); -foreach($mainmenuusedarray as $key => $val) +foreach($mainmenuusedarray as $val) { if (empty($val) || in_array($val,$divalreadydefined)) continue; //print "XXX".$val; diff --git a/htdocs/theme/cameleo/img/commissions.png b/htdocs/theme/cameleo/img/commissions.png deleted file mode 100644 index b1e139e3fbad0fd57430b5f2e9e2639a7ef92a8c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1676 zcmV;726Op|P)F!yWy~l%DCIe%H$N?#mv2w8@CGy1*CvwjvNT&;0}HbkuFY?MDBfYyDd3WT&vZ*KWD5?NoP%j7mD34H@p1>-M111D@lCTF+m$=s@?X}TJP@OzV zW*F>QPzLBM{hjsuH|YiO?+z5;@!x(W`=&=3oSgwNK-_JkWQI|KbqK07Hfq>;2h+Cb zHR@RT95U!3TU9_sjLnfYSGaTS7TQ4q=(ixK@sKxQDKlv9`} zm-%q2NZNe#jtqo7L;%9O2k{g#H-|oYhT)+mX?p=x+0H=a1p_|5SLNonw_eY{n`kv| z)miUKvKvi=y+rEVBM}<1>tm)(g08oh0bQY(-^qY&DbE8ORIAly3)u`&y*iyc3`DPB;K#HoUuZRap;gP&vC9)Mvs0_G-6oV0PiA=dv`5X0C?B1sf5O;e zU}$8LBOeseI*+#)5Rd-)OIbKP_Rd=U_x0P@xiYPKg-$0%rjovr$>3!F76Toxy2Asj zwE~)981F@^%gZf}l%GO<4S&O9-3{rbF-9)=aR%O(R;SPY{CSsSiS@=BQofpj}2QO||}$cy{&tmzu8qT2YNDB|Gv$t7}Mq71^z@ zS@T)h@OZirQ)_k+iiv4D=!U~kf0h$-M>#n&NOSEWD~pRfd1m9St*~D4skZ|%xtM%T z-3qN44!yX5leKn^WJ^~*m!&?92n(+Zt{1Vo+MwAAalH^tw?H*fWe5>lirAO# zk4_G9_xs1(nqS3o6wHkEGW2c+{=Z}@Z?yd6T*eU$j*T!nJIJhjUXHl7h`*~G-+uG2 zeY@Ond64o?pR;i1QABB|!1#C{gCmoiI9l52f!&&YcJ=(1s-|92HIuh3M`pg(7 zjyVuST>a*Mh*V`-xg zZ#VJmb2Wo7BGvmjG-T0VvN=BY6OMe)Pd0wC|2$xtCWZV692uj#vP7`4{N@wSHq&J- zgF{7!oDuTz=^^ZV0Spr*ZgTJYyRV-IMD+oRRw6rc8fR>Z#9JU~b?AC^I&s8?Yf@_r zY_X7-G2_QaF_jRT4f2LZt7B1la*ui|q}~o*GB9e9cV3>5uFCnn0d{NInnBf?WQ+xz zA<5*--rDc>K&t~tkP>2aQpKQ)#b!H4BXY=?x@()_k3#U(?f~-@S3UKvwKoiv{IOG{ zUWo7lTJ7jYno7Ef_)eAL#&7;~=f)Oy+jmzK<&zZUVi1JCjW*W`Z(IA9UlxCL{twsP z-KV?XdgZ@i_49I4U&(WUWnTY&beN=rDb>9ml>M)E^9LX#h>q9d6P}IuO9%B WL$*wD{RmJ10000mh diff --git a/htdocs/theme/cameleo/img/marges.png b/htdocs/theme/cameleo/img/marges.png deleted file mode 100644 index 4746f0fc7798c5e9341eacd320f00214a0cf887f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1851 zcmV-B2gLY^P)oVY zDi`e)Qprs&Pz#8(6$K=q1*av2#Om6P6Mw9|>-Fw>XLfdG4i~!#74@c#InwByIrH&* z&hMRf-Xqwiy?*WbY2YI80+1g}H-MQze|<3b&Y+)p>C9t|?cViSO$-6hg{;Tni4w)E zhiMvE%3!Ur1;9qjrx(RE+CIG~VapHM3PL^sIIp!{&{{X*IG%~4sB!V!shNiYI5b|O z+38}N3d4{%mcq3amiq6xAtknDAOPD`Yy}~0KP2o$)SDfGZjZH%7WIt=%PZBHSAP8B z7ynmF4YMZJnnpY5Qwo6;0wD#iWulaUV=0tj+;_)R64NlSErqKT6P^nQrp8Cu*l6(6 zYj2&{PG=~9l#(#GfiOBGv4g-y8V+%k#V|~wcmye93`1f_iIft$_ zxV1pw``hXa2M`h=TNK7zAOU>3ehZzf5{40eGbV{8f)q-+m{tnUE#TN$(z1jm!Amsr zi>q|Q-Y}Wr0EQF@1QHVfjmB{e0Nj)w+@eU)i+`w^c zlrk`s!f~DZ4lwXQqsixY0UCiqh=INk2r-=G0U?m&atD9|0K}0`6#E3hIzcC-7d1(A z2c;xRDQw$DCju!I5)*+y>(4gf0a+mEHdY9mRgelT6^50QMW@cXwuyZ>BKR$g&x8%F_eXq$&<+z zF&vx8@h<}ctuPjXXtF)n0WXuMn=j$FTck2sW@i@Z^?Fn)70$i%GB^JEHnwf! zrt^F$Utqkt$XE7^vgz0aTBFfODF!LM0|)ZiG~?xCNafH9Vjln6Gx$M3c4VAXCX18K zv%YeN?rM!MWNP?VUk9M!q?r8qt7zR{$j$(SU~P4of8L%YNfJh<9wlk5;&~p&j~>F# zWO?rS3k1EmUy_$s(1|8lui_<|L~GD`P$P_o2hbYaY?0F5n9X_>+fDJ&hYJLLhf1Zw z^WS@!-~Rdc6pKZK=`b;Mg!trfviSl^SZLjcxL2ee8X(aLo+T;m9mP6ykos24Q_ozW zzP?In;x@LM!pjy|S*_CQbTRA{vmd_K7nT;!efNg|7>0pi43&A11Da}emGwIx6NVw9 zQ^)D7%~39w8O_@lwI-N#2Y4#nQW+dk@v1gh{x`SE(N|~5u zvNM3*R)d_a8JQTR-j$sC`qOl}5tH+Cc$pmK@hMu38q14|c-aDT|N2M&Ic;$E!Vmgk zG)=5n50iN?fFE>Oo~sasA-VBsZoc<6*=!cevM@(RdFsipqHK?PD`2zLK^ltIW}UDX zqmzCXn3jn(Tz`9jIPSl|&W=!WvxI&dG)+u5!-2z( zQc5c(_fFHrzMqDcWs&HI{1J6J9dr^?&bjnrn_ebOH;NfQ@;F*+_D(;6n@Te}d6@QQ zo#mw^GKDg?Z(c`hO*a-ieg6As=mQMjdTtL;uW!8bi&uYjx?CzSIX*@%lcqdUWNf5B zoFwc@+w`IY=aG~2qL`zJChCP)wnw{Jr_%{Y1|bkY7=}XuhVB%8^vcijz=^@}7_c8W zz3&r1qay{%r2W%d5;U%%hWJ{>tS`2mWt>2Y{U(Kur$% p(*RM_n{PGhKe=-G(rep2_aA=tCs>aR@GJlT002ovPDHLkV1m{eb36b5 diff --git a/htdocs/theme/cameleo/img/object_marges.png b/htdocs/theme/cameleo/img/object_margin.png similarity index 100% rename from htdocs/theme/cameleo/img/object_marges.png rename to htdocs/theme/cameleo/img/object_margin.png diff --git a/htdocs/theme/cameleo/style.css.php b/htdocs/theme/cameleo/style.css.php index a63f1e04636..78121b403c0 100644 --- a/htdocs/theme/cameleo/style.css.php +++ b/htdocs/theme/cameleo/style.css.php @@ -467,7 +467,7 @@ $moduletomainmenu=array('user'=>'','syslog'=>'','societe'=>'companies','projet'= 'barcode'=>'','fckeditor'=>'','categorie'=>'', ); $mainmenuused='home'; -foreach($conf->modules as $key => $val) +foreach($conf->modules as $val) { $mainmenuused.=','.(isset($moduletomainmenu[$val])?$moduletomainmenu[$val]:$val); } @@ -476,7 +476,7 @@ $mainmenuusedarray=array_unique(explode(',',$mainmenuused)); $generic=1; $divalreadydefined=array('home','companies','products','commercial','accountancy','project','tools','members','shop','agenda','ecm','bookmark','cashdesk','geoipmaxmind','gravatar','clicktodial','paypal','webservices'); -foreach($mainmenuusedarray as $key => $val) +foreach($mainmenuusedarray as $val) { if (empty($val) || in_array($val,$divalreadydefined)) continue; //print "XXX".$val; diff --git a/htdocs/theme/eldy/img/commissions.png b/htdocs/theme/eldy/img/commissions.png deleted file mode 100644 index b1e139e3fbad0fd57430b5f2e9e2639a7ef92a8c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1676 zcmV;726Op|P)F!yWy~l%DCIe%H$N?#mv2w8@CGy1*CvwjvNT&;0}HbkuFY?MDBfYyDd3WT&vZ*KWD5?NoP%j7mD34H@p1>-M111D@lCTF+m$=s@?X}TJP@OzV zW*F>QPzLBM{hjsuH|YiO?+z5;@!x(W`=&=3oSgwNK-_JkWQI|KbqK07Hfq>;2h+Cb zHR@RT95U!3TU9_sjLnfYSGaTS7TQ4q=(ixK@sKxQDKlv9`} zm-%q2NZNe#jtqo7L;%9O2k{g#H-|oYhT)+mX?p=x+0H=a1p_|5SLNonw_eY{n`kv| z)miUKvKvi=y+rEVBM}<1>tm)(g08oh0bQY(-^qY&DbE8ORIAly3)u`&y*iyc3`DPB;K#HoUuZRap;gP&vC9)Mvs0_G-6oV0PiA=dv`5X0C?B1sf5O;e zU}$8LBOeseI*+#)5Rd-)OIbKP_Rd=U_x0P@xiYPKg-$0%rjovr$>3!F76Toxy2Asj zwE~)981F@^%gZf}l%GO<4S&O9-3{rbF-9)=aR%O(R;SPY{CSsSiS@=BQofpj}2QO||}$cy{&tmzu8qT2YNDB|Gv$t7}Mq71^z@ zS@T)h@OZirQ)_k+iiv4D=!U~kf0h$-M>#n&NOSEWD~pRfd1m9St*~D4skZ|%xtM%T z-3qN44!yX5leKn^WJ^~*m!&?92n(+Zt{1Vo+MwAAalH^tw?H*fWe5>lirAO# zk4_G9_xs1(nqS3o6wHkEGW2c+{=Z}@Z?yd6T*eU$j*T!nJIJhjUXHl7h`*~G-+uG2 zeY@Ond64o?pR;i1QABB|!1#C{gCmoiI9l52f!&&YcJ=(1s-|92HIuh3M`pg(7 zjyVuST>a*Mh*V`-xg zZ#VJmb2Wo7BGvmjG-T0VvN=BY6OMe)Pd0wC|2$xtCWZV692uj#vP7`4{N@wSHq&J- zgF{7!oDuTz=^^ZV0Spr*ZgTJYyRV-IMD+oRRw6rc8fR>Z#9JU~b?AC^I&s8?Yf@_r zY_X7-G2_QaF_jRT4f2LZt7B1la*ui|q}~o*GB9e9cV3>5uFCnn0d{NInnBf?WQ+xz zA<5*--rDc>K&t~tkP>2aQpKQ)#b!H4BXY=?x@()_k3#U(?f~-@S3UKvwKoiv{IOG{ zUWo7lTJ7jYno7Ef_)eAL#&7;~=f)Oy+jmzK<&zZUVi1JCjW*W`Z(IA9UlxCL{twsP z-KV?XdgZ@i_49I4U&(WUWnTY&beN=rDb>9ml>M)E^9LX#h>q9d6P}IuO9%B WL$*wD{RmJ10000mh diff --git a/htdocs/theme/eldy/img/marges.png b/htdocs/theme/eldy/img/marges.png deleted file mode 100644 index 4746f0fc7798c5e9341eacd320f00214a0cf887f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1851 zcmV-B2gLY^P)oVY zDi`e)Qprs&Pz#8(6$K=q1*av2#Om6P6Mw9|>-Fw>XLfdG4i~!#74@c#InwByIrH&* z&hMRf-Xqwiy?*WbY2YI80+1g}H-MQze|<3b&Y+)p>C9t|?cViSO$-6hg{;Tni4w)E zhiMvE%3!Ur1;9qjrx(RE+CIG~VapHM3PL^sIIp!{&{{X*IG%~4sB!V!shNiYI5b|O z+38}N3d4{%mcq3amiq6xAtknDAOPD`Yy}~0KP2o$)SDfGZjZH%7WIt=%PZBHSAP8B z7ynmF4YMZJnnpY5Qwo6;0wD#iWulaUV=0tj+;_)R64NlSErqKT6P^nQrp8Cu*l6(6 zYj2&{PG=~9l#(#GfiOBGv4g-y8V+%k#V|~wcmye93`1f_iIft$_ zxV1pw``hXa2M`h=TNK7zAOU>3ehZzf5{40eGbV{8f)q-+m{tnUE#TN$(z1jm!Amsr zi>q|Q-Y}Wr0EQF@1QHVfjmB{e0Nj)w+@eU)i+`w^c zlrk`s!f~DZ4lwXQqsixY0UCiqh=INk2r-=G0U?m&atD9|0K}0`6#E3hIzcC-7d1(A z2c;xRDQw$DCju!I5)*+y>(4gf0a+mEHdY9mRgelT6^50QMW@cXwuyZ>BKR$g&x8%F_eXq$&<+z zF&vx8@h<}ctuPjXXtF)n0WXuMn=j$FTck2sW@i@Z^?Fn)70$i%GB^JEHnwf! zrt^F$Utqkt$XE7^vgz0aTBFfODF!LM0|)ZiG~?xCNafH9Vjln6Gx$M3c4VAXCX18K zv%YeN?rM!MWNP?VUk9M!q?r8qt7zR{$j$(SU~P4of8L%YNfJh<9wlk5;&~p&j~>F# zWO?rS3k1EmUy_$s(1|8lui_<|L~GD`P$P_o2hbYaY?0F5n9X_>+fDJ&hYJLLhf1Zw z^WS@!-~Rdc6pKZK=`b;Mg!trfviSl^SZLjcxL2ee8X(aLo+T;m9mP6ykos24Q_ozW zzP?In;x@LM!pjy|S*_CQbTRA{vmd_K7nT;!efNg|7>0pi43&A11Da}emGwIx6NVw9 zQ^)D7%~39w8O_@lwI-N#2Y4#nQW+dk@v1gh{x`SE(N|~5u zvNM3*R)d_a8JQTR-j$sC`qOl}5tH+Cc$pmK@hMu38q14|c-aDT|N2M&Ic;$E!Vmgk zG)=5n50iN?fFE>Oo~sasA-VBsZoc<6*=!cevM@(RdFsipqHK?PD`2zLK^ltIW}UDX zqmzCXn3jn(Tz`9jIPSl|&W=!WvxI&dG)+u5!-2z( zQc5c(_fFHrzMqDcWs&HI{1J6J9dr^?&bjnrn_ebOH;NfQ@;F*+_D(;6n@Te}d6@QQ zo#mw^GKDg?Z(c`hO*a-ieg6As=mQMjdTtL;uW!8bi&uYjx?CzSIX*@%lcqdUWNf5B zoFwc@+w`IY=aG~2qL`zJChCP)wnw{Jr_%{Y1|bkY7=}XuhVB%8^vcijz=^@}7_c8W zz3&r1qay{%r2W%d5;U%%hWJ{>tS`2mWt>2Y{U(Kur$% p(*RM_n{PGhKe=-G(rep2_aA=tCs>aR@GJlT002ovPDHLkV1m{eb36b5 diff --git a/htdocs/theme/eldy/img/menus/marges.png b/htdocs/theme/eldy/img/menus/marges.png deleted file mode 100644 index 4746f0fc7798c5e9341eacd320f00214a0cf887f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1851 zcmV-B2gLY^P)oVY zDi`e)Qprs&Pz#8(6$K=q1*av2#Om6P6Mw9|>-Fw>XLfdG4i~!#74@c#InwByIrH&* z&hMRf-Xqwiy?*WbY2YI80+1g}H-MQze|<3b&Y+)p>C9t|?cViSO$-6hg{;Tni4w)E zhiMvE%3!Ur1;9qjrx(RE+CIG~VapHM3PL^sIIp!{&{{X*IG%~4sB!V!shNiYI5b|O z+38}N3d4{%mcq3amiq6xAtknDAOPD`Yy}~0KP2o$)SDfGZjZH%7WIt=%PZBHSAP8B z7ynmF4YMZJnnpY5Qwo6;0wD#iWulaUV=0tj+;_)R64NlSErqKT6P^nQrp8Cu*l6(6 zYj2&{PG=~9l#(#GfiOBGv4g-y8V+%k#V|~wcmye93`1f_iIft$_ zxV1pw``hXa2M`h=TNK7zAOU>3ehZzf5{40eGbV{8f)q-+m{tnUE#TN$(z1jm!Amsr zi>q|Q-Y}Wr0EQF@1QHVfjmB{e0Nj)w+@eU)i+`w^c zlrk`s!f~DZ4lwXQqsixY0UCiqh=INk2r-=G0U?m&atD9|0K}0`6#E3hIzcC-7d1(A z2c;xRDQw$DCju!I5)*+y>(4gf0a+mEHdY9mRgelT6^50QMW@cXwuyZ>BKR$g&x8%F_eXq$&<+z zF&vx8@h<}ctuPjXXtF)n0WXuMn=j$FTck2sW@i@Z^?Fn)70$i%GB^JEHnwf! zrt^F$Utqkt$XE7^vgz0aTBFfODF!LM0|)ZiG~?xCNafH9Vjln6Gx$M3c4VAXCX18K zv%YeN?rM!MWNP?VUk9M!q?r8qt7zR{$j$(SU~P4of8L%YNfJh<9wlk5;&~p&j~>F# zWO?rS3k1EmUy_$s(1|8lui_<|L~GD`P$P_o2hbYaY?0F5n9X_>+fDJ&hYJLLhf1Zw z^WS@!-~Rdc6pKZK=`b;Mg!trfviSl^SZLjcxL2ee8X(aLo+T;m9mP6ykos24Q_ozW zzP?In;x@LM!pjy|S*_CQbTRA{vmd_K7nT;!efNg|7>0pi43&A11Da}emGwIx6NVw9 zQ^)D7%~39w8O_@lwI-N#2Y4#nQW+dk@v1gh{x`SE(N|~5u zvNM3*R)d_a8JQTR-j$sC`qOl}5tH+Cc$pmK@hMu38q14|c-aDT|N2M&Ic;$E!Vmgk zG)=5n50iN?fFE>Oo~sasA-VBsZoc<6*=!cevM@(RdFsipqHK?PD`2zLK^ltIW}UDX zqmzCXn3jn(Tz`9jIPSl|&W=!WvxI&dG)+u5!-2z( zQc5c(_fFHrzMqDcWs&HI{1J6J9dr^?&bjnrn_ebOH;NfQ@;F*+_D(;6n@Te}d6@QQ zo#mw^GKDg?Z(c`hO*a-ieg6As=mQMjdTtL;uW!8bi&uYjx?CzSIX*@%lcqdUWNf5B zoFwc@+w`IY=aG~2qL`zJChCP)wnw{Jr_%{Y1|bkY7=}XuhVB%8^vcijz=^@}7_c8W zz3&r1qay{%r2W%d5;U%%hWJ{>tS`2mWt>2Y{U(Kur$% p(*RM_n{PGhKe=-G(rep2_aA=tCs>aR@GJlT002ovPDHLkV1m{eb36b5 diff --git a/htdocs/theme/eldy/img/object_marges.png b/htdocs/theme/eldy/img/object_margin.png similarity index 100% rename from htdocs/theme/eldy/img/object_marges.png rename to htdocs/theme/eldy/img/object_margin.png diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 326da714425..b8470e3c090 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -628,7 +628,7 @@ $moduletomainmenu=array('user'=>'','syslog'=>'','societe'=>'companies','projet'= 'barcode'=>'','fckeditor'=>'','categorie'=>'', ); $mainmenuused='home'; -foreach($conf->modules as $key => $val) +foreach($conf->modules as $val) { $mainmenuused.=','.(isset($moduletomainmenu[$val])?$moduletomainmenu[$val]:$val); } @@ -637,7 +637,7 @@ $mainmenuusedarray=array_unique(explode(',',$mainmenuused)); $generic=1; $divalreadydefined=array('home','companies','products','commercial','accountancy','project','tools','members','shop','agenda','bookmark','cashdesk','ecm','geoipmaxmind','gravatar','clicktodial','paypal','webservices'); -foreach($mainmenuusedarray as $key => $val) +foreach($mainmenuusedarray as $val) { if (empty($val) || in_array($val,$divalreadydefined)) continue; //print "XXX".$val; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index fe6650d4203..a78b4a91f55 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -531,7 +531,7 @@ class User extends CommonObject if ($perms) { - if (! isset($this->rights)) $this->rights = (object) array(); // For avoid error + if (! isset($this->rights) || ! is_object($this->rights)) $this->rights = (object) array(); // For avoid error if (! isset($this->rights->$module) || ! is_object($this->rights->$module)) $this->rights->$module = (object) array(); if ($subperms) { @@ -578,7 +578,7 @@ class User extends CommonObject if ($perms) { - if (! isset($this->rights)) $this->rights = (object) array(); // For avoid error + if (! isset($this->rights) || ! is_object($this->rights)) $this->rights = (object) array(); // For avoid error if (! isset($this->rights->$module) || ! is_object($this->rights->$module)) $this->rights->$module = (object) array(); if ($subperms) { diff --git a/htdocs/webservices/server_invoice.php b/htdocs/webservices/server_invoice.php index 9e67019dacc..1cc04f3c1a7 100755 --- a/htdocs/webservices/server_invoice.php +++ b/htdocs/webservices/server_invoice.php @@ -34,7 +34,7 @@ require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"); dol_syslog("Call Dolibarr webservices interfaces"); -$langs->load("main"); +$langs->load("main"); // Enable and test if module web services is enabled if (empty($conf->global->MAIN_MODULE_WEBSERVICES)) From 9cf088560ff16beb1ba7ff81e242b43e594804a7 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 23 Jul 2012 16:47:16 +0200 Subject: [PATCH 02/17] Fix: syntax error --- htdocs/install/mysql/migration/3.2.0-3.3.0.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/install/mysql/migration/3.2.0-3.3.0.sql b/htdocs/install/mysql/migration/3.2.0-3.3.0.sql index 537daf185a4..ec653e6d58a 100755 --- a/htdocs/install/mysql/migration/3.2.0-3.3.0.sql +++ b/htdocs/install/mysql/migration/3.2.0-3.3.0.sql @@ -58,7 +58,7 @@ alter table llx_propaldet drop column pa_ht; alter table llx_propaldet drop column marge_tx; alter table llx_propaldet drop column marque_tx; -ALTER TABLE llx_commande CHANGE fk_demand_reason fk_input_reason INT(11) NULL DEFAULT NULL -ALTER TABLE llx_propal CHANGE fk_demand_reason fk_input_reason INT(11) NULL DEFAULT NULL -ALTER TABLE llx_commande_fournisseur CHANGE fk_methode_commande fk_input_method INT(11) NULL DEFAULT '0' +ALTER TABLE llx_commande CHANGE fk_demand_reason fk_input_reason INT(11) NULL DEFAULT NULL; +ALTER TABLE llx_propal CHANGE fk_demand_reason fk_input_reason INT(11) NULL DEFAULT NULL; +ALTER TABLE llx_commande_fournisseur CHANGE fk_methode_commande fk_input_method INT(11) NULL DEFAULT '0'; From d5ff308992660beb641de870866316767fda838e Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 23 Jul 2012 20:52:55 +0200 Subject: [PATCH 03/17] Fix: declare $mesg and $mesgs in main.inc.php Fix: strict mode be back --- htdocs/adherents/document.php | 9 +--- htdocs/comm/mailing/fiche.php | 9 +--- htdocs/comm/propal.php | 39 +++++++------- htdocs/comm/propal/document.php | 61 ++++++++++----------- htdocs/commande/document.php | 13 ++--- htdocs/commande/fiche.php | 19 ++++--- htdocs/compta/facture/document.php | 9 +--- htdocs/contrat/document.php | 13 ++--- htdocs/core/class/commonobject.class.php | 52 +++++++++--------- htdocs/expedition/shipment.php | 69 +++++++++++------------- htdocs/fichinter/document.php | 13 ++--- htdocs/fourn/commande/document.php | 10 +--- htdocs/main.inc.php | 8 +++ htdocs/product/class/product.class.php | 5 +- htdocs/projet/document.php | 9 +--- htdocs/projet/tasks/document.php | 9 +--- htdocs/societe/document.php | 9 +--- 17 files changed, 139 insertions(+), 217 deletions(-) diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php index 5b7ca0d2614..0ba89db6895 100644 --- a/htdocs/adherents/document.php +++ b/htdocs/adherents/document.php @@ -40,13 +40,6 @@ $id=GETPOST('id','int'); $action=GETPOST('action','alpha'); $confirm=GETPOST('confirm','alpha'); -$mesg=''; -if (isset($_SESSION['DolMessage'])) -{ - $mesg=$_SESSION['DolMessage']; - unset($_SESSION['DolMessage']); -} - // Security check if ($user->societe_id > 0) { @@ -120,7 +113,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') $langs->load("other"); $file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). dol_delete_file($file); - $_SESSION['DolMessage'] = '
'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'
'; + $_SESSION['dol_message'] = '
'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'
'; Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); exit; } diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php index f39c64d872d..6fe06660139 100644 --- a/htdocs/comm/mailing/fiche.php +++ b/htdocs/comm/mailing/fiche.php @@ -41,13 +41,6 @@ $action=GETPOST('action','alpha'); $confirm=GETPOST('confirm','alpha'); $urlfrom=GETPOST('urlfrom'); -$mesg=''; -if (isset($_SESSION['DolMessage'])) -{ - $mesg=$_SESSION['DolMessage']; - unset($_SESSION['DolMessage']); -} - $object=new Mailing($db); $result=$object->fetch($id); @@ -562,7 +555,7 @@ if ($action == 'confirm_valid' && $confirm == 'yes') { $object->valid($user); - $_SESSION['DolMessage']='
'.$langs->trans("MailingSuccessfullyValidated").'
'; + $_SESSION['dol_message']='
'.$langs->trans("MailingSuccessfullyValidated").'
'; Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 01943653763..3ac7e56ae02 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -63,6 +63,7 @@ $search_montant_ht=GETPOST('search_montant_ht','alpha'); $sall=GETPOST("sall"); $mesg=(GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg")); +$mesgs=array(); $year=GETPOST("year"); $month=GETPOST("month"); @@ -863,7 +864,7 @@ else if ($action == "addline" && $user->rights->propale->creer) } // Mise a jour d'une ligne dans la propale -else if ($action == 'updateligne' && $user->rights->propale->creer && $_POST["save"] == $langs->trans("Save")) +else if ($action == 'updateligne' && $user->rights->propale->creer && GETPOST('save') == $langs->trans("Save")) { if (! $object->fetch($_POST["id"]) > 0) { @@ -1266,7 +1267,7 @@ print $formconfirm; print '
'.$langs->trans("MarginRate").''; print ''; // set by jquery (see below) print '
'.$langs->trans("MarkRate").''; print ''; // set by jquery (see below) print '
".price($objp->selling_price)."".price($objp->buying_price)."".price($objp->marge)."".(($marginRate === '')?'n/a':price($marginRate)."%")."".(($markRate === '')?'n/a':price($markRate)."%")."'.$invoicestatic->LibStatut($objp->paye,$objp->statut,5).'
".price($cumul_vente)."".price($cumul_achat)."".price($totalMargin)."".(($marginRate === '')?'n/a':price($marginRate)."%")."".(($markRate === '')?'n/a':price($markRate)."%")." 
'; -$linkback=''.$langs->trans("BackToList").''; +$linkback=''.$langs->trans("BackToList").''; // Ref print ''; print ''; // Project -if ($conf->projet->enabled) +if (! empty($conf->projet->enabled)) { $langs->load("projects"); print '
'.$langs->trans('Ref').''; @@ -1278,7 +1279,7 @@ print '
'; print ''; -if ($action != 'refclient' && $object->brouillon) print ''; +if ($action != 'refclient' && ! empty($object->brouillon)) print ''; print '
'; print $langs->trans('RefCustomer').''; print ''.img_edit($langs->trans('Modify')).''.img_edit($langs->trans('Modify')).'
'; print '
'; if ($user->rights->propale->creer && $action == 'refclient') @@ -1337,10 +1338,10 @@ print ''; print ''; -if ($action != 'editdate' && $object->brouillon) print ''; +if ($action != 'editdate' && ! empty($object->brouillon)) print ''; print '
'; print $langs->trans('Date'); print 'id.'">'.img_edit($langs->trans('SetDate'),1).'id.'">'.img_edit($langs->trans('SetDate'),1).'
'; print '
'; -if ($object->brouillon && $action == 'editdate') +if (! empty($object->brouillon) && $action == 'editdate') { print '
'; print ''; @@ -1368,10 +1369,10 @@ print '
'; print ''; -if ($action != 'editecheance' && $object->brouillon) print ''; +if ($action != 'editecheance' && ! empty($object->brouillon)) print ''; print '
'; print $langs->trans('DateEndPropal'); print 'id.'">'.img_edit($langs->trans('SetConditions'),1).'id.'">'.img_edit($langs->trans('SetConditions'),1).'
'; print '
'; -if ($object->brouillon && $action == 'editecheance') +if (! empty($object->brouillon) && $action == 'editecheance') { print ''; print ''; @@ -1382,7 +1383,7 @@ if ($object->brouillon && $action == 'editecheance') } else { - if ($object->fin_validite) + if (! empty($object->fin_validite)) { print dol_print_date($object->fin_validite,'daytext'); if ($object->statut == 1 && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); @@ -1400,7 +1401,7 @@ print '
'; print ''; -if ($action != 'editconditions' && $object->brouillon) print ''; +if ($action != 'editconditions' && ! empty($object->brouillon)) print ''; print '
'; print $langs->trans('PaymentConditionsShort'); print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetConditions'),1).'id.'">'.img_edit($langs->transnoentitiesnoconv('SetConditions'),1).'
'; print '
'; if ($action == 'editconditions') @@ -1420,7 +1421,7 @@ print '
'; print ''; -if ($action != 'editdate_livraison' && $object->brouillon) print ''; +if ($action != 'editdate_livraison' && ! empty($object->brouillon)) print ''; print '
'; print $langs->trans('DeliveryDate'); print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryDate'),1).'id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryDate'),1).'
'; print '
'; if ($action == 'editdate_livraison') @@ -1443,9 +1444,9 @@ print '
'; print ''; -if ($action != 'editavailability' && $object->brouillon) print ''; +if ($action != 'editavailability' && ! empty($object->brouillon)) print ''; print '
'; print $langs->trans('AvailabilityPeriod'); -if ($conf->commande->enabled) print ' ('.$langs->trans('AfterOrder').')'; +if (! empty($conf->commande->enabled)) print ' ('.$langs->trans('AfterOrder').')'; print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetAvailability'),1).'id.'">'.img_edit($langs->transnoentitiesnoconv('SetAvailability'),1).'
'; print '
'; if ($action == 'editavailability') @@ -1465,7 +1466,7 @@ print '
'; print ''; -if ($action != 'editdemandreason' && $object->brouillon) print ''; +if ($action != 'editdemandreason' && ! empty($object->brouillon)) print ''; print '
'; print $langs->trans('Source'); print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetDemandReason'),1).'id.'">'.img_edit($langs->transnoentitiesnoconv('SetDemandReason'),1).'
'; print '
'; //print $object->demand_reason_id; @@ -1487,7 +1488,7 @@ print ''; print ''; -if ($action != 'editmode' && $object->brouillon) print ''; +if ($action != 'editmode' && ! empty($object->brouillon)) print ''; print '
'; print $langs->trans('PaymentMode'); print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'),1).'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'),1).'
'; print '
'; if ($action == 'editmode') @@ -1501,7 +1502,7 @@ else print '
'; @@ -1525,7 +1526,7 @@ if ($conf->projet->enabled) else { print '
'; - if (!empty($object->fk_project)) + if (! empty($object->fk_project)) { print ''; $proj = new Project($db); @@ -1732,7 +1733,7 @@ if ($action != 'presend') } // Create an order - if ($conf->commande->enabled && $object->statut == 2 && $user->societe_id == 0) + if (! empty($conf->commande->enabled) && $object->statut == 2 && $user->societe_id == 0) { if ($user->rights->commande->creer) { @@ -1763,9 +1764,9 @@ if ($action != 'presend') } // Clone - if ($object->type == 0 && $user->rights->propale->creer) + if ($user->rights->propale->creer) { - print ''.$langs->trans("ToClone").''; + print ''.$langs->trans("ToClone").''; } // Delete diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index 5940c01c247..884d000adad 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -2,7 +2,7 @@ /* Copyright (C) 2003-2004 Rodolphe Quiedeville * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Ocebo - * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2005-2012 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 @@ -39,20 +39,14 @@ $confirm = GETPOST('confirm','alpha'); $id = GETPOST('id','int'); $ref = GETPOST('ref','alpha'); -$mesg=''; -if (isset($_SESSION['DolMessage'])) -{ - $mesg=$_SESSION['DolMessage']; - unset($_SESSION['DolMessage']); -} - // Security check -if ($user->societe_id) +$socid=''; +if (! empty($user->societe_id)) { $action=''; $socid = $user->societe_id; } -$result = restrictedArea($user, 'propale', $id, 'propal'); +$result = restrictedArea($user, 'propal', $id); // Get parameters $sortfield = GETPOST("sortfield",'alpha'); @@ -77,7 +71,7 @@ if ($object->id > 0) */ // Envoi fichier -if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) +if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) { if ($object->id > 0) { @@ -131,7 +125,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') $upload_dir = $conf->propal->dir_output . "/" . dol_sanitizeFileName($object->ref); $file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). dol_delete_file($file,0,0,0,$object); - $_SESSION['DolMessage'] = '
'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'
'; + $_SESSION['dol_message'] = '
'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'
'; Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); exit; } @@ -149,11 +143,11 @@ $form = new Form($db); if ($object->id > 0) { $upload_dir = $conf->propal->dir_output.'/'.dol_sanitizeFileName($object->ref); - + $head = propal_prepare_head($object); dol_fiche_head($head, 'document', $langs->trans('Proposal'), 0, 'propal'); - - + + // Construit liste des fichiers $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); $totalsize=0; @@ -161,17 +155,17 @@ if ($object->id > 0) { $totalsize+=$file['size']; } - - + + print ''; - - $linkback=''.$langs->trans("BackToList").''; - + + $linkback=''.$langs->trans("BackToList").''; + // Ref print ''; - + // Ref client print ''; // Project - if ($conf->projet->enabled) + if (! empty($conf->projet->enabled)) { $langs->load('projects'); print '
'.$langs->trans('Ref').''; print $form->showrefnav($object,'ref',$linkback,1,'ref','ref',''); print '
'; print ''; print ''; - + // Customer print ""; print ''; - + print ''; print ''; - + print '
'; @@ -182,34 +176,34 @@ if ($object->id > 0) print $object->ref_client; print '
".$langs->trans("Company")."'.$object->thirdparty->getNomUrl(1).'
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
'; - + print ''; - + dol_htmloutput_mesg($mesg,$mesgs); - + /* * Confirmation suppression fichier */ if ($action == 'delete') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$id.'&urlfile='.urlencode(GETPOST("urlfile")), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); + $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&urlfile='.urlencode(GETPOST("urlfile")), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); if ($ret == 'html') print '
'; } - + // Affiche formulaire upload $formfile=new FormFile($db); - $formfile->form_attach_new_file(DOL_URL_ROOT.'/comm/propal/document.php?id='.$object->id,'',0,0,$user->rights->propale->creer,50,$object); - - + $formfile->form_attach_new_file($_SERVER['PHP_SELF'].'?id='.$object->id,'',0,0,$user->rights->propale->creer,50,$object); + + // List of document $param='&id='.$object->id; $formfile->list_of_documents($filearray,$object,'propal',$param); @@ -219,7 +213,6 @@ else print $langs->trans("UnkownError"); } -$db->close(); - llxFooter(); +$db->close(); ?> diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index e158495b0c2..ded13509385 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -2,7 +2,7 @@ /* Copyright (C) 2003-2007 Rodolphe Quiedeville * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Ocebo - * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2005-2012 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,13 +40,6 @@ $confirm = GETPOST('confirm'); $id = GETPOST('id','int'); $ref = GETPOST('ref'); -$mesg=''; -if (isset($_SESSION['DolMessage'])) -{ - $mesg=$_SESSION['DolMessage']; - unset($_SESSION['DolMessage']); -} - // Security check if ($user->societe_id) { @@ -74,7 +67,7 @@ $object = new Commande($db); */ // Envoi fichier -if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) +if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) { if ($object->fetch($id)) { @@ -129,7 +122,7 @@ else if ($action == 'confirm_deletefile' && $confirm == 'yes') $upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($object->ref); $file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). dol_delete_file($file,0,0,0,$object); - $_SESSION['DolMessage'] = '
'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'
'; + $_SESSION['dol_message'] = '
'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'
'; Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); exit; } diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 5c00f9c6cdd..750da0afc82 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -617,7 +617,7 @@ else if ($action == 'addline' && $user->rights->commande->creer) $pa_ht = $_POST['np_buying_price']; else $pa_ht = null; - + $info_bits=0; if ($tva_npr) $info_bits |= 0x01; @@ -722,7 +722,7 @@ else if ($action == 'updateligne' && $user->rights->commande->creer && $_POST['s $pa_ht = $_POST['buying_price']; else $pa_ht = null; - + // Check parameters if (empty($_POST['productid']) && $_POST["type"] < 0) { @@ -825,7 +825,7 @@ else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->co if (! $idwarehouse || $idwarehouse == -1) { $error++; - $errors[]=$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")); + $mesgs[]='
'.$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")).'
'; $action=''; } } @@ -861,7 +861,7 @@ else if ($action == 'confirm_modif' && $user->rights->commande->creer) if (! $idwarehouse || $idwarehouse == -1) { $error++; - $errors[]=$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")); + $mesgs[]='
'.$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")).'
'; $action=''; } } @@ -906,7 +906,7 @@ else if ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->comm if (! $idwarehouse || $idwarehouse == -1) { $error++; - $errors[]=$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")); + $mesgs[]='
'.$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")).'
'; $action=''; } } @@ -1017,7 +1017,7 @@ else if ($action == 'remove_file') /* * Add file in email form */ -if ($_POST['addfile']) +if (GETPOST('addfile')) { require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); @@ -1592,7 +1592,6 @@ else if ($object->id > 0) { dol_htmloutput_mesg($mesg,$mesgs); - dol_htmloutput_errors('',$errors); $product_static=new Product($db); @@ -1929,10 +1928,10 @@ else print ''; - if ($_GET['action'] != 'editdemandreason' && $object->brouillon) print ''; + if ($action != 'editdemandreason' && ! empty($object->brouillon)) print ''; print '
'; print $langs->trans('Source'); print 'id.'">'.img_edit($langs->trans('SetDemandReason'),1).'id.'">'.img_edit($langs->trans('SetDemandReason'),1).'
'; print '
'; - if ($_GET['action'] == 'editdemandreason') + if ($action == 'editdemandreason') { $form->form_demand_reason($_SERVER['PHP_SELF'].'?id='.$object->id,$object->demand_reason_id,'demand_reason_id',1); } @@ -1947,7 +1946,7 @@ else print '
'; diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index 7a789c32c4f..e023a0dd242 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -43,13 +43,6 @@ $confirm = GETPOST('confirm'); $id = GETPOST('facid','int'); $ref = GETPOST('ref'); -$mesg=''; -if (isset($_SESSION['DolMessage'])) -{ - $mesg=$_SESSION['DolMessage']; - unset($_SESSION['DolMessage']); -} - // Security check if ($user->societe_id) { @@ -132,7 +125,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') $upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($object->ref); $file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). dol_delete_file($file,0,0,0,$object); - $_SESSION['DolMessage'] = '
'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'
'; + $_SESSION['dol_message'] = '
'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'
'; Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); exit; } diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index 8f3e0265caf..97dbbaa2c9c 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -41,13 +41,6 @@ $confirm = GETPOST('confirm','alpha'); $id = GETPOST('id','int'); $ref = GETPOST('ref','alpha'); -$mesg=''; -if (isset($_SESSION['DolMessage'])) -{ - $mesg=$_SESSION['DolMessage']; - unset($_SESSION['DolMessage']); -} - // Security check if ($user->societe_id > 0) { @@ -129,7 +122,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') $file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). $ret=dol_delete_file($file,0,0,0,$object); - $_SESSION['DolMessage'] = '
'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'
'; + $_SESSION['dol_message'] = '
'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'
'; Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit; } @@ -175,9 +168,9 @@ if ($object->id) print '
'; print ''; - + dol_htmloutput_mesg($mesg,$mesgs); - + /* * Confirmation suppression fichier */ diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 752d904c330..1811aa0575f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2533,7 +2533,7 @@ abstract class CommonObject print ''.$langs->trans('PriceUHT').''; print ''.$langs->trans('Qty').''; print ''.$langs->trans('ReductionShort').''; - if (! empty($conf->margin->enabled)) { + if (! empty($conf->margin->enabled)) { if ($conf->global->MARGIN_TYPE == "1") print ''.$langs->trans('BuyingPrice').''; else @@ -2861,43 +2861,43 @@ abstract class CommonObject 'total_margin' => 0, 'total_margin_rate' => '', 'total_mark_rate' => '' - ); - foreach($this->lines as $line) { - if (isset($line->fk_fournprice) && !$force_price) { + ); + foreach($this->lines as $line) { + if (isset($line->fk_fournprice) && !$force_price) { $product = new ProductFournisseur($this->db); - if ( $product->fetch_product_fournisseur_price($line->fk_fournprice)) + if ($product->fetch_product_fournisseur_price($line->fk_fournprice)) $line->pa_ht = $product->fourn_unitprice; - if ($conf->global->MARGIN_TYPE == "2" && $product->fourn_unitcharges > 0) + if (isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == "2" && $product->fourn_unitcharges > 0) $line->pa_ht += $product->fourn_unitcharges; - } - // si prix d'achat non renseign� et devrait l'�tre, alors prix achat = prix vente - if ((!isset($line->pa_ht) || $line->pa_ht == 0) && ($conf->global->ForceBuyingPriceIfNull == 1)) { - $line->pa_ht = $line->subprice * (1 - ($line->remise_percent / 100)); + } + // si prix d'achat non renseigné et devrait l'être, alors prix achat = prix vente + if ((!isset($line->pa_ht) || $line->pa_ht == 0) && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)) { + $line->pa_ht = $line->subprice * (1 - ($line->remise_percent / 100)); } // calcul des marges - if(isset($line->fk_remise_except)) { // remise - if ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '1') { // remise globale consid�r�e comme produit - $marginInfos['pa_products'] += ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100); + if (isset($line->fk_remise_except) && isset($conf->global->MARGIN_METHODE_FOR_DISCOUNT)) { // remise + if ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '1') { // remise globale considérée comme produit + $marginInfos['pa_products'] += ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100); $marginInfos['pv_products'] += $line->subprice * (1 - $line->remise_percent / 100); - $marginInfos['pa_total'] += ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100); + $marginInfos['pa_total'] += ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100); $marginInfos['pv_total'] += $line->subprice * (1 - $line->remise_percent / 100); } - elseif ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '2') { // remise globale consid�r�e comme service - $marginInfos['pa_services'] += ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100); + elseif ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '2') { // remise globale considérée comme service + $marginInfos['pa_services'] += ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100); $marginInfos['pv_services'] += $line->subprice * (1 - ($line->remise_percent / 100)); - $marginInfos['pa_total'] += ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100); + $marginInfos['pa_total'] += ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100); $marginInfos['pv_total'] += $line->subprice * (1 - $line->remise_percent / 100); } elseif ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '3') { // remise globale prise en compte uniqt sur total - $marginInfos['pa_total'] += ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100); + $marginInfos['pa_total'] += ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100); $marginInfos['pv_total'] += $line->subprice * (1 - ($line->remise_percent / 100)); } } - else { - $type=$line->product_type?$line->product_type:$line->fk_product_type; + else { + $type=$line->product_type?$line->product_type:$line->fk_product_type; if ($type == 0) { // product - $marginInfos['pa_products'] += $line->qty * $line->pa_ht; + $marginInfos['pa_products'] += $line->qty * $line->pa_ht; $marginInfos['pv_products'] += $line->qty * $line->subprice * (1 - $line->remise_percent / 100); $marginInfos['pa_total'] += $line->qty * $line->pa_ht; $marginInfos['pv_total'] += $line->qty * $line->subprice * (1 - $line->remise_percent / 100); @@ -2910,32 +2910,32 @@ abstract class CommonObject } } } - + $marginInfos['margin_on_products'] = $marginInfos['pv_products'] - $marginInfos['pa_products']; if ($marginInfos['pa_products'] > 0) $marginInfos['margin_rate_products'] = 100 * round($marginInfos['margin_on_products'] / $marginInfos['pa_products'],5); if ($marginInfos['pv_products'] > 0) $marginInfos['mark_rate_products'] = 100 * round($marginInfos['margin_on_products'] / $marginInfos['pv_products'],5); - + $marginInfos['margin_on_services'] = $marginInfos['pv_services'] - $marginInfos['pa_services']; if ($marginInfos['pa_services'] > 0) $marginInfos['margin_rate_services'] = 100 * round($marginInfos['margin_on_services'] / $marginInfos['pa_services'],5); if ($marginInfos['pv_services'] > 0) $marginInfos['mark_rate_services'] = 100 * round($marginInfos['margin_on_services'] / $marginInfos['pv_services'],5); - + $marginInfos['total_margin'] = $marginInfos['pv_total'] - $marginInfos['pa_total']; if ($marginInfos['pa_total'] > 0) $marginInfos['total_margin_rate'] = 100 * round($marginInfos['total_margin'] / $marginInfos['pa_total'],5); if ($marginInfos['pv_total'] > 0) $marginInfos['total_mark_rate'] = 100 * round($marginInfos['total_margin'] / $marginInfos['pv_total'],5); - + return $marginInfos; } function displayMarginInfos($force_price=false) { global $langs, $conf; - $marginInfo = $this->getMarginInfos($force_price); + $marginInfo = $this->getMarginInfos($force_price); print ''; print ''; print ''; diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 88fc29c764c..082e9e11228 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -231,15 +231,7 @@ if ($id > 0 || ! empty($ref)) // Date print ''; print ''; - print ''; + print ''; print ''; // Delivery date planned @@ -276,7 +268,7 @@ if ($id > 0 || ! empty($ref)) print $langs->trans('PaymentConditionsShort'); print ''; - if ($action != 'editconditions' && $commande->brouillon) print ''; + if ($action != 'editconditions' && ! empty($commande->brouillon)) print ''; print '
'.$langs->trans('Margins').'
'.$langs->trans('Date').''.dol_print_date($commande->date,'daytext').''.$langs->trans('Source').' : '.$commande->getLabelSource(); - if ($commande->source == 0 && $conf->propal->enabled && $commande->propale_id) - { - // Si source = propal - $propal = new Propal($db); - $propal->fetch($commande->propale_id); - print ' -> '.$propal->ref.''; - } - print ''.$langs->trans('Source').' : '.$commande->getLabelSource().'
id.'">'.img_edit($langs->trans('SetConditions'),1).'id.'">'.img_edit($langs->trans('SetConditions'),1).'
'; print ''; if ($action == 'editconditions') @@ -294,7 +286,7 @@ if ($id > 0 || ! empty($ref)) print ''; - if ($actionº != 'editmode' && $commande->brouillon) print ''; + if ($action != 'editmode' && ! empty($commande->brouillon)) print ''; print '
'; print $langs->trans('PaymentMode'); print 'id.'">'.img_edit($langs->trans('SetMode'),1).'id.'">'.img_edit($langs->trans('SetMode'),1).'
'; print ''; if ($action == 'editmode') @@ -394,7 +386,8 @@ if ($id > 0 || ! empty($ref)) print "\n"; $var=true; - $reste_a_livrer = array(); + $toBeShipped=array(); + $toBeShippedTotal=0; while ($i < $num) { $objp = $db->fetch_object($resql); @@ -412,25 +405,25 @@ if ($id > 0 || ! empty($ref)) // Product label if ($objp->fk_product > 0) { - // Define output language - if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) - { - $commande->fetch_thirdparty(); - $prod = new Product($db, $objp->fk_product); - $outputlangs = $langs; - $newlang=''; - if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; - if (empty($newlang)) $newlang=$commande->client->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } + // Define output language + if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) + { + $commande->fetch_thirdparty(); + $prod = new Product($db, $objp->fk_product); + $outputlangs = $langs; + $newlang=''; + if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; + if (empty($newlang)) $newlang=$commande->client->default_lang; + if (! empty($newlang)) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang($newlang); + } - $label = (! empty($prod->multilangs[$outputlangs->defaultlang]["libelle"])) ? $prod->multilangs[$outputlangs->defaultlang]["libelle"] : $objp->product_label; - } - else - $label = $objp->product_label; + $label = (! empty($prod->multilangs[$outputlangs->defaultlang]["libelle"])) ? $prod->multilangs[$outputlangs->defaultlang]["libelle"] : $objp->product_label; + } + else + $label = $objp->product_label; print ''; print ''; // ancre pour retourner sur la ligne @@ -475,17 +468,17 @@ if ($id > 0 || ! empty($ref)) $qtyProdCom=$objp->qty; print ''; // Nb of sending products for this line of order - $quantite_livree = $commande->expeditions[$objp->rowid]; - print $quantite_livree; + $qtyAlreadyShipped = (! empty($commande->expeditions[$objp->rowid])?$commande->expeditions[$objp->rowid]:0); + print $qtyAlreadyShipped; print ''; // Qty remains to ship print ''; if ($type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) { - $reste_a_livrer[$objp->fk_product] = $objp->qty - $quantite_livree; - $reste_a_livrer_total += $reste_a_livrer[$objp->fk_product]; - print $reste_a_livrer[$objp->fk_product]; + $toBeShipped[$objp->fk_product] = $objp->qty - $qtyAlreadyShipped; + $toBeShippedTotal += $toBeShipped[$objp->fk_product]; + print $toBeShipped[$objp->fk_product]; } else { @@ -503,7 +496,7 @@ if ($id > 0 || ! empty($ref)) { print ''; print $product->stock_reel; - if ($product->stock_reel < $reste_a_livrer[$objp->fk_product]) + if ($product->stock_reel < $toBeShipped[$objp->fk_product]) { print ' '.img_warning($langs->trans("StockTooLow")); } @@ -580,7 +573,7 @@ if ($id > 0 || ! empty($ref)) if ($user->rights->expedition->creer) { print ''.$langs->trans("NewSending").''; - if ($reste_a_livrer_total <= 0) + if ($toBeShippedTotal <= 0) { print ' '.img_warning($langs->trans("WarningNoQtyLeftToSend")); } @@ -625,7 +618,7 @@ if ($id > 0 || ! empty($ref)) } print ''; print ''; - if ($reste_a_livrer_total <= 0) + if ($toBeShippedTotal <= 0) { print ' '.img_warning($langs->trans("WarningNoQtyLeftToSend")); } diff --git a/htdocs/fichinter/document.php b/htdocs/fichinter/document.php index 3cc37c7959b..03ecf75522c 100644 --- a/htdocs/fichinter/document.php +++ b/htdocs/fichinter/document.php @@ -43,13 +43,6 @@ $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action','alpha'); $confirm = GETPOST('confirm','alpha'); -$mesg=''; -if (isset($_SESSION['DolMessage'])) -{ - $mesg=$_SESSION['DolMessage']; - unset($_SESSION['DolMessage']); -} - // Security check if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'ficheinter', $id, 'fichinter'); @@ -128,7 +121,7 @@ else if ($action == 'confirm_deletefile' && $confirm == 'yes') $file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). dol_delete_file($file,0,0,0,$object); - $_SESSION['DolMessage'] = '
'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'
'; + $_SESSION['dol_message'] = '
'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'
'; Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); exit; } @@ -177,9 +170,9 @@ if ($object->id) print ''; print ''; - + dol_htmloutput_mesg($mesg,$mesgs); - + /* * Confirmation suppression fichier */ diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php index d35b8900596..94483274ef7 100644 --- a/htdocs/fourn/commande/document.php +++ b/htdocs/fourn/commande/document.php @@ -46,14 +46,6 @@ $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action','alpha'); $confirm = GETPOST('confirm','alpha'); -$mesg=''; -$mesgs=array(); -if (isset($_SESSION['DolMessage'])) -{ - $mesg=$_SESSION['DolMessage']; - unset($_SESSION['DolMessage']); -} - // Security check if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'commande_fournisseur', $id,''); @@ -130,7 +122,7 @@ else if ($action == 'confirm_deletefile' && $confirm == 'yes') $file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). dol_delete_file($file,0,0,0,$object); - $_SESSION['DolMessage'] = '
'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'
'; + $_SESSION['dol_message'] = '
'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'
'; Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); exit; } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 7d8a41d5740..0f6378e880b 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -721,6 +721,14 @@ $bc=array(0=>'class="impair"',1=>'class="pair"'); $bcdd=array(0=>'class="impair drag drop"',1=>'class="pair drag drop"'); $bcnd=array(0=>'class="impair nodrag nodrop"',1=>'class="pair nodrag nodrop"'); +// Define messages variables +$mesg=''; $mesgs=array(); +if (isset($_SESSION['dol_message'])) +{ + $mesg=$_SESSION['dol_message']; + unset($_SESSION['dol_message']); +} + // Constants used to defined number of lines in textarea if (empty($conf->browser->firefox)) { diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 4d4a9e03e98..88ee6d23682 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2082,13 +2082,12 @@ class Product extends CommonObject function get_arbo_each_prod($multiply=1) { $this->res = array(); - if (is_array($this -> sousprods)) + if (isset($this->sousprods) && is_array($this->sousprods)) { - foreach($this -> sousprods as $nom_pere => $desc_pere) + foreach($this->sousprods as $nom_pere => $desc_pere) { if (is_array($desc_pere)) $this->fetch_prod_arbo($desc_pere,"",$multiply); } - // dol_sort($this->res,); } return $this->res; } diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index 7386bf62719..ee07aed7804 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -39,13 +39,6 @@ $ref = GETPOST('ref','alpha'); $mine = (GETPOST('mode','alpha') == 'mine' ? 1 : 0); //if (! $user->rights->projet->all->lire) $mine=1; // Special for projects -$mesg=''; -if (isset($_SESSION['DolMessage'])) -{ - $mesg=$_SESSION['DolMessage']; - unset($_SESSION['DolMessage']); -} - // Security check $socid=0; if ($user->societe_id > 0) $socid=$user->societe_id; @@ -122,7 +115,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->projet->s $upload_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->ref); $file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). dol_delete_file($file,0,0,0,$object); - $_SESSION['DolMessage'] = '
'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'
'; + $_SESSION['dol_message'] = '
'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'
'; Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit; } diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index b4611588775..7f9755fda37 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -44,13 +44,6 @@ $ref= GETPOST('ref','alpha'); $withproject=GETPOST('withproject','int'); $project_ref = GETPOST('project_ref','alpha'); -$mesg=''; -if (isset($_SESSION['DolMessage'])) -{ - $mesg=$_SESSION['DolMessage']; - unset($_SESSION['DolMessage']); -} - // Security check $socid=0; if ($user->societe_id > 0) $socid = $user->societe_id; @@ -119,7 +112,7 @@ if ($action=='delete') $langs->load("other"); $file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). dol_delete_file($file); - $_SESSION['DolMessage'] = '
'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'
'; + $_SESSION['dol_message'] = '
'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'
'; Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); exit; } diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index 26aad2de1dd..a5cdd9efb0e 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -39,13 +39,6 @@ $confirm=GETPOST('confirm'); $id=(GETPOST('socid','int') ? GETPOST('socid','int') : GETPOST('id','int')); $ref = GETPOST('ref', 'alpha'); -$mesg=''; -if (isset($_SESSION['DolMessage'])) -{ - $mesg=$_SESSION['DolMessage']; - unset($_SESSION['DolMessage']); -} - // Security check if ($user->societe_id > 0) { @@ -131,7 +124,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') $file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). dol_delete_file($file,0,0,0,$object); - $_SESSION['DolMessage'] = '
'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'
'; + $_SESSION['dol_message'] = '
'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'
'; Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit; } From eba0db736e5bbdbea7506726e0277ca05bb7354f Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 23 Jul 2012 21:31:10 +0200 Subject: [PATCH 04/17] Fix: try to use $mesgs (array) for stock all messages and $_SESSION['dol_message'] for specific message when a page is reloading --- htdocs/commande/orderstoinvoice.php | 31 +++++---- htdocs/compta/facture.php | 104 +++++++++++++--------------- htdocs/compta/facture/list.php | 8 +-- htdocs/main.inc.php | 2 +- 4 files changed, 67 insertions(+), 78 deletions(-) diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index a521f766574..cae2461a780 100755 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -62,7 +62,7 @@ if ($action == 'create') { if (! is_array($selected)) { - $mesg='
'.$langs->trans('Error_OrderNotChecked').'
'; + $mesgs[]='
'.$langs->trans('Error_OrderNotChecked').'
'; } else { @@ -80,9 +80,9 @@ $htmlother = new FormOther($db); /* * Actions -*/ + */ -if (($action == 'create' || $action == 'add') && ! $mesg ) +if (($action == 'create' || $action == 'add') && empty($mesgs)) { require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php"); @@ -92,8 +92,10 @@ if (($action == 'create' || $action == 'add') && ! $mesg ) require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php"); require_once(DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'); require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php"); - if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'); - if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'); + if (! empty($conf->projet->enabled)) { + require_once(DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'); + require_once(DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'); + } $langs->load('bills'); $langs->load('products'); $langs->load('main'); @@ -117,7 +119,6 @@ if (($action == 'create' || $action == 'add') && ! $mesg ) $_POST['originid']=$orders_id[0]; } - if (GETPOST('mesg','int',1) && isset($_SESSION['message'])) $mesg=$_SESSION['message']; $sall=isset($_GET['sall'])?trim($_GET['sall']):trim($_POST['sall']); $projectid=isset($_GET['projectid'])?$_GET['projectid']:0; $id =(GETPOST('id')?GETPOST("id"):GETPOST("facid")); // For backward compatibility @@ -242,7 +243,7 @@ if (($action == 'create' || $action == 'add') && ! $mesg ) } else { - $mesg=$discount->error; + $mesgs[]=$discount->error; $error++; break; } @@ -310,7 +311,7 @@ if (($action == 'create' || $action == 'add') && ! $mesg ) } else { - $mesg=$srcobject->error; + $mesgs[]=$srcobject->error; $error++; } $ii++; @@ -318,7 +319,7 @@ if (($action == 'create' || $action == 'add') && ! $mesg ) } else { - $mesg=$object->error; + $mesgs[]=$object->error; $error++; } } @@ -338,7 +339,7 @@ if (($action == 'create' || $action == 'add') && ! $mesg ) $action='create'; $_GET["origin"]=$_POST["origin"]; $_GET["originid"]=$_POST["originid"]; - if (! $mesg) $mesg='
'.$object->error.'
'; + $mesgs[]='
'.$object->error.'
'; } } @@ -354,9 +355,10 @@ if (($action == 'create' || $action == 'add') && ! $mesg ) if ($action == 'create') { $facturestatic=new Facture($db); + llxHeader(); print_fiche_titre($langs->trans('NewBill')); - dol_htmloutput_mesg($mesg); + $soc = new Societe($db); if ($socid) $res=$soc->fetch($socid); if ($res) @@ -474,7 +476,6 @@ if (($action == 'create' || $action == 'add') && ! $mesg ) print "\n"; } - //Mode liste else { @@ -669,8 +670,8 @@ else } -$db->close(); -dol_htmloutput_mesg($mesg); -llxFooter(); +dol_htmloutput_mesg($mesg,$mesgs); +llxFooter(); +$db->close(); ?> \ No newline at end of file diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 806af455da9..410c8f3bc29 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -54,11 +54,6 @@ $langs->load('main'); if (! empty($conf->margin->enabled)) $langs->load('margins'); -$mesg=''; -$errors=array(); - -if (GETPOST('mesg','int',1) && isset($_SESSION['message'])) $mesg=$_SESSION['message']; - $sall=trim(GETPOST('sall')); $projectid=(GETPOST('projectid')?GETPOST('projectid','int'):0); @@ -116,7 +111,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->facture->c { if (1==0 && empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"])) { - $mesg='
'.$langs->trans("NoCloneOptionsSpecified").'
'; + $mesgs[]='
'.$langs->trans("NoCloneOptionsSpecified").'
'; } else { @@ -130,7 +125,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->facture->c } else { - $mesg=$object->error; + $mesgs[]=$object->error; $action=''; } } @@ -152,7 +147,7 @@ else if ($action == 'reopen' && $user->rights->facture->creer) } else { - $mesg='
'.$object->error.'
'; + $mesgs[]='
'.$object->error.'
'; } } } @@ -170,7 +165,7 @@ else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fact } else { - $mesg='
'.$object->error.'
'; + $mesgs[]='
'.$object->error.'
'; } } @@ -206,7 +201,7 @@ else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights-> } else { - $mesg='
'.$object->error.'
'; + $mesgs[]='
'.$object->error.'
'; $action=''; } } @@ -230,7 +225,7 @@ else if ($action == 'valid' && $user->rights->facture->creer) // Si avoir, le signe doit etre negatif if ($object->total_ht >= 0) { - $mesg='
'.$langs->trans("ErrorInvoiceAvoirMustBeNegative").'
'; + $mesgs[]='
'.$langs->trans("ErrorInvoiceAvoirMustBeNegative").'
'; $action=''; } } @@ -239,7 +234,7 @@ else if ($action == 'valid' && $user->rights->facture->creer) // Si non avoir, le signe doit etre positif if (empty($conf->global->FACTURE_ENABLE_NEGATIVE) && $object->total_ht < 0) { - $mesg='
'.$langs->trans("ErrorInvoiceOfThisTypeMustBePositive").'
'; + $mesgs[]='
'.$langs->trans("ErrorInvoiceOfThisTypeMustBePositive").'
'; $action=''; } } @@ -306,7 +301,7 @@ else if ($action == "setabsolutediscount" && $user->rights->facture->creer) $result=$object->insert_discount($_POST["remise_id"]); if ($result < 0) { - $mesg='
'.$object->error.'
'; + $mesgs[]='
'.$object->error.'
'; } } else @@ -323,7 +318,7 @@ else if ($action == "setabsolutediscount" && $user->rights->facture->creer) $result=$discount->link_to_invoice(0,$id); if ($result < 0) { - $mesg='
'.$discount->error.'
'; + $mesgs[]='
'.$discount->error.'
'; } } } @@ -390,7 +385,7 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu } else { - $mesg='
'.$object->error.'
'; + $mesgs[]='
'.$object->error.'
'; } } } @@ -486,7 +481,7 @@ else if ($action == 'confirm_paid_partially' && $confirm == 'yes' && $user->righ } else { - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->trans("Reason")).'
'; + $mesgs[]='
'.$langs->trans("ErrorFieldRequired",$langs->trans("Reason")).'
'; } } // Classify "abandoned" @@ -501,7 +496,7 @@ else if ($action == 'confirm_canceled' && $confirm == 'yes') } else { - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->trans("Reason")).'
'; + $mesgs[]='
'.$langs->trans("ErrorFieldRequired",$langs->trans("Reason")).'
'; } } @@ -560,18 +555,18 @@ else if ($action == 'confirm_converttoreduc' && $confirm == 'yes' && $user->righ $result=$object->set_paid($user); if ($result > 0) { - //$mesg='OK'.$discount->id; + //$mesgs[]='OK'.$discount->id; $db->commit(); } else { - $mesg='
'.$object->error.'
'; + $mesgs[]='
'.$object->error.'
'; $db->rollback(); } } else { - $mesg='
'.$discount->error.'
'; + $mesgs[]='
'.$discount->error.'
'; $db->rollback(); } } @@ -595,13 +590,13 @@ else if ($action == 'add' && $user->rights->facture->creer) if (empty($datefacture)) { $error++; - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'
'; + $mesgs[]='
'.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'
'; } if (! ($_POST['fac_replacement'] > 0)) { $error++; - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->trans("ReplaceInvoice")).'
'; + $mesgs[]='
'.$langs->trans("ErrorFieldRequired",$langs->trans("ReplaceInvoice")).'
'; } if (! $error) @@ -627,7 +622,7 @@ else if ($action == 'add' && $user->rights->facture->creer) $object->type = 1; $id=$object->createFromCurrent($user); - if ($id <= 0) $mesg=$object->error; + if ($id <= 0) $mesgs[]=$object->error; } } @@ -637,14 +632,14 @@ else if ($action == 'add' && $user->rights->facture->creer) if (! $_POST['fac_avoir'] > 0) { $error++; - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->trans("CorrectInvoice")).'
'; + $mesgs[]='
'.$langs->trans("ErrorFieldRequired",$langs->trans("CorrectInvoice")).'
'; } $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); if (empty($datefacture)) { $error++; - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'
'; + $mesgs[]='
'.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'
'; } if (! $error) @@ -696,7 +691,7 @@ else if ($action == 'add' && $user->rights->facture->creer) if (empty($datefacture)) { $error++; - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'
'; + $mesgs[]='
'.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'
'; } if (! $error) @@ -725,7 +720,7 @@ else if ($action == 'add' && $user->rights->facture->creer) if (empty($datefacture)) { $error++; - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'
'; + $mesgs[]='
'.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'
'; } if (! $error) @@ -816,7 +811,7 @@ else if ($action == 'add' && $user->rights->facture->creer) } else { - $mesg=$discount->error; + $mesgs[]=$discount->error; $error++; break; } @@ -895,13 +890,13 @@ else if ($action == 'add' && $user->rights->facture->creer) } else { - $mesg=$srcobject->error; + $mesgs[]=$srcobject->error; $error++; } } else { - $mesg=$object->error; + $mesgs[]=$object->error; $error++; } } @@ -938,7 +933,7 @@ else if ($action == 'add' && $user->rights->facture->creer) $action='create'; $_GET["origin"]=$_POST["origin"]; $_GET["originid"]=$_POST["originid"]; - if (! $mesg) $mesg='
'.$object->error.'
'; + $mesgs[]='
'.$object->error.'
'; } } @@ -950,27 +945,27 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- if ($_POST['np_price'] < 0 && $_POST["qty"] < 0) { $langs->load("errors"); - $mesg='
'.$langs->trans("ErrorBothFieldCantBeNegative",$langs->transnoentitiesnoconv("UnitPriceHT"),$langs->transnoentitiesnoconv("Qty")).'
'; + $mesgs[]='
'.$langs->trans("ErrorBothFieldCantBeNegative",$langs->transnoentitiesnoconv("UnitPriceHT"),$langs->transnoentitiesnoconv("Qty")).'
'; $result = -1 ; } if (empty($_POST['idprod']) && $_POST["type"] < 0) { - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'
'; + $mesgs[]='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'
'; $result = -1 ; } if (empty($_POST['idprod']) && (! isset($_POST["np_price"]) || $_POST["np_price"]=='')) // Unit price can be 0 but not '' { - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")).'
'; + $mesgs[]='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")).'
'; $result = -1 ; } if (empty($_POST['idprod']) && empty($_POST["np_desc"]) && empty($_POST["dp_desc"])) { - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Description")).'
'; + $mesgs[]='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Description")).'
'; $result = -1 ; } if (! isset($_POST['qty']) || $_POST['qty']=='') { - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv('Qty')).'
'; + $mesgs[]='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv('Qty')).'
'; $result = -1 ; } if ($result >= 0 && ( ($_POST['np_price']!='' && ($_POST['np_desc'] || $_POST['dp_desc'])) || $_POST['idprod'] ) ) @@ -1082,7 +1077,7 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- $pa_ht = $_POST['np_buying_price']; else $pa_ht = null; - + $info_bits=0; if ($tva_npr) $info_bits |= 0x01; @@ -1155,7 +1150,7 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- } else { - if (empty($mesg)) $mesg='
'.$object->error.'
'; + $mesgs[]='
'.$object->error.'
'; } $action=''; @@ -1194,7 +1189,7 @@ else if ($action == 'updateligne' && $user->rights->facture->creer && $_POST['sa // Check parameters if (! GETPOST('productid') && GETPOST("type") < 0) { - $mesg = '
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'
'; + $mesgs[] = '
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'
'; $result = -1 ; } // Check minimum price @@ -1210,7 +1205,7 @@ else if ($action == 'updateligne' && $user->rights->facture->creer && $_POST['sa if ($object->type!=2 && $price_min && GETPOST('productid') && (price2num($up_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min))) { //print "CantBeLessThanMinPrice ".$up_ht." - ".GETPOST('remise_percent')." - ".$product->price_min; - $mesg = '
'.$langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').' '.$langs->trans("Currency".$conf->currency)).'
'; + $mesgs[] = '
'.$langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').' '.$langs->trans("Currency".$conf->currency)).'
'; $result=-1; } @@ -1328,7 +1323,7 @@ if (GETPOST('addfile')) $vardir=$conf->user->dir_output."/".$user->id; $upload_dir_tmp = $vardir.'/temp'; - $mesg=dol_add_file_process($upload_dir_tmp,0,0); + $mesgs[]=dol_add_file_process($upload_dir_tmp,0,0); $action='presend'; } @@ -1345,7 +1340,7 @@ if (! empty($_POST['removedfile'])) $upload_dir_tmp = $vardir.'/temp'; // TODO Delete only files that was uploaded from email form - $mesg=dol_remove_file_process($_POST['removedfile'],0); + $mesgs[]=dol_remove_file_process($_POST['removedfile'],0); $action='presend'; } @@ -1476,8 +1471,8 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO { // Redirect here // This avoid sending mail twice if going out and then back to page - $_SESSION['message'] = $mesg; - Header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&mesg=1'); + $_SESSION['dol_message'] = $mesg; + Header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$object->id); exit; } } @@ -1495,27 +1490,28 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO $mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS'; } $mesg.=''; + $mesgs[]=$mesg; } } /* } else { $langs->load("other"); - $mesg='
'.$langs->trans('ErrorMailRecipientIsEmpty').'
'; + $mesgs[]='
'.$langs->trans('ErrorMailRecipientIsEmpty').'
'; dol_syslog('Recipient email is empty'); }*/ } else { $langs->load("errors"); - $mesg='
'.$langs->trans('ErrorCantReadFile',$file).'
'; + $mesgs[]='
'.$langs->trans('ErrorCantReadFile',$file).'
'; dol_syslog('Failed to read file: '.$file); } } else { $langs->load("other"); - $mesg='
'.$langs->trans('ErrorFailedToReadEntity',$langs->trans("Invoice")).'
'; + $mesgs[]='
'.$langs->trans('ErrorFailedToReadEntity',$langs->trans("Invoice")).'
'; dol_syslog('Impossible de lire les donnees de la facture. Le fichier facture n\'a peut-etre pas ete genere.'); } @@ -1571,7 +1567,7 @@ else if ($action == 'remove_file') $upload_dir = $conf->facture->dir_output; $file = $upload_dir . '/' . GETPOST('file'); dol_delete_file($file,0,0,0,$object); - $mesg = '
'.$langs->trans("FileWasRemoved",GETPOST('file')).'
'; + $mesgs[] = '
'.$langs->trans("FileWasRemoved",GETPOST('file')).'
'; } } @@ -1597,11 +1593,11 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); - $mesg = '
'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'
'; + $mesgs[] = '
'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'
'; } else { - $mesg = '
'.$object->error.'
'; + $mesgs[] = '
'.$object->error.'
'; } } } @@ -1661,9 +1657,6 @@ if ($action == 'create') print_fiche_titre($langs->trans('NewBill')); - dol_htmloutput_mesg($mesg); - dol_htmloutput_errors('',$errors); - $soc = new Societe($db); if ($socid) $res=$soc->fetch($socid); @@ -2109,8 +2102,6 @@ else if ($id > 0 || ! empty($ref)) /* * Show object in view mode */ - dol_htmloutput_mesg($mesg); - dol_htmloutput_errors('',$errors); $result=$object->fetch($id,$ref); if ($result > 0) @@ -3332,7 +3323,8 @@ else if ($id > 0 || ! empty($ref)) } } +dol_htmloutput_mesg('',$mesgs); llxFooter(); $db->close(); -?> +?> \ No newline at end of file diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 6c356015ab1..9a29f016914 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -38,22 +38,18 @@ require_once(DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'); require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php"); require_once(DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'); require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php"); -if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'); -if ($conf->projet->enabled) +if (! empty($conf->commande->enabled)) require_once(DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'); +if (! empty($conf->projet->enabled)) { require_once(DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'); require_once(DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'); } $langs->load('bills'); -//print 'ee'.$langs->trans('BillsCustomer');exit; - $langs->load('companies'); $langs->load('products'); $langs->load('main'); -if (GETPOST('mesg','int',1) && isset($_SESSION['message'])) $mesg=$_SESSION['message']; - $sall=trim(GETPOST('sall')); $projectid=(GETPOST('projectid')?GETPOST('projectid','int'):0); diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 0f6378e880b..ed3320135fc 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -725,7 +725,7 @@ $bcnd=array(0=>'class="impair nodrag nodrop"',1=>'class="pair nodrag nodrop"'); $mesg=''; $mesgs=array(); if (isset($_SESSION['dol_message'])) { - $mesg=$_SESSION['dol_message']; + $mesgs[]=$_SESSION['dol_message']; unset($_SESSION['dol_message']); } From 2035eb0b1407d8430659552fd17da703d32eda18 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 23 Jul 2012 21:40:34 +0200 Subject: [PATCH 05/17] Fix: strict mode mini --- htdocs/compta/facture/list.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 9a29f016914..86a70f28e28 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -80,16 +80,19 @@ $pageprev = $page - 1; $pagenext = $page + 1; $search_user = GETPOST('search_user','int'); +$search_sale = GETPOST('search_sale','int'); $day = GETPOST('day','int'); $month = GETPOST('month','int'); $year = GETPOST('year','int'); +$filtre = GETPOST('filtre'); // Security check $fieldid = (! empty($ref)?'facnumber':'rowid'); -if ($user->societe_id) $socid=$user->societe_id; +if (! empty($user->societe_id)) $socid=$user->societe_id; $result = restrictedArea($user, 'facture', $id,'','','fk_soc',$fieldid); -$usehm=$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE; +// FIXME $usehm not used ? +$usehm=(! empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE:false); $object=new Facture($db); @@ -162,12 +165,12 @@ if ($userid) if ($userid == -1) $sql.=' AND f.fk_user_author IS NULL'; else $sql.=' AND f.fk_user_author = '.$userid; } -if ($_GET['filtre']) +if ($filtre) { - $filtrearr = explode(',', $_GET['filtre']); - foreach ($filtrearr as $fil) + $aFilter = explode(',', $filtre); + foreach ($aFilter as $filter) { - $filt = explode(':', $fil); + $filt = explode(':', $filter); $sql .= ' AND ' . trim($filt[0]) . ' = ' . trim($filt[1]); } } @@ -250,6 +253,7 @@ if ($resql) print ''; // If the user can view prospects other than his' + $moreforfilter=''; if ($user->rights->societe->client->voir || $socid) { $moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': '; @@ -310,6 +314,7 @@ if ($resql) { $var=True; $total=0; + $total_ttc=0; $totalrecu=0; while ($i < min($num,$limit)) From a4f35bbfd53647b0cde5d54a22a7df79815e09b4 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 23 Jul 2012 21:45:22 +0200 Subject: [PATCH 06/17] Fix: uniformize $mesgs --- htdocs/compta/facture.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 410c8f3bc29..4a1c6d8ebd7 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -357,7 +357,7 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu if (! $idwarehouse || $idwarehouse == -1) { $error++; - $errors[]=$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")); + $mesgs[]=$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")); $action=''; } } @@ -404,7 +404,7 @@ else if ($action == 'confirm_modif' && ((empty($conf->global->MAIN_USE_ADVANCED_ if (! $idwarehouse || $idwarehouse == -1) { $error++; - $errors[]=$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")); + $mesgs[]=$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")); $action=''; } } From 812d02ebe0c26e95c189f0a17ae617d7d8314f31 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 23 Jul 2012 22:04:06 +0200 Subject: [PATCH 07/17] Fix: strict mode and $mesgs --- htdocs/comm/fiche.php | 8 ++------ htdocs/core/lib/company.lib.php | 11 +++++++---- htdocs/societe/soc.php | 18 +++++++++--------- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index 962d15653e5..a4316343284 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -78,7 +78,7 @@ if ($action == 'setcustomeraccountancycode') $result=$object->update($object->id,$user,1,1,0); if ($result < 0) { - $mesg=join(',',$object->errors); + $mesgs[]=join(',',$object->errors); } $action=""; } @@ -158,11 +158,6 @@ if ($id > 0) dol_print_error($db,$object->error); } - if ($errmesg) - { - print "".$errmesg."
"; - } - /* * Affichage onglets */ @@ -821,6 +816,7 @@ else dol_print_error($db,'Bad value for socid parameter'); } +dol_htmloutput_mesg('',$mesgs); // End of page llxFooter(); diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index d866bd1f755..140361265f2 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -389,6 +389,7 @@ function getFormeJuridiqueLabel($code) function show_projects($conf,$langs,$db,$object,$backtopage='') { global $user; + global $bc; $i = -1 ; @@ -517,13 +518,13 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print '
'; print ''; print ""; - if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) + if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { print ''; } print ""; - $sql = "SELECT p.rowid, p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.note "; + $sql = "SELECT p.rowid, p.name, p.firstname, p.fk_pays, p.poste, p.phone, p.fax, p.email, p.note "; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p"; $sql .= " WHERE p.fk_soc = ".$object->id; $sql .= " ORDER by p.datec"; @@ -552,12 +553,14 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print ''; + $country_code = getCountry($obj->fk_pays, 2); + // Lien click to dial print ''; print ''; print ''; - if ($conf->service->enabled && $type == 1) + if (! empty($conf->service->enabled) && $type == 1) { print ''; print ''; - if ($conf->service->enabled && $type == 1) + if (! empty($conf->service->enabled) && $type == 1) { print '\n"; clearstatcache(); $workflowcodes=array( - 'WORKFLOW_PROPAL_AUTOCREATE_ORDER'=>array('enabled'=>($conf->propal->enabled && $conf->commande->enabled), 'picto'=>'order'), - 'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL'=>array('enabled'=>($conf->propal->enabled && $conf->commande->enabled), 'picto'=>'order','warning'=>'WarningCloseAlways'), - 'WORKFLOW_ORDER_AUTOCREATE_INVOICE'=>array('enabled'=>($conf->commande->enabled && $conf->facture->enabled), 'picto'=>'bill'), - 'WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER'=>array('enabled'=>($conf->facture->enabled && $conf->commande->enabled), 'picto'=>'bill','warning'=>'WarningCloseAlways'), + 'WORKFLOW_PROPAL_AUTOCREATE_ORDER'=>array('enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order'), + 'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL'=>array('enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order','warning'=>'WarningCloseAlways'), + 'WORKFLOW_ORDER_AUTOCREATE_INVOICE'=>array('enabled'=>'! empty($conf->commande->enabled) && ! empty($conf->facture->enabled)', 'picto'=>'bill'), + 'WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER'=>array('enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>'WarningCloseAlways'), ); -if (! empty($conf->modules_parts['workflow']) && is_array($conf->modules_parts['workflow'])) $workflow = array_merge($workflow, $conf->modules_parts['workflow']); +if (! empty($conf->modules_parts['workflow']) && is_array($conf->modules_parts['workflow'])) +{ + foreach($conf->modules_parts['workflow'] as $workflow) + { + $workflowcodes = array_merge($workflowcodes, $workflow); + } +} $nbqualified=0; -foreach($workflowcodes as $key => $tmparray) +foreach($workflowcodes as $key => $params) { - $picto=$tmparray['picto']; - $enabled=$tmparray['enabled']; - if (empty($enabled)) continue; + $picto=$params['picto']; + $enabled=$params['enabled']; + if (! verifCond($enabled)) continue; $nbqualified++; $var = !$var; print "\n"; print "\n"; print '
'.$langs->trans("Poste").''.$langs->trans("Tel").''.$langs->trans("Fax").''.$langs->trans("EMail").'  
'.$obj->poste.''; - print dol_print_phone($obj->phone,$obj->pays_code,$obj->rowid,$object->id,'AC_TEL'); + print dol_print_phone($obj->phone,$country_code,$obj->rowid,$object->id,'AC_TEL'); print ''; - print dol_print_phone($obj->fax,$obj->pays_code,$obj->rowid,$object->id,'AC_FAX'); + print dol_print_phone($obj->fax,$country_code,$obj->rowid,$object->id,'AC_FAX'); print ''; print dol_print_email($obj->email,$obj->rowid,$object->id,'AC_EMAIL'); diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 012aff5818f..ca9ac156ad9 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -84,20 +84,20 @@ $error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->e if (empty($reshook)) { - if ($_POST["getcustomercode"]) + if (GETPOST('getcustomercode')) { // We defined value code_client $_POST["code_client"]="Acompleter"; } - if ($_POST["getsuppliercode"]) + if (GETPOST('getsuppliercode')) { // We defined value code_fournisseur $_POST["code_fournisseur"]="Acompleter"; } // Add new third party - if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"]) + if ((! GETPOST('getcustomercode') && ! GETPOST('getsuppliercode')) && ($action == 'add' || $action == 'update') && $user->rights->societe->creer) { require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php"); @@ -1444,7 +1444,7 @@ else dol_htmloutput_errors($error,$errors); $showlogo=$object->logo; - $showbarcode=($conf->barcode->enabled && $user->rights->barcode->lire); + $showbarcode=(! empty($conf->barcode->enabled) && $user->rights->barcode->lire); print ''; @@ -1467,9 +1467,9 @@ else // Logo+barcode $rowspan=4; if (! empty($conf->global->SOCIETE_USEPREFIX)) $rowspan++; - if ($object->client) $rowspan++; - if ($conf->fournisseur->enabled && $object->fournisseur && ! empty($user->rights->fournisseur->lire)) $rowspan++; - if ($conf->global->MAIN_MODULE_BARCODE) $rowspan++; + if (! empty($object->client)) $rowspan++; + if (! empty($conf->fournisseur->enabled) && $object->fournisseur && ! empty($user->rights->fournisseur->lire)) $rowspan++; + if (! empty($conf->global->MAIN_MODULE_BARCODE)) $rowspan++; if (empty($conf->global->SOCIETE_DISABLE_STATE)) $rowspan++; $htmllogobar=''; if ($showlogo || $showbarcode) @@ -1502,7 +1502,7 @@ else } // Supplier code - if ($conf->fournisseur->enabled && $object->fournisseur && ! empty($user->rights->fournisseur->lire)) + if (! empty($conf->fournisseur->enabled) && $object->fournisseur && ! empty($user->rights->fournisseur->lire)) { print ''; // ProfId1 From c6cd17cf3fc5ae199da524068021b824f9cef391 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 24 Jul 2012 17:52:46 +0200 Subject: [PATCH 14/17] Fix: strict mode... far away --- htdocs/categories/class/categorie.class.php | 27 ++- htdocs/core/class/commonobject.class.php | 2 +- htdocs/product/class/product.class.php | 2 +- htdocs/product/fiche.php | 205 ++++++++++---------- htdocs/product/liste.php | 79 ++++---- htdocs/product/popuprop.php | 108 ++++++----- htdocs/product/reassort.php | 85 ++++---- 7 files changed, 257 insertions(+), 251 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index c0f92cc9288..b2e8bad1f03 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1084,21 +1084,28 @@ class Categorie */ function get_all_ways () { - $ways = array (); + $ways = array(); - foreach ($this->get_meres() as $mere) + $parents=$this->get_meres(); + if (! empty($parents)) { - foreach ($mere->get_all_ways() as $way) + foreach ($parents as $parent) { - $w = $way; - $w[] = $this; - - $ways[] = $w; + $allways=$parent->get_all_ways(); + if (! empty($allways)) + { + foreach ($allways as $way) + { + $w = $way; + $w[] = $this; + $ways[] = $w; + } + } } - } - if (count($ways) == 0) - $ways[0][0] = $this; + if (count($ways) == 0) + $ways[0][0] = $this; + } return $ways; } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 1811aa0575f..35e158231e4 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2055,7 +2055,7 @@ abstract class CommonObject $error=0; - if (count($this->array_options) > 0) + if (! empty($this->array_options)) { // Check parameters $langs->load('admin'); diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 88ee6d23682..68b26800d75 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -700,7 +700,7 @@ class Product extends CommonObject } if (!$this->db->query($sql2)) return -1; } - else + else if (isset($this->multilangs["$key"])) { if ($this->db->num_rows($result)) // si aucune ligne dans la base { diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index 58a62e9496b..b7694adb377 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -34,23 +34,24 @@ require_once(DOL_DOCUMENT_ROOT."/product/class/html.formproduct.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/extrafields.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/product.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/company.lib.php"); -if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php"); -if ($conf->facture->enabled) require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"); -if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php"); +if (! empty($conf->propal->enabled)) require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php"); +if (! empty($conf->facture->enabled)) require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"); +if (! empty($conf->commande->enabled)) require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php"); $langs->load("products"); $langs->load("other"); -if ($conf->stock->enabled) $langs->load("stocks"); -if ($conf->facture->enabled) $langs->load("bills"); +if (! empty($conf->stock->enabled)) $langs->load("stocks"); +if (! empty($conf->facture->enabled)) $langs->load("bills"); -$mesg=''; $error=0; $errors=array(); +$mesg=''; $error=0; $errors=array(); $_error=0; -$id = GETPOST('id', 'int'); -$ref = GETPOST('ref', 'alpha'); +$id=GETPOST('id', 'int'); +$ref=GETPOST('ref', 'alpha'); +$type=GETPOST('type','int'); $action=(GETPOST('action','alpha') ? GETPOST('action','alpha') : 'view'); $confirm=GETPOST('confirm','alpha'); $socid=GETPOST('socid','int'); -if ($user->societe_id) $socid=$user->societe_id; +if (! empty($user->societe_id)) $socid=$user->societe_id; $object = new Product($db); $extrafields = new ExtraFields($db); @@ -58,6 +59,7 @@ $extrafields = new ExtraFields($db); // Get object canvas (By default, this is not defined, so standard usage of dolibarr) $object->getCanvas($id,$ref); $canvas = $object->canvas?$object->canvas:GETPOST("canvas"); +$objcanvas=''; if (! empty($canvas)) { require_once(DOL_DOCUMENT_ROOT."/core/class/canvas.class.php"); @@ -91,7 +93,7 @@ if (empty($reshook)) if ($action == 'setfk_product_type' && $user->rights->produit->creer) { $object->fetch($id); - $result = $object->setValueFrom('fk_product_type', $_POST['fk_product_type']); + $result = $object->setValueFrom('fk_product_type', GETPOST('fk_product_type')); Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } @@ -100,7 +102,7 @@ if (empty($reshook)) if ($action == 'setfk_barcode_type' && $user->rights->barcode->creer) { $object->fetch($id); - $result = $object->setValueFrom('fk_barcode_type', $_POST['fk_barcode_type']); + $result = $object->setValueFrom('fk_barcode_type', GETPOST('fk_barcode_type')); Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } @@ -110,7 +112,7 @@ if (empty($reshook)) { $object->fetch($id); //Todo: ajout verification de la validite du code barre en fonction du type - $result = $object->setValueFrom('barcode', $_POST['barcode']); + $result = $object->setValueFrom('barcode', GETPOST('barcode')); Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } @@ -118,7 +120,7 @@ if (empty($reshook)) if ($action == 'setaccountancy_code_buy') { $object->fetch($id,$ref); - $result = $object->setValueFrom('accountancy_code_buy', $_POST['accountancy_code_buy']); + $result = $object->setValueFrom('accountancy_code_buy', GETPOST('accountancy_code_buy')); if ($result < 0) { $mesg=join(',',$object->errors); @@ -129,7 +131,7 @@ if (empty($reshook)) if ($action == 'setaccountancy_code_sell') { $object->fetch($id,$ref); - $result = $object->setValueFrom('accountancy_code_sell', $_POST['accountancy_code_sell']); + $result = $object->setValueFrom('accountancy_code_sell', GETPOST('accountancy_code_sell')); if ($result < 0) { $mesg=join(',',$object->errors); @@ -142,63 +144,59 @@ if (empty($reshook)) { $error=0; - if (empty($_POST["libelle"])) + if (GETPOST('libelle')) { $mesg='
'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Label')).'
'; $action = "create"; - $_GET["canvas"] = $_POST["canvas"]; - $_GET["type"] = $_POST["type"]; $error++; } if (empty($ref)) { $mesg='
'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Ref')).'
'; $action = "create"; - $_GET["canvas"] = $_POST["canvas"]; - $_GET["type"] = $_POST["type"]; $error++; } if (! $error) { $object->ref = $ref; - $object->libelle = $_POST["libelle"]; - $object->price_base_type = $_POST["price_base_type"]; - if ($object->price_base_type == 'TTC') $object->price_ttc = $_POST["price"]; - else $object->price = $_POST["price"]; - if ($object->price_base_type == 'TTC') $object->price_min_ttc = $_POST["price_min"]; - else $object->price_min = $_POST["price_min"]; - $object->tva_tx = str_replace('*','',$_POST['tva_tx']); - $object->tva_npr = preg_match('/\*/',$_POST['tva_tx'])?1:0; + $object->libelle = GETPOST('libelle'); + $object->price_base_type = GETPOST('price_base_type'); + if ($object->price_base_type == 'TTC') $object->price_ttc = GETPOST('price'); + else $object->price = GETPOST('price'); + if ($object->price_base_type == 'TTC') $object->price_min_ttc = GETPOST('price_min'); + else $object->price_min = GETPOST('price_min'); + $object->tva_tx = str_replace('*','',GETPOST('tva_tx')); + $object->tva_npr = preg_match('/\*/',GETPOST('tva_tx'))?1:0; // local taxes. $object->localtax1_tx = get_localtax($object->tva_tx,1); $object->localtax2_tx = get_localtax($object->tva_tx,2); - $object->type = $_POST["type"]; - $object->status = $_POST["statut"]; - $object->status_buy = $_POST["statut_buy"]; - $object->description = dol_htmlcleanlastbr($_POST["desc"]); - $object->note = dol_htmlcleanlastbr($_POST["note"]); - $object->customcode = $_POST["customcode"]; - $object->country_id = $_POST["country_id"]; - $object->duration_value = $_POST["duration_value"]; - $object->duration_unit = $_POST["duration_unit"]; - $object->seuil_stock_alerte = $_POST["seuil_stock_alerte"]?$_POST["seuil_stock_alerte"]:0; - $object->canvas = $_POST["canvas"]; - $object->weight = $_POST["weight"]; - $object->weight_units = $_POST["weight_units"]; - $object->length = $_POST["size"]; - $object->length_units = $_POST["size_units"]; - $object->surface = $_POST["surface"]; - $object->surface_units = $_POST["surface_units"]; - $object->volume = $_POST["volume"]; - $object->volume_units = $_POST["volume_units"]; - $object->finished = $_POST["finished"]; - $object->hidden = $_POST["hidden"]=='yes'?1:0; + $object->type = $type; + $object->status = GETPOST('statut'); + $object->status_buy = GETPOST('statut_buy'); + $object->description = dol_htmlcleanlastbr(GETPOST('desc')); + $object->note = dol_htmlcleanlastbr(GETPOST('note')); + $object->customcode = GETPOST('customcode'); + $object->country_id = GETPOST('country_id'); + $object->duration_value = GETPOST('duration_value'); + $object->duration_unit = GETPOST('duration_unit'); + $object->seuil_stock_alerte = GETPOST('seuil_stock_alerte')?GETPOST('seuil_stock_alerte'):0; + $object->canvas = GETPOST('canvas'); + $object->weight = GETPOST('weight'); + $object->weight_units = GETPOST('weight_units'); + $object->length = GETPOST('size'); + $object->length_units = GETPOST('size_units'); + $object->surface = GETPOST('surface'); + $object->surface_units = GETPOST('surface_units'); + $object->volume = GETPOST('volume'); + $object->volume_units = GETPOST('volume_units'); + $object->finished = GETPOST('finished'); + $object->hidden = GETPOST('hidden')=='yes'?1:0; // MultiPrix - if($conf->global->PRODUIT_MULTIPRICES) + if (! empty($conf->global->PRODUIT_MULTIPRICES)) { for($i=2;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++) { @@ -234,7 +232,6 @@ if (empty($reshook)) { $mesg='
'.$langs->trans($object->error).'
'; $action = "create"; - $_GET["type"] = $_POST["type"]; } } } @@ -242,7 +239,7 @@ if (empty($reshook)) // Update a product or service if ($action == 'update' && ($user->rights->produit->creer || $user->rights->service->creer)) { - if (! empty($_POST["cancel"])) + if (GETPOST('cancel')) { $action = ''; } @@ -253,27 +250,27 @@ if (empty($reshook)) $object->oldcopy=dol_clone($object); $object->ref = $ref; - $object->libelle = $_POST["libelle"]; - $object->description = dol_htmlcleanlastbr($_POST["desc"]); - $object->note = dol_htmlcleanlastbr($_POST["note"]); - $object->customcode = $_POST["customcode"]; - $object->country_id = $_POST["country_id"]; - $object->status = $_POST["statut"]; - $object->status_buy = $_POST["statut_buy"]; - $object->seuil_stock_alerte = $_POST["seuil_stock_alerte"]; - $object->duration_value = $_POST["duration_value"]; - $object->duration_unit = $_POST["duration_unit"]; - $object->canvas = $_POST["canvas"]; - $object->weight = $_POST["weight"]; - $object->weight_units = $_POST["weight_units"]; - $object->length = $_POST["size"]; - $object->length_units = $_POST["size_units"]; - $object->surface = $_POST["surface"]; - $object->surface_units = $_POST["surface_units"]; - $object->volume = $_POST["volume"]; - $object->volume_units = $_POST["volume_units"]; - $object->finished = $_POST["finished"]; - $object->hidden = $_POST["hidden"]=='yes'?1:0; + $object->libelle = GETPOST('libelle'); + $object->description = dol_htmlcleanlastbr(GETPOST('desc')); + $object->note = dol_htmlcleanlastbr(GETPOST('note')); + $object->customcode = GETPOST('customcode'); + $object->country_id = GETPOST('country_id'); + $object->status = GETPOST('statut'); + $object->status_buy = GETPOST('statut_buy'); + $object->seuil_stock_alerte = GETPOST('seuil_stock_alerte'); + $object->duration_value = GETPOST('duration_value'); + $object->duration_unit = GETPOST('duration_unit'); + $object->canvas = GETPOST('canvas'); + $object->weight = GETPOST('weight'); + $object->weight_units = GETPOST('weight_units'); + $object->length = GETPOST('size'); + $object->length_units = GETPOST('size_units'); + $object->surface = GETPOST('surface'); + $object->surface_units = GETPOST('surface_units'); + $object->volume = GETPOST('volume'); + $object->volume_units = GETPOST('volume_units'); + $object->finished = GETPOST('finished'); + $object->hidden = GETPOST('hidden')=='yes'?1:0; // Get extra fields foreach($_POST as $key => $value) @@ -348,7 +345,7 @@ if (empty($reshook)) { $db->rollback(); - $_error = 1; + $_error++; $action = ""; $mesg='
'.$langs->trans("ErrorProductAlreadyExists",$object->ref); @@ -403,7 +400,7 @@ if (empty($reshook)) if ($action == 'addinpropal') { $propal = new Propal($db); - $result=$propal->fetch($_POST["propalid"]); + $result=$propal->fetch(GETPOST('propalid')); if ($result <= 0) { dol_print_error($db,$propal->error); @@ -462,12 +459,12 @@ if (empty($reshook)) $propal->id, $desc, $pu_ht, - $_POST["qty"], + GETPOST('qty'), $tva_tx, $localtax1_tx, // localtax1 $localtax2_tx, // localtax2 $prod->id, - $_POST["remise_percent"], + GETPOST('remise_percent'), $price_base_type, $pu_ttc ); @@ -484,7 +481,7 @@ if (empty($reshook)) if ($action == 'addincommande') { $commande = new Commande($db); - $result=$commande->fetch($_POST["commandeid"]); + $result=$commande->fetch(GETPOST('commandeid')); if ($result <= 0) { dol_print_error($db,$commande->error); @@ -544,12 +541,12 @@ if (empty($reshook)) $commande->id, $desc, $pu_ht, - $_POST["qty"], + GETPOST('qty'), $tva_tx, $localtax1_tx, // localtax1 $localtax2_tx, // localtax2 $prod->id, - $_POST["remise_percent"], + GETPOST('remise_percent'), '', '', // TODO voir si fk_remise_except est encore valable car n'apparait plus dans les propales $price_base_type, @@ -567,7 +564,7 @@ if (empty($reshook)) if ($action == 'addinfacture' && $user->rights->facture->creer) { $facture = New Facture($db); - $result=$facture->fetch($_POST["factureid"]); + $result=$facture->fetch(GETPOST('factureid')); if ($result <= 0) { dol_print_error($db,$facture->error); @@ -626,12 +623,12 @@ if (empty($reshook)) $facture->id, $desc, $pu_ht, - $_POST["qty"], + GETPOST('qty'), $tva_tx, $localtax1_tx, $localtax2_tx, $prod->id, - $_POST["remise_percent"], + GETPOST('remise_percent'), '', '', '', @@ -697,9 +694,9 @@ else print '
'; print ''; print ''; - print ''."\n"; + print ''."\n"; - if ($_GET["type"]==1) $title=$langs->trans("NewService"); + if ($type==1) $title=$langs->trans("NewService"); else $title=$langs->trans("NewProduct"); print_fiche_titre($title); @@ -708,32 +705,32 @@ else print '
'; print $langs->trans('SupplierCode').''; @@ -1514,7 +1514,7 @@ else } // Barcode - if ($conf->global->MAIN_MODULE_BARCODE) + if (! empty($conf->global->MAIN_MODULE_BARCODE)) { print '
'; print $langs->trans('Gencod').''.$object->barcode; From 6fc9bf5143cd1bcb08495dbb331d03f629464154 Mon Sep 17 00:00:00 2001 From: FHenry Date: Tue, 24 Jul 2012 10:18:17 +0200 Subject: [PATCH 08/17] Correct mail tag __UNSUSCRIBE__ to __UNSUBSCRIBE__ --- htdocs/comm/mailing/fiche.php | 6 +++--- scripts/emailings/cron-mailing-send.php | 2 +- scripts/emailings/mailing-send.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php index 6fe06660139..e7ed17f5e04 100644 --- a/htdocs/comm/mailing/fiche.php +++ b/htdocs/comm/mailing/fiche.php @@ -72,7 +72,7 @@ if ($conf->global->MAILING_EMAIL_UNSUBSCRIBE) $object->substitutionarray, array( '__CHECK_READ__' => 'CheckMail', - '__UNSUSCRIBE__' => 'Unsubscribe' + '__UNSUBSCRIBE__' => 'Unsubscribe' ) ); } @@ -97,7 +97,7 @@ if ($conf->global->MAILING_EMAIL_UNSUBSCRIBE) $object->substitutionarrayfortest, array( '__CHECK_READ__' => 'TESTCheckMail', - '__UNSUSCRIBE__' => 'TESTUnsubscribe' + '__UNSUBSCRIBE__' => 'TESTUnsubscribe' ) ); } @@ -224,7 +224,7 @@ if ($action == 'sendallconfirmed' && $confirm == 'yes') '__ID__' => $obj->source_id, '__EMAIL__' => $obj->email, '__CHECK_READ__' => '', - '__UNSUSCRIBE__' => ''.$langs->trans("MailUnsubcribe").'', + '__UNSUBSCRIBE__' => ''.$langs->trans("MailUnsubcribe").'', '__MAILTOEMAIL__' => ''.$obj->email.'', '__LASTNAME__' => $obj->nom, '__FIRSTNAME__' => $obj->prenom, diff --git a/scripts/emailings/cron-mailing-send.php b/scripts/emailings/cron-mailing-send.php index a100a415651..61ba222e2ef 100644 --- a/scripts/emailings/cron-mailing-send.php +++ b/scripts/emailings/cron-mailing-send.php @@ -133,7 +133,7 @@ if ($resql) '__ID__' => $obj2->source_id, '__EMAIL__' => $obj2->email, '__CHECK_READ__' => '', - '__UNSUSCRIBE__' => ''.$langs->trans("MailUnsubcribe").'', + '__UNSUBSCRIBE__' => ''.$langs->trans("MailUnsubcribe").'', '__MAILTOEMAIL__' => ''.$obj2->email.'', '__LASTNAME__' => $obj2->lastname, '__FIRSTNAME__' => $obj2->firstname, diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index b7de64e74ca..abb2667f458 100644 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -140,7 +140,7 @@ if ($resql) '__ID__' => $obj->source_id, '__EMAIL__' => $obj->email, '__CHECK_READ__' => '', - '__UNSUSCRIBE__' => ''.$langs->trans("MailUnsubcribe").'', + '__UNSUBSCRIBE__' => ''.$langs->trans("MailUnsubcribe").'', '__MAILTOEMAIL__' => ''.$obj->email.'', '__LASTNAME__' => $obj->lastname, '__FIRSTNAME__' => $obj->firstname, From 3892c2cecab30cb40be0797158314384e4f6278e Mon Sep 17 00:00:00 2001 From: FHenry Date: Tue, 24 Jul 2012 13:24:22 +0200 Subject: [PATCH 09/17] Usubscribe mailling module - Correct indentation --- htdocs/core/modules/mailings/modules_mailings.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/mailings/modules_mailings.php b/htdocs/core/modules/mailings/modules_mailings.php index 44ad66059a8..951972d9b30 100644 --- a/htdocs/core/modules/mailings/modules_mailings.php +++ b/htdocs/core/modules/mailings/modules_mailings.php @@ -158,7 +158,9 @@ class MailingTargets // This can't be abstract as it is used for some method $sql .= " (fk_mailing,"; $sql .= " fk_contact,"; $sql .= " nom, prenom, email, other, source_url, source_id,"; - if (! empty($conf->global->MAILING_EMAIL_UNSUBSCRIBE)) $sql .= " tag,"; + if (! empty($conf->global->MAILING_EMAIL_UNSUBSCRIBE)) { + $sql .= " tag,"; + } $sql.= " source_type)"; $sql .= " VALUES (".$mailing_id.","; $sql .= (empty($cibles[$i]['fk_contact']) ? '0' : "'".$cibles[$i]['fk_contact']."'") .","; @@ -168,7 +170,9 @@ class MailingTargets // This can't be abstract as it is used for some method $sql .= "'".$this->db->escape($cibles[$i]['other'])."',"; $sql .= "'".$this->db->escape($cibles[$i]['source_url'])."',"; $sql .= "'".$this->db->escape($cibles[$i]['source_id'])."',"; - if (! empty($conf->global->MAILING_EMAIL_UNSUBSCRIBE)) $sql .= "'".$this->db->escape(md5($cibles[$i]['email'].';'.$cibles[$i]['name'].';'.$mailing_id.';'.$conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY))."',"; + if (! empty($conf->global->MAILING_EMAIL_UNSUBSCRIBE)) { + $sql .= "'".$this->db->escape(md5($cibles[$i]['email'].';'.$cibles[$i]['name'].';'.$mailing_id.';'.$conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY))."',"; + } $sql .= "'".$this->db->escape($cibles[$i]['source_type'])."')"; $result=$this->db->query($sql); if ($result) From 8f2efa4879a6c8fb68722b35bcceabb36887e25b Mon Sep 17 00:00:00 2001 From: FHenry Date: Tue, 24 Jul 2012 14:25:21 +0200 Subject: [PATCH 10/17] Add syslog for debug --- htdocs/core/modules/mailings/modules_mailings.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/modules/mailings/modules_mailings.php b/htdocs/core/modules/mailings/modules_mailings.php index 951972d9b30..e7635e808d6 100644 --- a/htdocs/core/modules/mailings/modules_mailings.php +++ b/htdocs/core/modules/mailings/modules_mailings.php @@ -193,6 +193,7 @@ class MailingTargets // This can't be abstract as it is used for some method } } + dol_syslog(get_class($this)."::add_to_target: sql ".$sql,LOG_DEBUG); dol_syslog(get_class($this)."::add_to_target: mailing ".$j." targets added"); //Update the status to show thirdparty mail that don't want to be contacted anymore' From a2b6abcb8524212a57e4dc36bbbd9977f6a61252 Mon Sep 17 00:00:00 2001 From: FHenry Date: Tue, 24 Jul 2012 14:33:27 +0200 Subject: [PATCH 11/17] Fix nb mailling message receive according toher status than error or not send --- htdocs/contact/class/contact.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index d9b69e35fcf..6e03e4c5eae 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -805,8 +805,12 @@ class Contact extends CommonObject $sql = "SELECT count(mc.email) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc"; $sql.= " WHERE mc.email = '".$this->db->escape($this->email)."'"; - $sql.= " AND mc.statut=1"; // -1 erreur, 0 non envoye, 1 envoye avec succes + $sql.= " AND mc.statut NOT IN (-1,0)"; // -1 erreur, 0 non envoye, 1 envoye avec succes + + dol_syslog(get_class($this)."::getNbOfEMailings sql=".$sql, LOG_DEBUG); + $resql=$this->db->query($sql); + if ($resql) { $obj = $this->db->fetch_object($resql); From 24c54ccaf1bbd5323cbbdbb977684b4b05cfa048 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 Jul 2012 16:19:46 +0200 Subject: [PATCH 12/17] Start to work on bug export --- htdocs/core/modules/modFacture.class.php | 2 ++ htdocs/exports/class/export.class.php | 8 ++++--- htdocs/exports/export.php | 30 ++++++++++++++++-------- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index 7990893036a..577107a3586 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -176,6 +176,7 @@ class modFacture extends DolibarrModules $this->export_permission[$r]=array(array("facture","facture","export")); $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','c.code'=>'CountryCode','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note'=>"NotePrivate",'f.note_public'=>"NotePublic",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalVAT",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.product_type'=>"TypeOfLineServiceOrProduct",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel'); $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','c.code'=>'company','s.tel'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'f.note_public'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.price'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product'); + $this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s'; @@ -193,6 +194,7 @@ class modFacture extends DolibarrModules $this->export_permission[$r]=array(array("facture","facture","export")); $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','c.code'=>'CountryCode','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note'=>"NotePrivate",'f.note_public'=>"NotePublic",'p.rowid'=>'PaymentId','pf.amount'=>'AmountPayment','p.datep'=>'DatePayment','p.num_paiement'=>'PaymentNumber'); $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','c.code'=>'company','s.tel'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'f.note_public'=>"invoice",'p.rowid'=>'payment','pf.amount'=>'payment','p.datep'=>'payment','p.num_paiement'=>'payment'); + $this->export_dependencies_array[$r]=array('payment'=>'p.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s'; diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index bc4b9ee1265..013e41e2fea 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -24,8 +24,7 @@ /** - * \class Export - * \brief Class to manage exports + * Class to manage exports */ class Export { @@ -36,7 +35,8 @@ class Export var $array_export_label=array(); // Tableau de "libelle de lots" var $array_export_sql=array(); // Tableau des "requetes sql" var $array_export_fields=array(); // Tableau des listes de champ+libelle a exporter - //var $array_export_alias=array(); // Tableau des listes de champ+alias a exporter + var $array_export_entities=array(); // Tableau des listes de champ+alias a exporter + var $array_export_dependencies=array(); // array of list of entities that must take care of the DISTINCT if a field is added into export var $array_export_special=array(); // Tableau des operations speciales sur champ // To store export modules @@ -162,6 +162,8 @@ class Export $this->array_export_fields[$i]=$module->export_fields_array[$r]; // Tableau des entites a exporter (cle=champ, valeur=entite) $this->array_export_entities[$i]=$module->export_entities_array[$r]; + // Tableau des entites qui requiert abandon du DISTINCT (cle=entite, valeur=champ id child records) + $this->array_export_dependencies[$i]=$module->export_dependencies_array[$r]; // Tableau des operations speciales sur champ $this->array_export_special[$i]=$module->export_special_array[$r]; diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index 0670724d264..3fca99ee8fc 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -64,12 +64,13 @@ $entitytolang=array( // Translation code ); $array_selected=isset($_SESSION["export_selected_fields"])?$_SESSION["export_selected_fields"]:array(); -$datatoexport=isset($_GET["datatoexport"])? $_GET["datatoexport"] : (isset($_POST["datatoexport"])?$_POST["datatoexport"]:''); -$action=isset($_GET["action"]) ? $_GET["action"] : (isset($_POST["action"])?$_POST["action"]:''); -$step=isset($_GET["step"])? $_GET["step"] : (isset($_POST["step"])?$_POST["step"]:1); -$export_name=isset($_POST["export_name"])? $_POST["export_name"] : ''; -$hexa=isset($_POST["hexa"])? $_POST["hexa"] : ''; -$exportmodelid=isset($_POST["exportmodelid"])? $_POST["exportmodelid"] : ''; +$datatoexport=GETPOST("datatoexport"); +$action=GETPOST("action"); +$step=GETPOST("step")?GETPOST("step"):1; +$export_name=GETPOST("export_name"); +$hexa=GETPOST("hexa"); +$exportmodelid=GETPOST("exportmodelid"); +$field=GETPOST("field"); $objexport=new Export($db); $objexport->load_arrays($user,$datatoexport); @@ -87,12 +88,15 @@ $sqlusedforexport=''; if ($action=='selectfield') { - if ($_GET["field"]=='all') + $fieldsarray=$objexport->array_export_fields[0]; + $fieldsentitiesarray=$objexport->array_export_entities[0]; + $fieldsdependenciesarray=$objexport->array_export_dependencies[0]; + + if ($field=='all') { - $fieldsarray=$objexport->array_export_fields[0]; foreach($fieldsarray as $key=>$val) { - if (! empty($array_selected[$key])) continue; // If already selected, select next + if (! empty($array_selected[$key])) continue; // If already selected, check next $array_selected[$key]=count($array_selected)+1; //print_r($array_selected); $_SESSION["export_selected_fields"]=$array_selected; @@ -100,7 +104,13 @@ if ($action=='selectfield') } else { - $array_selected[$_GET["field"]]=count($array_selected)+1; + $array_selected[$field]=count($array_selected)+1; // We tag the key $field as "selected" + // We check if there is a dependency + if (! empty($fieldsdependenciesarray[$fieldsentitiesarray[$field]])) + { + // TODO Show warning "risk of duplicate record filtered" + + } //print_r($array_selected); $_SESSION["export_selected_fields"]=$array_selected; } From b3ca7376625cbbf92f91e22234c771dff35c7c08 Mon Sep 17 00:00:00 2001 From: FHenry Date: Tue, 24 Jul 2012 17:33:26 +0200 Subject: [PATCH 13/17] remove useless parameters --- htdocs/admin/company.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 3e995d780be..c0c1fcba460 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -740,7 +740,7 @@ else // Forme juridique $var=!$var; print '
'.$langs->trans("JuridicalStatus").''; - print getFormeJuridiqueLabel($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE,1); + print getFormeJuridiqueLabel($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE); print '
'; print ''; print ''; // Label - print ''; + print ''; // On sell print ''; // To buy print ''; // Stock min level - if ($_GET["type"] != 1 && $conf->stock->enabled) + if ($type != 1 && $conf->stock->enabled) { print ''; } else @@ -745,24 +742,24 @@ else print '"; // Nature - if ($_GET["type"] != 1) + if ($type != 1) { print ''; } // Duration - if ($_GET["type"] == 1) + if ($type == 1) { - print ''; } - if ($_GET["type"] != 1) // Le poids et le volume ne concerne que les produits et pas les services + if ($type != 1) // Le poids et le volume ne concerne que les produits et pas les services { // Weight print ''; // Length print ''; // Surface print ''; // Volume print ''; } // Customs code - print ''; + print ''; // Origin country print ''; @@ -811,7 +808,7 @@ else { foreach($extrafields->attribute_label as $key=>$label) { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); + $value=(GETPOST('options_'.$key)?GETPOST('options_'.$key):$object->array_options["options_".$key]); print ''."\n"; @@ -821,7 +818,7 @@ else // Note (private, no output on invoices, propales...) print '"; diff --git a/htdocs/product/liste.php b/htdocs/product/liste.php index 11c9b8eb456..2c2a0a5b469 100644 --- a/htdocs/product/liste.php +++ b/htdocs/product/liste.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2005-2012 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 @@ -27,7 +27,8 @@ require("../main.inc.php"); require_once(DOL_DOCUMENT_ROOT.'/product/class/product.class.php'); require_once(DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.product.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php"); -if ($conf->categorie->enabled) require_once(DOL_DOCUMENT_ROOT."/categories/class/categorie.class.php"); +if (! empty($conf->categorie->enabled)) + require_once(DOL_DOCUMENT_ROOT."/categories/class/categorie.class.php"); $langs->load("products"); $langs->load("stocks"); @@ -43,6 +44,7 @@ $search_categ = GETPOST("search_categ",'int'); $tosell = GETPOST("tosell"); $tobuy = GETPOST("tobuy"); $fourn_id = GETPOST("fourn_id",'int'); +$catid = GETPOST('catid','int'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); @@ -59,7 +61,8 @@ $limit = $conf->liste_limit; // Get object canvas (By default, this is not defined, so standard usage of dolibarr) //$object->getCanvas($id); -$canvas = GETPOST("canvas"); +$canvas=GETPOST("canvas"); +$objcanvas=''; if (! empty($canvas)) { require_once(DOL_DOCUMENT_ROOT."/core/class/canvas.class.php"); @@ -85,12 +88,6 @@ if (isset($_POST["button_removefilter_x"])) $search_categ=0; } -if ($conf->categorie->enabled && GETPOST('catid')) -{ - $catid = GETPOST('catid','int'); -} - - /* * View @@ -108,7 +105,7 @@ else { $title=$langs->trans("ProductsAndServices"); - if (isset($_GET["type"])) + if (isset($type)) { if ($type==1) { @@ -129,7 +126,7 @@ else $sql.= ' p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte,'; $sql.= ' MIN(pfp.unitprice) as minsellprice'; $sql.= ' FROM '.MAIN_DB_PREFIX.'product as p'; - if ($search_categ || $catid) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; // We'll need this table joined to the select in order to filter by categ + if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; // We'll need this table joined to the select in order to filter by categ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; $sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')'; if ($sall) $sql.= " AND (p.ref LIKE '%".$db->escape($sall)."%' OR p.label LIKE '%".$db->escape($sall)."%' OR p.description LIKE '%".$db->escape($sall)."%' OR p.note LIKE '%".$db->escape($sall)."%')"; @@ -146,7 +143,7 @@ else if (isset($tobuy) && dol_strlen($tobuy) > 0) $sql.= " AND p.tobuy = ".$db->escape($tobuy); if (dol_strlen($canvas) > 0) $sql.= " AND p.canvas = '".$db->escape($canvas)."'"; if ($catid > 0) $sql.= " AND cp.fk_categorie = ".$catid; - if ($catid == -2) $sql.= " AND cp.fk_categorie IS NULL"; + if ($catid == -2) $sql.= " AND cp.fk_categorie IS NULL"; if ($search_categ > 0) $sql.= " AND cp.fk_categorie = ".$search_categ; if ($search_categ == -2) $sql.= " AND cp.fk_categorie IS NULL"; if ($fourn_id > 0) $sql.= " AND pfp.fk_soc = ".$fourn_id; @@ -173,13 +170,16 @@ else } $helpurl=''; - if (isset($_GET["type"]) && $_GET["type"] == 0) + if (isset($type)) { - $helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; - } - if (isset($_GET["type"]) && $_GET["type"] == 1) - { - $helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; + if ($type == 0) + { + $helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; + } + else if ($type == 1) + { + $helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; + } } llxHeader('',$title,$helpurl,''); @@ -193,16 +193,16 @@ else $param.=isset($type)?"&type=".$type:""; print_barre_liste($texte, $page, "liste.php", $param, $sortfield, $sortorder,'',$num); - if (isset($catid)) + if (! empty($catid)) { print "
"; - $c = new Categorie($db, $catid); + $c = new Categorie($db); $ways = $c->print_all_ways(' > ','product/liste.php'); print " > ".$ways[0]."
\n"; print "

"; } - if (!empty($_GET["canvas"]) && file_exists(DOL_DOCUMENT_ROOT.'/product/canvas/'.$_GET["canvas"].'/actions_card_'.$_GET["canvas"].'.class.php')) + if (! empty($canvas) && file_exists(DOL_DOCUMENT_ROOT.'/product/canvas/'.$canvas.'/actions_card_'.$canvas.'.class.php')) { $fieldlist = $object->field_list; $datas = $object->list_datas; @@ -211,14 +211,14 @@ else $title_text = $title; // Default templates directory - $template_dir = DOL_DOCUMENT_ROOT . '/product/canvas/'.$_GET["canvas"].'/tpl/'; + $template_dir = DOL_DOCUMENT_ROOT . '/product/canvas/'.$canvas.'/tpl/'; // Check if a custom template is present - if (file_exists(DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/tpl/product/'.$_GET["canvas"].'/list.tpl.php')) + if (file_exists(DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/tpl/product/'.$canvas.'/list.tpl.php')) { - $template_dir = DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/tpl/product/'.$_GET["canvas"].'/'; + $template_dir = DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/tpl/product/'.$canvas.'/'; } - include($template_dir.'list.tpl.php'); // Include native PHP templates + include($template_dir.'list.tpl.php'); // Include native PHP templates } else { @@ -233,7 +233,7 @@ else // Filter on categories $moreforfilter=''; - if ($conf->categorie->enabled) + if (! empty($conf->categorie->enabled)) { $moreforfilter.=$langs->trans('Categories'). ': '; $moreforfilter.=$htmlother->select_categories(0,$search_categ,'search_categ',1); @@ -251,12 +251,12 @@ else print "
"; print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label",$param,"","",$sortfield,$sortorder); - if ($conf->barcode->enabled) print_liste_field_titre($langs->trans("BarCode"), $_SERVER["PHP_SELF"], "p.barcode",$param,'','',$sortfield,$sortorder); + if (! empty($conf->barcode->enabled)) print_liste_field_titre($langs->trans("BarCode"), $_SERVER["PHP_SELF"], "p.barcode",$param,'','',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateModification"), $_SERVER["PHP_SELF"], "p.tms",$param,"",'align="center"',$sortfield,$sortorder); - if ($conf->service->enabled && $type != 0) print_liste_field_titre($langs->trans("Duration"), $_SERVER["PHP_SELF"], "p.duration",$param,"",'align="center"',$sortfield,$sortorder); + if (! empty($conf->service->enabled) && $type != 0) print_liste_field_titre($langs->trans("Duration"), $_SERVER["PHP_SELF"], "p.duration",$param,"",'align="center"',$sortfield,$sortorder); if (empty($conf->global->PRODUIT_MULTIPRICES)) print_liste_field_titre($langs->trans("SellingPrice"), $_SERVER["PHP_SELF"], "p.price",$param,"",'align="right"',$sortfield,$sortorder); print ''; - if ($conf->stock->enabled && $user->rights->stock->lire && $type != 1) print ''; + if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) print ''; print_liste_field_titre($langs->trans("Sell"), $_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Buy"), $_SERVER["PHP_SELF"], "p.tobuy",$param,"",'align="right"',$sortfield,$sortorder); print "\n"; @@ -269,7 +269,7 @@ else print ''; - if ($conf->barcode->enabled) + if (! empty($conf->barcode->enabled)) { print ''; // Duration - if ($conf->service->enabled && $type != 0) + if (! empty($conf->service->enabled) && $type != 0) { print ''; // Stock - if ($conf->stock->enabled && $user->rights->stock->lire && $type != 1) + if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) { print ''; // Barcode - if ($conf->barcode->enabled) + if (! empty($conf->barcode->enabled)) { print ''; } @@ -368,7 +368,7 @@ else print '\n"; // Duration - if ($conf->service->enabled && $type != 0) + if (! empty($conf->service->enabled) && $type != 0) { print ''; // Show stock - if ($conf->stock->enabled && $user->rights->stock->lire && $type != 1) + if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) { if ($objp->fk_product_type != 1) { @@ -435,7 +435,7 @@ else if ($num > $conf->liste_limit) { - if ($sref || $snom || $sall || $sbarcode || $_POST["search"]) + if ($sref || $snom || $sall || $sbarcode || GETPOST('search')) { print_barre_liste('', $page, "liste.php", "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num); } @@ -458,7 +458,6 @@ else } -$db->close(); - llxFooter(); +$db->close(); ?> diff --git a/htdocs/product/popuprop.php b/htdocs/product/popuprop.php index af75586dc21..70ca91c4f8c 100644 --- a/htdocs/product/popuprop.php +++ b/htdocs/product/popuprop.php @@ -2,7 +2,7 @@ /* Copyright (C) 2001-2003 Rodolphe Quiedeville * Copyright (C) 2004-2005 Laurent Destailleur * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005-2010 Regis Houssin + * Copyright (C) 2005-2012 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 @@ -27,13 +27,15 @@ require("../main.inc.php"); require_once(DOL_DOCUMENT_ROOT.'/product/class/product.class.php'); +$type=GETPOST("type","int"); + // Security check -if ($user->societe_id) $socid=$user->societe_id; +if (! empty($user->societe_id)) $socid=$user->societe_id; $result=restrictedArea($user,'produit|service'); -$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"]; -$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"]; -$page = $_GET["page"]; +$sortfield = GETPOST("sortfield",'alpha'); +$sortorder = GETPOST("sortorder",'alpha'); +$page = GETPOST("page",'int'); if ($page < 0) $page = 0; if (! $sortfield) $sortfield="c"; if (! $sortorder) $sortorder="DESC"; @@ -51,22 +53,22 @@ $staticproduct=new Product($db); */ $helpurl=''; -if (isset($_GET["type"]) && $_GET["type"] == 0) +if ($type == 0) { $helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; } -if (isset($_GET["type"]) && $_GET["type"] == 1) +else if ($type == 1) { $helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; } -llxHeader('',$title,$helpurl,''); +llxHeader('','',$helpurl); //On n'affiche le lien page suivante que s'il y a une page suivante ... $sql = "SELECT count(*) as c"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; $sql.= ' WHERE entity IN ('.getEntity('product', 1).')'; -if (isset($_GET['type'])) $sql.= " AND fk_product_type = ".$_GET['type']; +if (isset($type)) $sql.= " AND fk_product_type = ".$type; $result=$db->query($sql); if ($result) @@ -77,11 +79,11 @@ if ($result) $param = ''; $title = $langs->trans("ListProductServiceByPopularity"); -if (isset($_GET['type'])) +if (isset($type)) { - $param = '&type='.$_GET['type']; + $param = '&type='.$type; $title = $langs->trans("ListProductByPopularity"); - if ($_GET['type'] == 1) $title = $langs->trans("ListServiceByPopularity"); + if ($type == 1) $title = $langs->trans("ListServiceByPopularity"); } print_barre_liste($title, $page, "popuprop.php",$param,"","","",$num); @@ -101,7 +103,7 @@ $sql.= " FROM ".MAIN_DB_PREFIX."propaldet as pd"; $sql.= ", ".MAIN_DB_PREFIX."product as p"; $sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')'; $sql.= " AND p.rowid = pd.fk_product"; -if (isset($_GET['type'])) $sql.= " AND fk_product_type = ".$_GET['type']; +if (isset($type)) $sql.= " AND fk_product_type = ".$type; $sql.= " GROUP BY (p.rowid)"; $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit, $offset); @@ -109,52 +111,54 @@ $sql.= $db->plimit($limit, $offset); $result=$db->query($sql); if ($result) { - $num = $db->num_rows($result); - $i = 0; + $num = $db->num_rows($result); + $i = 0; - $var=True; - while ($i < $num) - { - $objp = $db->fetch_object($result); + $var=True; + while ($i < $num) + { + $objp = $db->fetch_object($result); - // Multilangs - if ($conf->global->MAIN_MULTILANGS) // si l'option est active - { - $sql = "SELECT label"; - $sql.= " FROM ".MAIN_DB_PREFIX."product_lang"; - $sql.= " WHERE fk_product=".$objp->rowid; - $sql.= " AND lang='". $langs->getDefaultLang() ."'"; - $sql.= " LIMIT 1"; + // Multilangs + if (! empty($conf->global->MAIN_MULTILANGS)) // si l'option est active + { + $sql = "SELECT label"; + $sql.= " FROM ".MAIN_DB_PREFIX."product_lang"; + $sql.= " WHERE fk_product=".$objp->rowid; + $sql.= " AND lang='". $langs->getDefaultLang() ."'"; + $sql.= " LIMIT 1"; - $resultp = $db->query($sql); - if ($resultp) - { - $objtp = $db->fetch_object($resultp); - if ($objtp->label != '') $objp->label = $objtp->label; - } - } + $resultp = $db->query($sql); + if ($resultp) + { + $objtp = $db->fetch_object($resultp); + if (! empty($objtp->label)) $objp->label = $objtp->label; + } + } - $var=!$var; - print ""; - print ''; - print ''; - print ''; - print ''; - print "\n"; - $i++; - } - $db->free(); + $var=!$var; + print ""; + print ''; + print ''; + print ''; + print ''; + print "\n"; + $i++; + } + + $db->free(); } + print "
'.$langs->trans("Ref").''; - if ($_error == 1) + if ($_error) { print $langs->trans("RefAlreadyExists"); } print '
'.$langs->trans("Label").'
'.$langs->trans("Label").'
'.$langs->trans("Status").' ('.$langs->trans("Sell").')'; $statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell")); - print $form->selectarray('statut',$statutarray,$_POST["statut"]); + print $form->selectarray('statut',$statutarray,GETPOST('statut')); print '
'.$langs->trans("Status").' ('.$langs->trans("Buy").')'; $statutarray=array('1' => $langs->trans("ProductStatusOnBuy"), '0' => $langs->trans("ProductStatusNotOnBuy")); - print $form->selectarray('statut_buy',$statutarray,$_POST["statut_buy"]); + print $form->selectarray('statut_buy',$statutarray,GETPOST('statut_buy"')); print '
'.$langs->trans("StockLimit").''; - print ''; + print ''; print '
'.$langs->trans("Description").''; require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php"); - $doleditor=new DolEditor('desc',$_POST["desc"],'',160,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,4,90); + $doleditor=new DolEditor('desc',GETPOST('desc'),'',160,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,4,90); $doleditor->Create(); print "
'.$langs->trans("Nature").''; $statutarray=array('1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial")); - print $form->selectarray('finished',$statutarray,$_POST["finished"]); + print $form->selectarray('finished',$statutarray,GETPOST('finished')); print '
'.$langs->trans("Duration").'  '; + print '
'.$langs->trans("Duration").'  '; print ''.$langs->trans("Hour").' '; print ''.$langs->trans("Day").' '; print ''.$langs->trans("Week").' '; @@ -771,36 +768,36 @@ else print '
'.$langs->trans("Weight").''; - print ''; + print ''; print $formproduct->select_measuring_units("weight_units","weight"); print '
'.$langs->trans("Length").''; - print ''; + print ''; print $formproduct->select_measuring_units("size_units","size"); print '
'.$langs->trans("Surface").''; - print ''; + print ''; print $formproduct->select_measuring_units("surface_units","surface"); print '
'.$langs->trans("Volume").''; - print ''; + print ''; print $formproduct->select_measuring_units("volume_units","volume"); print '
'.$langs->trans("CustomCode").'
'.$langs->trans("CustomCode").'
'.$langs->trans("CountryOrigin").''; - print $form->select_country($_POST["country_id"],'country_id'); + print $form->select_country(GETPOST('country_id','int'),'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); print '
'.$label.''; print $extrafields->showInputField($key,$value); print '
'.$langs->trans("NoteNotVisibleOnBill").''; require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php"); - $doleditor=new DolEditor('note',$_POST["note"],'',180,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,8,70); + $doleditor=new DolEditor('note',GETPOST('note'),'',180,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,8,70); $doleditor->Create(); print "
'.$langs->trans("BuyingPriceMinShort").''.$langs->trans("PhysicalStock").''.$langs->trans("PhysicalStock").'
'; print ''; print ''; print ''; @@ -280,7 +280,7 @@ else print ''; print ' '; @@ -301,7 +301,7 @@ else print ''; print ' '; @@ -328,7 +328,7 @@ else $objp = $db->fetch_object($resql); // Multilangs - if ($conf->global->MAIN_MULTILANGS) // si l'option est active + if (! empty($conf->global->MAIN_MULTILANGS)) // si l'option est active { $sql = "SELECT label"; $sql.= " FROM ".MAIN_DB_PREFIX."product_lang"; @@ -340,7 +340,7 @@ else if ($result) { $objtp = $db->fetch_object($result); - if ($objtp->label != '') $objp->label = $objtp->label; + if (! empty($objtp->label)) $objp->label = $objtp->label; } } @@ -359,7 +359,7 @@ else print ''.dol_trunc($objp->label,40).''.$objp->barcode.''.dol_print_date($db->jdate($objp->datem),'day')."'; if (preg_match('/([0-9]+)y/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear"); @@ -406,7 +406,7 @@ else print '
'; - if ($objp->type==1) print img_object($langs->trans("ShowService"),"service"); - else print img_object($langs->trans("ShowProduct"),"product"); - print " "; - print $objp->ref.''; - if ($objp->type==1) print $langs->trans("ShowService"); - else print $langs->trans("ShowProduct"); - print ''.$objp->label.''.$objp->c.'
'; + if ($objp->type==1) print img_object($langs->trans("ShowService"),"service"); + else print img_object($langs->trans("ShowProduct"),"product"); + print " "; + print $objp->ref.''; + if ($objp->type==1) print $langs->trans("ShowService"); + else print $langs->trans("ShowProduct"); + print ''.$objp->label.''.$objp->c.'
"; -$db->close(); llxFooter(); +$db->close(); ?> diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index 5d77302d953..b3f229c5ffb 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2005-2012 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 @@ -36,30 +36,41 @@ if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user,'produit|service'); -$sref=isset($_GET["sref"])?$_GET["sref"]:$_POST["sref"]; -$snom=isset($_GET["snom"])?$_GET["snom"]:$_POST["snom"]; -$sall=isset($_GET["sall"])?$_GET["sall"]:$_POST["sall"]; -$type=isset($_GET["type"])?$_GET["type"]:$_POST["type"]; -$sref=trim($sref); -$snom=trim($snom); -$sall=trim($sall); -$type=trim($type); +$action=GETPOST('action','alpha'); +$sref=GETPOST("sref"); +$snom=GETPOST("snom"); +$sall=GETPOST("sall"); +$type=GETPOST("type","int"); +$sbarcode=GETPOST("sbarcode"); +$catid=GETPOST('catid','int'); +$toolowstock=GETPOST('toolowstock'); +$tosell = GETPOST("tosell"); +$tobuy = GETPOST("tobuy"); +$fourn_id = GETPOST("fourn_id",'int'); -$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"]; -$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"]; +$sortfield = GETPOST("sortfield",'alpha'); +$sortorder = GETPOST("sortorder",'alpha'); +$page = GETPOST("page",'int'); if (! $sortfield) $sortfield="stock_physique"; if (! $sortorder) $sortorder="ASC"; -$page = $_GET["page"]; $limit = $conf->liste_limit; $offset = $limit * $page ; -$catid=GETPOST('catid'); -$toolowstock=GETPOST('toolowstock'); - // Load sale and categ filters $search_sale = GETPOST("search_sale"); $search_categ = GETPOST("search_categ"); +// Get object canvas (By default, this is not defined, so standard usage of dolibarr) +//$object->getCanvas($id); +$canvas=GETPOST("canvas"); +$objcanvas=''; +if (! empty($canvas)) +{ + require_once(DOL_DOCUMENT_ROOT."/core/class/canvas.class.php"); + $objcanvas = new Canvas($db,$action); + $objcanvas->getCanvas('product','list',$canvas); +} + if (! empty($_POST["button_removefilter_x"])) { $sref=""; @@ -118,15 +129,15 @@ if (dol_strlen($type)) if ($sref) $sql.= " AND p.ref LIKE '%".$sref."%'"; if ($sbarcode) $sql.= " AND p.barcode LIKE '%".$sbarcode."%'"; if ($snom) $sql.= " AND p.label LIKE '%".$db->escape($snom)."%'"; -if (isset($_GET["tosell"]) && dol_strlen($_GET["tosell"]) > 0) +if (! empty($tosell)) { - $sql.= " AND p.tosell = ".$_GET["tosell"]; + $sql.= " AND p.tosell = ".$tosell; } -if (isset($_GET["tobuy"]) && dol_strlen($_GET["tobuy"]) > 0) +if (! empty($tobuy)) { - $sql.= " AND p.tobuy = ".$_GET["tobuy"]; + $sql.= " AND p.tobuy = ".$tobuy; } -if (dol_strlen($canvas) > 0) +if (! empty($canvas)) { $sql.= " AND p.canvas = '".$db->escape($canvas)."'"; } @@ -164,21 +175,10 @@ if ($resql) exit; } - if (isset($_GET["tosell"]) || isset($_POST["tosell"])) - { - $tosell = (isset($_GET["tosell"])?$_GET["tosell"]:$_POST["tosell"]); - } - if (isset($_GET["tobuy"]) || isset($_POST["tobuy"])) - { - $tobuy = (isset($_GET["tobuy"])?$_GET["tobuy"]:$_POST["tobuy"]); - } - - - $helpurl=''; $helpurl='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks'; - if (isset($_GET["type"]) || isset($_POST["type"])) + if (isset($type)) { if ($type==1) { $texte = $langs->trans("Services"); } else { $texte = $langs->trans("Products"); } @@ -190,16 +190,16 @@ if ($resql) llxHeader("",$title,$helpurl,$texte); - if ($sref || $snom || $sall || $_POST["search"]) + if ($sref || $snom || $sall || GETPOST('search')) { - print_barre_liste($texte, $page, "reassort.php", "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$_POST["tosell"]."&tobuy=".$_POST["tobuy"], $sortfield, $sortorder,'',$num); + print_barre_liste($texte, $page, "reassort.php", "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num); } else { print_barre_liste($texte, $page, "reassort.php", "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":""), $sortfield, $sortorder,'',$num); } - if ($catid) + if (! empty($catid)) { print "
"; $c = new Categorie($db); @@ -219,7 +219,7 @@ if ($resql) // Filter on categories $moreforfilter=''; - if ($conf->categorie->enabled) + if (! empty($conf->categorie->enabled)) { $moreforfilter.=$langs->trans('Categories'). ': '; $moreforfilter.=$htmlother->select_categories(0,$search_categ,'search_categ'); @@ -258,7 +258,7 @@ if ($resql) print '
'; print ''; print ''; print ' '; @@ -282,7 +282,7 @@ if ($resql) $objp = $db->fetch_object($resql); // Multilangs - if ($conf->global->MAIN_MULTILANGS) // si l'option est active + if (! empty($conf->global->MAIN_MULTILANGS)) // si l'option est active { $sql = "SELECT label"; $sql.= " FROM ".MAIN_DB_PREFIX."product_lang"; @@ -294,7 +294,7 @@ if ($resql) if ($result) { $objtp = $db->fetch_object($result); - if ($objtp->label != '') $objp->label = $objtp->label; + if (! empty($objtp->label)) $objp->label = $objtp->label; } } @@ -308,7 +308,7 @@ if ($resql) print ''.$objp->label.''; if (preg_match('/([0-9]+)y/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear"); @@ -335,7 +335,7 @@ if ($resql) if ($num > $conf->liste_limit) { - if ($sref || $snom || $sall || $_POST["search"]) + if ($sref || $snom || $sall || GETPOST('search')) { print_barre_liste('', $page, "reassort.php", "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num, 0, ''); } @@ -354,7 +354,6 @@ else } -$db->close(); - llxFooter(); +$db->close(); ?> \ No newline at end of file From f8f50a722db95cac3414cc1a1d6279c33e3d6934 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 24 Jul 2012 18:38:35 +0200 Subject: [PATCH 15/17] Fix: patch of Terry (language) --- htdocs/langs/en_US/admin.lang | 84 +++++++++++++++++------------------ 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 530216d2bae..9074c85c2d6 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -75,8 +75,8 @@ AntiVirusCommandExample= Example for ClamWin: c:\Progra~1\ClamWin\bin\clamscan.e AntiVirusParam= More parameters on command line AntiVirusParamExample= Example for ClamWin: --database="C:\Program Files (x86)\ClamWin\lib" ComptaSetup=Accounting module setup -UserSetup=User's management setup -MenuSetup=Menu's management setup +UserSetup=User management setup +MenuSetup=Menu management setup MenuLimits=Limits and accuracy MenuIdParent=Parent menu ID DetailMenuIdParent=ID of parent menu (0 for a top menu) @@ -216,7 +216,7 @@ OfficialWiki=Dolibarr documentation on Wiki OfficialDemo=Dolibarr online demo OfficialMarketPlace=Official market place for external modules/addons OfficialWebHostingService=Official web hosting service (Cloud hosting) -ForDocumentationSeeWiki=For user's or developer's documentation (Doc, FAQs...),
take a look at the Dolibarr Wiki:
%s +ForDocumentationSeeWiki=For user or developer documentation (Doc, FAQs...),
take a look at the Dolibarr Wiki:
%s ForAnswersSeeForum=For any other questions/help, you can use the Dolibarr forum:
%s HelpCenterDesc1=This area can help you to get a Help support service on Dolibarr. HelpCenterDesc2=Some part of this service are available in english only. @@ -333,53 +333,53 @@ ButtonHideUnauthorized=Hide buttons unauthorized (instead of seeing gray) Module0Name=Users & groups Module0Desc=Users and groups management Module1Name=Third parties -Module1Desc=Companies and contact's management +Module1Desc=Companies and contact management Module2Name=Commercial Module2Desc=Commercial management Module10Name=Accounting Module10Desc=Simple accounting management (invoice and payment dispatching) Module20Name=Proposals -Module20Desc=Commercial proposal's management +Module20Desc=Commercial proposal management Module22Name=Mass E-mailings -Module22Desc=Mass E-mailing's management +Module22Desc=Mass E-mailing management Module23Name= Energy Module23Desc= Monitoring the consumption of energies Module25Name=Customer Orders -Module25Desc=Customer order's management +Module25Desc=Customer order management Module30Name=Invoices -Module30Desc=Invoices and credit note's management for customers. Invoice's management for suppliers +Module30Desc=Invoice and credit note management for customers. Invoice management for suppliers Module40Name=Suppliers -Module40Desc=Supplier's management and buying (orders and invoices) +Module40Desc=Supplier management and buying (orders and invoices) Module42Name=Logs Module42Desc=Logging facilities (file, syslog, ...) Module49Name=Editors -Module49Desc=Editor's management +Module49Desc=Editor management Module50Name=Products -Module50Desc=Product's management +Module50Desc=Product management Module51Name=Mass mailings -Module51Desc=Mass paper mailing's management +Module51Desc=Mass paper mailing management Module52Name=Stocks -Module52Desc=Stock's management of products +Module52Desc=Stock management (products) Module53Name=Services -Module53Desc=Service's management +Module53Desc=Service management Module54Name=Contracts -Module54Desc=Contract's and service's management +Module54Desc=Contract and service management Module55Name=Barcodes -Module55Desc=Barcode's management +Module55Desc=Barcode management Module56Name=Telephony Module56Desc=Telephony integration Module57Name=Standing orders -Module57Desc=Standing orders and withdrawal's management +Module57Desc=Standing orders and withdrawal management Module58Name=ClickToDial Module58Desc=Integration of a ClickToDial system (Asterisk, ...) Module59Name=Bookmark4u Module59Desc=Add function to generate Bookmark4u account from a Dolibarr account Module70Name=Interventions -Module70Desc=Intervention's management -Module75Name=Expenses and trips notes -Module75Desc=Expenses and trips note's management +Module70Desc=Intervention management +Module75Name=Expense and trip notes +Module75Desc=Expense and trip notes management Module80Name=Shipments -Module80Desc=Shipments and delivery order's management +Module80Desc=Shipments and delivery order management Module85Name=Banks and cash Module85Desc=Management of bank or cash accounts Module100Name=External site @@ -399,17 +399,17 @@ Module310Desc=Foundation members management Module320Name=RSS Feed Module320Desc=Add RSS feed inside Dolibarr screen pages Module330Name=Bookmarks -Module330Desc=Bookmark's management +Module330Desc=Bookmark management Module400Name=Projects -Module400Desc=Project's management inside other modules +Module400Desc=Project management inside other modules Module410Name=Webcalendar Module410Desc=Webcalendar integration Module500Name=Taxes, social contributions and dividends -Module500Desc=Taxes and social contribution's management +Module500Desc=Taxes and social contribution management Module600Name=Notifications -Module600Desc=Send notifications by email on some Dolibarr business events to third party's contacts +Module600Desc=Send notifications by email on some Dolibarr business events to third party contacts Module700Name=Donations -Module700Desc=Donation's management +Module700Desc=Donation management Module800Name=OSCommerce by direct database access Module800Desc=Interface to show an OSCommerce or OSCSS shop via direct database access Module900Name=OSCommerce by WS @@ -419,13 +419,13 @@ Module1200Desc=Mantis integration Module1400Name=Accounting Module1400Desc=Accounting management (double parties) Module1780Name=Categories -Module1780Desc=Categorie's management (products, suppliers and customers) +Module1780Desc=Category management (products, suppliers and customers) Module2000Name=WYSIWYG editor Module2000Desc=Allow to edit some text area using an advanced editor Module2200Name=Lending rights Module2200Desc=Lending rights management Module2300Name=Menus -Module2300Desc=Menu's management +Module2300Desc=Menu management Module2400Name=Agenda Module2400Desc=Events/tasks and agenda management Module2500Name=Electronic Content Management @@ -493,7 +493,7 @@ Permission94=Export social contributions Permission95=Read reports Permission96=Setup dispatching Permission97=Read invoice accountancy dispatching -Permission98=Dispatch invoice's accountancy lines +Permission98=Dispatch invoice accountancy lines Permission101=Read sendings Permission102=Create/modify sendings Permission104=Validate sendings @@ -612,8 +612,8 @@ Permission703=Delete donations Permission1001=Read stocks Permission1002=Create/modify stocks Permission1003=Delete stocks -Permission1004=Read stock's movements -Permission1005=Create/modify stock's movements +Permission1004=Read stock movements +Permission1005=Create/modify stock movements Permission1101=Read delivery orders Permission1102=Create/modify delivery orders Permission1104=Validate delivery orders @@ -729,7 +729,7 @@ TableName=Table name TableLineFormat=Line format NbOfRecord=Nb of records Constraints=Constraints -ConstraintsType=Constraint's type +ConstraintsType=Constraints type ConstraintsToShowOrNotEntry=Constraint to show or not the menu entry AllMustBeOk=All of these must be checked Host=Server @@ -961,7 +961,7 @@ UseOptionLineIfNoQuantity=A line of product/service with a zero amount is consid FreeLegalTextOnProposal=Free text on commercial proposals WatermarkOnDraftProposal=Watermark on draft commercial proposals (any if empty) ##### Orders ##### -OrdersSetup=Order's management setup +OrdersSetup=Order management setup OrdersNumberingModules=Orders numbering modules OrdersModelModule=Order documents models HideTreadedOrders=Hide the treated or canceled orders in the list @@ -1033,7 +1033,7 @@ LDAPDnMemberActive=Members' synchronization LDAPDnMemberActiveExample=Activated/Unactivated synchronization LDAPContactDn=Dolibarr contacts' DN LDAPContactDnExample=Complete DN (ex: ou=contacts,dc=society,dc=com) -LDAPMemberDn=Dolibarr member's DN +LDAPMemberDn=Dolibarr members DN LDAPMemberDnExample=Complete DN (ex: ou=members,dc=society,dc=com) LDAPMemberObjectClassList=List of objectClass LDAPMemberObjectClassListExample=List of objectClass defining record attributes (ex: top,inetOrgPerson or top,user for active directory) @@ -1043,13 +1043,13 @@ LDAPGroupObjectClassList=List of objectClass LDAPGroupObjectClassListExample=List of objectClass defining record attributes (ex: top,groupOfUniqueNames) LDAPContactObjectClassList=List of objectClass LDAPContactObjectClassListExample=List of objectClass defining record attributes (ex: top,inetOrgPerson or top,user for active directory) -LDAPMemberTypeDn=Dolibarr member's type DN +LDAPMemberTypeDn=Dolibarr members type DN LDAPMemberTypeDnExample=Complete DN (ex: ou=type_members,dc=society,dc=com) LDAPTestConnect=Test LDAP connection -LDAPTestSynchroContact=Test contact's synchronization -LDAPTestSynchroUser=Test user's synchronization -LDAPTestSynchroGroup=Test group's synchronization -LDAPTestSynchroMember=Test member's synchronization +LDAPTestSynchroContact=Test contacts synchronization +LDAPTestSynchroUser=Test user synchronization +LDAPTestSynchroGroup=Test group synchronization +LDAPTestSynchroMember=Test member synchronization LDAPSynchroOK=Synchronization test successful LDAPSynchroKO=Failed synchronization test LDAPSynchroKOMayBePermissions=Failed synchronization test. Check that connexion to server is correctly configured and allows LDAP udpates @@ -1189,8 +1189,8 @@ FreeLegalTextOnDeliveryReceipts=Free text on delivery receipts ##### FCKeditor ##### AdvancedEditor=Advanced editor ActivateFCKeditor=Activate advanced editor for: -FCKeditorForCompany=WYSIWIG creation/edition of element's description and note (except products/services) -FCKeditorForProduct=WYSIWIG creation/edition of products/service's description and note +FCKeditorForCompany=WYSIWIG creation/edition of elements description and note (except products/services) +FCKeditorForProduct=WYSIWIG creation/edition of products/services description and note FCKeditorForProductDetails=WYSIWIG creation/edition of products details lines for all entities (proposals, orders, invoices, etc...). Warning: Using this option for this case is seriously not recommanded as it can create problems with special characters and page formating when building PDF files. FCKeditorForMailing=WYSIWIG creation/edition of mailings ##### OSCommerce 1 ##### @@ -1309,4 +1309,4 @@ TestGeoIPResult=Test of a conversion IP -> country ##### Projects ##### ProjectsNumberingModules=Projects numbering module ProjectsSetup=Project module setup -ProjectsModelModule=Project's report document model +ProjectsModelModule=Project reports document model From 8e953a6858122791e6bf1a68d9570799892ffe7e Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 24 Jul 2012 20:15:34 +0200 Subject: [PATCH 16/17] Fix: external modules workflow compatibility --- dev/skeletons/modMyModule.class.php | 2 +- htdocs/admin/workflow.php | 30 +++++++++++++++++------------ 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/dev/skeletons/modMyModule.class.php b/dev/skeletons/modMyModule.class.php index e599665b645..8f819e58438 100644 --- a/dev/skeletons/modMyModule.class.php +++ b/dev/skeletons/modMyModule.class.php @@ -83,7 +83,7 @@ class modMyModule extends DolibarrModules // 'models' => 0, // Set this to 1 if module has its own models directory (core/modules/xxx) // 'css' => '/mymodule/css/mymodule.css.php', // Set this to relative path of css if module has its own css file // 'hooks' => array('hookcontext1','hookcontext2') // Set here all hooks context managed by module - // 'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE')) // Set here all workflow context managed by module + // 'workflow' => array('WORKFLOW_MODULE1_YOURACTIONTYPE_MODULE2'=>array('enabled'=>'! empty($conf->module1->enabled) && ! empty($conf->module2->enabled)', 'picto'=>'yourpicto@mymodule')) // Set here all workflow context managed by module // ); $this->module_parts = array(); diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php index 33f16d98a7b..c9fe8782a45 100755 --- a/htdocs/admin/workflow.php +++ b/htdocs/admin/workflow.php @@ -77,34 +77,40 @@ print "
".img_object('', $picto).$langs->trans('desc'.$key); - if (! empty($tmparray['warning'])) + if (! empty($params['warning'])) { $langs->load("errors"); - print ' '.img_warning($langs->transnoentitiesnoconv($tmparray['warning'])); + print ' '.img_warning($langs->transnoentitiesnoconv($params['warning'])); } print "'; - if ($conf->use_javascript_ajax) + if (! empty($conf->use_javascript_ajax)) { print ajax_constantonoff($key); } From e12604cb7176cb412a3218e8b4ad844d1e8bf982 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 25 Jul 2012 09:09:56 +0200 Subject: [PATCH 17/17] Fix: avoid warning and strict mode story --- htdocs/commande/fiche.php | 608 ++++++++++++++--------------- htdocs/core/lib/functions2.lib.php | 22 +- 2 files changed, 313 insertions(+), 317 deletions(-) diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 750da0afc82..e35a5cfff45 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -36,11 +36,11 @@ require_once(DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'); require_once(DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'); require_once(DOL_DOCUMENT_ROOT."/core/lib/order.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php"); -if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'); -if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'); -if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'); - -if (!$user->rights->commande->lire) accessforbidden(); +if (! empty($conf->projet->enabled)) { + require_once(DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'); + require_once(DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'); + require_once(DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'); +} $langs->load('orders'); $langs->load('sendings'); @@ -52,12 +52,15 @@ $langs->load('products'); if (! empty($conf->margin->enabled)) $langs->load('margins'); -$id = (GETPOST('id','int')?GETPOST('id','int'):GETPOST("orderid")); -$ref = GETPOST('ref'); -$socid = GETPOST('socid','int'); -$action = GETPOST('action'); -$confirm = GETPOST('confirm'); -$lineid = GETPOST('lineid'); +$id=(GETPOST('id','int')?GETPOST('id','int'):GETPOST('orderid','int')); +$ref=GETPOST('ref','alpha'); +$socid=GETPOST('socid','int'); +$action=GETPOST('action','alpha'); +$confirm=GETPOST('confirm','alpha'); +$lineid=GETPOST('lineid','int'); +$origin=GETPOST('origin','alpha'); +$originid=GETPOST('origin_id','int'); + $mesg = GETPOST('mesg'); //PDF @@ -66,8 +69,8 @@ $hidedesc = (GETPOST('hidedesc','int') ? GETPOST('hidedesc','int') : (! empty( $hideref = (GETPOST('hideref','int') ? GETPOST('hideref','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); // Security check -if ($user->societe_id) $socid=$user->societe_id; -$result=restrictedArea($user,'commande',$id,''); +if (! empty($user->societe_id)) $socid=$user->societe_id; +$result=restrictedArea($user,'commande',$id); $object = new Commande($db); @@ -125,7 +128,7 @@ else if ($action == 'reopen' && $user->rights->commande->creer) $result = $object->set_reopen($user); if ($result > 0) { - Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); + Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit; } else @@ -159,7 +162,7 @@ else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights-> // Define output language $outputlangs = $langs; $newlang=''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id'); if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; if (! empty($newlang)) { @@ -168,11 +171,11 @@ else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights-> } if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { - $ret=$object->fetch($id); // Reload to get new records + $ret=$object->fetch($object->id); // Reload to get new records commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); } - Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); + Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit; } else @@ -184,203 +187,201 @@ else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights-> // Categorisation dans projet else if ($action == 'classin' && $user->rights->commande->creer) { - $object->setProject($_POST['projectid']); + $object->setProject(GETPOST('projectid')); } // Add order else if ($action == 'add' && $user->rights->commande->creer) { - $datecommande = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); - $datelivraison = dol_mktime(12, 0, 0, $_POST['liv_month'],$_POST['liv_day'],$_POST['liv_year']); + $datecommande = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); + $datelivraison = dol_mktime(12, 0, 0, GETPOST('liv_month'),GETPOST('liv_day'),GETPOST('liv_year')); - $object->socid=$socid; - $object->fetch_thirdparty(); + $object->socid=$socid; + $object->fetch_thirdparty(); - $db->begin(); + $db->begin(); - $object->date_commande = $datecommande; - $object->note = $_POST['note']; - $object->note_public = $_POST['note_public']; - $object->source = $_POST['source_id']; - $object->fk_project = $_POST['projectid']; - $object->ref_client = $_POST['ref_client']; - $object->modelpdf = $_POST['model']; - $object->cond_reglement_id = $_POST['cond_reglement_id']; - $object->mode_reglement_id = $_POST['mode_reglement_id']; - $object->availability_id = $_POST['availability_id']; - $object->demand_reason_id = $_POST['demand_reason_id']; - $object->date_livraison = $datelivraison; - $object->fk_delivery_address = $_POST['fk_address']; - $object->contactid = $_POST['contactidp']; + $object->date_commande = $datecommande; + $object->note = GETPOST('note'); + $object->note_public = GETPOST('note_public'); + $object->source = GETPOST('source_id'); + $object->fk_project = GETPOST('projectid'); + $object->ref_client = GETPOST('ref_client'); + $object->modelpdf = GETPOST('model'); + $object->cond_reglement_id = GETPOST('cond_reglement_id'); + $object->mode_reglement_id = GETPOST('mode_reglement_id'); + $object->availability_id = GETPOST('availability_id'); + $object->demand_reason_id = GETPOST('demand_reason_id'); + $object->date_livraison = $datelivraison; + $object->fk_delivery_address = GETPOST('fk_address'); + $object->contactid = GETPOST('contactidp'); - // If creation from another object of another module (Example: origin=propal, originid=1) - if ($_POST['origin'] && $_POST['originid']) - { - // Parse element/subelement (ex: project_task) - $element = $subelement = $_POST['origin']; - if (preg_match('/^([^_]+)_([^_]+)/i',$_POST['origin'],$regs)) - { - $element = $regs[1]; - $subelement = $regs[2]; - } + // If creation from another object of another module (Example: origin=propal, originid=1) + if ($origin && $originid) + { + // Parse element/subelement (ex: project_task) + $element = $subelement = $origin; + if (preg_match('/^([^_]+)_([^_]+)/i',$origin,$regs)) + { + $element = $regs[1]; + $subelement = $regs[2]; + } - // For compatibility - if ($element == 'order') { $element = $subelement = 'commande'; } - if ($element == 'propal') { $element = 'comm/propal'; $subelement = 'propal'; } - if ($element == 'contract') { $element = $subelement = 'contrat'; } + // For compatibility + if ($element == 'order') { $element = $subelement = 'commande'; } + if ($element == 'propal') { $element = 'comm/propal'; $subelement = 'propal'; } + if ($element == 'contract') { $element = $subelement = 'contrat'; } - $object->origin = $_POST['origin']; - $object->origin_id = $_POST['originid']; + $object->origin = $origin; + $object->origin_id = $originid; - // Possibility to add external linked objects with hooks - $object->linked_objects[$object->origin] = $object->origin_id; - if (is_array($_POST['other_linked_objects']) && ! empty($_POST['other_linked_objects'])) - { - $object->linked_objects = array_merge($object->linked_objects, $_POST['other_linked_objects']); - } + // Possibility to add external linked objects with hooks + $object->linked_objects[$object->origin] = $object->origin_id; + $other_linked_objects=GETPOST('other_linked_objects','array'); + if (! empty($other_linked_objects)) + { + $object->linked_objects = array_merge($object->linked_objects, $other_linked_objects); + } - $object_id = $object->create($user); + $object_id = $object->create($user); - if ($object_id > 0) - { - dol_include_once('/'.$element.'/class/'.$subelement.'.class.php'); + if ($object_id > 0) + { + dol_include_once('/'.$element.'/class/'.$subelement.'.class.php'); - $classname = ucfirst($subelement); - $srcobject = new $classname($db); + $classname = ucfirst($subelement); + $srcobject = new $classname($db); - dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add lines"); - $result=$srcobject->fetch($object->origin_id); - if ($result > 0) - { - $lines = $srcobject->lines; - if (empty($lines) && method_exists($srcobject,'fetch_lines')) $lines = $srcobject->fetch_lines(); + dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add lines"); + $result=$srcobject->fetch($object->origin_id); + if ($result > 0) + { + $lines = $srcobject->lines; + if (empty($lines) && method_exists($srcobject,'fetch_lines')) $lines = $srcobject->fetch_lines(); - $fk_parent_line=0; - $num=count($lines); + $fk_parent_line=0; + $num=count($lines); - for ($i=0;$i<$num;$i++) - { - $desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle); - $product_type=($lines[$i]->product_type?$lines[$i]->product_type:0); + for ($i=0;$i<$num;$i++) + { + $desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle); + $product_type=($lines[$i]->product_type?$lines[$i]->product_type:0); - // Dates - // TODO mutualiser - $date_start=$lines[$i]->date_debut_prevue; - if ($lines[$i]->date_debut_reel) $date_start=$lines[$i]->date_debut_reel; - if ($lines[$i]->date_start) $date_start=$lines[$i]->date_start; - $date_end=$lines[$i]->date_fin_prevue; - if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel; - if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end; + // Dates + // TODO mutualiser + $date_start=$lines[$i]->date_debut_prevue; + if ($lines[$i]->date_debut_reel) $date_start=$lines[$i]->date_debut_reel; + if ($lines[$i]->date_start) $date_start=$lines[$i]->date_start; + $date_end=$lines[$i]->date_fin_prevue; + if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel; + if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end; - // Reset fk_parent_line for no child products and special product - if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) { - $fk_parent_line = 0; - } + // Reset fk_parent_line for no child products and special product + if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) { + $fk_parent_line = 0; + } - $result = $object->addline( - $object_id, - $desc, - $lines[$i]->subprice, - $lines[$i]->qty, - $lines[$i]->tva_tx, - $lines[$i]->localtax1_tx, - $lines[$i]->localtax2_tx, - $lines[$i]->fk_product, - $lines[$i]->remise_percent, - $lines[$i]->info_bits, - $lines[$i]->fk_remise_except, - 'HT', - 0, - $datestart, - $dateend, - $product_type, - $lines[$i]->rang, - $lines[$i]->special_code, - $fk_parent_line, - $lines[$i]->fk_fournprice, - $lines[$i]->pa_ht - ); + $result = $object->addline( + $object_id, + $desc, + $lines[$i]->subprice, + $lines[$i]->qty, + $lines[$i]->tva_tx, + $lines[$i]->localtax1_tx, + $lines[$i]->localtax2_tx, + $lines[$i]->fk_product, + $lines[$i]->remise_percent, + $lines[$i]->info_bits, + $lines[$i]->fk_remise_except, + 'HT', + 0, + $datestart, + $dateend, + $product_type, + $lines[$i]->rang, + $lines[$i]->special_code, + $fk_parent_line, + $lines[$i]->fk_fournprice, + $lines[$i]->pa_ht + ); - if ($result < 0) - { - $error++; - break; - } + if ($result < 0) + { + $error++; + break; + } - // Defined the new fk_parent_line - if ($result > 0 && $lines[$i]->product_type == 9) { - $fk_parent_line = $result; - } - } + // Defined the new fk_parent_line + if ($result > 0 && $lines[$i]->product_type == 9) { + $fk_parent_line = $result; + } + } - // Hooks - $parameters=array('objFrom'=>$srcobject); - $reshook=$hookmanager->executeHooks('createFrom',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - if ($reshook < 0) $error++; - } - else - { - $mesg=$srcobject->error; - $error++; - } - } - else - { - $mesg=$object->error; - $error++; - } - } - else - { - $object_id = $object->create($user); + // Hooks + $parameters=array('objFrom'=>$srcobject); + $reshook=$hookmanager->executeHooks('createFrom',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) $error++; + } + else + { + $mesg=$srcobject->error; + $error++; + } + } + else + { + $mesg=$object->error; + $error++; + } + } + else + { + $object_id = $object->create($user); - // If some invoice's lines already known - $NBLINES=8; - for ($i = 1 ; $i <= $NBLINES ; $i++) - { - if ($_POST['idprod'.$i]) - { - $xid = 'idprod'.$i; - $xqty = 'qty'.$i; - $xremise = 'remise_percent'.$i; - $object->add_product($_POST[$xid],$_POST[$xqty],$_POST[$xremise]); - } - } - } + // If some invoice's lines already known + $NBLINES=8; + for ($i = 1 ; $i <= $NBLINES ; $i++) + { + if ($_POST['idprod'.$i]) + { + $xid = 'idprod'.$i; + $xqty = 'qty'.$i; + $xremise = 'remise_percent'.$i; + $object->add_product($_POST[$xid],$_POST[$xqty],$_POST[$xremise]); + } + } + } - // Insert default contacts if defined - if ($object_id > 0) - { - if ($_POST["contactidp"]) - { - $result=$object->add_contact($_POST["contactidp"],'CUSTOMER','external'); + // Insert default contacts if defined + if ($object_id > 0) + { + if (GETPOST('contactidp')) + { + $result=$object->add_contact(GETPOST('contactidp'),'CUSTOMER','external'); + if ($result < 0) + { + $mesg = '
'.$langs->trans("ErrorFailedToAddContact").'
'; + $error++; + } + } - if ($result < 0) - { - $mesg = '
'.$langs->trans("ErrorFailedToAddContact").'
'; - $error++; - } - } - - $id = $object_id; - $action = ''; - } - - // End of object creation, we show it - if ($object_id > 0 && ! $error) - { - $db->commit(); - Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object_id); - exit; - } - else - { - $db->rollback(); - $action='create'; - $socid=$_POST['socid']; - if (! $mesg) $mesg='
'.$object->error.'
'; - } + $id = $object_id; + $action = ''; + } + // End of object creation, we show it + if ($object_id > 0 && ! $error) + { + $db->commit(); + Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object_id); + exit; + } + else + { + $db->rollback(); + $action='create'; + if (! $mesg) $mesg='
'.$object->error.'
'; + } } else if ($action == 'classifybilled' && $user->rights->commande->creer) @@ -391,21 +392,21 @@ else if ($action == 'classifybilled' && $user->rights->commande->creer) // Positionne ref commande client else if ($action == 'set_ref_client' && $user->rights->commande->creer) { - $object->set_ref_client($user, $_POST['ref_client']); + $object->set_ref_client($user, GETPOST('ref_client')); } else if ($action == 'setremise' && $user->rights->commande->creer) { - $object->set_remise($user, $_POST['remise']); + $object->set_remise($user, GETPOST('remise')); } else if ($action == 'setabsolutediscount' && $user->rights->commande->creer) { - if ($_POST["remise_id"]) + if (GETPOST('remise_id')) { if ($object->id > 0) { - $object->insert_discount($_POST["remise_id"]); + $object->insert_discount(GETPOST('remise_id')); } else { @@ -417,7 +418,7 @@ else if ($action == 'setabsolutediscount' && $user->rights->commande->creer) else if ($action == 'setdate' && $user->rights->commande->creer) { //print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; - $date=dol_mktime(0, 0, 0, $_POST['order_month'], $_POST['order_day'], $_POST['order_year']); + $date=dol_mktime(0, 0, 0, GETPOST('order_month'), GETPOST('order_day'), GETPOST('order_year')); $result=$object->set_date($user,$date); if ($result < 0) @@ -429,7 +430,7 @@ else if ($action == 'setdate' && $user->rights->commande->creer) else if ($action == 'setdate_livraison' && $user->rights->commande->creer) { //print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; - $datelivraison=dol_mktime(0, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year']); + $datelivraison=dol_mktime(0, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year')); $result=$object->set_date_livraison($user,$datelivraison); if ($result < 0) @@ -446,13 +447,13 @@ else if ($action == 'setmode' && $user->rights->commande->creer) else if ($action == 'setavailability' && $user->rights->commande->creer) { - $result=$object->availability($_POST['availability_id']); + $result=$object->availability(GETPOST('availability_id')); if ($result < 0) dol_print_error($db,$object->error); } else if ($action == 'setdemandreason' && $user->rights->commande->creer) { - $result=$object->demand_reason($_POST['demand_reason_id']); + $result=$object->demand_reason(GETPOST('demand_reason_id')); if ($result < 0) dol_print_error($db,$object->error); } @@ -477,7 +478,7 @@ else if ($action == 'setconditions' && $user->rights->commande->creer) $outputlangs->setDefaultLang($newlang); } - $ret=$object->fetch($id); // Reload to get new records + $ret=$object->fetch($object->id); // Reload to get new records commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); } } @@ -485,12 +486,12 @@ else if ($action == 'setconditions' && $user->rights->commande->creer) else if ($action == 'setremisepercent' && $user->rights->commande->creer) { - $result = $object->set_remise($user, $_POST['remise_percent']); + $result = $object->set_remise($user, GETPOST('remise_percent')); } else if ($action == 'setremiseabsolue' && $user->rights->commande->creer) { - $result = $object->set_remise_absolue($user, $_POST['remise_absolue']); + $result = $object->set_remise_absolue($user, GETPOST('remise_absolue')); } else if ($action == 'setnote_public' && $user->rights->commande->creer) @@ -512,33 +513,33 @@ else if ($action == 'addline' && $user->rights->commande->creer) { $result=0; - if (empty($_POST['idprod']) && $_POST["type"] < 0) + if (! GETPOST('idprod') && GETPOST('type') < 0) { $mesg = '
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'
'; $result = -1 ; } - if (empty($_POST['idprod']) && (! isset($_POST["np_price"]) || $_POST["np_price"]=='')) // Unit price can be 0 but not '' + if (! GETPOST('idprod') && GETPOST('np_price')=='') // Unit price can be 0 but not '' { $mesg = '
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")).'
'; $result = -1 ; } - if ($result >= 0 && $_POST['qty'] && (($_POST['np_price'] != '' && ($_POST['np_desc'] || $_POST['dp_desc'])) || $_POST['idprod'])) + if ($result >= 0 && GETPOST('qty') && ((GETPOST('np_price') != '' && (GETPOST('np_desc') || GETPOST('dp_desc'))) || GETPOST('idprod'))) { // Clean parameters - $suffixe = $_POST['idprod'] ? '_predef' : ''; - $date_start=dol_mktime(0, 0, 0, $_POST['date_start'.$suffixe.'month'], $_POST['date_start'.$suffixe.'day'], $_POST['date_start'.$suffixe.'year']); - $date_end=dol_mktime(0, 0, 0, $_POST['date_end'.$suffixe.'month'], $_POST['date_end'.$suffixe.'day'], $_POST['date_end'.$suffixe.'year']); + $suffixe = GETPOST('idprod') ? '_predef' : ''; + $date_start=dol_mktime(0, 0, 0, GETPOST('date_start'.$suffixe.'month'), GETPOST('date_start'.$suffixe.'day'), GETPOST('date_start'.$suffixe.'year')); + $date_end=dol_mktime(0, 0, 0, GETPOST('date_end'.$suffixe.'month'), GETPOST('date_end'.$suffixe.'day'), GETPOST('date_end'.$suffixe.'year')); $price_base_type = 'HT'; // Ecrase $pu par celui du produit // Ecrase $desc par celui du produit // Ecrase $txtva par celui du produit // Ecrase $base_price_type par celui du produit - if ($_POST['idprod']) + if (GETPOST('idprod')) { $prod = new Product($db); - $prod->fetch($_POST['idprod']); + $prod->fetch(GETPOST('idprod')); $tva_tx = get_default_tva($mysoc,$object->client,$prod->id); @@ -592,17 +593,17 @@ else if ($action == 'addline' && $user->rights->commande->creer) $desc = $prod->description; } - $desc.= ($desc && $_POST['np_desc']) ? ((dol_textishtml($desc) || dol_textishtml($_POST['np_desc']))?"
\n":"\n") : ""; - $desc.= $_POST['np_desc']; + $desc.= ($desc && GETPOST('np_desc')) ? ((dol_textishtml($desc) || dol_textishtml(GETPOST('np_desc')))?"
\n":"\n") : ""; + $desc.= GETPOST('np_desc'); $type = $prod->type; } else { - $pu_ht=$_POST['np_price']; - $tva_tx=str_replace('*','',$_POST['np_tva_tx']); - $tva_npr=preg_match('/\*/',$_POST['np_tva_tx'])?1:0; - $desc=$_POST['dp_desc']; - $type=$_POST["type"]; + $pu_ht=GETPOST('np_price'); + $tva_tx=str_replace('*','',GETPOST('np_tva_tx')); + $tva_npr=preg_match('/\*/',GETPOST('np_tva_tx'))?1:0; + $desc=GETPOST('dp_desc'); + $type=GETPOST('type'); } // Local Taxes @@ -611,19 +612,19 @@ else if ($action == 'addline' && $user->rights->commande->creer) $desc=dol_htmlcleanlastbr($desc); - // ajout prix achat - $fk_fournprice = $_POST['np_fournprice']; - if ( ! empty($_POST['np_buying_price']) ) - $pa_ht = $_POST['np_buying_price']; - else - $pa_ht = null; + // ajout prix achat + $fk_fournprice = GETPOST('np_fournprice'); + if (GETPOST('np_buying_price')) + $pa_ht = GETPOST('np_buying_price'); + else + $pa_ht = null; $info_bits=0; if ($tva_npr) $info_bits |= 0x01; if ($result >= 0) { - if($price_min && (price2num($pu_ht)*(1-price2num($_POST['remise_percent'])/100) < price2num($price_min))) + if($price_min && (price2num($pu_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min))) { //print "CantBeLessThanMinPrice ".$up_ht." - ".GETPOST('remise_percent')." - ".$product->price_min; $mesg = '
'.$langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').' '.$langs->trans("Currency".$conf->currency)).'
' ; @@ -632,15 +633,15 @@ else if ($action == 'addline' && $user->rights->commande->creer) { // Insert line $result = $object->addline( - $id, + $object->id, $desc, $pu_ht, - $_POST['qty'], + GETPOST('qty'), $tva_tx, $localtax1_tx, $localtax2_tx, - $_POST['idprod'], - $_POST['remise_percent'], + GETPOST('idprod'), + GETPOST('remise_percent'), $info_bits, 0, $price_base_type, @@ -650,9 +651,9 @@ else if ($action == 'addline' && $user->rights->commande->creer) $type, -1, '', - $_POST['fk_parent_line'], - $fk_fournprice, - $pa_ht + GETPOST('fk_parent_line'), + $fk_fournprice, + $pa_ht ); if ($result > 0) @@ -669,7 +670,7 @@ else if ($action == 'addline' && $user->rights->commande->creer) $outputlangs->setDefaultLang($newlang); } - $ret=$object->fetch($id); // Reload to get new records + $ret=$object->fetch($object->id); // Reload to get new records commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); } @@ -681,7 +682,7 @@ else if ($action == 'addline' && $user->rights->commande->creer) unset($_POST['np_desc']); unset($_POST['np_price']); unset($_POST['np_tva_tx']); - unset($_POST['np_buying_price']); + unset($_POST['np_buying_price']); } else { @@ -695,74 +696,69 @@ else if ($action == 'addline' && $user->rights->commande->creer) /* * Mise a jour d'une ligne dans la commande */ -else if ($action == 'updateligne' && $user->rights->commande->creer && $_POST['save'] == $langs->trans('Save')) +else if ($action == 'updateligne' && $user->rights->commande->creer && GETPOST('save') == $langs->trans('Save')) { // Clean parameters $date_start=''; $date_end=''; - $date_start=dol_mktime(0, 0, 0, $_POST['date_start'.$suffixe.'month'], $_POST['date_start'.$suffixe.'day'], $_POST['date_start'.$suffixe.'year']); - $date_end=dol_mktime(0, 0, 0, $_POST['date_end'.$suffixe.'month'], $_POST['date_end'.$suffixe.'day'], $_POST['date_end'.$suffixe.'year']); - $description=dol_htmlcleanlastbr($_POST['desc']); + $date_start=dol_mktime(0, 0, 0, GETPOST('date_start'.$suffixe.'month'), GETPOST('date_start'.$suffixe.'day'), GETPOST('date_start'.$suffixe.'year')); + $date_end=dol_mktime(0, 0, 0, GETPOST('date_end'.$suffixe.'month'), GETPOST('date_end'.$suffixe.'day'), GETPOST('date_end'.$suffixe.'year')); + $description=dol_htmlcleanlastbr(GETPOST('desc')); $up_ht=GETPOST('pu')?GETPOST('pu'):GETPOST('subprice'); // Define info_bits $info_bits=0; - if (preg_match('/\*/',$_POST['tva_tx'])) $info_bits |= 0x01; + if (preg_match('/\*/',GETPOST('tva_tx'))) $info_bits |= 0x01; // Define vat_rate - $vat_rate=$_POST['tva_tx']; + $vat_rate=GETPOST('tva_tx'); $vat_rate=str_replace('*','',$vat_rate); $localtax1_rate=get_localtax($vat_rate,1,$object->client); $localtax2_rate=get_localtax($vat_rate,2,$object->client); // ajout prix d'achat - $fk_fournprice = $_POST['fournprice']; - if ( ! empty($_POST['buying_price']) ) - $pa_ht = $_POST['buying_price']; + $fk_fournprice = GETPOST('fournprice'); + if (GETPOST('buying_price')) + $pa_ht = GETPOST('buying_price'); else - $pa_ht = null; + $pa_ht = null; - // Check parameters - if (empty($_POST['productid']) && $_POST["type"] < 0) - { - $mesg = '
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'
'; - $result = -1 ; - } // Check minimum price - if(! empty($_POST['productid'])) + if (GETPOST('productid')) { - $productid = $_POST['productid']; + $productid = GETPOST('productid'); $product = new Product($db); $product->fetch($productid); $type=$product->type; $price_min = $product->price_min; if ($conf->global->PRODUIT_MULTIPRICES && $object->client->price_level) $price_min = $product->multiprices_min[$object->client->price_level]; - } - if ($price_min && GETPOST('productid') && (price2num($up_ht)*(1-price2num($_POST['remise_percent'])/100) < price2num($price_min))) - { - $mesg = '
'.$langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').' '.$langs->trans("Currency".$conf->currency)).'
' ; - $result=-1; - } - // Define params - if (! empty($_POST['productid'])) - { - $type=$product->type; + if ($price_min && (price2num($up_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min))) + { + $mesg = '
'.$langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').' '.$langs->trans("Currency".$conf->currency)).'
' ; + $error++; + } } else { - $type=$_POST["type"]; + $type=GETPOST('type'); + + // Check parameters + if (GETPOST('type') < 0) { + $mesg = '
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'
'; + $error++; + } } - if ($result >= 0) + if (! $error) { $result = $object->updateline( - $_POST['lineid'], + GETPOST('lineid'), $description, $up_ht, - $_POST['qty'], - $_POST['remise_percent'], + GETPOST('qty'), + GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, @@ -771,10 +767,10 @@ else if ($action == 'updateligne' && $user->rights->commande->creer && $_POST['s $date_start, $date_end, $type, - $_POST['fk_parent_line'], - 0, - $fk_fournprice, - $pa_ht + GETPOST('fk_parent_line'), + 0, + $fk_fournprice, + $pa_ht ); if ($result >= 0) @@ -782,7 +778,7 @@ else if ($action == 'updateligne' && $user->rights->commande->creer && $_POST['s // Define output language $outputlangs = $langs; $newlang=''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id'); if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; if (! empty($newlang)) { @@ -793,12 +789,12 @@ else if ($action == 'updateligne' && $user->rights->commande->creer && $_POST['s { $ret=$object->fetch($object->id); // Reload to get new records commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); - unset($_POST['qty']); - unset($_POST['type']); - unset($_POST['np_price']); - unset($_POST['dp_desc']); - unset($_POST['np_tva_tx']); - unset($_POST['np_buying_price']); + unset($_POST['qty']); + unset($_POST['type']); + unset($_POST['np_price']); + unset($_POST['dp_desc']); + unset($_POST['np_tva_tx']); + unset($_POST['np_buying_price']); } } else @@ -809,7 +805,7 @@ else if ($action == 'updateligne' && $user->rights->commande->creer && $_POST['s } } -else if ($action == 'updateligne' && $user->rights->commande->creer && $_POST['cancel'] == $langs->trans('Cancel')) +else if ($action == 'updateligne' && $user->rights->commande->creer && GETPOST('cancel') == $langs->trans('Cancel')) { Header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id); // Pour reaffichage de la fiche en cours d'edition exit; @@ -924,7 +920,7 @@ else if ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->comm else if ($action == 'up' && $user->rights->commande->creer) { - $object->line_up($_GET['rowid']); + $object->line_up(GETPOST('rowid')); // Define output language $outputlangs = $langs; @@ -939,13 +935,13 @@ else if ($action == 'up' && $user->rights->commande->creer) if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); - Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'#'.$_GET['rowid']); + Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'#'.GETPOST('rowid')); exit; } else if ($action == 'down' && $user->rights->commande->creer) { - $object->line_down($_GET['rowid']); + $object->line_down(GETPOST('rowid')); // Define output language $outputlangs = $langs; @@ -959,7 +955,7 @@ else if ($action == 'down' && $user->rights->commande->creer) } if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); - Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'#'.$_GET['rowid']); + Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'#'.GETPOST('rowid')); exit; } @@ -1033,7 +1029,7 @@ if (GETPOST('addfile')) /* * Remove file in email form */ -if (! empty($_POST['removedfile'])) +if (GETPOST('removedfile')) { require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); @@ -1042,7 +1038,7 @@ if (! empty($_POST['removedfile'])) $upload_dir_tmp = $vardir.'/temp'; // TODO Delete only files that was uploaded from email form - $mesg=dol_remove_file_process($_POST['removedfile'],0); + $mesg=dol_remove_file_process(GETPOST('removedfile'),0); $action ='presend'; } @@ -1050,7 +1046,7 @@ if (! empty($_POST['removedfile'])) /* * Send mail */ -if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_POST['cancel']) +if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! GETPOST('cancel')) { $langs->load('mails'); @@ -1061,24 +1057,24 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P // if (is_readable($file)) // { - if ($_POST['sendto']) + if (GETPOST('sendto')) { // Le destinataire a ete fourni via le champ libre - $sendto = $_POST['sendto']; + $sendto = GETPOST('sendto'); $sendtoid = 0; } - elseif ($_POST['receiver'] != '-1') + elseif (GETPOST('receiver') != '-1') { // Recipient was provided from combo list - if ($_POST['receiver'] == 'thirdparty') // Id of third party + if (GETPOST('receiver') == 'thirdparty') // Id of third party { $sendto = $object->client->email; $sendtoid = 0; } else // Id du contact { - $sendto = $object->client->contact_get_property($_POST['receiver'],'email'); - $sendtoid = $_POST['receiver']; + $sendto = $object->client->contact_get_property(GETPOST('receiver'),'email'); + $sendtoid = GETPOST('receiver'); } } @@ -1086,15 +1082,15 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P { $langs->load("commercial"); - $from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>'; - $replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>'; - $message = $_POST['message']; - $sendtocc = $_POST['sendtocc']; - $deliveryreceipt = $_POST['deliveryreceipt']; + $from = GETPOST('fromname') . ' <' . GETPOST('frommail') .'>'; + $replyto = GETPOST('replytoname'). ' <' . GETPOST('replytomail').'>'; + $message = GETPOST('message'); + $sendtocc = GETPOST('sendtocc'); + $deliveryreceipt = GETPOST('deliveryreceipt'); - if ($_POST['action'] == 'send') + if ($action == 'send') { - if (dol_strlen($_POST['subject'])) $subject=$_POST['subject']; + if (dol_strlen(GETPOST('subject'))) $subject=GETPOST('subject'); else $subject = $langs->transnoentities('Order').' '.$object->ref; $actiontypecode='AC_COM'; $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n"; @@ -1206,7 +1202,7 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) if ($object->id > 0) { $contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid')); - $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]); + $result = $object->add_contact($contactid, GETPOST('type'), GETPOST('source')); } if ($result >= 0) @@ -1283,11 +1279,11 @@ if ($action == 'create' && $user->rights->commande->creer) $soc = new Societe($db); if ($socid) $res=$soc->fetch($socid); - if (GETPOST('origin') && GETPOST('originid')) + if ($origin && $originid) { // Parse element/subelement (ex: project_task) - $element = $subelement = GETPOST('origin'); - if (preg_match('/^([^_]+)_([^_]+)/i',GETPOST('origin'),$regs)) + $element = $subelement = $origin; + if (preg_match('/^([^_]+)_([^_]+)/i',$origin,$regs)) { $element = $regs[1]; $subelement = $regs[2]; @@ -1295,7 +1291,7 @@ if ($action == 'create' && $user->rights->commande->creer) if ($element == 'project') { - $projectid=GETPOST('originid'); + $projectid=$originid; } else { @@ -1308,7 +1304,7 @@ if ($action == 'create' && $user->rights->commande->creer) $classname = ucfirst($subelement); $objectsrc = new $classname($db); - $objectsrc->fetch(GETPOST('originid')); + $objectsrc->fetch($originid); if (empty($objectsrc->lines) && method_exists($objectsrc,'fetch_lines')) $objectsrc->fetch_lines(); $objectsrc->fetch_thirdparty(); @@ -1353,8 +1349,8 @@ if ($action == 'create' && $user->rights->commande->creer) print '' ."\n"; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; @@ -1422,14 +1418,14 @@ if ($action == 'create' && $user->rights->commande->creer) // What trigger creation print ''; // Project - if ($conf->projet->enabled) + if (! empty($conf->projet->enabled)) { $projectid = 0; - if (isset($_GET["origin"]) && $_GET["origin"] == 'project') $projectid = ($_GET["originid"]?$_GET["originid"]:0); + if ($origin == 'project') $projectid = ($originid?$originid:0); print '
'.$langs->trans('Source').''; - $form->select_demand_reason((GETPOST("origin")=='propal'?'SRC_COMM':''),'demand_reason_id','',1); + $form->select_demand_reason(($origin=='propal'?'SRC_COMM':''),'demand_reason_id','',1); print '
'.$langs->trans('Project').''; $numprojet=select_projects($soc->id,$projectid); @@ -1489,7 +1485,7 @@ if ($action == 'create' && $user->rights->commande->creer) if (is_object($objectsrc)) { // TODO for compatibility - if ($_GET['origin'] == 'contrat') + if ($origin == 'contrat') { // Calcul contrat->price (HT), contrat->total (TTC), contrat->tva $objectsrc->remise_absolue=$remise_absolue; @@ -2285,7 +2281,7 @@ else $formmail->fromname = $user->getFullName($langs); $formmail->frommail = $user->email; $formmail->withfrom=1; - $formmail->withto=empty($_POST["sendto"])?1:$_POST["sendto"]; + $formmail->withto=GETPOST('sendto')?GETPOST('sendto'):1; $formmail->withtosocid=$soc->id; $formmail->withtocc=1; $formmail->withtoccsocid=0; diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index fd79483cf83..85328dd6e52 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1,6 +1,6 @@ - * Copyright (C) 2008-2011 Regis Houssin + * Copyright (C) 2008-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) * * This program is free software; you can redistribute it and/or modify @@ -27,32 +27,32 @@ /** * Same function than javascript unescape() function but in PHP. * - * @param string $sourcetodecode String to decode - * @return + * @param string $source String to decode + * @return String decoded */ function jsUnEscape($source) { $decodedStr = ""; $pos = 0; - $len = strlen ($source); + $len = strlen($source); while ($pos < $len) { - $charAt = substr ($source, $pos, 1); + $charAt = substr($source, $pos, 1); if ($charAt == '%') { $pos++; - $charAt = substr ($source, $pos, 1); + $charAt = substr($source, $pos, 1); if ($charAt == 'u') { // we got a unicode character $pos++; - $unicodeHexVal = substr ($source, $pos, 4); - $unicode = hexdec ($unicodeHexVal); + $unicodeHexVal = substr($source, $pos, 4); + $unicode = hexdec($unicodeHexVal); $entity = "&#". $unicode . ';'; - $decodedStr .= utf8_encode ($entity); + $decodedStr .= utf8_encode($entity); $pos += 4; } else { // we have an escaped ascii character - $hexVal = substr ($source, $pos, 2); - $decodedStr .= chr (hexdec ($hexVal)); + $hexVal = substr($source, $pos, 2); + $decodedStr .= chr(hexdec ($hexVal)); $pos += 2; } } else {