From d09ccf58551d35b7bce22104add0bf113f272e5e Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 20 Jun 2014 13:21:49 +0200 Subject: [PATCH 01/11] Fix == instaed of = in variable affectation --- htdocs/comm/propal.php | 2 +- htdocs/commande/fiche.php | 2 +- htdocs/compta/facture.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index ddec39d90d2..ccf482e8d4a 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -739,7 +739,7 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- $price_min = $prod->multiprices_min[$object->client->price_level]; $price_base_type = $prod->multiprices_base_type[$object->client->price_level]; $tva_tx=$prod->multiprices_tva_tx[$object->client->price_level]; - $tva_npr ==$prod->multiprices_recuperableonly[$object->client->price_level]; + $tva_npr=$prod->multiprices_recuperableonly[$object->client->price_level]; } else { diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 12d62904dd8..e48787c5c34 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -687,7 +687,7 @@ else if ($action == 'addline' && $user->rights->commande->creer) $price_min = $prod->multiprices_min[$object->client->price_level]; $price_base_type = $prod->multiprices_base_type[$object->client->price_level]; $tva_tx=$prod->multiprices_tva_tx[$object->client->price_level]; - $tva_npr ==$prod->multiprices_recuperableonly[$object->client->price_level]; + $tva_npr=$prod->multiprices_recuperableonly[$object->client->price_level]; } else { diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 4f00678b514..cfac16c4901 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1260,7 +1260,7 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- $price_min = $prod->multiprices_min[$object->client->price_level]; $price_base_type = $prod->multiprices_base_type[$object->client->price_level]; $tva_tx=$prod->multiprices_tva_tx[$object->client->price_level]; - $tva_npr ==$prod->multiprices_recuperableonly[$object->client->price_level]; + $tva_npr=$prod->multiprices_recuperableonly[$object->client->price_level]; } else { From 76532218c21ceebc9c609b07e948287cbec0d8ab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 21 Jun 2014 15:35:30 +0200 Subject: [PATCH 02/11] Fix: [ bug #1476 ] Invoice creation form loses invoice date when there is a validation error --- ChangeLog | 1 + htdocs/compta/facture.php | 33 ++++++++++++++------------------- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index dd6c12d1b72..089b498acfa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ English Dolibarr ChangeLog -------------------------------------------------------------- ***** ChangeLog for 3.5.4 compared to 3.5.3 ***** +Fix: [ bug #1476 ] Invoice creation form loses invoice date when there is a validation error. Fix: [ bug #1431 ] Reception and Send supplier order box has a weird top margin. Fix: [ bug #1428 ] "Nothing" is shown in the middle of the screen in a supplier order. Fix: The object deliverycompany was not used anymore and output of diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 71ee5c8afd6..07960ed2c2c 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -676,8 +676,8 @@ else if ($action == 'add' && $user->rights->facture->creer) // Replacement invoice if ($_POST['type'] == 1) { - $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); - if (empty($datefacture)) + $dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + if (empty($dateinvoice)) { $error++; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")),'errors'); @@ -695,7 +695,7 @@ else if ($action == 'add' && $user->rights->facture->creer) $result=$object->fetch($_POST['fac_replacement']); $object->fetch_thirdparty(); - $object->date = $datefacture; + $object->date = $dateinvoice; $object->note_public = trim($_POST['note_public']); $object->note = trim($_POST['note']); $object->ref_client = $_POST['ref_client']; @@ -725,8 +725,8 @@ else if ($action == 'add' && $user->rights->facture->creer) setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CorrectInvoice")),'errors'); } - $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); - if (empty($datefacture)) + $dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + if (empty($dateinvoice)) { $error++; setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Date")),'errors'); @@ -734,14 +734,9 @@ else if ($action == 'add' && $user->rights->facture->creer) if (! $error) { - // Si facture avoir - $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); - - //$result=$object->fetch($_POST['fac_avoir']); - $object->socid = GETPOST('socid','int'); $object->number = $_POST['facnumber']; - $object->date = $datefacture; + $object->date = $dateinvoice; $object->note_public = trim($_POST['note_public']); $object->note = trim($_POST['note']); $object->ref_client = $_POST['ref_client']; @@ -777,8 +772,8 @@ else if ($action == 'add' && $user->rights->facture->creer) // Standard invoice or Deposit invoice created from a Predefined invoice if (($_POST['type'] == 0 || $_POST['type'] == 3) && $_POST['fac_rec'] > 0) { - $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); - if (empty($datefacture)) + $dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + if (empty($dateinvoice)) { $error++; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")),'errors'); @@ -789,7 +784,7 @@ else if ($action == 'add' && $user->rights->facture->creer) $object->socid = GETPOST('socid','int'); $object->type = $_POST['type']; $object->number = $_POST['facnumber']; - $object->date = $datefacture; + $object->date = $dateinvoice; $object->note_public = trim($_POST['note_public']); $object->note_private = trim($_POST['note_private']); $object->ref_client = $_POST['ref_client']; @@ -814,8 +809,8 @@ else if ($action == 'add' && $user->rights->facture->creer) setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Customer")),'errors'); } - $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); - if (empty($datefacture)) + $dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + if (empty($dateinvoice)) { $error++; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")),'errors'); @@ -827,7 +822,7 @@ else if ($action == 'add' && $user->rights->facture->creer) $object->socid = GETPOST('socid','int'); $object->type = GETPOST('type'); $object->number = $_POST['facnumber']; - $object->date = $datefacture; + $object->date = $dateinvoice; $object->note_public = trim($_POST['note_public']); $object->note_private = trim($_POST['note_private']); $object->ref_client = $_POST['ref_client']; @@ -2084,7 +2079,7 @@ if ($action == 'create') $mode_reglement_id = (! empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(! empty($soc->mode_reglement_id)?$soc->mode_reglement_id:0)); $remise_percent = (! empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(! empty($soc->remise_percent)?$soc->remise_percent:0)); $remise_absolue = (! empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(! empty($soc->remise_absolue)?$soc->remise_absolue:0)); - $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''; + $dateinvoice = (empty($dateinvoice)?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$dateinvoice); //Replicate extrafields $objectsrc->fetch_optionals($originid); @@ -2097,7 +2092,7 @@ if ($action == 'create') $mode_reglement_id = $soc->mode_reglement_id; $remise_percent = $soc->remise_percent; $remise_absolue = 0; - $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''; + $dateinvoice = (empty($dateinvoice)?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$dateinvoice); } $absolute_discount=$soc->getAvailableDiscounts(); From d19b34cc7ee1c1f16a7b1d8c3bd3bac36e82b9f5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 21 Jun 2014 15:45:53 +0200 Subject: [PATCH 03/11] Fix: Renaming a project with uplaoded files failed. --- ChangeLog | 1 + htdocs/product/class/product.class.php | 2 +- htdocs/projet/class/project.class.php | 9 +++++---- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 089b498acfa..55cc3594ac3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ English Dolibarr ChangeLog -------------------------------------------------------------- ***** ChangeLog for 3.5.4 compared to 3.5.3 ***** +Fix: Renaming a project with uplaoded files failed. Fix: [ bug #1476 ] Invoice creation form loses invoice date when there is a validation error. Fix: [ bug #1431 ] Reception and Send supplier order box has a weird top margin. Fix: [ bug #1428 ] "Nothing" is shown in the middle of the screen in a supplier order. diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 934706a1c95..d7d5952ab66 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -547,7 +547,7 @@ class Product extends CommonObject if (file_exists($olddir)) { include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; - $res=@dol_move($olddir, $newdir); + $res=dol_move($olddir, $newdir); if (! $res) { $this->error='ErrorFailToMoveDir'; diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 43e2137715c..7ceb6a8438c 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -247,8 +247,9 @@ class Project extends CommonObject $newdir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($this->ref); if (file_exists($olddir)) { - $res=@dol_move($olddir, $newdir); - if (! $res) + include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; + $res=dol_move($olddir, $newdir); + if (! $res) { $this->error='ErrorFailToMoveDir'; $error++; @@ -511,7 +512,7 @@ class Project extends CommonObject $sql = "DELETE FROM " . MAIN_DB_PREFIX . "projet_extrafields"; $sql.= " WHERE fk_object=" . $this->id; - + dol_syslog(get_class($this) . "::delete sql=" . $sql, LOG_DEBUG); $resql = $this->db->query($sql); @@ -556,7 +557,7 @@ class Project extends CommonObject // End call triggers } } - + if (empty($error)) { $this->db->commit(); return 1; From 0778d38b2c2f30748d24e5ee46132aeb35181b59 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 21 Jun 2014 18:03:01 +0200 Subject: [PATCH 04/11] Fix: Deprecated and no more used fields should not appear to user. --- htdocs/admin/agenda_xcal.php | 3 +-- htdocs/core/lib/agenda.lib.php | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/agenda_xcal.php b/htdocs/admin/agenda_xcal.php index 135429e15d3..bbfa52c24de 100644 --- a/htdocs/admin/agenda_xcal.php +++ b/htdocs/admin/agenda_xcal.php @@ -49,7 +49,7 @@ if ($actionsave) $i+=dolibarr_set_const($db,'MAIN_AGENDA_EXPORT_PAST_DELAY',trim(GETPOST('MAIN_AGENDA_EXPORT_PAST_DELAY','alpha')),'chaine',0,'',$conf->entity); $i+=dolibarr_set_const($db,'MAIN_AGENDA_EXPORT_CACHE',trim(GETPOST('MAIN_AGENDA_EXPORT_CACHE','alpha')),'chaine',0,'',$conf->entity); $i+=dolibarr_set_const($db,'AGENDA_EXPORT_FIX_TZ',trim(GETPOST('AGENDA_EXPORT_FIX_TZ','alpha')),'chaine',0,'',$conf->entity); - + if ($i >= 4) { $db->commit(); @@ -174,7 +174,6 @@ $message=$langs->trans("AgendaUrlOptions1",$user->login,$user->login).'
'; $message.=$langs->trans("AgendaUrlOptions2",$user->login,$user->login).'
'; $message.=$langs->trans("AgendaUrlOptions3",$user->login,$user->login).'
'; $message.=$langs->trans("AgendaUrlOptions4",$user->login,$user->login).'
'; -$message.=$langs->trans("AgendaUrlOptions5",$user->login,$user->login); print info_admin($message); if (! empty($conf->use_javascript_ajax)) diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index f6c84bdeb4a..622c42164ca 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -78,12 +78,12 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh print $form->select_dolusers($filtert, 'usertodo', 1, '', ! $canedit); print ''; - print ''; + /*print ''; print ''; print $langs->trans("or") . ' ' . $langs->trans("ActionsDoneBy"); print '  '; print $form->select_dolusers($filterd, 'userdone', 1, '', ! $canedit); - print ''; + print '';*/ include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; $formactions=new FormActions($db); From d22bfa8847abe92451b8c9f9831ce99a32f954d7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 21 Jun 2014 18:16:22 +0200 Subject: [PATCH 05/11] Fix: Cloning must use dol_clone --- htdocs/commande/fiche.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index e48787c5c34..0b9590d7e2f 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -113,7 +113,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->commande-> if ($object->id > 0) { //Because createFromClone modifies the object, we must clone it so that we can restore it later - $orig = clone $object; + $orig = dol_clone($object); $result=$object->createFromClone($socid); if ($result > 0) From b4add020a9cfe3ead702c8137f9fc3a4d7b4854e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 23 Jun 2014 11:47:07 +0200 Subject: [PATCH 06/11] Fix: Question about warehouse must not be done when module stock is disabled. Fix: Option STOCK_SUPPORTS_SERVICES was not correctly implemented (missing test at some places). --- ChangeLog | 3 ++ htdocs/commande/fiche.php | 77 +++++++++++++++++++++++++++++---- htdocs/fourn/commande/fiche.php | 26 +++++++++-- htdocs/fourn/facture/fiche.php | 14 +++++- 4 files changed, 107 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 55cc3594ac3..b10c4b11d91 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,9 @@ English Dolibarr ChangeLog -------------------------------------------------------------- ***** ChangeLog for 3.5.4 compared to 3.5.3 ***** +Fix: Question about warehouse must not be done when module stock is disabled. +Fix: Option STOCK_SUPPORTS_SERVICES was not correctly implemented + (missing test at some places). Fix: Renaming a project with uplaoded files failed. Fix: [ bug #1476 ] Invoice creation form loses invoice date when there is a validation error. Fix: [ bug #1431 ] Reception and Send supplier order box has a weird top margin. diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 0b9590d7e2f..99864a59dd2 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -1011,8 +1011,18 @@ else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->co { $idwarehouse=GETPOST('idwarehouse'); + $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_VALIDATE_ORDER) && $object->hasProductsOrServices(1)) + if (! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change) { if (! $idwarehouse || $idwarehouse == -1) { @@ -1047,8 +1057,18 @@ else if ($action == 'confirm_modif' && $user->rights->commande->creer) { $idwarehouse=GETPOST('idwarehouse'); + $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_VALIDATE_ORDER) && $object->hasProductsOrServices(1)) + if (! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change) { if (! $idwarehouse || $idwarehouse == -1) { @@ -1094,8 +1114,18 @@ else if ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->comm { $idwarehouse=GETPOST('idwarehouse'); + $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_VALIDATE_ORDER) && $object->hasProductsOrServices(1)) + if (! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change) { if (! $idwarehouse || $idwarehouse == -1) { @@ -1887,8 +1917,19 @@ else $text.='
'; $text.=$notify->confirmMessage('ORDER_VALIDATE',$object->socid); } + + $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); + } + $formquestion=array(); - if (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $object->hasProductsOrServices(1)) + if (! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change) { $langs->load("stocks"); require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; @@ -1906,9 +1947,19 @@ else // Confirm back to draft status if ($action == 'modif') { + $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); + } + $text=$langs->trans('ConfirmUnvalidateOrder',$object->ref); $formquestion=array(); - if (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $object->hasProductsOrServices(1)) + if (! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change) { $langs->load("stocks"); require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; @@ -1934,12 +1985,22 @@ else /* * Confirmation de l'annulation - */ + */ if ($action == 'cancel') { + $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); + } + $text=$langs->trans('ConfirmCancelOrder',$object->ref); $formquestion=array(); - if (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $object->hasProductsOrServices(1)) + if (! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change) { $langs->load("stocks"); require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; @@ -1956,7 +2017,7 @@ else /* * Confirmation de la suppression d'une ligne produit - */ + */ if ($action == 'ask_deleteline') { $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 0, 1); diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 21d165c118e..24b80a60f94 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -488,7 +488,7 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->fourn setEventMessage($object->error, 'errors'); } - // If we have permission, and if we don't need to provide th idwarehouse, we go directly on approved step + // If we have permission, and if we don't need to provide the idwarehouse, we go directly on approved step if ($user->rights->fournisseur->commande->approuver && ! (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) && $object->hasProductsOrServices(1))) { $action='confirm_approve'; @@ -499,8 +499,18 @@ else if ($action == 'confirm_approve' && $confirm == 'yes' && $user->rights->fou { $idwarehouse=GETPOST('idwarehouse', 'int'); + $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_VALIDATE_ORDER) && $object->hasProductsOrServices(1)) + if (! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) && $qualified_for_stock_change) { if (! $idwarehouse || $idwarehouse == -1) { @@ -1193,8 +1203,18 @@ elseif (! empty($object->id)) */ if ($action == 'approve') { + $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); + } + $formquestion=array(); - if (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) && $object->hasProductsOrServices(1)) + if (! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) && $qualified_for_stock_change) { $langs->load("stocks"); require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 8ea921d094b..2874127471a 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -129,7 +129,7 @@ elseif ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->fourni } // Check parameters - if (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $qualified_for_stock_change) + if (! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $qualified_for_stock_change) { $langs->load("stocks"); if (! $idwarehouse || $idwarehouse == -1) @@ -1475,7 +1475,17 @@ else }*/ $formquestion=array(); - if (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $object->hasProductsOrServices(1)) + $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); + } + + if (! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $qualified_for_stock_change) { $langs->load("stocks"); require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; From 0f267559c6623fe1fcab1686beab99d458157283 Mon Sep 17 00:00:00 2001 From: Cedric Date: Mon, 23 Jun 2014 12:28:59 +0200 Subject: [PATCH 07/11] FIX #1485:LINEBILL_SUPPLIER_DELETE failure trigger leads to an endless loop --- htdocs/fourn/facture/fiche.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 8ea921d094b..dea8285d7de 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -179,6 +179,8 @@ elseif ($action == 'confirm_delete_line' && $confirm == 'yes' && $user->rights-> else { $mesg='
'.$object->error.'
'; + /* Fix bug 1485 : Reset action to avoid asking again confirmation on failure */ + $action=''; } } From 7ced580abc2ea15e81add5483c65cb49174b4330 Mon Sep 17 00:00:00 2001 From: Cedric Date: Mon, 23 Jun 2014 12:35:37 +0200 Subject: [PATCH 08/11] Add fix to changelog --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 55cc3594ac3..a1c1330c097 100644 --- a/ChangeLog +++ b/ChangeLog @@ -34,6 +34,7 @@ Fix: [ bug #1254 ] Error when using "Enter" on qty input box of a product (on su Fix: [ bug #1462, 1468, 1480, 1483, 1490, 1497] $this instead of $object Fix: [ bug #1455 ] outstanding amount Fix: [ bug #1425 ] +Fix: [ bug #1425 ] LINEBILL_SUPPLIER_DELETE failure trigger leads to an endless loop ***** ChangeLog for 3.5.3 compared to 3.5.2 ***** Fix: Error on field accountancy code for export profile of invoices. From 54f55cf03edf8d166a6e5f2c647eebc3e81904f1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 Jun 2014 22:14:45 +0200 Subject: [PATCH 09/11] Fix: No change if error on trigger --- htdocs/commande/class/commande.class.php | 28 ++++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 199b6500184..57281bb43a6 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -290,13 +290,6 @@ class Commande extends CommonOrder } } - // Set new ref and current status - if (! $error) - { - $this->ref = $num; - $this->statut = 1; - } - if (! $error) { // Appel des triggers @@ -307,6 +300,13 @@ class Commande extends CommonOrder // Fin appel triggers } + // Set new ref and current status + if (! $error) + { + $this->ref = $num; + $this->statut = 1; + } + if (! $error) { $this->db->commit(); @@ -1060,7 +1060,7 @@ class Commande extends CommonOrder function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0, $date_start='', $date_end='', $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='',$array_option=0) { global $mysoc; - + $commandeid=$this->id; dol_syslog(get_class($this)."::addline commandeid=$commandeid, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc, date_start=$date_start, date_end=$date_end, type=$type", LOG_DEBUG); @@ -1107,9 +1107,9 @@ class Commande extends CommonOrder // qty, pu, remise_percent et txtva // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - + $localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc); - + $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type,'', $localtaxes_type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; @@ -2314,9 +2314,9 @@ class Commande extends CommonOrder // qty, pu, remise_percent et txtva // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - + $localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc); - + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, '', $localtaxes_type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; @@ -2565,8 +2565,8 @@ class Commande extends CommonOrder while ($obj=$this->db->fetch_object($resql)) { $this->nbtodo++; - - $date_to_test = empty($obj->delivery_date) ? $obj->datec : $obj->delivery_date; + + $date_to_test = empty($obj->delivery_date) ? $obj->datec : $obj->delivery_date; if ($obj->fk_statut != 3 && $this->db->jdate($date_to_test) < ($now - $conf->commande->client->warning_delay)) $this->nbtodolate++; } return 1; From f64f0d6933755776cdea8004b10ecec5dd5fd17c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 Jun 2014 23:43:53 +0200 Subject: [PATCH 10/11] Fix: If showempty is 0 and empty, do not show button. --- htdocs/core/class/html.formfile.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index d139f235fd9..9ce484e5d43 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -482,7 +482,7 @@ class FormFile // Language code (if multilang) $out.= ''; - if (($allowgenifempty || (is_array($modellist) && count($modellist) > 0)) && $conf->global->MAIN_MULTILANGS && ! $forcenomultilang) + if (($allowgenifempty || (is_array($modellist) && count($modellist) > 0)) && $conf->global->MAIN_MULTILANGS && ! $forcenomultilang && (! empty($modellist) || $showempty)) { include_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; $formadmin=new FormAdmin($this->db); @@ -508,6 +508,7 @@ class FormFile $genbutton.= ' '.img_warning($langs->transnoentitiesnoconv("WarningNoDocumentModelActivated")); } if (! $allowgenifempty && ! is_array($modellist) && empty($modellist) && empty($conf->dol_no_mouse_hover) && $modulepart != 'unpaid') $genbutton=''; + if (empty($modellist) && ! $showempty) $genbutton=''; $out.= $genbutton; $out.= ''; From 018771c0f53ef482f94c4a5462b37d917af8623c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 25 Jun 2014 20:07:21 +0200 Subject: [PATCH 11/11] Fix: sql syntax error (missing ' on date) --- htdocs/commande/class/commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 57281bb43a6..6b88ff3553d 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -483,7 +483,7 @@ class Commande extends CommonOrder $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande'; $sql.= ' SET fk_statut = 3,'; $sql.= ' fk_user_cloture = '.$user->id.','; - $sql.= ' date_cloture = '.$this->db->idate($now); + $sql.= " date_cloture = '".$this->db->idate($now)."'"; $sql.= ' WHERE rowid = '.$this->id.' AND fk_statut > 0'; if ($this->db->query($sql))