Merge remote-tracking branch 'origin/3.5' into 3.6
Conflicts: htdocs/comm/propal.php htdocs/commande/class/commande.class.php htdocs/commande/fiche.php htdocs/compta/facture.php htdocs/product/class/product.class.php htdocs/projet/class/project.class.php
This commit is contained in:
commit
018e1d31e3
@ -107,6 +107,11 @@ removed. You must now use the 6 parameters way. See file modMyModule.class.php f
|
||||
|
||||
|
||||
***** 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.
|
||||
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
|
||||
@ -136,6 +141,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.
|
||||
|
||||
@ -291,13 +291,6 @@ class Commande extends CommonOrder
|
||||
}
|
||||
}
|
||||
|
||||
// Set new ref and current status
|
||||
if (! $error)
|
||||
{
|
||||
$this->ref = $num;
|
||||
$this->statut = 1;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// Appel des triggers
|
||||
@ -308,6 +301,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();
|
||||
@ -2590,8 +2590,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;
|
||||
|
||||
@ -862,12 +862,24 @@ else if ($action == 'updateligne' && $user->rights->commande->creer && GETPOST('
|
||||
else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->commande->valider) {
|
||||
$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 (! $idwarehouse || $idwarehouse == - 1) {
|
||||
$error ++;
|
||||
$mesgs [] = '<div class="error">' . $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")) . '</div>';
|
||||
$action = '';
|
||||
if (! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change)
|
||||
{
|
||||
if (! $idwarehouse || $idwarehouse == -1)
|
||||
{
|
||||
$error++;
|
||||
$mesgs[]='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")).'</div>';
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
|
||||
@ -895,12 +907,24 @@ else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->co
|
||||
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 (! $idwarehouse || $idwarehouse == - 1) {
|
||||
$error ++;
|
||||
$mesgs [] = '<div class="error">' . $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")) . '</div>';
|
||||
$action = '';
|
||||
if (! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change)
|
||||
{
|
||||
if (! $idwarehouse || $idwarehouse == -1)
|
||||
{
|
||||
$error++;
|
||||
$mesgs[]='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")).'</div>';
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
|
||||
@ -936,12 +960,24 @@ else if ($action == 'confirm_shipped' && $confirm == 'yes' && $user->rights->com
|
||||
else if ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->commande->valider) {
|
||||
$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 (! $idwarehouse || $idwarehouse == - 1) {
|
||||
$error ++;
|
||||
$mesgs [] = '<div class="error">' . $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")) . '</div>';
|
||||
$action = '';
|
||||
if (! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change)
|
||||
{
|
||||
if (! $idwarehouse || $idwarehouse == -1)
|
||||
{
|
||||
$error++;
|
||||
$mesgs[]='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse")).'</div>';
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
|
||||
@ -1663,8 +1699,20 @@ if ($action == 'create' && $user->rights->commande->creer) {
|
||||
$text .= '<br>';
|
||||
$text .= $notify->confirmMessage('ORDER_VALIDATE', $object->socid);
|
||||
}
|
||||
$formquestion = array();
|
||||
if (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $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);
|
||||
}
|
||||
|
||||
$formquestion=array();
|
||||
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';
|
||||
$formproduct = new FormProduct($db);
|
||||
@ -1681,10 +1729,22 @@ if ($action == 'create' && $user->rights->commande->creer) {
|
||||
}
|
||||
|
||||
// Confirm back to draft status
|
||||
if ($action == 'modif') {
|
||||
$text = $langs->trans('ConfirmUnvalidateOrder', $object->ref);
|
||||
$formquestion = array();
|
||||
if (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $object->hasProductsOrServices(1)) {
|
||||
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->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';
|
||||
$formproduct = new FormProduct($db);
|
||||
@ -1709,11 +1769,23 @@ if ($action == 'create' && $user->rights->commande->creer) {
|
||||
|
||||
/*
|
||||
* Confirmation de l'annulation
|
||||
*/
|
||||
if ($action == 'cancel') {
|
||||
$text = $langs->trans('ConfirmCancelOrder', $object->ref);
|
||||
$formquestion = array();
|
||||
if (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $object->hasProductsOrServices(1)) {
|
||||
*/
|
||||
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->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';
|
||||
$formproduct = new FormProduct($db);
|
||||
@ -1731,9 +1803,10 @@ if ($action == 'create' && $user->rights->commande->creer) {
|
||||
|
||||
/*
|
||||
* 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);
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
// Clone confirmation
|
||||
|
||||
@ -597,10 +597,11 @@ else if ($action == 'add' && $user->rights->facture->creer)
|
||||
// Replacement invoice
|
||||
if ($_POST['type'] == Facture::TYPE_REPLACEMENT)
|
||||
{
|
||||
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||
if (empty($datefacture)) {
|
||||
$error ++;
|
||||
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), 'errors');
|
||||
$dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||
if (empty($dateinvoice))
|
||||
{
|
||||
$error++;
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")),'errors');
|
||||
}
|
||||
|
||||
if (! ($_POST['fac_replacement'] > 0)) {
|
||||
@ -613,17 +614,17 @@ else if ($action == 'add' && $user->rights->facture->creer)
|
||||
$result = $object->fetch($_POST['fac_replacement']);
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$object->date = $datefacture;
|
||||
$object->note_public = trim($_POST['note_public']);
|
||||
$object->note = trim($_POST['note']);
|
||||
$object->ref_client = $_POST['ref_client'];
|
||||
$object->ref_int = $_POST['ref_int'];
|
||||
$object->modelpdf = $_POST['model'];
|
||||
$object->fk_project = $_POST['projectid'];
|
||||
$object->cond_reglement_id = $_POST['cond_reglement_id'];
|
||||
$object->mode_reglement_id = $_POST['mode_reglement_id'];
|
||||
$object->remise_absolue = $_POST['remise_absolue'];
|
||||
$object->remise_percent = $_POST['remise_percent'];
|
||||
$object->date = $dateinvoice;
|
||||
$object->note_public = trim($_POST['note_public']);
|
||||
$object->note = trim($_POST['note']);
|
||||
$object->ref_client = $_POST['ref_client'];
|
||||
$object->ref_int = $_POST['ref_int'];
|
||||
$object->modelpdf = $_POST['model'];
|
||||
$object->fk_project = $_POST['projectid'];
|
||||
$object->cond_reglement_id = $_POST['cond_reglement_id'];
|
||||
$object->mode_reglement_id = $_POST['mode_reglement_id'];
|
||||
$object->remise_absolue = $_POST['remise_absolue'];
|
||||
$object->remise_percent = $_POST['remise_percent'];
|
||||
|
||||
// Proprietes particulieres a facture de remplacement
|
||||
$object->fk_facture_source = $_POST['fac_replacement'];
|
||||
@ -644,8 +645,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');
|
||||
@ -653,24 +654,19 @@ 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->note_public = trim($_POST['note_public']);
|
||||
$object->note = trim($_POST['note']);
|
||||
$object->ref_client = $_POST['ref_client'];
|
||||
$object->ref_int = $_POST['ref_int'];
|
||||
$object->modelpdf = $_POST['model'];
|
||||
$object->fk_project = $_POST['projectid'];
|
||||
$object->cond_reglement_id = 0;
|
||||
$object->mode_reglement_id = $_POST['mode_reglement_id'];
|
||||
$object->remise_absolue = $_POST['remise_absolue'];
|
||||
$object->remise_percent = $_POST['remise_percent'];
|
||||
$object->socid = GETPOST('socid','int');
|
||||
$object->number = $_POST['facnumber'];
|
||||
$object->date = $dateinvoice;
|
||||
$object->note_public = trim($_POST['note_public']);
|
||||
$object->note = trim($_POST['note']);
|
||||
$object->ref_client = $_POST['ref_client'];
|
||||
$object->ref_int = $_POST['ref_int'];
|
||||
$object->modelpdf = $_POST['model'];
|
||||
$object->fk_project = $_POST['projectid'];
|
||||
$object->cond_reglement_id = 0;
|
||||
$object->mode_reglement_id = $_POST['mode_reglement_id'];
|
||||
$object->remise_absolue = $_POST['remise_absolue'];
|
||||
$object->remise_percent = $_POST['remise_percent'];
|
||||
|
||||
// Proprietes particulieres a facture avoir
|
||||
$object->fk_facture_source = $_POST['fac_avoir'];
|
||||
@ -737,23 +733,24 @@ 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)) {
|
||||
$error ++;
|
||||
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), 'errors');
|
||||
$dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||
if (empty($dateinvoice))
|
||||
{
|
||||
$error++;
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")),'errors');
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$object->socid = GETPOST('socid', 'int');
|
||||
$object->type = $_POST['type'];
|
||||
$object->number = $_POST['facnumber'];
|
||||
$object->date = $datefacture;
|
||||
$object->note_public = trim($_POST['note_public']);
|
||||
$object->note_private = trim($_POST['note_private']);
|
||||
$object->ref_client = $_POST['ref_client'];
|
||||
$object->ref_int = $_POST['ref_int'];
|
||||
$object->modelpdf = $_POST['model'];
|
||||
$object->socid = GETPOST('socid','int');
|
||||
$object->type = $_POST['type'];
|
||||
$object->number = $_POST['facnumber'];
|
||||
$object->date = $dateinvoice;
|
||||
$object->note_public = trim($_POST['note_public']);
|
||||
$object->note_private = trim($_POST['note_private']);
|
||||
$object->ref_client = $_POST['ref_client'];
|
||||
$object->ref_int = $_POST['ref_int'];
|
||||
$object->modelpdf = $_POST['model'];
|
||||
|
||||
// Source facture
|
||||
$object->fac_rec = $_POST['fac_rec'];
|
||||
@ -771,30 +768,32 @@ 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)) {
|
||||
$error ++;
|
||||
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), 'errors');
|
||||
$dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||
if (empty($dateinvoice))
|
||||
{
|
||||
$error++;
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")),'errors');
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// Si facture standard
|
||||
$object->socid = GETPOST('socid', 'int');
|
||||
$object->type = GETPOST('type');
|
||||
$object->number = $_POST['facnumber'];
|
||||
$object->date = $datefacture;
|
||||
$object->note_public = trim($_POST['note_public']);
|
||||
$object->note_private = trim($_POST['note_private']);
|
||||
$object->ref_client = $_POST['ref_client'];
|
||||
$object->ref_int = $_POST['ref_int'];
|
||||
$object->modelpdf = $_POST['model'];
|
||||
$object->fk_project = $_POST['projectid'];
|
||||
$object->cond_reglement_id = ($_POST['type'] == 3 ? 1 : $_POST['cond_reglement_id']);
|
||||
$object->mode_reglement_id = $_POST['mode_reglement_id'];
|
||||
$object->amount = $_POST['amount'];
|
||||
$object->remise_absolue = $_POST['remise_absolue'];
|
||||
$object->remise_percent = $_POST['remise_percent'];
|
||||
$object->socid = GETPOST('socid','int');
|
||||
$object->type = GETPOST('type');
|
||||
$object->number = $_POST['facnumber'];
|
||||
$object->date = $dateinvoice;
|
||||
$object->note_public = trim($_POST['note_public']);
|
||||
$object->note_private = trim($_POST['note_private']);
|
||||
$object->ref_client = $_POST['ref_client'];
|
||||
$object->ref_int = $_POST['ref_int'];
|
||||
$object->modelpdf = $_POST['model'];
|
||||
$object->fk_project = $_POST['projectid'];
|
||||
$object->cond_reglement_id = ($_POST['type'] == 3?1:$_POST['cond_reglement_id']);
|
||||
$object->mode_reglement_id = $_POST['mode_reglement_id'];
|
||||
$object->amount = $_POST['amount'];
|
||||
$object->remise_absolue = $_POST['remise_absolue'];
|
||||
$object->remise_percent = $_POST['remise_percent'];
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
// If creation from another object of another module (Example: origin=propal, originid=1)
|
||||
@ -1883,7 +1882,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);
|
||||
@ -1897,7 +1896,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:''; // Do not set 0 here (0 for a date is 1970)
|
||||
$dateinvoice = (empty($dateinvoice)?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$dateinvoice); // Do not set 0 here (0 for a date is 1970)
|
||||
}
|
||||
$absolute_discount = $soc->getAvailableDiscounts();
|
||||
|
||||
|
||||
@ -483,7 +483,7 @@ class FormFile
|
||||
|
||||
// Language code (if multilang)
|
||||
$out.= '<th align="center" class="formdoc liste_titre">';
|
||||
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);
|
||||
@ -509,6 +509,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.= '</th>';
|
||||
|
||||
|
||||
@ -485,7 +485,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';
|
||||
@ -496,8 +496,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)
|
||||
{
|
||||
@ -1205,8 +1215,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';
|
||||
|
||||
@ -131,7 +131,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)
|
||||
@ -181,6 +181,8 @@ elseif ($action == 'confirm_delete_line' && $confirm == 'yes' && $user->rights->
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$object->error.'</div>';
|
||||
/* Fix bug 1485 : Reset action to avoid asking again confirmation on failure */
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
|
||||
@ -1508,7 +1510,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';
|
||||
|
||||
@ -681,7 +681,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';
|
||||
|
||||
@ -249,8 +249,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++;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user