diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index e97a09559af..344bf615f56 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -392,7 +392,7 @@ class Adherent extends CommonObject $nbrowsaffected=0; $error=0; - dol_syslog(get_class($this)."::update notrigger=".$notrigger.", nosyncuser=".$nosyncuser.", nosyncuserpass=".$nosyncuserpass.", email=".$this->email); + dol_syslog(get_class($this)."::update notrigger=".$notrigger.", nosyncuser=".$nosyncuser.", nosyncuserpass=".$nosyncuserpass." nosyncthirdparty=".$nosyncthirdparty.", email=".$this->email); // Clean parameters $this->lastname=trim($this->lastname)?trim($this->lastname):trim($this->lastname); @@ -1013,7 +1013,7 @@ class Adherent extends CommonObject { global $langs; - $sql = "SELECT d.rowid, d.civilite, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note,"; + $sql = "SELECT d.rowid, d.ref_ext, d.civilite, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note,"; $sql.= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass,"; $sql.= " d.photo, d.fk_adherent_type, d.morphy, d.entity,"; $sql.= " d.datec as datec,"; @@ -1050,6 +1050,7 @@ class Adherent extends CommonObject $this->entity = $obj->entity; $this->ref = $obj->rowid; $this->id = $obj->rowid; + $this->ref_ext = $obj->ref_ext; $this->civilite_id = $obj->civilite; $this->firstname = $obj->firstname; $this->lastname = $obj->lastname; diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index 9c1f1ae2973..77553e67d13 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -432,7 +432,7 @@ else if ($action == 'addline' && $user->rights->contrat->creer) } $desc = $prod->description; - $desc.= $prod->description && GETPOST('desc') ? "\n" : ""; + $desc.= $prod->description && GETPOST('np_desc') ? "\n" : ""; $desc.= GETPOST('np_desc'); } else diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 31a8fc85b77..e3bc1fadb8b 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -659,7 +659,7 @@ class FactureFournisseur extends CommonInvoice } } } - + // Remove extrafields if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used { @@ -855,6 +855,45 @@ class FactureFournisseur extends CommonInvoice } } + if (! $error) + { + $this->oldref = ''; + + // Rename directory if dir was a temporary ref + if (preg_match('/^[\(]?PROV/i', $this->ref)) + { + // On renomme repertoire facture ($this->ref = ancienne ref, $num = nouvelle ref) + // afin de ne pas perdre les fichiers attaches + $facref = dol_sanitizeFileName($this->ref); + $snumfa = dol_sanitizeFileName($num); + + $dirsource = $conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id,2).$facref; + $dirdest = $conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id,2).$snumfa; + if (file_exists($dirsource)) + { + dol_syslog(get_class($this)."::validate rename dir ".$dirsource." into ".$dirdest); + + if (@rename($dirsource, $dirdest)) + { + $this->oldref = $facref; + + dol_syslog("Rename ok"); + // Suppression ancien fichier PDF dans nouveau rep + dol_delete_file($conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id,2).$snumfa.'/'.$facref.'*.*'); + } + } + } + } + + // Set new ref and define current statut + if (! $error) + { + $this->ref = $num; + $this->statut=1; + //$this->date_validation=$now; this is stored into log table + } + + // Triggers call if (! $error) { // Appel des triggers diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 3a157d74ceb..8774c2b871c 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -114,8 +114,18 @@ elseif ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->fourni $object->fetch($id); $object->fetch_thirdparty(); + $qualified_for_stock_change=0; + if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) + { + $qualified_for_stock_change=$object->hasProductsOrServices(2); + } + else + { + $qualified_for_stock_change=$object->hasProductsOrServices(1); + } + // Check parameters - if (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $object->hasProductsOrServices(1)) + if (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $qualified_for_stock_change) { $langs->load("stocks"); if (! $idwarehouse || $idwarehouse == -1) diff --git a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql index 155e27508fa..eee29dbd594 100755 --- a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql +++ b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql @@ -256,6 +256,7 @@ CREATE TABLE llx_printer_ipp ) ENGINE=innodb; ALTER TABLE llx_socpeople ADD COLUMN ref_ext varchar(128) after entity; +ALTER TABLE llx_adherent MODIFY COLUMN ref_ext varchar(128); create table llx_commande_extrafields ( @@ -377,4 +378,7 @@ ALTER TABLE llx_facture_fourn_extrafields ADD INDEX idx_facture_fourn_extrafield ALTER TABLE llx_user_clicktodial ADD COLUMN url varchar(255) AFTER fk_user; + ALTER TABLE llx_fichinterdet ADD COLUMN fk_parent_line integer NULL AFTER fk_fichinter; + +ALTER TABLE llx_societe_address CHANGE COLUMN tel phone varchar(20); diff --git a/htdocs/install/mysql/tables/llx_adherent.sql b/htdocs/install/mysql/tables/llx_adherent.sql index 936f04d78a4..af15f5da198 100644 --- a/htdocs/install/mysql/tables/llx_adherent.sql +++ b/htdocs/install/mysql/tables/llx_adherent.sql @@ -28,7 +28,7 @@ create table llx_adherent ( rowid integer AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, -- multi company id - ref_ext varchar(30), -- reference into an external system (not used by dolibarr) + ref_ext varchar(128), -- reference into an external system (not used by dolibarr) civilite varchar(6), lastname varchar(50), diff --git a/htdocs/install/mysql/tables/llx_societe_address.sql b/htdocs/install/mysql/tables/llx_societe_address.sql index 7d39a9654fa..aa596333b2c 100644 --- a/htdocs/install/mysql/tables/llx_societe_address.sql +++ b/htdocs/install/mysql/tables/llx_societe_address.sql @@ -1,6 +1,6 @@ -- ======================================================================== -- Copyright (C) 2000-2004 Rodolphe Quiedeville --- Copyright (C) 2005-2010 Houssin Regis +-- Copyright (C) 2005-2013 Houssin Regis -- -- 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 @@ -29,7 +29,7 @@ create table llx_societe_address zip varchar(10), -- zipcode town varchar(50), -- town fk_pays integer DEFAULT 0, -- - tel varchar(20), -- phone number + phone varchar(20), -- phone number fax varchar(20), -- fax number note text, -- fk_user_creat integer, diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 0ea3253bdd1..f998f563729 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -588,13 +588,14 @@ class Societe extends CommonObject if ($result > 0) { - $lmember->firstname=$this->firstname; - $lmember->lastname=$this->lastname; + $lmember->societe=$this->name; + //$lmember->firstname=$this->firstname?$this->firstname:$lmember->firstname; // We keep firstname and lastname of member unchanged + //$lmember->lastname=$this->lastname?$this->lastname:$lmember->lastname; // We keep firstname and lastname of member unchanged $lmember->address=$this->address; $lmember->email=$this->email; $lmember->phone=$this->phone; - $result=$lmember->update($user,0,1,1); // Use nosync to 1 to avoid cyclic updates + $result=$lmember->update($user,0,1,1,1); // Use nosync to 1 to avoid cyclic updates if ($result < 0) { $this->error=$lmember->error;