From bd25a98e03a700e21d73443489e037d4f47218fc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 10 Feb 2014 00:24:20 +0100 Subject: [PATCH] New: Generation auto of barcode is available for product. --- htdocs/admin/barcode.php | 140 +++++++++--------- ...d.php => mod_barcode_product_standard.php} | 58 +++----- htdocs/langs/en_US/admin.lang | 5 +- htdocs/product/class/product.class.php | 65 ++++++-- htdocs/product/fiche.php | 46 +++--- htdocs/societe/soc.php | 9 +- 6 files changed, 175 insertions(+), 148 deletions(-) rename htdocs/core/modules/barcode/{mod_barcode_standard.php => mod_barcode_product_standard.php} (79%) diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index 72d50cebd28..5824d298ee4 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -39,15 +39,16 @@ $action = GETPOST('action','alpha'); * Actions */ -if ($action == 'setbarcodeon') +if ($action == 'setbarcodeproducton') { - $res=dolibarr_set_const($db, "BARCODE_ADDON_NUM", GETPOST('value'), 'chaine', 0, '', $conf->entity); + $res=dolibarr_set_const($db, "BARCODE_PRODUCT_ADDON_NUM", GETPOST('value'), 'chaine', 0, '', $conf->entity); } -elseif ($action == 'setbarcodeoff') +elseif ($action == 'setbarcodeproductoff') { - $res=dolibarr_del_const($db, "BARCODE_ADDON_NUM", $conf->entity); + $res=dolibarr_del_const($db, "BARCODE_PRODUCT_ADDON_NUM", $conf->entity); } -else if ($action == 'setcoder') + +if ($action == 'setcoder') { $coder = GETPOST('coder','alpha'); $code_id = GETPOST('code_id','alpha'); @@ -82,7 +83,7 @@ else if ($action == 'update') if ($action == 'setModuleOptions') { $post_size=count($_POST); - + for($i=0;$i < $post_size;$i++) { if (array_key_exists('param'.$i,$_POST)) @@ -125,7 +126,8 @@ if ($action && $action != 'setcoder' && $action != 'setModuleOptions') $form = new Form($db); $formbarcode = new FormBarCode($db); -llxHeader('',$langs->trans("BarcodeSetup"),'BarcodeConfiguration'); +$help_url='EN:Module_Barcode|FR:Module_Codes_Barre|ES:Módulo Código de barra'; +llxHeader('',$langs->trans("BarcodeSetup"),$help_url); $linkback=''.$langs->trans("BackToModuleList").''; print_fiche_titre($langs->trans("BarcodeSetup"),$linkback,'setup'); @@ -351,74 +353,78 @@ print "\n"; print '
'; + + // Select barcode numbering module - -print_titre($langs->trans("BarCodeNumberManager")); - -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print "\n"; - -$dirbarcodenum=array_merge(array('/core/modules/barcode/'),$conf->modules_parts['barcode']); - -foreach ($dirbarcodenum as $dirroot) +if ($conf->produit->enabled) { - $dir = dol_buildpath($dirroot,0); + print_titre($langs->trans("BarCodeNumberManager")." (".$langs->trans("Product").")"); - $handle = @opendir($dir); - if (is_resource($handle)) - { - while (($file = readdir($handle))!==false) - { - if (preg_match('/^mod_barcode_.*php$/', $file)) - { - $file = substr($file, 0, dol_strlen($file)-4); + print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Status").''.$langs->trans("ShortInfo").'
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; - try { - dol_include_once($dirroot.$file.'.php'); - } - catch(Exception $e) - { - dol_syslog($e->getMessage(), LOG_ERR); - } + $dirbarcodenum=array_merge(array('/core/modules/barcode/'),$conf->modules_parts['barcode']); - $modBarCode = new $file(); - $var = !$var; + foreach ($dirbarcodenum as $dirroot) + { + $dir = dol_buildpath($dirroot,0); - print ''; - print ''; - print '\n"; + $handle = @opendir($dir); + if (is_resource($handle)) + { + while (($file = readdir($handle))!==false) + { + if (preg_match('/^mod_barcode_product_.*php$/', $file)) + { + $file = substr($file, 0, dol_strlen($file)-4); - if ($conf->global->BARCODE_ADDON_NUM == "$file") - { - print ''; - } - else - { - print ''; - } - print ''; - print "\n"; - } - } - closedir($handle); - } + try { + dol_include_once($dirroot.$file.'.php'); + } + catch(Exception $e) + { + dol_syslog($e->getMessage(), LOG_ERR); + } + + $modBarCode = new $file(); + $var = !$var; + + print ''; + print ''; + print '\n"; + + if ($conf->global->BARCODE_PRODUCT_ADDON_NUM == "$file") + { + print ''; + } + else + { + print ''; + } + print ''; + print "\n"; + } + } + closedir($handle); + } + } + print "
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Status").''.$langs->trans("ShortInfo").'
'.$modBarCode->nom."\n"; - print $modBarCode->info($langs); - print ''.$modBarCode->getExample($langs)."'; - print img_picto($langs->trans("Activated"),'switch_on'); - print ''; - print img_picto($langs->trans("Disabled"),'switch_off'); - print ''; - $s=$modBarCode->getToolTip($langs,null,-1); - print $form->textwithpicto('',$s,1); - print '
'.$modBarCode->nom."\n"; + print $modBarCode->info($langs); + print ''.$modBarCode->getExample($langs)."'; + print img_picto($langs->trans("Activated"),'switch_on'); + print ''; + print img_picto($langs->trans("Disabled"),'switch_off'); + print ''; + $s=$modBarCode->getToolTip($langs,null,-1); + print $form->textwithpicto('',$s,1); + print '
\n"; } -print "\n"; print ''; diff --git a/htdocs/core/modules/barcode/mod_barcode_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php similarity index 79% rename from htdocs/core/modules/barcode/mod_barcode_standard.php rename to htdocs/core/modules/barcode/mod_barcode_product_standard.php index b543c1d3221..d20c7502f4a 100644 --- a/htdocs/core/modules/barcode/mod_barcode_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php @@ -20,7 +20,7 @@ */ /** - * \file htdocs/core/modules/product/mod_barcode_standard.php + * \file htdocs/core/modules/product/mod_barcode_product_standard.php * \ingroup barcode * \brief File of class to manage barcode numbering with standard rule */ @@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/barcode/modules_barcode.class.php' /** * Class to manage barcode with standard rule */ -class mod_barcode_standard extends ModeleNumRefBarCode +class mod_barcode_product_standard extends ModeleNumRefBarCode { var $nom='Standard'; // Nom du modele var $code_modifiable; // Code modifiable @@ -78,7 +78,7 @@ class mod_barcode_standard extends ModeleNumRefBarCode $texte.= '
'; $texte.= ''; $texte.= ''; - $texte.= ''; + $texte.= ''; $texte.= ''; $tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("BarCode"),$langs->transnoentities("BarCode")); @@ -89,7 +89,7 @@ class mod_barcode_standard extends ModeleNumRefBarCode // Mask parameter //$texte.= ''; $texte.= ''; - $texte.= ''; + $texte.= ''; $texte.= ''; $texte.= ''; @@ -137,10 +137,10 @@ class mod_barcode_standard extends ModeleNumRefBarCode require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php'; // TODO - + // Get Mask value $mask = ''; - if (! empty($conf->global->BARCODE_STANDARD_MASK)) $mask = $conf->global->BARCODE_STANDARD_MASK; + if (! empty($conf->global->BARCODE_STANDARD_PRODUCT_MASK)) $mask = $conf->global->BARCODE_STANDARD_PRODUCT_MASK; if (empty($mask)) { @@ -157,35 +157,19 @@ class mod_barcode_standard extends ModeleNumRefBarCode return $numFinal; } - - /** - * Check if mask/numbering use prefix - * - * @return int 0 or 1 - */ - function verif_prefixIsUsed() - { - global $conf; - - $mask = $conf->global->BARCODE_STANDARD_MASK; - if (preg_match('/\{pre\}/i',$mask)) return 1; - - return 0; - } - /** * Check validity of code according to its rules * - * @param DoliDB $db Database handler - * @param string &$code Code to check/correct + * @param DoliDB $db Database handler + * @param string &$code Code to check/correct * @param Product $product Object product - * @param int $type 0 = customer/prospect , 1 = supplier - * @return int 0 if OK - * -1 ErrorBadCustomerCodeSyntax - * -2 ErrorCustomerCodeRequired - * -3 ErrorCustomerCodeAlreadyUsed - * -4 ErrorPrefixRequired + * @param int $type 0 = customer/prospect , 1 = supplier + * @return int 0 if OK + * -1 ErrorBadCustomerCodeSyntax + * -2 ErrorCustomerCodeRequired + * -3 ErrorCustomerCodeAlreadyUsed + * -4 ErrorPrefixRequired */ function verif($db, &$code, $product, $type) { @@ -196,20 +180,18 @@ class mod_barcode_standard extends ModeleNumRefBarCode $result=0; $code = strtoupper(trim($code)); - if (empty($code) && $this->code_null && empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED)) + if (empty($code) && $this->code_null && empty($conf->global->BARCODE_STANDARD_PRODUCT_MASK)) { $result=0; } - else if (empty($code) && (! $this->code_null || ! empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED)) ) + else if (empty($code) && (! $this->code_null || ! empty($conf->global->BARCODE_STANDARD_PRODUCT_MASK)) ) { $result=-2; } else { // Get Mask value - $mask = ''; - if ($type==0) $mask = empty($conf->global->PRODUCT_ELEPHANT_MASK_PRODUCT)?'':$conf->global->PRODUCT_ELEPHANT_MASK_PRODUCT; - if ($type==1) $mask = empty($conf->global->PRODUCT_ELEPHANT_MASK_SSERVICE)?'':$conf->global->PRODUCT_ELEPHANT_MASK_SERVICE; + $mask = empty($conf->global->BARCODE_STANDARD_PRODUCT_MASK)?'':$conf->global->BARCODE_STANDARD_PRODUCT_MASK; if (! $mask) { $this->error='NotConfigured'; @@ -219,17 +201,17 @@ class mod_barcode_standard extends ModeleNumRefBarCode $result=check_value($mask,$code); } - dol_syslog("mod_codeclient_elephant::verif type=".$type." result=".$result); + dol_syslog(get_class($this)."::verif type=".$type." result=".$result); return $result; } /** - * Renvoi si un code est pris ou non (par autre tiers) + * Return if a code is used (by other element) * * @param DoliDB $db Handler acces base * @param string $code Code a verifier - * @param Product $product Objet product + * @param Product $product Objet product * @return int 0 if available, <0 if KO */ function verif_dispo($db, $code, $product) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index dfcd5c5d27c..b1f1ca324c2 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1014,6 +1014,7 @@ FieldEdition=Edition of field %s FixTZ=TimeZone fix FillThisOnlyIfRequired=Example: +2 (fill only if timezone offset problems are experienced) GetBarCode=Get barcode +EmptyNumRefModelDesc=The code is free. This code can be modified at any time. ##### Module password generation PasswordGenerationStandard=Return a password generated according to internal Dolibarr algorithm: 8 characters containing shared numbers and characters in lowercase. PasswordGenerationNone=Do not suggest any generated password. Password must be type in manually. @@ -1040,8 +1041,8 @@ DocumentModelOdt=Generate documents from OpenDocuments templates (.ODT or .ODS f WatermarkOnDraft=Watermark on draft document CompanyIdProfChecker=Rules on Professional Ids MustBeUnique=Must be unique ? -MustBeMandatory=Must be mandatory to create thirds? -MustBeInvoiceMandatory=Must be mandatory to validate invoices? +MustBeMandatory=Mandatory to create third parties ? +MustBeInvoiceMandatory=Mandatory to validate invoices ? Miscellaneous=Miscellaneous ##### Webcal setup ##### WebCalSetup=Webcalendar link setup diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 3a41f65a3a2..103df7ee322 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -7,7 +7,7 @@ * Copyright (C) 2010-2013 Juanjo Menent * Copyright (C) 2013 Cedric GROSS * Copyright (C) 2013 Marcos García - * Copyright (C) 2011-2014 Alexandre Spangaro + * Copyright (C) 2011-2014 Alexandre Spangaro * * 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 @@ -117,7 +117,7 @@ class Product extends CommonObject //! barcode var $barcode; // value var $barcode_type; // id - var $barcode_type_code; // code (loaded by fetch_barcode) + var $barcode_type_code; // code (loaded by fetch_barcode). Example ean, isbn... var $barcode_type_label; // label (loaded by fetch_barcode) var $barcode_type_coder; // coder (loaded by fetch_barcode) @@ -256,8 +256,8 @@ class Product extends CommonObject $price_min_ht = price2num($this->price_min,'MU'); $price_min_ttc = price2num($this->price_min * (1 + ($this->tva_tx / 100)),'MU'); } - - $this->accountancy_code_buy = trim($this->accountancy_code_buy); + + $this->accountancy_code_buy = trim($this->accountancy_code_buy); $this->accountancy_code_sell= trim($this->accountancy_code_sell); // Check parameters @@ -297,6 +297,9 @@ class Product extends CommonObject $this->db->begin(); + // For automatic creation during create action (not used by Dolibarr GUI, can be used by scripts) + if ($this->barcode == -1) $this->get_barcode($this,$this->barcode_type_code); + $sql = "SELECT count(*) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; $sql.= " WHERE entity IN (".getEntity('product', 1).")"; @@ -324,12 +327,12 @@ class Product extends CommonObject $sql.= ", price_base_type"; $sql.= ", tobuy"; $sql.= ", tosell"; - $sql.= ", accountancy_code_buy"; - $sql.= ", accountancy_code_sell"; + $sql.= ", accountancy_code_buy"; + $sql.= ", accountancy_code_sell"; $sql.= ", canvas"; $sql.= ", finished"; $sql.= ") VALUES ("; - $sql.= $this->db->idate($now); + $sql.= "'".$this->db->idate($now)."'"; $sql.= ", ".$conf->entity; $sql.= ", '".$this->db->escape($this->ref)."'"; $sql.= ", ".(! empty($this->ref_ext)?"'".$this->db->escape($this->ref_ext)."'":"null"); @@ -343,8 +346,8 @@ class Product extends CommonObject $sql.= ", '".$this->price_base_type."'"; $sql.= ", ".$this->status; $sql.= ", ".$this->status_buy; - $sql.= ", '".$this->accountancy_code_buy."'"; - $sql.= ", '".$this->accountancy_code_sell."'"; + $sql.= ", '".$this->accountancy_code_buy."'"; + $sql.= ", '".$this->accountancy_code_sell."'"; $sql.= ", '".$this->canvas."'"; $sql.= ", ".((empty($this->finished) || $this->finished < 0)?'null':$this->finished); $sql.= ")"; @@ -467,6 +470,12 @@ class Product extends CommonObject if (empty($this->country_id)) $this->country_id = 0; + //Gencod + $this->barcode=trim($this->barcode); + + // For automatic creation + if ($this->barcode == -1) $this->get_barcode($this,$this->barcode_type_code); + $this->accountancy_code_buy = trim($this->accountancy_code_buy); $this->accountancy_code_sell= trim($this->accountancy_code_sell); @@ -481,7 +490,7 @@ class Product extends CommonObject $sql.= ", barcode = ". (empty($this->barcode)?"null":"'".$this->db->escape($this->barcode)."'"); $sql.= ", fk_barcode_type = ". (empty($this->barcode_type)?"null":$this->db->escape($this->barcode_type)); - + $sql.= ", tosell = " . $this->status; $sql.= ", tobuy = " . $this->status_buy; $sql.= ", finished = " . ((empty($this->finished) || $this->finished < 0) ? "null" : $this->finished); @@ -1361,7 +1370,7 @@ class Product extends CommonObject // We should not load stock at each fetch. If someone need stock, he must call load_stock after fetch. //$res=$this->load_stock(); //return $res; - + return 1; } else @@ -1842,7 +1851,7 @@ class Product extends CommonObject return $this->_get_stats($sql,$mode); } - + /** * Return nb of units or orders in which product is included * @@ -1853,7 +1862,7 @@ class Product extends CommonObject function get_nb_ordersupplier($socid,$mode) { global $conf, $user; - + $sql = "SELECT sum(d.qty), date_format(c.date_commande, '%Y%m')"; if ($mode == 'bynumber') $sql.= ", count(DISTINCT c.rowid)"; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as d, ".MAIN_DB_PREFIX."commande_fournisseur as c, ".MAIN_DB_PREFIX."societe as s"; @@ -1866,7 +1875,7 @@ class Product extends CommonObject if ($socid > 0) $sql.= " AND c.fk_soc = ".$socid; $sql.= " GROUP BY date_format(c.date_commande,'%Y%m')"; $sql.= " ORDER BY date_format(c.date_commande,'%Y%m') DESC"; - + return $this->_get_stats($sql,$mode); } @@ -3095,6 +3104,34 @@ class Product extends CommonObject return ($this->type == 1 ? true : false); } + /** + * Attribut un code barre a partir du module de controle des codes. + * Return value is stored into this->barcode + * + * @param Product $object Object product or service + * @param int $type Barcode type (ean, isbn, ...) + * @return void + */ + function get_barcode($object,$type='') + { + global $conf; + if (! empty($conf->global->BARCODE_PRODUCT_ADDON_NUM)) + { + $dirsociete=array_merge(array('/core/modules/barcode/'),$conf->modules_parts['barcode']); + foreach ($dirsociete as $dirroot) + { + $res=dol_include_once($dirroot.$conf->global->BARCODE_PRODUCT_ADDON_NUM.'.php'); + if ($res) break; + } + $var = $conf->global->BARCODE_PRODUCT_ADDON_NUM; + $mod = new $var; + + $this->barcode = $mod->getNextValue($object,$type); + + dol_syslog(get_class($this)."::get_barcode barcode=".$this->barcode." module=".$var); + } + } + /** * Initialise an instance with random values. * Used to build previews or test instances. diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index 021e3a2688b..14c87f75743 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -8,7 +8,7 @@ * Copyright (C) 2010-2011 Juanjo Menent * Copyright (C) 2013 Marcos García * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2011-2014 Alexandre Spangaro + * Copyright (C) 2011-2014 Alexandre Spangaro * * 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 @@ -182,10 +182,10 @@ if (empty($reshook)) $object->type = $type; $object->status = GETPOST('statut'); $object->status_buy = GETPOST('statut_buy'); - + $object->barcode_type = GETPOST('fk_barcode_type'); $object->barcode = GETPOST('barcode'); - + $object->description = dol_htmlcleanlastbr(GETPOST('desc')); $object->note = dol_htmlcleanlastbr(GETPOST('note')); $object->customcode = GETPOST('customcode'); @@ -646,8 +646,8 @@ if (GETPOST("cancel") == $langs->trans("Cancel")) */ $helpurl=''; -if (GETPOST("type") == '0') $helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; -if (GETPOST("type") == '1') $helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; +if (GETPOST("type") == '0' || ($object->type == '0')) $helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; +if (GETPOST("type") == '1' || ($object->type == '1')) $helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; if (isset($_GET['type'])) $title = $langs->trans('CardProduct'.GETPOST('type')); else $title = $langs->trans('ProductServiceCard'); @@ -695,16 +695,16 @@ else } // Load object modBarCodeProduct - if (! empty($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE)) + if (! empty($conf->barcode->enabled) && ! empty($conf->global->BARCODE_PRODUCT_ADDON_NUM)) { - $module='mod_barcode_'.strtolower($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE); - $result=dol_include_once('/core/modules/barcode/doc/'.$module.'.php'); + $module=strtolower($conf->global->BARCODE_PRODUCT_ADDON_NUM); + $result=dol_include_once('/core/modules/barcode/'.$module.'.php'); if ($result > 0) { $modBarCodeProduct =new $module(); } } - + print ''; print ''; print ''; @@ -713,7 +713,7 @@ else print ''; if (! empty($modBarCodeProduct->code_auto)) print ''; - + if ($type==1) $title=$langs->trans("NewService"); else $title=$langs->trans("NewProduct"); print_fiche_titre($title); @@ -745,7 +745,7 @@ else print ''; $showbarcode=(! empty($conf->barcode->enabled) && $user->rights->barcode->lire); - + if ($showbarcode) { print ''; } - + // Description (used in invoice, propal...) print '
'.$langs->trans("Mask").' ('.$langs->trans("BarCodeModel").'):
'.$langs->trans("Mask").':'.$form->textwithpicto('',$tooltip,1,1).''.$form->textwithpicto('',$tooltip,1,1).' 
'.$langs->trans('BarcodeType').''; @@ -766,7 +766,7 @@ else print ''; print '
'.$langs->trans("Description").''; @@ -894,7 +894,7 @@ else print '
'; } - + if (empty($conf->accounting->enabled) && empty($conf->comptabilite->enabled) && empty($conf->accountingexpert->enabled)) { // Don't show accounting field when accounting id disabled. @@ -1090,7 +1090,7 @@ else print '
'; print '
'; - + if (empty($conf->accounting->enabled) && empty($conf->comptabilite->enabled) && empty($conf->accountingexpert->enabled)) { // Don't show accounting field when accounting id disabled. @@ -1098,22 +1098,22 @@ else else { print ''; - + // Accountancy_code_sell print ''; print ''; - + // Accountancy_code_buy print ''; print ''; - + print '
'.$langs->trans("ProductAccountancySellCode").''; print '
'.$langs->trans("ProductAccountancyBuyCode").''; print '
'; - + print '
'; } - + print '
    '; print '
'; @@ -1223,12 +1223,12 @@ else // Don't show accounting field when accounting id disabled. } else - { + { // Accountancy sell code print ''.$form->editfieldkey("ProductAccountancySellCode",'accountancy_code_sell',$object->accountancy_code_sell,$object,$user->rights->produit->creer||$user->rights->service->creer,'string').''; print $form->editfieldval("ProductAccountancySellCode",'accountancy_code_sell',$object->accountancy_code_sell,$object,$user->rights->produit->creer||$user->rights->service->creer,'string'); print ''; - + // Accountancy buy code print ''.$form->editfieldkey("ProductAccountancyBuyCode",'accountancy_code_buy',$object->accountancy_code_buy,$object,$user->rights->produit->creer||$user->rights->service->creer,'string').''; print $form->editfieldval("ProductAccountancyBuyCode",'accountancy_code_buy',$object->accountancy_code_buy,$object,$user->rights->produit->creer||$user->rights->service->creer,'string'); @@ -1393,7 +1393,7 @@ if (empty($reshook)) if ($user->rights->produit->creer || $user->rights->service->creer) { if (! isset($object->no_button_edit) || $object->no_button_edit <> 1) print ''; - + if (! isset($object->no_button_copy) || $object->no_button_copy <> 1) { if (! empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile)) @@ -1407,7 +1407,7 @@ if (empty($reshook)) } } $object_is_used = $object->isObjectUsed($object->id); - + if (($object->type == 0 && $user->rights->produit->supprimer) || ($object->type == 1 && $user->rights->service->supprimer)) { diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index cb5d2dfb1bc..dd7a34e648f 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -579,7 +579,8 @@ else if ($res) break; } $modCodeClient = new $module; - $module=$conf->global->SOCIETE_CODECLIENT_ADDON; + // Load object modCodeFournisseur + $module=(! empty($conf->global->SOCIETE_CODECLIENT_ADDON)?$conf->global->SOCIETE_CODECLIENT_ADDON:'mod_codeclient_leopard'); if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') { $module = substr($module, 0, dol_strlen($module)-4); @@ -1831,12 +1832,12 @@ else $langs->load("mails"); print ''; } - + if ($user->rights->societe->creer) { print ''."\n"; } - + if ($user->rights->societe->supprimer) { if ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile)) // We can(t use preloaded confirm form with jmobile @@ -1849,7 +1850,7 @@ else } } } - + print ''."\n";