From 86dff79b735a2554785c62fd26fe83c5617115b1 Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Sat, 16 Mar 2013 16:58:45 +0100 Subject: [PATCH 1/6] try to fix : cannot display numbering models --- .../mod_facture_fournisseur_cactus.php | 6 ++--- .../mod_facture_fournisseur_tulip.php | 2 +- .../modules_facturefournisseur.php | 24 ++++++++++++------- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php index f753d8b2fce..7e1febf3189 100644 --- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php +++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php @@ -20,11 +20,11 @@ /** * \file htdocs/core/modules/supplier_order/mod_facture_fournisseur_cactus.php - * \ingroup commande + * \ingroup supplier invoice * \brief File containing the Cactus Class of numbering models of suppliers invoices references */ -require_once DOL_DOCUMENT_ROOT .'/core/modules/supplier_order/modules_facturefournisseur.php'; +require_once DOL_DOCUMENT_ROOT .'/core/modules/supplier_invoice/modules_facturefournisseur.php'; /** @@ -123,7 +123,7 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices //$date=time(); $date=$object->datec; // Not always defined - if (empty($date)) $date=$object->date; // Creation date is order date for suppliers orders + if (empty($date)) $date=$object->date; // Creation date is invoice date for suppliers invoices $yymm = strftime("%y%m",$date); $num = sprintf("%04s",$max+1); diff --git a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php index 72cf50adc60..d0ee9e23738 100644 --- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php +++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php @@ -123,7 +123,7 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices return 0; } - $numFinal=get_next_value($db,$mask,'facture_fournisseur','ref','',$objsoc->code_fournisseur,$object->date_commande); + $numFinal=get_next_value($db,$mask,'facture_fournisseur','ref','',$objsoc->code_fournisseur,$object->datec); return $numFinal; } diff --git a/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php b/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php index 7a80cc93bfe..6be7100c14e 100755 --- a/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php +++ b/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php @@ -22,6 +22,7 @@ * \file htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php * \ingroup facture fournisseur * \brief File that contains parent class for supplier invoices models + * and parent class for supplier invoices numbering models */ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requis car utilise par les classes qui heritent @@ -36,7 +37,7 @@ abstract class ModelePDFSuppliersInvoices extends CommonDocGenerator /** - * Return list of active generation modules + * Return list of active generation models * * @param DoliDB $db Database handler * @param string $maxfilenamelength Max length of value to show @@ -131,7 +132,7 @@ abstract class ModeleNumRefSuppliersInvoices } /** - * Create a document onto disk according to template module. + * Create a document onto disk according to template model. * * @param DoliDB $db Database handler * @param Object $object Object supplier invoice @@ -158,7 +159,7 @@ function supplier_invoice_pdf_create($db, $object, $modele, $outputlangs, $hided $srctemplatepath=''; - // Positionne le modele sur le nom du modele a utiliser + // Set the model on the model name to use if (! dol_strlen($modele)) { if (! empty($conf->global->INVOICE_SUPPLIER_ADDON_PDF)) @@ -189,7 +190,7 @@ function supplier_invoice_pdf_create($db, $object, $modele, $outputlangs, $hided { $file = $prefix."_".$modele.".modules.php"; - // On verifie l'emplacement du modele + // We checked the location of the model $file=dol_buildpath($reldir."core/modules/supplier_invoice/pdf/".$file,0); if (file_exists($file)) { @@ -201,7 +202,7 @@ function supplier_invoice_pdf_create($db, $object, $modele, $outputlangs, $hided if ($filefound) break; } - // Charge le modele + // Load the model if ($filefound) { require_once $file; @@ -219,12 +220,12 @@ function supplier_invoice_pdf_create($db, $object, $modele, $outputlangs, $hided require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; dol_delete_preview($object); - // Appel des triggers + // Calls triggers include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($db); $result=$interface->run_triggers('BILL_INVOICE_BUILDDOC',$object,$user,$langs,$conf); if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // End calls triggers return 1; } @@ -238,7 +239,14 @@ function supplier_invoice_pdf_create($db, $object, $modele, $outputlangs, $hided } else { - print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file); + if (! $conf->global->INVOICE_SUPPLIER_ADDON_PDF) + { + print $langs->trans("Error")." ".$langs->trans("Error_INVOICE_SUPPLIER_ADDON_PDF_NotDefined"); + } + else + { + print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file); + } return 0; } } From d2c10159fe9aeb2eb073cf44da6663e0bdaefe74 Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Sat, 16 Mar 2013 17:10:24 +0100 Subject: [PATCH 2/6] try to fix : cannot display numbering models --- htdocs/core/modules/modFournisseur.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index 7ca64a2c524..6a948192dc6 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -95,7 +95,7 @@ class modFournisseur extends DolibarrModules $this->const[$r][0] = "INVOICE_SUPPLIER_ADDON_NUMBER"; $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "tulip"; + $this->const[$r][2] = "mod_facture_fournisseur_tulip"; $r++; // Boxes From 8931a19b7e06483e32d2738f8aeddb4d76e1733d Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Sat, 16 Mar 2013 17:25:39 +0100 Subject: [PATCH 3/6] try to fix : cannot display numbering models --- .../fourn/class/fournisseur.facture.class.php | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index ffc123fe2de..cd106c3a120 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1305,6 +1305,59 @@ class FactureFournisseur extends CommonInvoice $result.=$lien.($max?dol_trunc($this->ref,$max):$this->ref).$lienfin; return $result; } + + /** + * Renvoie la reference de facture suivante non utilisee en fonction du modele + * de numerotation actif defini dans INVOICE_SUPPLIER_ADDON_NUMBER + * + * @param Societe $soc objet societe + * @return string reference libre pour la facture + */ + function getNextNumRef($soc) + { + global $db, $langs, $conf; + $langs->load("orders"); + + $dir = DOL_DOCUMENT_ROOT .'/core/modules/supplier_invoice/'; + + if (! empty($conf->global->INVOICE_SUPPLIER_ADDON_NUMBER)) + { + $file = $conf->global->INVOICE_SUPPLIER_ADDON_NUMBER.'.php'; + + if (is_readable($dir.'/'.$file)) + { + // Definition du nom de modele de numerotation de commande fournisseur + $modName=$conf->global->INVOICE_SUPPLIER_ADDON_NUMBER; + require_once $dir.'/'.$file; + + // Recuperation de la nouvelle reference + $objMod = new $modName($this->db); + + $numref = ""; + $numref = $objMod->invoice_get_num($soc,$this); + + if ( $numref != "") + { + return $numref; + } + else + { + dol_print_error($db, get_class($this)."::getNextNumRef ".$obj->error); + return -1; + } + } + else + { + print $langs->trans("Error")." ".$langs->trans("Error_FailedToLoad_INVOICE_SUPPLIER_ADDON_NUMBER_File",$conf->global->INVOICE_SUPPLIER_ADDON_NUMBER); + return -2; + } + } + else + { + print $langs->trans("Error")." ".$langs->trans("Error_INVOICE_SUPPLIER_ADDON_NUMBER_NotDefined"); + return -3; + } + } /** From 88256b753133fb53a1dfc70a668fa955a55e11d6 Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Sun, 17 Mar 2013 10:21:44 +0100 Subject: [PATCH 4/6] normalize --- htdocs/admin/supplier_order.php | 4 ++-- htdocs/core/modules/modFournisseur.class.php | 11 ++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index aa609d65721..a14b8cd1a6a 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -188,7 +188,7 @@ if ($action == 'setmod') // TODO Verifier si module numerotation choisi peut etre active // par appel methode canBeActivated - dolibarr_set_const($db, "COMMANDE_SUPPLIER_ADDON",$value,'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "COMMANDE_SUPPLIER_ADDON_NUMBER",$value,'chaine',0,'',$conf->entity); } if ($action == 'addcat') @@ -306,7 +306,7 @@ foreach ($dirmodels as $reldir) print ''."\n"; print ''; - if ($conf->global->COMMANDE_SUPPLIER_ADDON == "$file") + if ($conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER == "$file") { print img_picto($langs->trans("Activated"),'switch_on'); } diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index 6a948192dc6..5868d6d2108 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2012 Juanjo Menent + * Copyright (C) 2013 Philippe Grand * * 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 @@ -81,21 +82,29 @@ class modFournisseur extends DolibarrModules $this->const[$r][0] = "COMMANDE_SUPPLIER_ADDON_PDF"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = "muscadet"; + $this->const[$r][3] = 'Nom du gestionnaire de generation des bons de commande en PDF'; + $this->const[$r][4] = 0; $r++; - $this->const[$r][0] = "COMMANDE_SUPPLIER_ADDON"; + $this->const[$r][0] = "COMMANDE_SUPPLIER_ADDON_NUMBER"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = "mod_commande_fournisseur_muguet"; + $this->const[$r][3] = 'Nom du gestionnaire de numerotation des commandes fournisseur'; + $this->const[$r][4] = 0; $r++; $this->const[$r][0] = "INVOICE_SUPPLIER_ADDON_PDF"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = "canelle"; + $this->const[$r][3] = 'Nom du gestionnaire de generation des factures fournisseur en PDF'; + $this->const[$r][4] = 0; $r++; $this->const[$r][0] = "INVOICE_SUPPLIER_ADDON_NUMBER"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = "mod_facture_fournisseur_tulip"; + $this->const[$r][3] = 'Nom du gestionnaire de numerotation des factures fournisseur'; + $this->const[$r][4] = 0; $r++; // Boxes From c44e9d60445882c847f38e48b282b3d36ffa888a Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Sun, 17 Mar 2013 11:00:38 +0100 Subject: [PATCH 5/6] normalize and simplify code --- htdocs/admin/expedition.php | 39 ++++++------ htdocs/admin/supplier_order.php | 109 +++++++++++--------------------- 2 files changed, 56 insertions(+), 92 deletions(-) diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index 2c69b643884..00830445ca6 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -65,9 +65,9 @@ if ($action == 'updateMask') if (isset($res)) { if ($res < 0) - setEventMessage($langs->trans("Error"), 'errors'); - else setEventMessage($langs->trans("SetupSaved")); + else + setEventMessage($langs->trans("Error"), 'errors'); } } @@ -77,9 +77,9 @@ else if ($action == 'set_SHIPPING_FREE_TEXT') $res = dolibarr_set_const($db, "SHIPPING_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); if ($res < 0) - setEventMessage($langs->trans("Error"), 'errors'); - else setEventMessage($langs->trans("SetupSaved")); + else + setEventMessage($langs->trans("Error"), 'errors'); } else if ($action == 'set_SHIPPING_DRAFT_WATERMARK') @@ -88,9 +88,9 @@ else if ($action == 'set_SHIPPING_DRAFT_WATERMARK') $res = dolibarr_set_const($db, "SHIPPING_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity); if ($res < 0) - setEventMessage($langs->trans("Error"), 'errors'); - else setEventMessage($langs->trans("SetupSaved")); + else + setEventMessage($langs->trans("Error"), 'errors'); } else if ($action == 'specimen') @@ -173,12 +173,7 @@ else if ($action == 'setdoc') else if ($action == 'setmodel') { - $res = dolibarr_set_const($db, "EXPEDITION_ADDON_NUMBER",$value,'chaine',0,'',$conf->entity); - - if ($res < 0) - setEventMessage($langs->trans("Error"), 'errors'); - else - setEventMessage($langs->trans("SetupSaved")); + dolibarr_set_const($db, "EXPEDITION_ADDON_NUMBER",$value,'chaine',0,'',$conf->entity); } @@ -259,16 +254,16 @@ foreach ($dirmodels as $reldir) { $file = substr($file, 0, dol_strlen($file)-4); - require_once DOL_DOCUMENT_ROOT ."/core/modules/expedition/".$file.'.php'; + require_once $dir.$file.'.php'; $module = new $file; - - // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; - + if ($module->isEnabled()) { + // Show modules according to features level + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; + $var=!$var; print ''.$module->nom."\n"; print ''; @@ -278,7 +273,9 @@ foreach ($dirmodels as $reldir) // Show example of numbering module print ''; $tmp=$module->getExample(); - if (preg_match('/^Error/',$tmp)) { $langs->load("errors"); print '
'.$langs->trans($tmp).'
'; } + if (preg_match('/^Error/',$tmp)) { + $langs->load("errors"); print '
'.$langs->trans($tmp).'
'; + } elseif ($tmp=='NotConfigured') print $langs->trans($tmp); else print $tmp; print ''."\n"; @@ -333,7 +330,7 @@ print '
'; /* - * Modeles de documents + * Documents models for Sendings Receipt */ print_titre($langs->trans("SendingsReceiptModel")); @@ -495,4 +492,4 @@ print ''; llxFooter(); $db->close(); -?> +?> \ No newline at end of file diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index a14b8cd1a6a..ab8569b15b0 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -54,9 +54,9 @@ $specimenthirdparty->initAsSpecimen(); if ($action == 'updateMask') { $maskconstorder=GETPOST('maskconstorder','alpha'); - $maskorder=GETPOST('maskorder','alpha'); + $maskvalue=GETPOST('maskvalue','alpha'); - if ($maskconstorder) $res = dolibarr_set_const($db,$maskconstorder,$maskorder,'chaine',0,'',$conf->entity); + if ($maskconstorder) $res = dolibarr_set_const($db,$maskconstorder,$maskvalue,'chaine',0,'',$conf->entity); if (! $res > 0) $error++; @@ -70,7 +70,7 @@ if ($action == 'updateMask') } } -if ($action == 'specimen') // For orders +else if ($action == 'specimen') // For orders { $modele=GETPOST('module','alpha'); @@ -116,74 +116,40 @@ if ($action == 'specimen') // For orders } } -if ($action == 'set') +// Activate a model +else if ($action == 'set') { - $label = GETPOST('label','alpha'); - $scandir = GETPOST('scandir','alpha'); - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)"; - $sql.= " VALUES ('".$db->escape($value)."','".$type."',".$conf->entity.", "; - $sql.= ($label?"'".$db->escape($label)."'":'null').", "; - $sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null"); - $sql.= ")"; - $res=$db->query($sql); - if ($res) - { - - } - // else dol_print_error($db); + $ret = addDocumentModel($value, $type, $label, $scandir); } -if ($action == 'del') +else if ($action == 'del') { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; - $sql.= " WHERE nom = '".$value."'"; - $sql.= " AND type = '".$type."'"; - $sql.= " AND entity = ".$conf->entity; - $db->query($sql); - if ($res) - { - - } - // else dol_print_error($db); + $ret = delDocumentModel($value, $type); + if ($ret > 0) + { + if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF == "$value") dolibarr_del_const($db, 'COMMANDE_SUPPLIER_ADDON_PDF',$conf->entity); + } } -if ($action == 'setdoc') +// Set default model +else if ($action == 'setdoc') { - $label = GETPOST('label','alpha'); - $scandir = GETPOST('scandir','alpha'); + if (dolibarr_set_const($db, "COMMANDE_SUPPLIER_ADDON_PDF",$value,'chaine',0,'',$conf->entity)) + { + // La constante qui a ete lue en avant du nouveau set + // on passe donc par une variable pour avoir un affichage coherent + $conf->global->COMMANDE_SUPPLIER_ADDON_PDF = $value; + } - $db->begin(); - - if ($type == 'order_supplier' && dolibarr_set_const($db, "COMMANDE_SUPPLIER_ADDON_PDF",$value,'chaine',0,'',$conf->entity)) - { - $conf->global->COMMANDE_SUPPLIER_ADDON_PDF = $value; - } - - // On active le modele - $sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; - $sql_del.= " WHERE nom = '".$db->escape($value)."'"; - $sql_del.= " AND type = '".$type."'"; - $sql_del.= " AND entity = ".$conf->entity; - $result1=$db->query($sql_del); - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)"; - $sql.= " VALUES ('".$db->escape($value)."', '".$type."', ".$conf->entity.", "; - $sql.= ($label?"'".$db->escape($label)."'":'null').", "; - $sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null"); - $sql.= ")"; - $result2=$db->query($sql); - if ($result1 && $result2) - { - $db->commit(); - } - else - { - $db->rollback(); - } + // On active le modele + $ret = delDocumentModel($value, $type); + if ($ret > 0) + { + $ret = addDocumentModel($value, $type, $label, $scandir); + } } -if ($action == 'setmod') +else if ($action == 'setmod') { // TODO Verifier si module numerotation choisi peut etre active // par appel methode canBeActivated @@ -191,13 +157,13 @@ if ($action == 'setmod') dolibarr_set_const($db, "COMMANDE_SUPPLIER_ADDON_NUMBER",$value,'chaine',0,'',$conf->entity); } -if ($action == 'addcat') +else if ($action == 'addcat') { $fourn = new Fournisseur($db); $fourn->CreateCategory($user,$_POST["cat"]); } -if ($action == 'set_SUPPLIER_ORDER_FREE_TEXT') +else if ($action == 'set_SUPPLIER_ORDER_FREE_TEXT') { $freetext = GETPOST('SUPPLIER_ORDER_FREE_TEXT'); // No alpha here, we want exact string @@ -352,10 +318,8 @@ foreach ($dirmodels as $reldir) print '
'; - - /* - * Modeles documents for supplier orders + * Documents models for supplier orders */ print_titre($langs->trans("OrdersModelModule")); @@ -396,17 +360,14 @@ print ''."\n"; clearstatcache(); +$var=true; foreach ($dirmodels as $reldir) { $dir = dol_buildpath($reldir."core/modules/supplier_order/pdf/"); if (is_dir($dir)) { - $var=true; - $handle=opendir($dir); - - if (is_resource($handle)) { while (($file = readdir($handle))!==false) @@ -448,7 +409,7 @@ foreach ($dirmodels as $reldir) print ""; } - // Defaut + // Default print ''; if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF == "$name") { @@ -485,6 +446,12 @@ foreach ($dirmodels as $reldir) } print '
'; +print '
'; + +/* + * Other options + * + */ print_titre($langs->trans("OtherOptions")); print ''; From 57d20e28fb49a25ec69a1f870ff9a8d054047189 Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Sun, 17 Mar 2013 12:56:54 +0100 Subject: [PATCH 6/6] normalize and simplify code --- htdocs/admin/expedition.php | 7 ++--- htdocs/admin/livraison.php | 33 +++++++++++---------- htdocs/core/modules/modExpedition.class.php | 3 +- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index 00830445ca6..34535b1d321 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -6,7 +6,7 @@ * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011-2012 Juanjo Menent - * Copyright (C) 2011-2012 Philippe Grand + * Copyright (C) 2011-2013 Philippe Grand * * 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 @@ -220,9 +220,8 @@ if (! empty($conf->global->MAIN_SUBMODULE_LIVRAISON)) dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup")); /* - * Numbering module - */ -//print "
"; + * Expedition numbering model + */ print_titre($langs->trans("SendingsNumberingModules")); diff --git a/htdocs/admin/livraison.php b/htdocs/admin/livraison.php index fa4b7b3c1d4..49cbeee9026 100644 --- a/htdocs/admin/livraison.php +++ b/htdocs/admin/livraison.php @@ -6,7 +6,7 @@ * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011-2012 Juanjo Menent - * Copyright (C) 2011-2012 Philippe Grand + * Copyright (C) 2011-2013 Philippe Grand * * 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 @@ -164,7 +164,7 @@ if ($action == 'setmod') // TODO Verifier si module numerotation choisi peut etre active // par appel methode canBeActivated - dolibarr_set_const($db, "LIVRAISON_ADDON",$value,'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "LIVRAISON_ADDON_NUMBER",$value,'chaine',0,'',$conf->entity); } @@ -209,8 +209,9 @@ $h++; dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup")); /* - * Module numerotation + * Livraison numbering model */ + print_titre($langs->trans("DeliveryOrderNumberingModules")); print '
'; @@ -240,16 +241,16 @@ foreach ($dirmodels as $reldir) { $file = substr($file, 0, dol_strlen($file)-4); - require_once DOL_DOCUMENT_ROOT ."/core/modules/livraison/".$file.'.php'; + require_once $dir.$file.'.php'; $module = new $file; - - // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; - - if ($module->isEnabled()) + + if ($module->isEnabled()) { + // Show modules according to features level + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; + $var=!$var; print ''."\n"; print '
'.$module->nom."\n"; print $module->info(); @@ -258,13 +259,15 @@ foreach ($dirmodels as $reldir) // Show example of numbering module print ''; $tmp=$module->getExample(); - if (preg_match('/^Error/',$tmp)) { $langs->load("errors"); print '
'.$langs->trans($tmp).'
'; } + if (preg_match('/^Error/',$tmp)) { + $langs->load("errors"); print '
'.$langs->trans($tmp).'
'; + } elseif ($tmp=='NotConfigured') print $langs->trans($tmp); else print $tmp; print '
'; - if ($conf->global->LIVRAISON_ADDON == "$file") + if ($conf->global->LIVRAISON_ADDON_NUMBER == "$file") { print img_picto($langs->trans("Activated"),'switch_on'); } @@ -311,12 +314,12 @@ print '
'; /* - * Modeles de documents + * Documents Models for delivery */ print '
'; print_titre($langs->trans("DeliveryOrderModel")); -// Defini tableau def de modele invoice +// Defini tableau def de modele $type="delivery"; $def = array(); @@ -397,7 +400,7 @@ foreach ($dirmodels as $reldir) print ""; } - // Defaut + // Default print ""; if ($conf->global->LIVRAISON_ADDON_PDF == "$name") { diff --git a/htdocs/core/modules/modExpedition.class.php b/htdocs/core/modules/modExpedition.class.php index 112173656c5..5704f96d0cc 100644 --- a/htdocs/core/modules/modExpedition.class.php +++ b/htdocs/core/modules/modExpedition.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2013 Philippe Grand * * 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 @@ -101,7 +102,7 @@ class modExpedition extends DolibarrModules $this->const[$r][4] = 0; $r++; - $this->const[$r][0] = "LIVRAISON_ADDON"; + $this->const[$r][0] = "LIVRAISON_ADDON_NUMBER"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = "mod_livraison_jade"; $this->const[$r][3] = 'Nom du gestionnaire de numerotation des bons de reception';