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 e16f1e81eb2..46de4089c75 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 @@ -378,4 +378,6 @@ 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_fichinterdet.sql b/htdocs/install/mysql/tables/llx_fichinterdet.sql index ada5557f1de..5fcd1b1d524 100644 --- a/htdocs/install/mysql/tables/llx_fichinterdet.sql +++ b/htdocs/install/mysql/tables/llx_fichinterdet.sql @@ -21,6 +21,7 @@ create table llx_fichinterdet ( rowid integer AUTO_INCREMENT PRIMARY KEY, fk_fichinter integer, + fk_parent_line integer NULL, date datetime, -- date de la ligne d'intervention description text, -- description de la ligne d'intervention duree integer, -- duree de la ligne d'intervention diff --git a/htdocs/langs/en_US/cron.lang b/htdocs/langs/en_US/cron.lang index 82431c2d96d..526c299f2af 100644 --- a/htdocs/langs/en_US/cron.lang +++ b/htdocs/langs/en_US/cron.lang @@ -79,7 +79,7 @@ CronHourStart= Start Hour and date of task CronEvery= And execute task each CronObject= Instance/Object to create CronArgs=Parameters -CronSaveSucess=Save succefully +CronSaveSucess=Save succesfully CronNote=Comment CronFieldMandatory=Fields %s is mandatory CronErrEndDateStartDt=End date cannot be before start date @@ -109,4 +109,4 @@ CronType=Task type CronType_method=Call method of a Dolibarr Class CronType_command=Shell command CronMenu=Cron -CronCannotLoadClass=Cannot load class %s or object %s \ No newline at end of file +CronCannotLoadClass=Cannot load class %s or object %s