From 2d34e7bf8bdd0169abdf37dbfc64e0a844ce9af9 Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Fri, 24 Aug 2012 16:34:05 +0200 Subject: [PATCH 1/5] fix some issue within typhon pdf --- .../modules/livraison/pdf/pdf_typhon.modules.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php index f371cfb8d43..a4eccaea3f6 100644 --- a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke * Copyright (C) 2008 Chiptronik + * Copyright (C) 2011-2012 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 @@ -142,8 +143,8 @@ class pdf_typhon extends ModelePDFDeliveryOrder if (file_exists($dir)) { $pdf=pdf_getInstance($this->format); - $heightforinfotot = 80; // Height reserved to output the info and total part (value include bottom margin) - $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin) + $heightforinfotot = 50; // Height reserved to output the info and total part (value include bottom margin) + $heightforfooter = 50; // Height reserved to output the footer (value include bottom margin) $pdf->SetAutoPageBreak(1,0); if (class_exists('TCPDF')) @@ -205,8 +206,8 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->SetTextColor(0,0,0); $tab_top = 90; - $tab_top_newpage = 50; - $tab_height = 110; + $tab_top_newpage = 5; + $tab_height = 150; $tab_height_newpage = 150; // Affiche notes @@ -242,7 +243,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page - $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot-50); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); // Description de la ligne produit @@ -253,7 +254,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut - $nexY = $pdf->GetY(); + $nexY = $pdf->GetY()+4; /* // TVA From 977571e0322eeaf1338632d1c0dee3dcad8566f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Fri, 24 Aug 2012 18:32:19 +0200 Subject: [PATCH 2/5] Forgot to apply the patch to the rest of the files --- htdocs/fourn/commande/document.php | 20 +++++++++++++++++++- htdocs/fourn/commande/history.php | 20 +++++++++++++++++++- htdocs/fourn/commande/note.php | 20 +++++++++++++++++++- 3 files changed, 57 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php index da69298763e..643dc943a48 100644 --- a/htdocs/fourn/commande/document.php +++ b/htdocs/fourn/commande/document.php @@ -160,7 +160,25 @@ if ($object->id > 0) if ($object->methode_commande) { - print ''.$langs->trans("Method").''.$object->methode_commande.''; + $sql = "SELECT rowid, code, libelle"; + $sql.= " FROM ".MAIN_DB_PREFIX.'c_input_method'; + $sql.= " WHERE active=1 AND rowid = ".$db->escape($object->methode_commande_id); + + $resql = $db->query($sql); + + if ($resql && $db->num_rows($resql)) + { + $obj = $db->fetch_object($resql); + + // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut + $methode_commande = ($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->libelle!='-'?$obj->libelle:'')); + } + else + { + dol_print_error($db); + } + + print ''.$langs->trans("Method").''.$methode_commande.''; } } diff --git a/htdocs/fourn/commande/history.php b/htdocs/fourn/commande/history.php index 2ba34ecc885..b4eb7a08241 100644 --- a/htdocs/fourn/commande/history.php +++ b/htdocs/fourn/commande/history.php @@ -109,7 +109,25 @@ if ($id > 0 || ! empty($ref)) if ($commande->methode_commande) { - print ''.$langs->trans("Method").''.$commande->methode_commande.''; + $sql = "SELECT rowid, code, libelle"; + $sql.= " FROM ".MAIN_DB_PREFIX.'c_input_method'; + $sql.= " WHERE active=1 AND rowid = ".$db->escape($commande->methode_commande_id); + + $resql = $db->query($sql); + + if ($resql && $db->num_rows($resql)) + { + $obj = $db->fetch_object($resql); + + // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut + $methode_commande = ($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->libelle!='-'?$obj->libelle:'')); + } + else + { + dol_print_error($db); + } + + print ''.$langs->trans("Method").''.$methode_commande.''; } } diff --git a/htdocs/fourn/commande/note.php b/htdocs/fourn/commande/note.php index d3e61d40999..4e7ba219d98 100644 --- a/htdocs/fourn/commande/note.php +++ b/htdocs/fourn/commande/note.php @@ -130,7 +130,25 @@ if ($id > 0 || ! empty($ref)) if ($object->methode_commande) { - print ''.$langs->trans("Method").''.$object->methode_commande.''; + $sql = "SELECT rowid, code, libelle"; + $sql.= " FROM ".MAIN_DB_PREFIX.'c_input_method'; + $sql.= " WHERE active=1 AND rowid = ".$db->escape($object->methode_commande_id); + + $resql = $db->query($sql); + + if ($resql && $db->num_rows($resql)) + { + $obj = $db->fetch_object($resql); + + // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut + $methode_commande = ($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->libelle!='-'?$obj->libelle:'')); + } + else + { + dol_print_error($db); + } + + print ''.$langs->trans("Method").''.$methode_commande.''; } } From 082753d115bb391a9d06020f2e74223437fe6031 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Fri, 24 Aug 2012 19:55:31 +0200 Subject: [PATCH 3/5] Refactored code --- .../class/fournisseur.commande.class.php | 38 +++++++++++++++++++ htdocs/fourn/commande/document.php | 21 +--------- htdocs/fourn/commande/fiche.php | 20 +--------- htdocs/fourn/commande/history.php | 20 +--------- htdocs/fourn/commande/note.php | 23 ++--------- 5 files changed, 45 insertions(+), 77 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 53211070923..e4cd29813db 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2007 Franky Van Liedekerke * Copyright (C) 2010-2011 Juanjo Menent * Copyright (C) 2010-2012 Philippe Grand + * Copyright (C) 2012 Marcos García * * 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 @@ -1840,6 +1841,43 @@ class CommandeFournisseur extends CommonOrder return -1; } } + + /** + * Returns the translated input method + * + * @return string + */ + function getInputMethod() + { + global $db, $langs; + + if ($this->methode_commande_id > 0) + { + $sql = "SELECT rowid, code, libelle"; + $sql.= " FROM ".MAIN_DB_PREFIX.'c_input_method'; + $sql.= " WHERE active=1 AND rowid = ".$db->escape($this->methode_commande_id); + + $query = $db->query($sql); + + if ($query && $db->num_rows($query)) + { + $result = $db->fetch_object($query); + + $string = $langs->trans($result->code); + + if ($string == $result->code) + { + $string = $obj->libelle != '-' ? $obj->libelle : ''; + } + + return $string; + } + + dol_print_error($db); + } + + return ''; + } } diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php index 643dc943a48..80530156201 100644 --- a/htdocs/fourn/commande/document.php +++ b/htdocs/fourn/commande/document.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2012 Marcos García * * 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 @@ -160,25 +161,7 @@ if ($object->id > 0) if ($object->methode_commande) { - $sql = "SELECT rowid, code, libelle"; - $sql.= " FROM ".MAIN_DB_PREFIX.'c_input_method'; - $sql.= " WHERE active=1 AND rowid = ".$db->escape($object->methode_commande_id); - - $resql = $db->query($sql); - - if ($resql && $db->num_rows($resql)) - { - $obj = $db->fetch_object($resql); - - // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut - $methode_commande = ($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->libelle!='-'?$obj->libelle:'')); - } - else - { - dol_print_error($db); - } - - print ''.$langs->trans("Method").''.$methode_commande.''; + print ''.$langs->trans("Method").''.$object->getInputMethod().''; } } diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 18de50e8c2c..7837a4c347a 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -1118,25 +1118,7 @@ if ($id > 0 || ! empty($ref)) if ($object->methode_commande) { - $sql = "SELECT rowid, code, libelle"; - $sql.= " FROM ".MAIN_DB_PREFIX.'c_input_method'; - $sql.= " WHERE active=1 AND rowid = ".$db->escape($object->methode_commande_id); - - $resql = $db->query($sql); - - if ($resql && $db->num_rows($resql)) - { - $obj = $db->fetch_object($resql); - - // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut - $methode_commande = ($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->libelle!='-'?$obj->libelle:'')); - } - else - { - dol_print_error($db); - } - - print ''.$langs->trans("Method").''.$methode_commande.''; + print ''.$langs->trans("Method").''.$object->getInputMethod().''; } } diff --git a/htdocs/fourn/commande/history.php b/htdocs/fourn/commande/history.php index b4eb7a08241..4dd2e12fd0e 100644 --- a/htdocs/fourn/commande/history.php +++ b/htdocs/fourn/commande/history.php @@ -109,25 +109,7 @@ if ($id > 0 || ! empty($ref)) if ($commande->methode_commande) { - $sql = "SELECT rowid, code, libelle"; - $sql.= " FROM ".MAIN_DB_PREFIX.'c_input_method'; - $sql.= " WHERE active=1 AND rowid = ".$db->escape($commande->methode_commande_id); - - $resql = $db->query($sql); - - if ($resql && $db->num_rows($resql)) - { - $obj = $db->fetch_object($resql); - - // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut - $methode_commande = ($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->libelle!='-'?$obj->libelle:'')); - } - else - { - dol_print_error($db); - } - - print ''.$langs->trans("Method").''.$methode_commande.''; + print ''.$langs->trans("Method").''.$commande->getInputMethod().''; } } diff --git a/htdocs/fourn/commande/note.php b/htdocs/fourn/commande/note.php index 4e7ba219d98..3fd9a18a8f5 100644 --- a/htdocs/fourn/commande/note.php +++ b/htdocs/fourn/commande/note.php @@ -1,7 +1,8 @@ * Copyright (C) 2004-2009 Laurent Destailleur - * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2012 Marcos García * * 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 @@ -130,25 +131,7 @@ if ($id > 0 || ! empty($ref)) if ($object->methode_commande) { - $sql = "SELECT rowid, code, libelle"; - $sql.= " FROM ".MAIN_DB_PREFIX.'c_input_method'; - $sql.= " WHERE active=1 AND rowid = ".$db->escape($object->methode_commande_id); - - $resql = $db->query($sql); - - if ($resql && $db->num_rows($resql)) - { - $obj = $db->fetch_object($resql); - - // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut - $methode_commande = ($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->libelle!='-'?$obj->libelle:'')); - } - else - { - dol_print_error($db); - } - - print ''.$langs->trans("Method").''.$methode_commande.''; + print ''.$langs->trans("Method").''.$object->getInputMethod().''; } } From 954f2afbc584ed3c3c80bd12f66d66752892cdc1 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 25 Aug 2012 10:49:59 +0200 Subject: [PATCH 4/5] Fix: remove obsolete code --- htdocs/admin/expedition.php | 180 ++++---------------- htdocs/core/modules/modExpedition.class.php | 21 +-- 2 files changed, 40 insertions(+), 161 deletions(-) diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index d13378000c3..1ed96bd2e8c 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -1,12 +1,12 @@ - * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2004 Sebastien Di Cintio - * Copyright (C) 2004 Benoit Mortier - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005-2011 Regis Houssin - * Copyright (C) 2011-2012 Juanjo Menent - * Copyright (C) 2011-2012 Philippe Grand +/* Copyright (C) 2003-2008 Rodolphe Quiedeville + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004 Sebastien Di Cintio + * Copyright (C) 2004 Benoit Mortier + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2011-2012 Juanjo Menent + * Copyright (C) 2011-2012 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 @@ -37,7 +37,8 @@ $langs->load("sendings"); $langs->load("deliveries"); $langs->load('other'); -if (!$user->admin) accessforbidden(); +if (! $user->admin) + accessforbidden(); $action=GETPOST('action','alpha'); $value=GETPOST('value','alpha'); @@ -54,22 +55,20 @@ if (empty($conf->global->EXPEDITION_ADDON_NUMBER)) /* * Actions */ - if ($action == 'updateMask') +if ($action == 'updateMask') { $maskconst=GETPOST('maskconstexpedition','alpha'); $maskvalue=GETPOST('maskexpedition','alpha'); - if ($maskconst) $res = dolibarr_set_const($db,$maskconst,$maskvalue,'chaine',0,'',$conf->entity); + if (! empty($maskconst)) + $res = dolibarr_set_const($db,$maskconst,$maskvalue,'chaine',0,'',$conf->entity); - if (! $res > 0) $error++; - - if (! $error) - { - $mesg = "".$langs->trans("SetupSaved").""; - } - else - { - $mesg = "".$langs->trans("Error").""; - } + if (isset($res)) + { + if ($res < 0) + setEventMessage($langs->trans("SetupSaved")); + else + setEventMessage($langs->trans("Error"), 'errors'); + } } if ($action == 'set_SHIPPING_FREE_TEXT') @@ -77,34 +76,21 @@ if ($action == 'set_SHIPPING_FREE_TEXT') $freetext=GETPOST('SHIPPING_FREE_TEXT','alpha'); $res = dolibarr_set_const($db, "SHIPPING_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); - if (! $res > 0) $error++; - - if (! $error) - { - $mesg = "".$langs->trans("SetupSaved").""; - } - else - { - $mesg = "".$langs->trans("Error").""; - } + if ($res < 0) + setEventMessage($langs->trans("SetupSaved")); + else + setEventMessage($langs->trans("Error"), 'errors'); } if ($action == 'set_SHIPPING_DRAFT_WATERMARK') { $draft=GETPOST('SHIPPING_DRAFT_WATERMARK','alpha'); - $res = dolibarr_set_const($db, "SHIPPING_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity); - if (! $res > 0) $error++; - - if (! $error) - { - $mesg = "".$langs->trans("SetupSaved").""; - } - else - { - $mesg = "".$langs->trans("Error").""; - } + if ($res < 0) + setEventMessage($langs->trans("SetupSaved")); + else + setEventMessage($langs->trans("Error"), 'errors'); } if ($action == 'specimen') @@ -141,13 +127,13 @@ if ($action == 'specimen') } else { - $mesg=''.$module->error.''; + setEventMessage($module->error, 'errors'); dol_syslog($module->error, LOG_ERR); } } else { - $mesg=''.$langs->trans("ErrorModuleNotFound").''; + setEventMessage($langs->trans("ErrorModuleNotFound"), 'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } } @@ -167,104 +153,6 @@ if ($action == 'del') } } -// Set default model -if ($action == 'setdoc') -{ - if (dolibarr_set_const($db, "EXPEDITION_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->EXPEDITION_ADDON_PDF = $value; - } - - // On active le modele - $ret = delDocumentModel($value, $type); - if ($ret > 0) - { - $ret = addDocumentModel($value, $type, $label, $scandir); - } -} - -// TODO A quoi servent les methode d'expedition ? -if ($action == 'setmethod' || $action== 'setmod') -{ - $module=GETPOST('module','alpha'); - $moduleid=GETPOST('moduleid','alpha'); - $statut=GETPOST('statut','alpha'); - - require_once DOL_DOCUMENT_ROOT."/core/modules/expedition/methode_expedition_$module.modules.php"; - - $classname = "methode_expedition_$module"; - $expem = new $classname($db); - - $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."c_shipment_mode"; - $sql.= " WHERE rowid = ".$moduleid; - - $resql = $db->query($sql); - if ($resql && ($statut == 1 || $action == 'setmod')) - { - $db->begin(); - - $sqlu = "UPDATE ".MAIN_DB_PREFIX."c_shipment_mode"; - $sqlu.= " SET statut=1"; - $sqlu.= " WHERE rowid=".$moduleid; - - $result=$db->query($sqlu); - if ($result) - { - $db->commit(); - } - else - { - $db->rollback(); - } - } - - if ($statut == 1 || $action == 'setmod') - { - $db->begin(); - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."c_shipment_mode (rowid,code,libelle,description,statut)"; - $sql.= " VALUES (".$moduleid.",'".$expem->code."','".$expem->name."','".$expem->description."',1)"; - $result=$db->query($sql); - if ($result) - { - $db->commit(); - } - else - { - //dol_print_error($db); - $db->rollback(); - } - } - else if ($statut == 0) - { - $db->begin(); - - $sql = "UPDATE ".MAIN_DB_PREFIX."c_shipment_mode"; - $sql.= " SET statut=0"; - $sql.= " WHERE rowid=".$moduleid; - $result=$db->query($sql); - if ($result) - { - $db->commit(); - } - else - { - $db->rollback(); - } - } -} - -if ($action == 'setmod') -{ - // TODO Verifier si module numerotation choisi peut etre active - // par appel methode canBeActivated - - dolibarr_set_const($db, "EXPEDITION_ADDON",$value,'chaine',0,'',$conf->entity); - -} - if ($action == 'setmodel') { dolibarr_set_const($db, "EXPEDITION_ADDON_NUMBER",$value,'chaine',0,'',$conf->entity); @@ -489,10 +377,10 @@ foreach ($dirmodels as $reldir) // Active if (in_array($name, $def)) { - print "\n"; + print "\n"; print ''; print img_picto($langs->trans("Activated"),'switch_on'); - print ''; + print ''; print ""; } else @@ -577,9 +465,7 @@ print ''; print ''; -dol_htmloutput_mesg($mesg); - -$db->close(); llxFooter(); +$db->close(); ?> \ No newline at end of file diff --git a/htdocs/core/modules/modExpedition.class.php b/htdocs/core/modules/modExpedition.class.php index c47c9710d27..487f39e51ea 100644 --- a/htdocs/core/modules/modExpedition.class.php +++ b/htdocs/core/modules/modExpedition.class.php @@ -84,11 +84,11 @@ class modExpedition extends DolibarrModules $this->const[$r][4] = 0; $r++; - $this->const[$r][0] = "EXPEDITION_ADDON"; - $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "elevement"; - $this->const[$r][3] = 'Nom du gestionnaire du type d\'expedition'; - $this->const[$r][4] = 0; + $this->const[$r][0] = "EXPEDITION_ADDON_NUMBER"; + $this->const[$r][1] = "chaine"; + $this->const[$r][2] = "mod_expedition_safor"; + $this->const[$r][3] = 'Nom du gestionnaire de numerotation des expeditions'; + $this->const[$r][4] = 0; $r++; $this->const[$r][0] = "LIVRAISON_ADDON_PDF"; @@ -105,13 +105,6 @@ class modExpedition extends DolibarrModules $this->const[$r][4] = 0; $r++; - $this->const[$r][0] = "EXPEDITION_ADDON_NUMBER"; - $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "mod_expedition_safor"; - $this->const[$r][3] = 'Nom du gestionnaire de numerotation des expeditions'; - $this->const[$r][4] = 0; - $r++; - // Boxes $this->boxes = array(); @@ -211,8 +204,8 @@ class modExpedition extends DolibarrModules $sql = array( "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity, "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','shipping',".$conf->entity.")", - "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[1][2]."' AND entity = ".$conf->entity, - "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[1][2]."','delivery',".$conf->entity.")", + "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[2][2]."' AND entity = ".$conf->entity, + "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[2][2]."','delivery',".$conf->entity.")", ); return $this->_init($sql,$options); From e00b74619a22aa8ade7fd7c285a3951351b27b02 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 25 Aug 2012 11:09:58 +0200 Subject: [PATCH 5/5] Fix: regression --- htdocs/admin/expedition.php | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index 1ed96bd2e8c..85f37143748 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -71,7 +71,7 @@ if ($action == 'updateMask') } } -if ($action == 'set_SHIPPING_FREE_TEXT') +else if ($action == 'set_SHIPPING_FREE_TEXT') { $freetext=GETPOST('SHIPPING_FREE_TEXT','alpha'); $res = dolibarr_set_const($db, "SHIPPING_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); @@ -82,7 +82,7 @@ if ($action == 'set_SHIPPING_FREE_TEXT') setEventMessage($langs->trans("Error"), 'errors'); } -if ($action == 'set_SHIPPING_DRAFT_WATERMARK') +else if ($action == 'set_SHIPPING_DRAFT_WATERMARK') { $draft=GETPOST('SHIPPING_DRAFT_WATERMARK','alpha'); $res = dolibarr_set_const($db, "SHIPPING_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity); @@ -93,7 +93,7 @@ if ($action == 'set_SHIPPING_DRAFT_WATERMARK') setEventMessage($langs->trans("Error"), 'errors'); } -if ($action == 'specimen') +else if ($action == 'specimen') { $modele=GETPOST('module','alpha'); @@ -139,12 +139,12 @@ if ($action == 'specimen') } // Activate a model -if ($action == 'set') +else if ($action == 'set') { $ret = addDocumentModel($value, $type, $label, $scandir); } -if ($action == 'del') +else if ($action == 'del') { $ret = delDocumentModel($value, $type); if ($ret > 0) @@ -153,7 +153,25 @@ if ($action == 'del') } } -if ($action == 'setmodel') +// Set default model +else if ($action == 'setdoc') +{ + if (dolibarr_set_const($db, "EXPEDITION_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->EXPEDITION_ADDON_PDF = $value; + } + + // On active le modele + $ret = delDocumentModel($value, $type); + if ($ret > 0) + { + $ret = addDocumentModel($value, $type, $label, $scandir); + } +} + +else if ($action == 'setmodel') { dolibarr_set_const($db, "EXPEDITION_ADDON_NUMBER",$value,'chaine',0,'',$conf->entity); }