New: Generation auto of barcode is available for product.

This commit is contained in:
Laurent Destailleur 2014-02-10 00:24:20 +01:00
parent 70ab096b79
commit bd25a98e03
6 changed files with 175 additions and 148 deletions

View File

@ -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='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("BarcodeSetup"),$linkback,'setup');
@ -351,74 +353,78 @@ print "</table>\n";
print '<br>';
// Select barcode numbering module
print_titre($langs->trans("BarCodeNumberManager"));
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td width="140">'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td>'.$langs->trans("Example").'</td>';
print '<td align="center" width="80">'.$langs->trans("Status").'</td>';
print '<td align="center" width="60">'.$langs->trans("ShortInfo").'</td>';
print "</tr>\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 '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td width="140">'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td>'.$langs->trans("Example").'</td>';
print '<td align="center" width="80">'.$langs->trans("Status").'</td>';
print '<td align="center" width="60">'.$langs->trans("ShortInfo").'</td>';
print "</tr>\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 '<tr '.$bc[$var].'>';
print '<td>'.$modBarCode->nom."</td><td>\n";
print $modBarCode->info($langs);
print '</td>';
print '<td class="nowrap">'.$modBarCode->getExample($langs)."</td>\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 '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeoff&value='.$file.'">';
print img_picto($langs->trans("Activated"),'switch_on');
print '</a></td>';
}
else
{
print '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeon&value='.$file.'">';
print img_picto($langs->trans("Disabled"),'switch_off');
print '</a></td>';
}
print '<td align="center">';
$s=$modBarCode->getToolTip($langs,null,-1);
print $form->textwithpicto('',$s,1);
print '</td>';
print "</tr>\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 '<tr '.$bc[$var].'>';
print '<td>'.$modBarCode->nom."</td><td>\n";
print $modBarCode->info($langs);
print '</td>';
print '<td class="nowrap">'.$modBarCode->getExample($langs)."</td>\n";
if ($conf->global->BARCODE_PRODUCT_ADDON_NUM == "$file")
{
print '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeproductoff&value='.$file.'">';
print img_picto($langs->trans("Activated"),'switch_on');
print '</a></td>';
}
else
{
print '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeproducton&value='.$file.'">';
print img_picto($langs->trans("Disabled"),'switch_off');
print '</a></td>';
}
print '<td align="center">';
$s=$modBarCode->getToolTip($langs,null,-1);
print $form->textwithpicto('',$s,1);
print '</td>';
print "</tr>\n";
}
}
closedir($handle);
}
}
print "</table>\n";
}
print "</table>\n";
print '</form>';

View File

@ -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.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$texte.= '<input type="hidden" name="action" value="setModuleOptions">';
$texte.= '<input type="hidden" name="param1" value="BARCODE_STANDARD_MASK">';
$texte.= '<input type="hidden" name="param1" value="BARCODE_STANDARD_PRODUCT_MASK">';
$texte.= '<table class="nobordernopadding" width="100%">';
$tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("BarCode"),$langs->transnoentities("BarCode"));
@ -89,7 +89,7 @@ class mod_barcode_standard extends ModeleNumRefBarCode
// Mask parameter
//$texte.= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("BarCodeModel").'):</td>';
$texte.= '<tr><td>'.$langs->trans("Mask").':</td>';
$texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="value1" value="'.(! empty($conf->global->BARCODE_STANDARD_MASK)?$conf->global->BARCODE_STANDARD_MASK:'').'"'.$disabled.'>',$tooltip,1,1).'</td>';
$texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="value1" value="'.(! empty($conf->global->BARCODE_STANDARD_PRODUCT_MASK)?$conf->global->BARCODE_STANDARD_PRODUCT_MASK:'').'"'.$disabled.'>',$tooltip,1,1).'</td>';
$texte.= '<td align="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"'.$disabled.'></td>';
$texte.= '</tr>';
@ -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)

View File

@ -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

View File

@ -7,7 +7,7 @@
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Cedric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
*
* 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.

View File

@ -8,7 +8,7 @@
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
*
* 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&oacute;dulo_Productos';
if (GETPOST("type") == '1') $helpurl='EN:Module_Services_En|FR:Module_Services|ES:M&oacute;dulo_Servicios';
if (GETPOST("type") == '0' || ($object->type == '0')) $helpurl='EN:Module_Products|FR:Module_Produits|ES:M&oacute;dulo_Productos';
if (GETPOST("type") == '1' || ($object->type == '1')) $helpurl='EN:Module_Services_En|FR:Module_Services|ES:M&oacute;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 '<form action="fiche.php" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">';
@ -713,7 +713,7 @@ else
print '<input type="hidden" name="code_auto" value="1">';
if (! empty($modBarCodeProduct->code_auto))
print '<input type="hidden" name="barcode_auto" value="1">';
if ($type==1) $title=$langs->trans("NewService");
else $title=$langs->trans("NewProduct");
print_fiche_titre($title);
@ -745,7 +745,7 @@ else
print '</td></tr>';
$showbarcode=(! empty($conf->barcode->enabled) && $user->rights->barcode->lire);
if ($showbarcode)
{
print '<tr><td>'.$langs->trans('BarcodeType').'</td><td>';
@ -766,7 +766,7 @@ else
print '<input size="40" type="text" name="barcode" value="'.$tmpcode.'">';
print '</td></tr>';
}
// Description (used in invoice, propal...)
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="3">';
@ -894,7 +894,7 @@ else
print '<br>';
}
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 '</table>';
print '<br>';
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 '<table class="border" width="100%">';
// Accountancy_code_sell
print '<tr><td>'.$langs->trans("ProductAccountancySellCode").'</td>';
print '<td><input name="accountancy_code_sell" size="16" value="'.$object->accountancy_code_sell.'">';
print '</td></tr>';
// Accountancy_code_buy
print '<tr><td width="20%">'.$langs->trans("ProductAccountancyBuyCode").'</td>';
print '<td><input name="accountancy_code_buy" size="16" value="'.$object->accountancy_code_buy.'">';
print '</td></tr>';
print '</table>';
print '<br>';
}
print '<center><input type="submit" class="button" value="'.$langs->trans("Save").'"> &nbsp; &nbsp; ';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></center>';
@ -1223,12 +1223,12 @@ else
// Don't show accounting field when accounting id disabled.
}
else
{
{
// Accountancy sell code
print '<tr><td>'.$form->editfieldkey("ProductAccountancySellCode",'accountancy_code_sell',$object->accountancy_code_sell,$object,$user->rights->produit->creer||$user->rights->service->creer,'string').'</td><td colspan="2">';
print $form->editfieldval("ProductAccountancySellCode",'accountancy_code_sell',$object->accountancy_code_sell,$object,$user->rights->produit->creer||$user->rights->service->creer,'string');
print '</td></tr>';
// Accountancy buy code
print '<tr><td>'.$form->editfieldkey("ProductAccountancyBuyCode",'accountancy_code_buy',$object->accountancy_code_buy,$object,$user->rights->produit->creer||$user->rights->service->creer,'string').'</td><td colspan="2">';
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 '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&amp;id='.$object->id.'">'.$langs->trans("Modify").'</a></div>';
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))
{

View File

@ -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 '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NoEmail")).'">'.$langs->trans('SendMail').'</a></div>';
}
if ($user->rights->societe->creer)
{
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&amp;action=edit">'.$langs->trans("Modify").'</a></div>'."\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 '</div>'."\n";