From 3782742aad00d5f9aab6349e60ce3d38f997c9a4 Mon Sep 17 00:00:00 2001 From: KreizIT Date: Sat, 15 Mar 2014 10:28:01 +0100 Subject: [PATCH 01/21] - add batch management on supplier dispatch product - SECURITY FIX : replace $_GET and $_POST by GETPOST in dispatch.php --- htdocs/core/js/lib_batch.js | 34 ++++++ .../class/fournisseur.commande.class.php | 8 +- htdocs/fourn/commande/dispatch.php | 105 ++++++++++++++---- htdocs/fourn/commande/fiche.php | 3 +- htdocs/langs/fr_FR/productbatch.lang | 2 +- 5 files changed, 127 insertions(+), 25 deletions(-) create mode 100644 htdocs/core/js/lib_batch.js diff --git a/htdocs/core/js/lib_batch.js b/htdocs/core/js/lib_batch.js new file mode 100644 index 00000000000..65c138b73aa --- /dev/null +++ b/htdocs/core/js/lib_batch.js @@ -0,0 +1,34 @@ +// Copyright (C) 2014 Cedric GROSS +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// or see http://www.gnu.org/ + +// +// \file htdocs/core/js/lib_batch.js +// \brief File that include javascript functions used when dispatching batch-enabled product +// + +function AddLineBatch(index) { + var nme = 'dluo_0_'+index; + $row=$("tr[name='"+nme+"']").clone(true); + $row.find("input[name^='qty']").val(''); + var trs = $("tr[name^='dluo_'][name$='_"+index+"']"); + var newrow=$row.html().replace(/_0_/g,"_"+(trs.length)+"_"); + $row.html(newrow); + //clear value + $row.find("input[name^='qty']").val(''); + //change name of row + $row.attr('name','dluo_'+trs.length+'_'+index); + $("tr[name^='dluo_'][name$='_"+index+"']:last").after($row); +} \ No newline at end of file diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index ed9cd323597..4de4092691b 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -31,6 +31,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/class/commonorder.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; +if (! empty($conf->productbatch->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/productbatch.class.php'; /** @@ -1233,9 +1234,12 @@ class CommandeFournisseur extends CommonOrder * @param int $entrepot Id of warehouse to add product * @param double $price Unit Price for PMP value calculation (Unit price without Tax and taking into account discount) * @param string $comment Comment for stock movement + * @param date $eatby eat-by date + * @param date $sellby sell-by date + * @param string $batch Lot number * @return int <0 if KO, >0 if OK */ - function DispatchProduct($user, $product, $qty, $entrepot, $price=0, $comment='') + function DispatchProduct($user, $product, $qty, $entrepot, $price=0, $comment='', $eatby='', $sellby='', $batch='') { global $conf; $error = 0; @@ -1288,7 +1292,7 @@ class CommandeFournisseur extends CommonOrder if ($product > 0) { // $price should take into account discount (except if option STOCK_EXCLUDE_DISCOUNT_FOR_PMP is on) - $result=$mouv->reception($user, $product, $entrepot, $qty, $price, $comment); + $result=$mouv->reception($user, $product, $entrepot, $qty, $price, $comment, $eatby, $sellby, $batch); if ($result < 0) { $this->error=$mouv->error; diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 4bc7a22b06b..c9d6b0f3ad7 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -4,6 +4,7 @@ * Copyright (C) 2005 Eric Seigne * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2010 Juanjo Menent + * Copyright (C) 2014 Cdric Gross * * 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,6 +41,7 @@ $langs->load('bills'); $langs->load('deliveries'); $langs->load('products'); $langs->load('stocks'); +if (! empty($conf->productbatch->enabled)) $langs->load('productbatch'); // Security check $id = GETPOST("id",'int'); @@ -53,7 +55,7 @@ if (empty($conf->stock->enabled)) // Recuperation de l'id de projet $projectid = 0; -if ($_GET["projectid"]) $projectid = $_GET["projectid"]; +if ($_GET["projectid"]) $projectid = GETPOST("projectid",'int'); $mesg=''; @@ -76,9 +78,9 @@ if ($_POST["action"] == 'dispatch' && $user->rights->fournisseur->commande->rece $qty = "qty_".$reg[1]; $ent = "entrepot_".$reg[1]; $pu = "pu_".$reg[1]; // This is unit price including discount - if ($_POST[$ent] > 0) + if (GETPOST($ent,'int') > 0) { - $result = $commande->DispatchProduct($user, $_POST[$prod], $_POST[$qty], $_POST[$ent], $_POST[$pu], $_POST["comment"]); + $result = $commande->DispatchProduct($user, GETPOST($prod,'int'),GETPOST($qty), GETPOST($ent,'int'), GETPOST($pu), GETPOST("comment")); } else { @@ -86,7 +88,33 @@ if ($_POST["action"] == 'dispatch' && $user->rights->fournisseur->commande->rece $text = $langs->transnoentities('Warehouse').', '.$langs->transnoentities('Line').'' .($reg[1]-1); setEventMessage($langs->trans('ErrorFieldRequired',$text), 'errors'); } + } else if (preg_match('/^product_([0-9]+)_([0-9]+)$/i', $key, $reg)) { + //eat-by date dispatch + $prod = "product_".$reg[1]."_".$reg[2]; + $qty = "qty_".$reg[1]."_".$reg[2]; + $ent = "entrepot_".$reg[1]."_".$reg[2]; + $pu = "pu_".$reg[1]."_".$reg[2]; + $lot = "lot_number_".$reg[1]."_".$reg[2]; + $dDLUO = dol_mktime(12, 0 , 0, $_POST['dluo_'.$reg[1]."_".$reg[2].'month'], $_POST['dluo_'.$reg[1]."_".$reg[2].'day'], $_POST['dluo_'.$reg[1]."_".$reg[2].'year']); + $dDLC = dol_mktime(12, 0 , 0, $_POST['dlc_'.$reg[1]."_".$reg[2].'month'], $_POST['dlc_'.$reg[1]."_".$reg[2].'day'], $_POST['dlc_'.$reg[1]."_".$reg[2].'year']); + + if (! (GETPOST($ent,'int') > 0)) + { + dol_syslog('No dispatch for line '.$key.' as no warehouse choosed'); + $text = $langs->transnoentities('Warehouse').', '.$langs->transnoentities('Line').'' .($reg[1]-1); + setEventMessage($langs->trans('ErrorFieldRequired',$text), 'errors'); } + if (!((GETPOST($qty) > 0 ) && ( $_POST[$lot] or $dDLUO or $dDLC) )) + { + dol_syslog('No dispatch for line '.$key.' as qty is not set or eat-by date are not set'); + $text = $langs->transnoentities('atleast1batchfield').', '.$langs->transnoentities('Line').'' .($reg[1]-1); + setEventMessage($langs->trans('ErrorFieldRequired',$text), 'errors'); + } else { + $result = $commande->DispatchProduct($user, GETPOST($prod,'int'),GETPOST($qty), GETPOST($ent,'int'), GETPOST($pu), GETPOST("comment"), $dDLC, $dDLUO, GETPOST($lot)); + } + + } + } if (! $notrigger) @@ -104,7 +132,7 @@ if ($_POST["action"] == 'dispatch' && $user->rights->fournisseur->commande->rece { $db->commit(); - header("Location: dispatch.php?id=".$_GET["id"]); + header("Location: dispatch.php?id=".$id); exit; } else @@ -120,22 +148,27 @@ if ($_POST["action"] == 'dispatch' && $user->rights->fournisseur->commande->rece * View */ -llxHeader('',$langs->trans("OrderCard"),"CommandeFournisseur"); + if (!empty($conf->productbatch->enabled)) { + llxHeader('',$langs->trans("OrderCard"),"CommandeFournisseur",'',0,0,array('/core/js/lib_batch.js')); + + } else { + llxHeader('',$langs->trans("OrderCard"),"CommandeFournisseur"); +} $form = new Form($db); $warehouse_static = new Entrepot($db); $now=dol_now(); -$id = $_GET['id']; -$ref= $_GET['ref']; +$id = GETPOST('id','int'); +$ref= GETPOST('ref'); if ($id > 0 || ! empty($ref)) { //if ($mesg) print $mesg.'
'; $commande = new CommandeFournisseur($db); - $result=$commande->fetch($_GET['id'],$_GET['ref']); + $result=$commande->fetch($id,$ref); if ($result >= 0) { $soc = new Societe($db); @@ -237,11 +270,11 @@ if ($id > 0 || ! empty($ref)) } $sql = "SELECT l.fk_product, l.subprice, l.remise_percent, SUM(l.qty) as qty,"; - $sql.= " p.ref, p.label"; + $sql.= " p.ref, p.label, p.tobatch"; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON l.fk_product=p.rowid"; $sql.= " WHERE l.fk_commande = ".$commande->id; - $sql.= " GROUP BY p.ref, p.label, l.fk_product, l.subprice, l.remise_percent"; // Calculation of amount dispatched is done per fk_product so we must group by fk_product + $sql.= " GROUP BY p.ref, p.label, p.tobatch, l.fk_product, l.subprice, l.remise_percent"; // Calculation of amount dispatched is done per fk_product so we must group by fk_product $sql.= " ORDER BY p.ref, p.label"; $resql = $db->query($sql); @@ -253,13 +286,23 @@ if ($id > 0 || ! empty($ref)) if ($num) { print ''; - print ''.$langs->trans("Description").''; + print ''.$langs->trans("Description").''; print ''.$langs->trans("QtyOrdered").''; print ''.$langs->trans("QtyDispatched").''; print ''.$langs->trans("QtyDelivered").''; print ''.$langs->trans("Warehouse").''; print "\n"; + if (!empty($conf->productbatch->enabled)) { + print ''; + print ' '; + print ''.$langs->trans("l_eatby").''; + print ''.$langs->trans("l_sellby").''; + print ''.$langs->trans("batch_number").''; + print ' '; + print "\n"; + } + } $nbfreeproduct=0; @@ -285,35 +328,57 @@ if ($id > 0 || ! empty($ref)) $var=!$var; print ""; - print ''; + print ''; print ''.img_object($langs->trans("ShowProduct"),'product').' '.$objp->ref.''; print ' - '.$objp->label."\n"; // To show detail cref and description value, we must make calculation by cref //print ($objp->cref?' ('.$objp->cref.')':''); //if ($objp->description) print '
'.nl2br($objp->description); - print ''."\n"; + if ((empty($conf->productbatch->enabled)) || $objp->tobatch==0) { + $suffix='_'.$i; + } else { + $suffix='_0_'.$i; + } - $up_ht_disc=$objp->subprice; - if (! empty($objp->remise_percent) && empty($conf->global->STOCK_EXCLUDE_DISCOUNT_FOR_PMP)) $up_ht_disc=price2num($up_ht_disc * (100 - $objp->remise_percent) / 100, 'MU'); + $up_ht_disc=$objp->subprice; + if (! empty($objp->remise_percent) && empty($conf->global->STOCK_EXCLUDE_DISCOUNT_FOR_PMP)) $up_ht_disc=price2num($up_ht_disc * (100 - $objp->remise_percent) / 100, 'MU'); - print ''."\n"; print "\n"; print ''.$objp->qty.''; print ''.$products_dispatched[$objp->fk_product].''; + if ( !(empty($conf->productbatch->enabled)) && $objp->tobatch==1) { + print ''.img_picto_common($langs->trans('add_dispatch_batch'),'treemenu/plustop2.gif','onClick="AddLineBatch('.$i.')"').''; + print ''; + print ''; + print ''; + print ''; + print ''; + $form->select_date('','dlc'.$suffix,'','',1,""); + print ''; + $form->select_date('','dluo'.$suffix,'','',1,""); + print ''; + print ''; + print ''; + print ' '; + } else { + print ''; + print ''; + } + // Dispatch - print ''; + print ''; // Warehouse print ''; if (count($listwarehouses)>1) { - print $form->selectarray("entrepot_".$i, $listwarehouses, '', 1, 0, 0, '', 0, 0, $disabled); + print $form->selectarray("entrepot".$suffix, $listwarehouses, '', 1, 0, 0, '', 0, 0, $disabled); } elseif (count($listwarehouses)==1) { - print $form->selectarray("entrepot_".$i, $listwarehouses, '', 0, 0, 0, '', 0, 0, $disabled); + print $form->selectarray("entrepot".$suffix, $listwarehouses, '', 0, 0, 0, '', 0, 0, $disabled); } else { @@ -339,7 +404,7 @@ if ($id > 0 || ! empty($ref)) { print $langs->trans("Comment").' : '; print 'trans("DispatchSupplierOrder",$commande->ref); + print $_POST["comment"]?GETPOST("comment"):$langs->trans("DispatchSupplierOrder",$commande->ref); // print ' / '.$commande->ref_supplier; // Not yet available print '" class="flat">

'; diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 93897eefadc..743988b3195 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -194,7 +194,7 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer) || (! GETPOST('dp_desc') && ! GETPOST('addline_predefined') && GETPOST('idprod', 'int')>0) // we push enter onto qty field ) { - $predef=(($conf->global->MAIN_FEATURES_LEVEL < 2) ? '_predef' : ''); + $predef= '_predef'; $idprod=GETPOST('idprod', 'int'); $product_desc = (GETPOST('product_desc')?GETPOST('product_desc'):(GETPOST('np_desc')?GETPOST('np_desc'):'')); $price_ht = ''; @@ -202,7 +202,6 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer) } $qty = GETPOST('qty'.$predef); $remise_percent=GETPOST('remise_percent'.$predef); - if (GETPOST('addline_libre') && GETPOST('pu') < 0 && $qty < 0) { setEventMessage($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPrice'), $langs->transnoentitiesnoconv('Qty')), 'errors'); diff --git a/htdocs/langs/fr_FR/productbatch.lang b/htdocs/langs/fr_FR/productbatch.lang index 081ea1ba291..a5c72da3aaa 100644 --- a/htdocs/langs/fr_FR/productbatch.lang +++ b/htdocs/langs/fr_FR/productbatch.lang @@ -15,4 +15,4 @@ printBatch= Lot: %s printEatby= DLC: %s printSellby= DLUO: %s printQty= Qté: %d - +add_dispatch_batch= Ajouter une ligne de dispatch DLUO From 9be2bb0e6013297093ab65552ea75f9181153472 Mon Sep 17 00:00:00 2001 From: KreizIT Date: Sun, 16 Mar 2014 07:00:27 +0100 Subject: [PATCH 02/21] Travis Fix --- htdocs/fourn/commande/dispatch.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index c9d6b0f3ad7..11854726c07 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -95,8 +95,8 @@ if ($_POST["action"] == 'dispatch' && $user->rights->fournisseur->commande->rece $ent = "entrepot_".$reg[1]."_".$reg[2]; $pu = "pu_".$reg[1]."_".$reg[2]; $lot = "lot_number_".$reg[1]."_".$reg[2]; - $dDLUO = dol_mktime(12, 0 , 0, $_POST['dluo_'.$reg[1]."_".$reg[2].'month'], $_POST['dluo_'.$reg[1]."_".$reg[2].'day'], $_POST['dluo_'.$reg[1]."_".$reg[2].'year']); - $dDLC = dol_mktime(12, 0 , 0, $_POST['dlc_'.$reg[1]."_".$reg[2].'month'], $_POST['dlc_'.$reg[1]."_".$reg[2].'day'], $_POST['dlc_'.$reg[1]."_".$reg[2].'year']); + $dDLUO = dol_mktime(12, 0, 0, $_POST['dluo_'.$reg[1]."_".$reg[2].'month'], $_POST['dluo_'.$reg[1]."_".$reg[2].'day'], $_POST['dluo_'.$reg[1]."_".$reg[2].'year']); + $dDLC = dol_mktime(12, 0, 0, $_POST['dlc_'.$reg[1]."_".$reg[2].'month'], $_POST['dlc_'.$reg[1]."_".$reg[2].'day'], $_POST['dlc_'.$reg[1]."_".$reg[2].'year']); if (! (GETPOST($ent,'int') > 0)) { From 55750e16d87f75f2d71dfd43684c4b844b658cc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Ferry?= Date: Sun, 16 Mar 2014 14:48:46 +0100 Subject: [PATCH 03/21] Prepare extrafields into categories --- .../admin/categorie_extrafields.php | 151 ++++++++++++++++++ htdocs/categories/class/categorie.class.php | 2 +- htdocs/core/lib/categories.lib.php | 5 + htdocs/core/modules/modCategorie.class.php | 2 +- .../install/mysql/migration/3.5.0-3.6.0.sql | 15 +- .../tables/llx_categories_extrafields.key.sql | 20 +++ .../tables/llx_categories_extrafields.sql | 26 +++ htdocs/langs/en_US/categories.lang | 6 +- 8 files changed, 222 insertions(+), 5 deletions(-) create mode 100644 htdocs/categories/admin/categorie_extrafields.php create mode 100644 htdocs/install/mysql/tables/llx_categories_extrafields.key.sql create mode 100644 htdocs/install/mysql/tables/llx_categories_extrafields.sql diff --git a/htdocs/categories/admin/categorie_extrafields.php b/htdocs/categories/admin/categorie_extrafields.php new file mode 100644 index 00000000000..7ff0c854dcf --- /dev/null +++ b/htdocs/categories/admin/categorie_extrafields.php @@ -0,0 +1,151 @@ + + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/categories/admin/categorie_extrafields.php + * \ingroup societe + * \brief Page to setup extra fields of category + */ + +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + +$langs->load("categories"); +$langs->load("admin"); + +$extrafields = new ExtraFields($db); +$form = new Form($db); + +// List of supported format +$tmptype2label=getStaticMember(get_class($extrafields),'type2label'); +$type2label=array(''); +foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val); + +$action=GETPOST('action', 'alpha'); +$attrname=GETPOST('attrname', 'alpha'); +$elementtype='categories'; //Must be the $element of the class that manage extrafield + +if (!$user->admin) accessforbidden(); + + +/* + * Actions + */ +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; + + +/* + * View + */ + +$textobject=$langs->transnoentitiesnoconv("Categories"); + +$help_url='EN:Module Third Parties setup|FR:Paramétrage_du_module_Tiers'; +llxHeader('',$langs->trans("CompanySetup"),$help_url); + + +$linkback=''.$langs->trans("BackToModuleList").''; +print_fiche_titre($langs->trans("CategoriesSetup"),$linkback,'setup'); + +$head = categoriesadmin_prepare_head(null); + +dol_fiche_head($head, 'attributes_categories', $langs->trans("Categories"), 0, 'categoriesadmin'); + +print $langs->trans("DefineHereComplementaryAttributes",$textobject).'
'."\n"; +print '
'; + +// Load attribute_label +$extrafields->fetch_name_optionals_label($elementtype); + +print ""; + +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print "\n"; + +$var=True; +foreach($extrafields->attribute_type as $key => $value) +{ + $var=!$var; + print ""; + print "\n"; + print "\n"; + print "\n"; + print '\n"; + print '\n"; + print '\n"; + print '\n"; + print ""; + // $i++; +} + +print "
'.$langs->trans("Label").''.$langs->trans("AttributeCode").''.$langs->trans("Type").''.$langs->trans("Size").''.$langs->trans("Unique").''.$langs->trans("Required").' 
".$extrafields->attribute_label[$key]."".$key."".$type2label[$extrafields->attribute_type[$key]]."'.$extrafields->attribute_size[$key]."'.yn($extrafields->attribute_unique[$key])."'.yn($extrafields->attribute_required[$key])."'.img_edit().''; + print "  ".img_delete()."
"; + +dol_fiche_end(); + + +// Buttons +if ($action != 'create' && $action != 'edit') +{ + print '
'; + print "".$langs->trans("NewAttribute").""; + print "
"; +} + + +/* ************************************************************************** */ +/* */ +/* Creation d'un champ optionnel + /* */ +/* ************************************************************************** */ + +if ($action == 'create') +{ + print "
"; + print_titre($langs->trans('NewAttribute')); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; +} + +/* ************************************************************************** */ +/* */ +/* Edition d'un champ optionnel */ +/* */ +/* ************************************************************************** */ +if ($action == 'edit' && ! empty($attrname)) +{ + print "
"; + print_titre($langs->trans("FieldEdition", $attrname)); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; +} + +llxFooter(); + +$db->close(); +?> diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 244b1987448..9aec1a23319 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -39,7 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; class Categorie { public $element='category'; - public $table_element='category'; + public $table_element='categories'; var $id; var $fk_parent; diff --git a/htdocs/core/lib/categories.lib.php b/htdocs/core/lib/categories.lib.php index dc4b5aaac20..179ff317294 100644 --- a/htdocs/core/lib/categories.lib.php +++ b/htdocs/core/lib/categories.lib.php @@ -78,6 +78,11 @@ function categoriesadmin_prepare_head() $head[$h][1] = $langs->trans("Setup"); $head[$h][2] = 'setup'; $h++; + + $head[$h][0] = DOL_URL_ROOT.'/categories/admin/categorie_extrafields.php'; + $head[$h][1] = $langs->trans("ExtraFieldsCategories"); + $head[$h][2] = 'attributes_categories'; + $h++; // Show more tabs from modules // Entries must be declared in modules descriptor with line diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index 2eccc4701b3..030b40a09f4 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -63,7 +63,7 @@ class modCategorie extends DolibarrModules $this->depends = array(); // Config pages - $this->config_page_url = array(); + $this->config_page_url = array('categorie_extrafields.php@categories'); $this->langfiles = array("products","companies","categories"); // Constantes diff --git a/htdocs/install/mysql/migration/3.5.0-3.6.0.sql b/htdocs/install/mysql/migration/3.5.0-3.6.0.sql index 0fb148e0f40..ff795a7ab79 100644 --- a/htdocs/install/mysql/migration/3.5.0-3.6.0.sql +++ b/htdocs/install/mysql/migration/3.5.0-3.6.0.sql @@ -1064,4 +1064,17 @@ CREATE TABLE llx_payment_salary ( --New 1074 : Stock mouvement link to origin ALTER TABLE llx_stock_mouvement ADD fk_origin INT NOT NULL ; -ALTER TABLE llx_stock_mouvement ADD origintype VARCHAR( 32 ) NOT NULL ; \ No newline at end of file +ALTER TABLE llx_stock_mouvement ADD origintype VARCHAR( 32 ) NOT NULL ; + + +-- New : extrafield on categories +create table llx_categories_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; + +ALTER TABLE llx_categories_extrafields ADD INDEX idx_categories_extrafields (fk_object); + diff --git a/htdocs/install/mysql/tables/llx_categories_extrafields.key.sql b/htdocs/install/mysql/tables/llx_categories_extrafields.key.sql new file mode 100644 index 00000000000..6089f886028 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_categories_extrafields.key.sql @@ -0,0 +1,20 @@ +-- =================================================================== +-- Copyright (C) 2014 Jean-François Ferry +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- =================================================================== + + +ALTER TABLE llx_categories_extrafields ADD INDEX idx_categories_extrafields (fk_object); diff --git a/htdocs/install/mysql/tables/llx_categories_extrafields.sql b/htdocs/install/mysql/tables/llx_categories_extrafields.sql new file mode 100644 index 00000000000..ff91cc34b2b --- /dev/null +++ b/htdocs/install/mysql/tables/llx_categories_extrafields.sql @@ -0,0 +1,26 @@ +-- ======================================================================== +-- Copyright (C) 2014 Jean-François Ferry +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- ======================================================================== + +create table llx_categories_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; + diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index 1740288683d..85d445dfc19 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -66,7 +66,7 @@ ReturnInCompany=Back to customer/prospect card ContentsVisibleByAll=The contents will be visible by all ContentsVisibleByAllShort=Contents visible by all ContentsNotVisibleByAllShort=Contents not visible by all -CategoriesTree=Categories tree +CategoriesTree=Categories tree² DeleteCategory=Delete category ConfirmDeleteCategory=Are you sure you want to delete this category ? RemoveFromCategory=Remove link with categorie @@ -106,4 +106,6 @@ CatCusLinks=Customer/Prospects CatSupLinks=Suppliers DeleteFromCat=Remove from category DeletePicture=Picture delete -ConfirmDeletePicture=Confirm picture deletion? \ No newline at end of file +ConfirmDeletePicture=Confirm picture deletion? +ExtraFieldsCategories=Complementary attributes +CategoriesSetup=Categories setup \ No newline at end of file From f14d2fbfe04731381c871fe78441a7721e192214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Ferry?= Date: Sun, 16 Mar 2014 15:00:10 +0100 Subject: [PATCH 04/21] Add information message for option into categories setup --- htdocs/categories/admin/categorie.php | 4 ++-- htdocs/langs/en_US/categories.lang | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/categories/admin/categorie.php b/htdocs/categories/admin/categorie.php index b762e1b1fcc..085c5b7f5e1 100644 --- a/htdocs/categories/admin/categorie.php +++ b/htdocs/categories/admin/categorie.php @@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php'; if (!$user->admin) accessforbidden(); -$langs->load("cateogries"); +$langs->load("categories"); $action=GETPOST("action"); @@ -95,7 +95,7 @@ $form = new Form($db); $var=!$var; print ''; print ''.$langs->trans("CategorieRecursiv").''; -print ' '; +print ''. $form->textwithpicto('',$langs->trans("CategorieRecursivHelp"),1,'help').''; print ''; if ($conf->use_javascript_ajax) diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index 85d445dfc19..0727deeb86f 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -108,4 +108,6 @@ DeleteFromCat=Remove from category DeletePicture=Picture delete ConfirmDeletePicture=Confirm picture deletion? ExtraFieldsCategories=Complementary attributes -CategoriesSetup=Categories setup \ No newline at end of file +CategoriesSetup=Categories setup +CategorieRecursiv=Link with parent category automatically +CategorieRecursivHelp=If activated, product will also linked to parent category when adding into a subcategory \ No newline at end of file From d9baae345689347a5fede8872bca39500430ae41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Ferry?= Date: Sun, 16 Mar 2014 15:25:13 +0100 Subject: [PATCH 05/21] Implement extrafields into category create --- htdocs/categories/class/categorie.class.php | 3 ++- htdocs/categories/fiche.php | 14 +++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 9aec1a23319..de82480bf4f 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -28,6 +28,7 @@ * \brief File of class to manage categories */ +require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; @@ -36,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; /** * Class to manage categories */ -class Categorie +class Categorie extends CommonObject { public $element='category'; public $table_element='categories'; diff --git a/htdocs/categories/fiche.php b/htdocs/categories/fiche.php index d43c4df9a3d..64f526bcb3c 100644 --- a/htdocs/categories/fiche.php +++ b/htdocs/categories/fiche.php @@ -27,9 +27,12 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $langs->load("categories"); +$extrafields = new ExtraFields($db); +$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); // Security check $socid=GETPOST('socid','int'); @@ -59,6 +62,7 @@ if ($origin) if ($catorigin && $type == 0) $idCatOrigin = $catorigin; +$object = new Categorie($db); /* * Actions @@ -112,7 +116,7 @@ if ($action == 'add' && $user->rights->categorie->creer) } } - $object = new Categorie($db); + $object->label = $label; $object->description = dol_htmlcleanlastbr($description); @@ -121,6 +125,8 @@ if ($action == 'add' && $user->rights->categorie->creer) $object->type = $type; if ($parent != "-1") $object->fk_parent = $parent; + + $ret = $extrafields->setOptionalsFromPost($extralabels,$object); if (! $object->label) { @@ -238,6 +244,12 @@ if ($user->rights->categorie->creer) print ''.$langs->trans("AddIn").''; print $form->select_all_categories($type, $catorigin); print ''; + + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) + { + print $object->showOptionals($extrafields,'edit'); + } print ''; From e2b47b99191b13de4540917ccaeeb9a4484324e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Ferry?= Date: Sun, 16 Mar 2014 16:04:18 +0100 Subject: [PATCH 06/21] Category extrafields on categories: edit and view --- htdocs/categories/class/categorie.class.php | 44 ++++++++++++++++++++- htdocs/categories/edit.php | 13 +++++- htdocs/categories/viewcat.php | 11 ++++++ 3 files changed, 65 insertions(+), 3 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index de82480bf4f..f645739d25e 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -103,6 +103,8 @@ class Categorie extends CommonObject $this->visible = $res['visible']; $this->type = $res['type']; $this->entity = $res['entity']; + + $this->fetch_optionals($this->id,$extralabels); $this->db->free($resql); @@ -131,7 +133,7 @@ class Categorie extends CommonObject */ function create($user='') { - global $conf,$langs; + global $conf,$langs,$hookmanager; $langs->load('categories'); $error=0; @@ -189,6 +191,24 @@ class Categorie extends CommonObject if ($id > 0) { $this->id = $id; + + // Actions on extra fields (by external module or standard code) + // FIXME le hook fait double emploi avec le trigger !! + $hookmanager->initHooks(array('HookModuleNamedao')); + $parameters=array('socid'=>$this->id); + $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if (empty($reshook)) + { + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + { + $result=$this->insertExtraFields(); + if ($result < 0) + { + $error++; + } + } + } + else if ($reshook < 0) $error++; // Appel des triggers include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; @@ -225,7 +245,7 @@ class Categorie extends CommonObject */ function update($user='') { - global $conf, $langs; + global $conf, $langs,$hookmanager; $error=0; @@ -258,8 +278,28 @@ class Categorie extends CommonObject dol_syslog(get_class($this)."::update sql=".$sql); if ($this->db->query($sql)) { + + // Actions on extra fields (by external module or standard code) + // FIXME le hook fait double emploi avec le trigger !! + $hookmanager->initHooks(array('HookCategorydao')); + $parameters=array(); + $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if (empty($reshook)) + { + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + { + $result=$this->insertExtraFields(); + if ($result < 0) + { + $error++; + } + } + } + else if ($reshook < 0) $error++; + $this->db->commit(); + // Appel des triggers include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($this->db); diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index 388cf47436a..de85a6ca6e2 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -26,6 +26,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $langs->load("categories"); @@ -50,7 +51,10 @@ if ($id == "") // Security check $result = restrictedArea($user, 'categorie', $id, '&category'); +$object = new Categorie($db); +$extrafields = new ExtraFields($db); +$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); /* * Actions @@ -85,6 +89,8 @@ if ($action == 'update' && $user->rights->categorie->creer) } if (empty($categorie->error)) { + $ret = $extrafields->setOptionalsFromPost($extralabels,$categorie); + if ($categorie->update($user) > 0) { header('Location: '.DOL_URL_ROOT.'/categories/viewcat.php?id='.$categorie->id.'&type='.$type); @@ -115,7 +121,6 @@ print_fiche_titre($langs->trans("ModifCat")); dol_htmloutput_errors($mesg); -$object = new Categorie($db); $object->fetch($id); $form = new Form($db); @@ -153,6 +158,12 @@ print ''.$langs->trans("In").''; print $form->select_all_categories($type,$object->fk_parent,'parent',64,$object->id); print ''; +$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook +if (empty($reshook) && ! empty($extrafields->attribute_label)) +{ + print $object->showOptionals($extrafields,'edit'); +} + print ''; print '
'; diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 53bd6179000..bec834e1ff9 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -27,6 +27,8 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + $langs->load("categories"); @@ -49,6 +51,7 @@ $result = restrictedArea($user, 'categorie', $id, '&category'); $object = new Categorie($db); $result=$object->fetch($id); +$object->fetch_optionals($id,$extralabels); if ($result <= 0) { dol_print_error($db,$object->error); @@ -57,6 +60,8 @@ if ($result <= 0) $type=$object->type; +$extrafields = new ExtraFields($db); +$extralabels = $extrafields->fetch_name_optionals_label($object->table_element); /* * Actions @@ -166,6 +171,12 @@ print $langs->trans("Description").''; print nl2br($object->description); print ''; +$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook +if (empty($reshook) && ! empty($extrafields->attribute_label)) +{ + print $object->showOptionals($extrafields); +} + print ''; print ''; From 503435689974ad2a2fc9491cb96aac3922808590 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Ferry?= Date: Sun, 16 Mar 2014 16:06:32 +0100 Subject: [PATCH 07/21] Manage extrafields deletion on categories --- htdocs/categories/class/categorie.class.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index f645739d25e..4c15c006cab 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -402,6 +402,19 @@ class Categorie extends CommonObject } else { + // Removed extrafields + if (! $error) + { + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + { + $result=$this->deleteExtraFields(); + if ($result < 0) + { + $error++; + dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR); + } + } + } // Appel des triggers include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($this->db); From eb5e891cf9262aa9c34376fbf26027f4d84ca05b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 16 Mar 2014 20:37:43 +0100 Subject: [PATCH 08/21] Fix: Not mandatory field must not be not null Fix: field to store amount must be double(24,8) --- htdocs/install/mysql/migration/3.5.0-3.6.0.sql | 10 +++++----- htdocs/install/mysql/tables/llx_projet_task_time.sql | 3 ++- htdocs/install/mysql/tables/llx_user.sql | 1 + htdocs/user/class/user.class.php | 7 +++---- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/htdocs/install/mysql/migration/3.5.0-3.6.0.sql b/htdocs/install/mysql/migration/3.5.0-3.6.0.sql index fef128888d2..214fbe4c89d 100644 --- a/htdocs/install/mysql/migration/3.5.0-3.6.0.sql +++ b/htdocs/install/mysql/migration/3.5.0-3.6.0.sql @@ -1063,9 +1063,9 @@ CREATE TABLE llx_payment_salary ( )ENGINE=innodb; --New 1074 : Stock mouvement link to origin -ALTER TABLE llx_stock_mouvement ADD fk_origin INT NOT NULL ; -ALTER TABLE llx_stock_mouvement ADD origintype VARCHAR( 32 ) NOT NULL ; +ALTER TABLE llx_stock_mouvement ADD fk_origin integer; +ALTER TABLE llx_stock_mouvement ADD origintype VARCHAR(32); ---NEw 1300 : Add THM on user -ALTER TABLE llx_user ADD thm FLOAT NOT NULL ; -ALTER TABLE llx_projet_task_time ADD thm FLOAT NOT NULL ; \ No newline at end of file +--New 1300 : Add THM on user +ALTER TABLE llx_user ADD thm double(24,8); +ALTER TABLE llx_projet_task_time ADD thm double(24,8); diff --git a/htdocs/install/mysql/tables/llx_projet_task_time.sql b/htdocs/install/mysql/tables/llx_projet_task_time.sql index 615bc587a06..8bef980a12e 100644 --- a/htdocs/install/mysql/tables/llx_projet_task_time.sql +++ b/htdocs/install/mysql/tables/llx_projet_task_time.sql @@ -19,9 +19,10 @@ create table llx_projet_task_time ( rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_task integer NOT NULL, + fk_task integer NOT NULL, task_date date, task_duration double, fk_user integer, + thm double(24,8), note text )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_user.sql b/htdocs/install/mysql/tables/llx_user.sql index a2d6a32264c..199bfe7e69e 100644 --- a/htdocs/install/mysql/tables/llx_user.sql +++ b/htdocs/install/mysql/tables/llx_user.sql @@ -54,6 +54,7 @@ create table llx_user fk_socpeople integer, fk_member integer, fk_user integer, -- Hierarchic parent + thm double(24,8), note text DEFAULT NULL, datelastlogin datetime, datepreviouslogin datetime, diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 965088d7358..3241f6dbc12 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -207,7 +207,7 @@ class User extends CommonObject $this->office_fax = $obj->office_fax; $this->user_mobile = $obj->user_mobile; $this->email = $obj->email; - $this->skype = $obj->skype; + $this->skype = $obj->skype; $this->job = $obj->job; $this->signature = $obj->signature; $this->admin = $obj->admin; @@ -218,7 +218,7 @@ class User extends CommonObject $this->lang = $obj->lang; $this->entity = $obj->entity; $this->accountancy_code = $obj->accountancy_code; - $this->thm = $obj->thm; + $this->thm = $obj->thm; $this->datec = $this->db->jdate($obj->datec); $this->datem = $this->db->jdate($obj->datem); @@ -1138,7 +1138,6 @@ class User extends CommonObject $this->zip = empty($this->zip)?'':$this->zip; $this->town = empty($this->town)?'':$this->town; $this->accountancy_code = trim($this->accountancy_code); - $this->thm = price2num($this->thm); // Check parameters if (! empty($conf->global->USER_MAIL_REQUIRED) && ! isValidEMail($this->email)) @@ -1169,7 +1168,7 @@ class User extends CommonObject $sql.= ", job = '".$this->db->escape($this->job)."'"; $sql.= ", signature = '".$this->db->escape($this->signature)."'"; $sql.= ", accountancy_code = '".$this->db->escape($this->accountancy_code)."'"; - $sql.= ", thm = ".$this->thm; + $sql.= ", thm = ".(isset($this->thm)?$this->thm:"null"); // If not set, we use null $sql.= ", note = '".$this->db->escape($this->note)."'"; $sql.= ", photo = ".($this->photo?"'".$this->db->escape($this->photo)."'":"null"); $sql.= ", openid = ".($this->openid?"'".$this->db->escape($this->openid)."'":"null"); From 2494b01cf1ef674aaaecf9badc8124c2c4810966 Mon Sep 17 00:00:00 2001 From: jfefe Date: Mon, 17 Mar 2014 10:20:43 +0100 Subject: [PATCH 09/21] Fix : bad character into categories lang Probably due to my table neighbor who constantly moving during devcamp ^^ --- htdocs/langs/en_US/categories.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index 0727deeb86f..fb9ad8a3b6d 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -66,7 +66,7 @@ ReturnInCompany=Back to customer/prospect card ContentsVisibleByAll=The contents will be visible by all ContentsVisibleByAllShort=Contents visible by all ContentsNotVisibleByAllShort=Contents not visible by all -CategoriesTree=Categories tree² +CategoriesTree=Categories tree DeleteCategory=Delete category ConfirmDeleteCategory=Are you sure you want to delete this category ? RemoveFromCategory=Remove link with categorie @@ -110,4 +110,4 @@ ConfirmDeletePicture=Confirm picture deletion? ExtraFieldsCategories=Complementary attributes CategoriesSetup=Categories setup CategorieRecursiv=Link with parent category automatically -CategorieRecursivHelp=If activated, product will also linked to parent category when adding into a subcategory \ No newline at end of file +CategorieRecursivHelp=If activated, product will also linked to parent category when adding into a subcategory From 81b8961dab725fb2171e3bbdc62e135c54487ce5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Mar 2014 11:13:53 +0100 Subject: [PATCH 10/21] Qual: Dead code war --- htdocs/core/class/menubase.class.php | 1 - htdocs/main.inc.php | 17 +---------------- htdocs/theme/amarok/style.css.php | 4 ---- htdocs/theme/auguria/style.css.php | 4 ---- htdocs/theme/bureau2crea/style.css.php | 2 -- htdocs/theme/cameleo/style.css.php | 4 ---- htdocs/theme/eldy/style.css.php | 2 -- 7 files changed, 1 insertion(+), 33 deletions(-) diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php index 961cfd5733c..c884344dd1f 100644 --- a/htdocs/core/class/menubase.class.php +++ b/htdocs/core/class/menubase.class.php @@ -547,7 +547,6 @@ class Menubase $tmpcond=$menu['enabled']; if ($leftmenu == 'all') $tmpcond=preg_replace('/\$leftmenu\s*==\s*["\'a-zA-Z_]+/','1==1',$tmpcond); // Force part of condition to true $enabled = verifCond($tmpcond); - //if ($conf->use_javascript_ajax && ! empty($conf->global->MAIN_MENU_USE_JQUERY_ACCORDION) && empty($conf->dol_use_jmobile) && preg_match('/^\$leftmenu/',$menu['enabled'])) $enabled=1; } // Define $title diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 7140c04a80c..68f341e612b 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1177,6 +1177,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs { // We must force not using ajax because cache of jquery does not load js of other pages. // This also increase seriously speed onto mobile device where complex js code is very slow and memory very low. + // Note: dol_use_jmobile=1 use jmobile without ajax, dol_use_jmobile=2 use jmobile with ajax if (empty($conf->dol_use_jmobile) || ($conf->dol_use_jmobile != 2 && $conf->dol_use_jmobile != 3)) { print ''; } - /* This make menu bugged - if ($conf->use_javascript_ajax && ! empty($conf->global->MAIN_MENU_USE_JQUERY_ACCORDION) && empty($conf->dol_use_jmobile)) - { - print "\n".''; - } */ - // Wrapper to show tooltips print "\n".'