From cf63f1a40da02e93360913d3580aea60f1fe8e53 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 21 Jul 2014 08:36:59 +0200 Subject: [PATCH 1/6] Remane contract ref_ext to ref_supplier --- ChangeLog | 2 +- htdocs/compta/facture/class/facture.class.php | 16 +++++++++++++++- htdocs/contrat/class/contrat.class.php | 14 +++++++------- htdocs/contrat/fiche.php | 14 +++++++------- htdocs/contrat/liste.php | 16 ++++++++-------- htdocs/install/mysql/migration/3.6.0-3.7.0.sql | 2 +- htdocs/install/mysql/tables/llx_contrat.sql | 2 +- 7 files changed, 40 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index cc29d46bd26..5fdc485df86 100644 --- a/ChangeLog +++ b/ChangeLog @@ -43,7 +43,7 @@ For users: - Fix: [ bug #1501 ] DEPLACEMENT_CREATE trigger do not intercept trigger action - Fix: [ bug #1506, #1507 ] ECM trigger error problem - Fix: [ bug #1469 ] Triggers CONTACT_MODIFY and CONTACT_DELETE duplicates error message -- New: [ task #1204 ] add a External reference to contract +- New: [ task #1204 ] add a Supplier reference to contract For translators: - Update language files. diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 7e5af441280..9b0e236af35 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -593,6 +593,8 @@ class Facture extends CommonInvoice // Load source object $objFrom = dol_clone($this); + + // Change socid if needed if (! empty($socid) && $socid != $this->socid) @@ -635,10 +637,22 @@ class Facture extends CommonInvoice unset($this->products[$i]); // Tant que products encore utilise } } - + // Create clone $result=$this->create($user); if ($result < 0) $error++; + else { + // copy internal contacts + if ($this->copy_linked_contact($objFrom, 'internal') < 0) + $error++; + + // copy external contacts if same company + elseif ($objFrom->socid == $this->socid) + { + if ($this->copy_linked_contact($objFrom, 'external') < 0) + $error++; + } + } if (! $error) { diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 9c57ff9f570..66de1e3eaa7 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -44,7 +44,7 @@ class Contrat extends CommonObject var $id; var $ref; - var $ref_ext; + var $ref_supplier; var $socid; var $societe; // Objet societe var $statut=0; // 0=Draft, @@ -400,7 +400,7 @@ class Contrat extends CommonObject $sql.= " fk_projet,"; $sql.= " fk_commercial_signature, fk_commercial_suivi,"; $sql.= " note_private, note_public, extraparams"; - $sql.= " ,ref_ext"; + $sql.= " ,ref_supplier"; $sql.= " FROM ".MAIN_DB_PREFIX."contrat"; if ($ref) { @@ -419,7 +419,7 @@ class Contrat extends CommonObject { $this->id = $result["rowid"]; $this->ref = (!isset($result["ref"]) || !$result["ref"]) ? $result["rowid"] : $result["ref"]; - $this->ref_ext = $result["ref_ext"]; + $this->ref_supplier = $result["ref_supplier"]; $this->statut = $result["statut"]; $this->mise_en_service = $this->db->jdate($result["datemise"]); $this->date_contrat = $this->db->jdate($result["datecontrat"]); @@ -720,7 +720,7 @@ class Contrat extends CommonObject // Insert contract $sql = "INSERT INTO ".MAIN_DB_PREFIX."contrat (datec, fk_soc, fk_user_author, date_contrat,"; $sql.= " fk_commercial_signature, fk_commercial_suivi, fk_projet,"; - $sql.= " ref, entity, note_private, note_public, ref_ext)"; + $sql.= " ref, entity, note_private, note_public, ref_supplier)"; $sql.= " VALUES ('".$this->db->idate($now)."',".$this->socid.",".$user->id; $sql.= ", '".$this->db->idate($this->date_contrat)."'"; $sql.= ",".($this->commercial_signature_id>0?$this->commercial_signature_id:"NULL"); @@ -730,7 +730,7 @@ class Contrat extends CommonObject $sql.= ", ".$conf->entity; $sql.= ", ".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL"); $sql.= ", ".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL"); - $sql.= ", ".(!empty($this->ref_ext)?("'".$this->db->escape($this->ref_ext)."'"):"NULL"); + $sql.= ", ".(!empty($this->ref_supplier)?("'".$this->db->escape($this->ref_supplier)."'"):"NULL"); $sql.= ")"; $resql=$this->db->query($sql); if ($resql) @@ -965,7 +965,7 @@ class Contrat extends CommonObject // Clean parameters if (isset($this->ref)) $this->ref=trim($this->ref); - if (isset($this->ref_ext)) $this->ref_ext=trim($this->ref_ext); + if (isset($this->ref_supplier)) $this->ref_supplier=trim($this->ref_supplier); if (isset($this->entity)) $this->entity=trim($this->entity); if (isset($this->statut)) $this->statut=trim($this->statut); if (isset($this->fk_soc)) $this->fk_soc=trim($this->fk_soc); @@ -988,7 +988,7 @@ class Contrat extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."contrat SET"; $sql.= " ref=".(isset($this->ref)?"'".$this->db->escape($this->ref)."'":"null").","; - $sql.= " ref_ext=".(isset($this->ref_ext)?"'".$this->db->escape($this->ref_ext)."'":"null").","; + $sql.= " ref_supplier=".(isset($this->ref_supplier)?"'".$this->db->escape($this->ref_supplier)."'":"null").","; $sql.= " entity=".$conf->entity.","; $sql.= " date_contrat=".(dol_strlen($this->date_contrat)!=0 ? "'".$this->db->idate($this->date_contrat)."'" : 'null').","; $sql.= " statut=".(isset($this->statut)?$this->statut:"null").","; diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index e073566c55f..708ee6e59d9 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -206,7 +206,7 @@ if ($action == 'add' && $user->rights->contrat->creer) $object->fk_project = GETPOST('projectid','int'); $object->remise_percent = GETPOST('remise_percent','alpha'); $object->ref = GETPOST('ref','alpha'); - $object->ref_ext = GETPOST('ref_ext','alpha'); + $object->ref_supplier = GETPOST('ref_supplier','alpha'); // If creation from another object of another module (Example: origin=propal, originid=1) if ($_POST['origin'] && $_POST['originid']) @@ -713,17 +713,17 @@ else if ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contra $action = 'edit_extras'; setEventMessage($object->error,'errors'); } -} elseif ($action=='setref_ext') { +} elseif ($action=='setref_supplier') { $result = $object->fetch($id); if ($result < 0) { setEventMessage($object->errors,'errors'); } - $object->ref_ext=GETPOST('ref_ext','alpha'); + $object->ref_supplier=GETPOST('ref_supplier','alpha'); $result = $object->update($user); if ($result < 0) { setEventMessage($object->errors,'errors'); - $action='editref_ext'; + $action='editref_supplier'; } else { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; @@ -878,7 +878,7 @@ if ($action == 'create') // Ref Int print ''.$langs->trans('RefCustomer').''; - print ''; + print ''; // Customer print ''; @@ -1069,9 +1069,9 @@ else print ''; print ''; - print $form->editfieldkey("RefCustomer",'ref_ext',$object->ref_ext,$object,$user->rights->contrat->creer); + print $form->editfieldkey("RefCustomer",'ref_supplier',$object->ref_supplier,$object,$user->rights->contrat->creer); print ''; - print $form->editfieldval("RefCustomer",'ref_ext',$object->ref_ext,$object,$user->rights->contrat->creer); + print $form->editfieldval("RefCustomer",'ref_supplier',$object->ref_supplier,$object,$user->rights->contrat->creer); print ''; print ''; diff --git a/htdocs/contrat/liste.php b/htdocs/contrat/liste.php index 16586b9dd4c..985f8c5a04f 100644 --- a/htdocs/contrat/liste.php +++ b/htdocs/contrat/liste.php @@ -42,7 +42,7 @@ $offset = $limit * $page ; $search_nom=GETPOST('search_nom'); $search_contract=GETPOST('search_contract'); -$search_ref_ext=GETPOST('search_ref_ext','alpha'); +$search_ref_supplier=GETPOST('search_ref_supplier','alpha'); $sall=GETPOST('sall'); $statut=GETPOST('statut')?GETPOST('statut'):1; $socid=GETPOST('socid'); @@ -75,7 +75,7 @@ $sql.= ' SUM('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND $sql.= ' SUM('.$db->ifsql("cd.statut=5",1,0).') as nb_closed,'; $sql.= " c.rowid as cid, c.ref, c.datec, c.date_contrat, c.statut,"; $sql.= " s.nom, s.rowid as socid"; -$sql.= " ,c.ref_ext"; +$sql.= " ,c.ref_supplier"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ", ".MAIN_DB_PREFIX."contrat as c"; @@ -90,8 +90,8 @@ if ($search_nom) { if ($search_contract) { $sql .= natural_search(array('c.rowid', 'c.ref'), $search_contract); } -if (!empty($search_ref_ext)) { - $sql .= natural_search(array('c.ref_ext'), $search_ref_ext); +if (!empty($search_ref_supplier)) { + $sql .= natural_search(array('c.ref_supplier'), $search_ref_supplier); } if ($sall) { $sql .= natural_search(array('s.nom', 'cd.label', 'cd.description'), $sall); @@ -114,9 +114,9 @@ if ($resql) print ''; $param='&search_contract='.$search_contract; $param.='&search_nom='.$search_nom; - $param.='&search_ref_ext='.$search_ref_ext; + $param.='&search_ref_supplier='.$search_ref_supplier; print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "c.rowid","","$param",'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("RefCustomer"), $_SERVER["PHP_SELF"], "c.ref_ext","","$param",'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("RefCustomer"), $_SERVER["PHP_SELF"], "c.ref_supplier","","$param",'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Company"), $_SERVER["PHP_SELF"], "s.nom","","$param",'',$sortfield,$sortorder); //print_liste_field_titre($langs->trans("DateCreation"), $_SERVER["PHP_SELF"], "c.datec","","$param",'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateContract"), $_SERVER["PHP_SELF"], "c.date_contrat","","$param",'align="center"',$sortfield,$sortorder); @@ -134,7 +134,7 @@ if ($resql) print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; @@ -156,7 +156,7 @@ if ($resql) print img_object($langs->trans("ShowContract"),"contract").' '.(isset($obj->ref) ? $obj->ref : $obj->cid) .''; if ($obj->nb_late) print img_warning($langs->trans("Late")); print ''; - print ''.$obj->ref_ext.''; + print ''.$obj->ref_supplier.''; print ''.img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.''; //print ''.dol_print_date($obj->datec).''; print ''.dol_print_date($db->jdate($obj->date_contrat)).''; diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql index 30e010431cc..1e3072876eb 100644 --- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql +++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql @@ -121,4 +121,4 @@ create table llx_accounting_fiscalyear fk_user_modif integer NULL )ENGINE=innodb; -ALTER TABLE llx_contrat ADD COLUMN ref_ext varchar(30) after ref; +ALTER TABLE llx_contrat ADD COLUMN ref_supplier varchar(30) after ref; diff --git a/htdocs/install/mysql/tables/llx_contrat.sql b/htdocs/install/mysql/tables/llx_contrat.sql index 9cef8fddb42..496ecd4c97d 100644 --- a/htdocs/install/mysql/tables/llx_contrat.sql +++ b/htdocs/install/mysql/tables/llx_contrat.sql @@ -22,7 +22,7 @@ create table llx_contrat ( rowid integer AUTO_INCREMENT PRIMARY KEY, ref varchar(30), -- contrat reference - ref_ext varchar(30), -- external contract ref + ref_supplier varchar(30), -- suplier contract ref entity integer DEFAULT 1 NOT NULL, -- multi company id tms timestamp, datec datetime, -- creation date From 8b8615c13b5c16300c37c845ee8a8105e2839651 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 21 Jul 2014 08:38:23 +0200 Subject: [PATCH 2/6] changelog --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 5fdc485df86..ca954c7a5bc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -44,6 +44,7 @@ For users: - Fix: [ bug #1506, #1507 ] ECM trigger error problem - Fix: [ bug #1469 ] Triggers CONTACT_MODIFY and CONTACT_DELETE duplicates error message - New: [ task #1204 ] add a Supplier reference to contract +- New: Invoice clone clone invoice contact For translators: - Update language files. From db7478098a42219b5c52a05dcbf3b17b3e1b7d96 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 12 Aug 2014 13:26:06 +0200 Subject: [PATCH 3/6] Add a real free numbering module for contract --- ChangeLog | 1 + htdocs/contrat/class/contrat.class.php | 25 ++++- htdocs/contrat/fiche.php | 56 +++++++-- .../modules/contract/mod_contract_magre.php | 1 + .../modules/contract/mod_contract_olive.php | 106 ++++++++++++++++++ .../modules/contract/mod_contract_serpis.php | 1 + 6 files changed, 177 insertions(+), 13 deletions(-) create mode 100644 htdocs/core/modules/contract/mod_contract_olive.php diff --git a/ChangeLog b/ChangeLog index 5145e6505e3..681455af224 100644 --- a/ChangeLog +++ b/ChangeLog @@ -56,6 +56,7 @@ For users: - Fix: [ bug #1469 ] Triggers CONTACT_MODIFY and CONTACT_DELETE duplicates error message - Fix: [ bug #1537 ] Difference between societe.nom and adherent.societe. - New: [ task #1204 ] add a External reference to contract +- New: [ task #1204 ] add Numering contrat module free (like leopard in product module) For translators: - Update language files. diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index e6a26a8b9d4..709888dffed 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -743,13 +743,28 @@ class Contrat extends CommonObject $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."contrat"); - // Mise a jour ref - $sql = 'UPDATE '.MAIN_DB_PREFIX."contrat SET ref='(PROV".$this->id.")' WHERE rowid=".$this->id; - if ($this->db->query($sql)) + + // Load object modContract + $module=(! empty($conf->global->CONTRACT_ADDON)?$conf->global->CONTRACT_ADDON:'mod_contract_olive'); + if (substr($module, 0, 13) == 'mod_contract_' && substr($module, -3) == 'php') { - if ($this->id) + $module = substr($module, 0, dol_strlen($module)-4); + } + $result=dol_include_once('/core/modules/contract/'.$module.'.php'); + if ($result > 0) + { + $modCodeContract = new $module(); + } + + if (!empty($modCodeContract->code_auto)) { + // Mise a jour ref + $sql = 'UPDATE '.MAIN_DB_PREFIX."contrat SET ref='(PROV".$this->id.")' WHERE rowid=".$this->id; + if ($this->db->query($sql)) { - $this->ref="(PROV".$this->id.")"; + if ($this->id) + { + $this->ref="(PROV".$this->id.")"; + } } } diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index de97b870c08..38f4ba9a8c4 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -342,7 +342,7 @@ if ($action == 'add' && $user->rights->contrat->creer) // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels, $object); - + $result = $object->create($user); if ($result > 0) { @@ -744,6 +744,21 @@ else if ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contra header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } +} elseif ($action=='setref') { + $result = $object->fetch($id); + if ($result < 0) { + setEventMessage($object->errors,'errors'); + } + $object->ref=GETPOST('ref','alpha'); + + $result = $object->update($user); + if ($result < 0) { + setEventMessage($object->errors,'errors'); + $action='editref'; + } else { + header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); + exit; + } } if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->contrat->creer) @@ -818,6 +833,18 @@ $form = new Form($db); $objectlignestatic=new ContratLigne($db); +// Load object modContract +$module=(! empty($conf->global->CONTRACT_ADDON)?$conf->global->CONTRACT_ADDON:'mod_contract_olive'); +if (substr($module, 0, 13) == 'mod_contract_' && substr($module, -3) == 'php') +{ + $module = substr($module, 0, dol_strlen($module)-4); +} +$result=dol_include_once('/core/modules/contract/'.$module.'.php'); +if ($result > 0) +{ + $modCodeContract = new $module(); +} + /********************************************************************* * @@ -878,8 +905,6 @@ if ($action == 'create') $object->date_contrat = dol_now(); - $numct = $object->getNextNumRef($soc); - print '
'; print ''; @@ -890,7 +915,12 @@ if ($action == 'create') print ''; // Ref - print ''; + if (! empty($modCodeContract->code_auto)) { + $tmpcode=$langs->trans("Draft"); + } else { + $tmpcode=''; + } + print ''; // Ref Int print ''; @@ -1040,7 +1070,7 @@ else if ($action == 'valid') { $ref = substr($object->ref, 1, 4); - if ($ref == 'PROV') + if ($ref == 'PROV' && !empty($modCodeContract->code_auto)) { $numref = $object->getNextNumRef($soc); } @@ -1079,9 +1109,19 @@ else $linkback = ''.$langs->trans("BackToList").''; // Ref du contrat - print '"; + if (!empty($modCodeContract->code_auto)) { + print '"; + } else { + print ''; + print ''; + print ''; + } print ''; print '
'.$langs->trans('Ref').''.$langs->trans("Draft").'
'.$langs->trans('Ref').''.$tmpcode.'
'.$langs->trans('RefCustomer').'
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); - print "
'.$langs->trans("Ref").''; + print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); + print "
'; + print $form->editfieldkey("Ref",'ref',$object->ref,$object,$user->rights->contrat->creer); + print ''; + print $form->editfieldval("Ref",'ref',$object->ref,$object,$user->rights->contrat->creer); + print '
'; diff --git a/htdocs/core/modules/contract/mod_contract_magre.php b/htdocs/core/modules/contract/mod_contract_magre.php index 8281552b459..289b474de5e 100644 --- a/htdocs/core/modules/contract/mod_contract_magre.php +++ b/htdocs/core/modules/contract/mod_contract_magre.php @@ -32,6 +32,7 @@ class mod_contract_magre extends ModelNumRefContracts var $version='dolibarr'; var $error = ''; var $nom = 'Magre'; + var $code_auto=1; /** * Return default description of numbering model diff --git a/htdocs/core/modules/contract/mod_contract_olive.php b/htdocs/core/modules/contract/mod_contract_olive.php new file mode 100644 index 00000000000..f2439bb431e --- /dev/null +++ b/htdocs/core/modules/contract/mod_contract_olive.php @@ -0,0 +1,106 @@ + + * Copyright (C) 2006-2009 Laurent Destailleur + * Copyright (C) 2014 Floran Henry + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * or see http://www.gnu.org/ + */ + +/** + * \file htdocs/core/modules/contract/mod_contract_olive.php + * \ingroup contract + * \brief File of class to manage contract numbering rules Olive + */ + +require_once DOL_DOCUMENT_ROOT .'/core/modules/contract/modules_contract.php'; + + +/** + * Class to manage contract numbering rules Olive + */ +class mod_contract_olive extends ModelNumRefContracts +{ + + + var $nom='Olive'; // Nom du modele + var $code_modifiable = 1; // Code modifiable + var $code_modifiable_invalide = 1; // Code modifiable si il est invalide + var $code_modifiable_null = 1; // Code modifiables si il est null + var $code_null = 1; // Code facultatif + var $version='dolibarr'; // 'development', 'experimental', 'dolibarr' + var $code_auto = 0; // Numerotation automatique + + + /** Return description of module + * + * @param Translate $langs Object langs + * @return string Description of module + */ + function info() + { + global $langs; + + $langs->load("companies"); + return $langs->trans("LeopardNumRefModelDesc"); + } + + /** + * Return an example of result returned by getNextValue + * + * @param product $objproduct Object product + * @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect) + * @return string Return next value + */ + function getNextValue($objsoc,$contract) + { + global $langs; + return ''; + } + + + /** + * Check validity of code according to its rules + * + * @param DoliDB $db Database handler + * @param string &$code Code to check/correct + * @param Product $product Object product + * @param int $type 0 = product , 1 = service + * @return int 0 if OK + * -1 ErrorBadProductCodeSyntax + * -2 ErrorProductCodeRequired + * -3 ErrorProductCodeAlreadyUsed + * -4 ErrorPrefixRequired + */ + function verif($db, &$code, $product, $type) + { + global $conf; + + $result=0; + $code = strtoupper(trim($code)); + + if (empty($code) && $this->code_null && empty($conf->global->MAIN_CONTARCT_CODE_ALWAYS_REQUIRED)) + { + $result=0; + } + else if (empty($code) && (! $this->code_null || ! empty($conf->global->MAIN_CONTARCT_CODE_ALWAYS_REQUIRED)) ) + { + $result=-2; + } + + dol_syslog("mod_contract_olive::verif type=".$type." result=".$result); + return $result; + } +} + diff --git a/htdocs/core/modules/contract/mod_contract_serpis.php b/htdocs/core/modules/contract/mod_contract_serpis.php index 61ca01ae419..b909b762541 100644 --- a/htdocs/core/modules/contract/mod_contract_serpis.php +++ b/htdocs/core/modules/contract/mod_contract_serpis.php @@ -32,6 +32,7 @@ class mod_contract_serpis extends ModelNumRefContracts var $prefix='CT'; var $error=''; var $nom='Serpis'; + var $code_auto=1; /** From bab75335781368408b14bec00276a19761227de9 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 12 Aug 2014 18:16:59 +0200 Subject: [PATCH 4/6] Enable supplier price log table --- ChangeLog | 1 + htdocs/fourn/class/fournisseur.product.class.php | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 681455af224..6cecbc2b752 100644 --- a/ChangeLog +++ b/ChangeLog @@ -57,6 +57,7 @@ For users: - Fix: [ bug #1537 ] Difference between societe.nom and adherent.societe. - New: [ task #1204 ] add a External reference to contract - New: [ task #1204 ] add Numering contrat module free (like leopard in product module) +- New: Enable supplier price log table For translators: - Update language files. diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index b9cd7f40163..367ba5b972e 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -263,9 +263,9 @@ class ProductFournisseur extends Product $error++; } - /*if (! $error) + if (! $error && !empty($cong->global->PRODUCT_PRICE_SUPPLIER_NO_LOG)) { - // Ajoute modif dans table log + // Add record into log table $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_fournisseur_price_log("; $sql.= "datec, fk_product_fournisseur,fk_user,price,quantity)"; $sql.= "values('".$this->db->idate($now)."',"; @@ -281,7 +281,7 @@ class ProductFournisseur extends Product $error++; } } - */ + if (! $error) { From ca05345a60d2154c2f45f115a8f513602b6a89e8 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 12 Aug 2014 18:20:36 +0200 Subject: [PATCH 5/6] Fix Travis --- htdocs/core/modules/contract/mod_contract_olive.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/contract/mod_contract_olive.php b/htdocs/core/modules/contract/mod_contract_olive.php index f2439bb431e..3e056cf80cf 100644 --- a/htdocs/core/modules/contract/mod_contract_olive.php +++ b/htdocs/core/modules/contract/mod_contract_olive.php @@ -43,10 +43,11 @@ class mod_contract_olive extends ModelNumRefContracts var $code_auto = 0; // Numerotation automatique - /** Return description of module + /** + * Return description of module * - * @param Translate $langs Object langs - * @return string Description of module + * @param Translate $langs Object langs + * @return string Description of module */ function info() { @@ -59,7 +60,7 @@ class mod_contract_olive extends ModelNumRefContracts /** * Return an example of result returned by getNextValue * - * @param product $objproduct Object product + * @param Societe $objsoc Object thirdparty * @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect) * @return string Return next value */ From 3c96063165ae9b678fb2943bf8a437e6de6fda4f Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 12 Aug 2014 18:38:27 +0200 Subject: [PATCH 6/6] fix travis --- htdocs/core/modules/contract/mod_contract_olive.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/modules/contract/mod_contract_olive.php b/htdocs/core/modules/contract/mod_contract_olive.php index 3e056cf80cf..2b10d520b25 100644 --- a/htdocs/core/modules/contract/mod_contract_olive.php +++ b/htdocs/core/modules/contract/mod_contract_olive.php @@ -46,7 +46,6 @@ class mod_contract_olive extends ModelNumRefContracts /** * Return description of module * - * @param Translate $langs Object langs * @return string Description of module */ function info() @@ -61,7 +60,7 @@ class mod_contract_olive extends ModelNumRefContracts * Return an example of result returned by getNextValue * * @param Societe $objsoc Object thirdparty - * @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect) + * @param Contrat $contract Object contract * @return string Return next value */ function getNextValue($objsoc,$contract)