diff --git a/ChangeLog b/ChangeLog index e516382f62f..f61d3a4820d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -284,6 +284,68 @@ Following changes may create regressions for some external modules, but were nec where {TYPE} is contact type code (BILLING, SHIPPING, CUSTOMER, ... see contact type dictionnary). + +***** ChangeLog for 7.0.4 compared to 7.0.3 ***** +FIX: #8984 button create expense report +FIX: #9032 +FIX: #9161 +FIX: #9328 +FIX: According to french law, if seller is in France and buyer isn't in UE and isn't a company, TVA used = TVA product +FIX: Add calls to fetchComments function +FIX: better compatibility with multicompany +FIX: case when we valid form with keyboard +FIX: character making error on bill list +FIX: check !empty exclude select element +FIX: combo into popup become crazy with IE10 +FIX: combo of stock in popup are crazy in IE +FIX: Deletion of files in migration +FIX: exclude element of the select +FIX: extrafieldkey +FIX: Fetch function will fetch comments +FIX: Fetch task will now fetch comments +FIX: filter supplier invoice list by societe name. +FIX: $fk_account is always empty, must be $soc->fk_account +FIX: Force stripe api version to avoid trouble if we update stripe api +FIX: getEntity project and not projet +FIX: Get templates in a forced language +FIX: global $mysoc missing (to avoid php notice on lines 279, 280 & 281) +FIX: Injection +FIX: invoice stats: situation invoices were not counted +FIX: keep context filter on contact list on change column displayed +FIX: Keep same project when creating shipping from order +FIX: langs fr +FIX: Lose filter on payment type or category after a sort on invoice list +FIX: Missing behavior +FIX: missing hook to edit sql +FIX: multicompany compatibility ! +FIX: need to filter on current entity on replenish +FIX: Option MAIN_DISABLE_NOTES_TAB #9611 +FIX: page must always be 0 when we search (to avoid case : when we're on page 3 and we're looking for a precise thirdparty, we stay on page 3 and nothing's displaied) +FIX: Pagination on related item pages +FIX: Pagination on withdraw request list +FIX: PDF address: handle when contact thirdparty different from document thirdparty +FIX: PHP warning, undefined index notnull +FIX: Product marge tabs on product card +FIX: Product margin tab and credit note +FIX: propal: correctly preset project when creating with origin/originid +FIX: remain to pay for credit note was wrong on invoice list +FIX: remove debug +FIX: Remove fetchComments from project and task fetch function +FIX: remove rowid for multicompany compatibility +FIX: Search on Ref project on order list +FIX: search on ref project on propal list +FIX: showOptionals: column mismatches +FIX: SQL Injections reported by mu shcor (ADLab of Venustech) +FIX: stock replenish with multientity +FIX: table llx_chargessociales doesn't exists +FIX: we must see number of all shared projects +FIX: when stock is empty for current entity but > 0 in other entity, until this commit product wasn't displaied on replenishment, it must depends on multientity stock sharing +FIX: when we're just admin and not super admin, if we create new user with transverse mode, we don't see it then we can't add him in usergroup +FIX: wrong function name +FIX: Wrong position of firstname lastname +FIX: wrong value for module part and return access denied +FIX: Wrong variable and trigger name + ***** ChangeLog for 7.0.3 compared to 7.0.2 ***** FIX: 7.0 task contact card without withproject parameters FIX: #8722 @@ -766,6 +828,32 @@ Following changes may create regressions for some external modules, but were nec multicompany module to a version that support Dolibarr v7, everything should work as expected. +***** ChangeLog for 6.0.8 compared to 6.0.7 ***** +FIX: #8762 +FIX: #9032 +FIX: case when we valid form with keyboard +FIX: clause must not be there +FIX: dol_delete_file must work in a context without db handler loaded +FIX: entity test must be on product_fourn_price table and not product table +FIX: Fetch shipping will now fetch project id +FIX: $fk_account is always empty, must be $soc->fk_account +FIX: getEntity project and not projet +FIX: If we enable 3 steps for supplier order approbation, we must not delete all fourn rights def. +FIX: Keep supplier proposal price for supplier order +FIX: langs fr +FIX: missing filters during reordering +FIX: need to filter on aa.entity for same accounting accounts available in several entities +FIX: page must always be 0 when we search (to avoid case : when we're on page 3 and we're looking for a precise thirdparty, we stay on page 3 and nothing's displaied) +FIX: PDF address: handle when contact thirdparty different from document thirdparty +FIX: propal: correctly preset project when creating with origin/originid +FIX: pu_ht_devise was not converted to numeric so decimals were lost when calculating total_ht_devise +FIX: remain to pay for credit note was wrong on invoice list +FIX: shipment: fk_proje(c)t not handled in fetch() and update() methods +FIX: showOptionals: column mismatches +FIX: sometimes amounts are identical but php find them different. +FIX: test is_erasable() must be done before call function delete() too to avoid delete invoice with &action=delete in url +FIX: we must see number of all shared projects +FIX: wrong var name ***** ChangeLog for 6.0.7 compared to 6.0.6 ***** FIX: #8023 diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index fe797cc3e06..161e3346b9c 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -141,6 +141,11 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x', $filter = array(); } + +/* + * View + */ + if ($action == 'export_csv') { $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; @@ -167,11 +172,6 @@ if ($action == 'export_csv') } - -/* - * View - */ - $title_page = $langs->trans("AccountBalance"); llxHeader('', $title_page); diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index da6989b41fd..ab169afc096 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -319,10 +319,11 @@ if (empty($reshook)) if ($i) $sql.=","; $sql.= $field."="; -// print $keycode.' - '.$_POST[$keycode].'
'; - if ($_POST[$keycode] == '' || ($keycode != 'langcode' && $keycode != 'private' && empty($_POST[$keycode]))) $sql.="null"; // lang must be '' if not defined so the unique key that include lang will work - elseif ($_POST[$keycode] == '0' && $keycode == 'langcode') $sql.="''"; // lang must be '' if not defined so the unique key that include lang will work - elseif ($keycode == 'private') $sql.=((int) $_POST[$keycode]); // private must be 0 or 1 + //print $keycode.' - '.$_POST[$keycode].'
'; + if ($_POST[$keycode] == '' || ($keycode != 'langcode' && $keycode != 'position' && $keycode != 'private' && empty($_POST[$keycode]))) $sql.="null"; // lang must be '' if not defined so the unique key that include lang will work + elseif ($_POST[$keycode] == '0' && $keycode == 'langcode') $sql.="''"; // lang must be '' if not defined so the unique key that include lang will work + elseif ($keycode == 'private') $sql.=((int) $_POST[$keycode]); // private must be 0 or 1 + elseif ($keycode == 'position') $sql.=((int) $_POST[$keycode]); else $sql.="'".$db->escape($_POST[$keycode])."'"; $i++; } diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 3233dff3a4b..1e6df0b014f 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -975,6 +975,7 @@ if (empty($reshook)) // Add custom code and origin country into description if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) { + $tmptxt = '('; // Define output language if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { $outputlangs = $langs; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index dd3fd890ccc..65e7aa31d33 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1536,6 +1536,7 @@ if (empty($reshook)) { $line->origin = $object->origin; $line->origin_id = $line->id; + $line->fk_prev_id = $line->id; $line->fetch_optionals($line->id); $line->situation_percent = $line->get_prev_progress($object->id); // get good progress including credit note @@ -3299,8 +3300,7 @@ if ($action == 'create') print '' . $langs->trans($newclassname) . '' . $objectsrc->getNomUrl(1); // We check if Origin document (id and type is known) has already at least one invoice attached to it $objectsrc->fetchObjectLinked($originid,$origin,'','facture'); - $cntinvoice=count($objectsrc->linkedObjects['facture']); - if ($cntinvoice>=1) + if (is_array($objectsrc->linkedObjects['facture']) && count($objectsrc->linkedObjects['facture']) >= 1) { setEventMessages('WarningBillExist', null, 'warnings'); echo ' ('.$langs->trans('LatestRelatedBill').end($objectsrc->linkedObjects['facture'])->getNomUrl(1).')'; diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 7ff5c9100f8..344b8050b65 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -396,6 +396,7 @@ class Notify { $outputlangs = new Translate('', $conf); $outputlangs->setDefaultLang($obj->default_lang); + $outputlangs->loadLangs(array("main","other")); } $subject = '['.$mysoc->name.'] '.$outputlangs->transnoentitiesnoconv("DolibarrNotification").($projtitle?' '.$projtitle:''); @@ -405,72 +406,72 @@ class Notify $link='/compta/facture/card.php?facid='.$object->id; $dir_output = $conf->facture->dir_output; $object_type = 'facture'; - $mesg = $langs->transnoentitiesnoconv("EMailTextInvoiceValidated",$newref); + $mesg = $outputlangs->transnoentitiesnoconv("EMailTextInvoiceValidated",$newref); break; case 'BILL_PAYED': $link='/compta/facture/card.php?facid='.$object->id; $dir_output = $conf->facture->dir_output; $object_type = 'facture'; - $mesg = $langs->transnoentitiesnoconv("EMailTextInvoicePayed",$newref); + $mesg = $outputlangs->transnoentitiesnoconv("EMailTextInvoicePayed",$newref); break; case 'ORDER_VALIDATE': $link='/commande/card.php?id='.$object->id; $dir_output = $conf->commande->dir_output; $object_type = 'order'; - $mesg = $langs->transnoentitiesnoconv("EMailTextOrderValidated",$newref); + $mesg = $outputlangs->transnoentitiesnoconv("EMailTextOrderValidated",$newref); break; case 'PROPAL_VALIDATE': $link='/comm/propal/card.php?id='.$object->id; $dir_output = $conf->propal->multidir_output[$object->entity]; $object_type = 'propal'; - $mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated",$newref); + $mesg = $outputlangs->transnoentitiesnoconv("EMailTextProposalValidated",$newref); break; case 'PROPAL_CLOSE_SIGNED': $link='/comm/propal/card.php?id='.$object->id; $dir_output = $conf->propal->multidir_output[$object->entity]; $object_type = 'propal'; - $mesg = $langs->transnoentitiesnoconv("EMailTextProposalClosedSigned",$newref); + $mesg = $outputlangs->transnoentitiesnoconv("EMailTextProposalClosedSigned",$newref); break; case 'FICHINTER_ADD_CONTACT': $link='/fichinter/card.php?id='.$object->id; $dir_output = $conf->ficheinter->dir_output; $object_type = 'ficheinter'; - $mesg = $langs->transnoentitiesnoconv("EMailTextInterventionAddedContact",$object->ref); + $mesg = $outputlangs->transnoentitiesnoconv("EMailTextInterventionAddedContact",$newref); break; case 'FICHINTER_VALIDATE': $link='/fichinter/card.php?id='.$object->id; $dir_output = $conf->ficheinter->dir_output; $object_type = 'ficheinter'; - $mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated",$object->ref); + $mesg = $outputlangs->transnoentitiesnoconv("EMailTextInterventionValidated",$newref); break; case 'ORDER_SUPPLIER_VALIDATE': $link='/fourn/commande/card.php?id='.$object->id; $dir_output = $conf->fournisseur->commande->dir_output; $object_type = 'order_supplier'; - $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n"; - $mesg.= $langs->transnoentitiesnoconv("EMailTextOrderValidatedBy",$object->ref,$user->getFullName($langs)); - $mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n"; + $mesg = $outputlangs->transnoentitiesnoconv("Hello").",\n\n"; + $mesg.= $outputlangs->transnoentitiesnoconv("EMailTextOrderValidatedBy",$newref,$user->getFullName($langs)); + $mesg.= "\n\n".$outputlangs->transnoentitiesnoconv("Sincerely").".\n\n"; break; case 'ORDER_SUPPLIER_APPROVE': $link='/fourn/commande/card.php?id='.$object->id; $dir_output = $conf->fournisseur->commande->dir_output; $object_type = 'order_supplier'; - $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n"; - $mesg.= $langs->transnoentitiesnoconv("EMailTextOrderApprovedBy",$newref,$user->getFullName($langs)); - $mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n"; + $mesg = $outputlangs->transnoentitiesnoconv("Hello").",\n\n"; + $mesg.= $outputlangs->transnoentitiesnoconv("EMailTextOrderApprovedBy",$newref,$user->getFullName($langs)); + $mesg.= "\n\n".$outputlangs->transnoentitiesnoconv("Sincerely").".\n\n"; break; case 'ORDER_SUPPLIER_REFUSE': $link='/fourn/commande/card.php?id='.$object->id; $dir_output = $conf->fournisseur->commande->dir_output; $object_type = 'order_supplier'; - $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n"; - $mesg.= $langs->transnoentitiesnoconv("EMailTextOrderRefusedBy",$newref,$user->getFullName($langs)); - $mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n"; + $mesg = $outputlangs->transnoentitiesnoconv("Hello").",\n\n"; + $mesg.= $outputlangs->transnoentitiesnoconv("EMailTextOrderRefusedBy",$newref,$user->getFullName($langs)); + $mesg.= "\n\n".$outputlangs->transnoentitiesnoconv("Sincerely").".\n\n"; break; case 'SHIPPING_VALIDATE': $dir_output = $conf->expedition->dir_output.'/sending/'; $object_type = 'order_supplier'; - $mesg = $langs->transnoentitiesnoconv("EMailTextExpeditionValidated",$newref); + $mesg = $outputlangs->transnoentitiesnoconv("EMailTextExpeditionValidated",$newref); break; } $ref = dol_sanitizeFileName($newref); @@ -679,6 +680,8 @@ class Notify $message.= $langs->transnoentities("YouReceiveMailBecauseOfNotification2",$application,$mysoc->name)."\n"; $message.= "\n"; $message.= $mesg; + //if ($link) $message.= "\n" . $urlwithroot . $link; // link already added around the ref into the text + $message = nl2br($message); // Replace keyword __SUPERVISOREMAIL__ diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 8f01ea6aebe..f75e53939a2 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -572,6 +572,8 @@ function dol_get_first_day_week($day,$month,$year,$gm=false) */ function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR', $lastday=0) { + global $conf; + $nbFerie = 0; // Check to ensure we use correct parameters @@ -587,6 +589,26 @@ function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR', $ $jour = date("d", $timestampStart); $mois = date("m", $timestampStart); $annee = date("Y", $timestampStart); + + + // Check into var $conf->global->HOLIDAY_MORE_DAYS MM-DD,YYYY-MM-DD, ... + if (! empty($conf->global->HOLIDAY_MORE_PUBLIC_HOLIDAYS)) + { + $arrayofdaystring=explode(',',$conf->global->HOLIDAY_MORE_PUBLIC_HOLIDAYS); + foreach($arrayofdaystring as $daystring) + { + $tmp=explode('-',$daystring); + if ($tmp[2]) + { + if ($tmp[0] == $annee && $tmp[1] == $mois && $tmp[2] == $jour) $ferie=true; + } + else + { + if ($tmp[0] == $mois && $tmp[1] == $jour) $ferie=true; + } + } + } + if ($countrycode == 'FR') { $countryfound=1; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 5aff804b4da..7897041ebbf 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2496,7 +2496,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, //$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; } // Wrapping pour les propales - else if ($modulepart == 'propal' && !empty($conf->propal->multidir_output[$entity])) + else if (($modulepart == 'propal' || $modulepart == 'propale') && !empty($conf->propal->multidir_output[$entity])) { if ($fuser->rights->propale->{$lire} || preg_match('/^specimen/i',$original_file)) { diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index e112c0a279c..5b8a5d6d4c4 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1395,7 +1395,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl if ($detail->eatby) $dte[]=$outputlangs->transnoentitiesnoconv('printEatby',dol_print_date($detail->eatby, $format, false, $outputlangs)); if ($detail->sellby) $dte[]=$outputlangs->transnoentitiesnoconv('printSellby',dol_print_date($detail->sellby, $format, false, $outputlangs)); if ($detail->batch) $dte[]=$outputlangs->transnoentitiesnoconv('printBatch',$detail->batch); - $dte[]=$outputlangs->transnoentitiesnoconv('printQty',$detail->dluo_qty); + $dte[]=$outputlangs->transnoentitiesnoconv('printQty',$detail->qty); $libelleproduitservice.= "__N__ ".implode(" - ", $dte); } } diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index c01026b445d..38660cc272a 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -364,7 +364,7 @@ function show_list_sending_receive($origin,$origin_id,$filter='') $detail.= $langs->trans("Batch").': '.$dbatch->batch; $detail.= ' - '.$langs->trans("SellByDate").': '.dol_print_date($dbatch->sellby,"day"); $detail.= ' - '.$langs->trans("EatByDate").': '.dol_print_date($dbatch->eatby,"day"); - $detail.= ' - '.$langs->trans("Qty").': '.$dbatch->dluo_qty; + $detail.= ' - '.$langs->trans("Qty").': '.$dbatch->qty; $detail.= '
'; } print $form->textwithtooltip(img_picto('', 'object_barcode').' '.$langs->trans("DetailBatchNumber"),$detail); diff --git a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php index b506bda0793..6b6d22cf822 100644 --- a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php +++ b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php @@ -23,7 +23,7 @@ if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_ if ($align) print ' align="'.$align.'"'; print '>'; $tmpkey='options_'.$key; - if (in_array($extrafields->attributes[$extrafieldsobjectkey]['type'][$key], array('date', 'datetime', 'timestamp'))) + if (in_array($extrafields->attributes[$extrafieldsobjectkey]['type'][$key], array('date', 'datetime', 'timestamp')) && !is_numeric($obj->$tmpkey)) { $datenotinstring = $obj->$tmpkey; if (! is_numeric($obj->$tmpkey)) // For backward compatibility diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index cd58eae7a8c..69deecdf4c0 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -650,7 +650,7 @@ if (empty($reshook)) $qty = "qtyl".$detail_batch->fk_expeditiondet.'_'.$detail_batch->id; $batch_id = GETPOST($batch,'int'); $batch_qty = GETPOST($qty, 'int'); - if (! empty($batch_id) && ($batch_id != $detail_batch->fk_origin_stock || $batch_qty != $detail_batch->dluo_qty)) + if (! empty($batch_id) && ($batch_id != $detail_batch->fk_origin_stock || $batch_qty != $detail_batch->qty)) { if ($lotStock->fetch($batch_id) > 0 && $line->fetch($detail_batch->fk_expeditiondet) > 0) // $line is ExpeditionLine { @@ -667,7 +667,7 @@ if (empty($reshook)) $line->detail_batch->batch = $lotStock->batch; $line->detail_batch->id = $detail_batch->id; $line->detail_batch->entrepot_id = $lotStock->warehouseid; - $line->detail_batch->dluo_qty = $batch_qty; + $line->detail_batch->qty = $batch_qty; if ($line->update($user) < 0) { setEventMessages($line->error, $line->errors, 'errors'); $error++; @@ -721,7 +721,7 @@ if (empty($reshook)) $line->detail_batch->fk_origin_stock = $batch_id; $line->detail_batch->batch = $lotStock->batch; $line->detail_batch->entrepot_id = $lotStock->warehouseid; - $line->detail_batch->dluo_qty = $batch_qty; + $line->detail_batch->qty = $batch_qty; if ($line->update($user) < 0) { setEventMessages($line->error, $line->errors, 'errors'); $error++; @@ -742,7 +742,7 @@ if (empty($reshook)) $line->detail_batch[0]->fk_origin_stock = $batch_id; $line->detail_batch[0]->batch = $lotStock->batch; $line->detail_batch[0]->entrepot_id = $lotStock->warehouseid; - $line->detail_batch[0]->dluo_qty = $batch_qty; + $line->detail_batch[0]->qty = $batch_qty; if ($object->create_line_batch($line, $line->array_options) < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -1307,6 +1307,7 @@ if ($action == 'create') { // Product need lot print ''; // end line and start a new one for lot/serial + print ''; $staticwarehouse=new Entrepot($db); if ($warehouse_id > 0) $staticwarehouse->fetch($warehouse_id); @@ -1324,7 +1325,7 @@ if ($action == 'create') print ''; if (is_object($product->stock_warehouse[$warehouse_id]) && count($product->stock_warehouse[$warehouse_id]->detail_batch)) { - foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch) + foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch) // $dbatch is instance of Productbatch { //var_dump($dbatch); $batchStock = + $dbatch->qty; // To get a numeric @@ -1345,7 +1346,7 @@ if ($action == 'create') $detail.= $langs->trans("Batch").': '.$dbatch->batch; $detail.= ' - '.$langs->trans("SellByDate").': '.dol_print_date($dbatch->sellby,"day"); $detail.= ' - '.$langs->trans("EatByDate").': '.dol_print_date($dbatch->eatby,"day"); - $detail.= ' - '.$langs->trans("Qty").': '.$dbatch->dluo_qty; + $detail.= ' - '.$langs->trans("Qty").': '.$dbatch->qty; $detail.= '
'; print $detail; @@ -2242,7 +2243,7 @@ else if ($id || $ref) { print ''; // Qty to ship or shipped - print '' . '' . ''; + print '' . '' . ''; // Batch number managment if ($lines[$i]->entrepot_id == 0) { @@ -2354,12 +2355,12 @@ else if ($id || $ref) if ($lines[$i]->product_tobatch) { $detail = ''; - foreach ($lines[$i]->detail_batch as $dbatch) + foreach ($lines[$i]->detail_batch as $dbatch) // $dbatch is instance of ExpeditionLineBatch { $detail.= $langs->trans("Batch").': '.$dbatch->batch; $detail.= ' - '.$langs->trans("SellByDate").': '.dol_print_date($dbatch->sellby,"day"); $detail.= ' - '.$langs->trans("EatByDate").': '.dol_print_date($dbatch->eatby,"day"); - $detail.= ' - '.$langs->trans("Qty").': '.$dbatch->dluo_qty; + $detail.= ' - '.$langs->trans("Qty").': '.$dbatch->qty; $detail.= '
'; } print $form->textwithtooltip(img_picto('', 'object_barcode').' '.$langs->trans("DetailBatchNumber"),$detail); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 7b764e32093..6b7ee83a906 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -458,7 +458,7 @@ class Expedition extends CommonObject { if ($detbatch->entrepot_id) { - $stockLocationQty[$detbatch->entrepot_id] += $detbatch->dluo_qty; + $stockLocationQty[$detbatch->entrepot_id] += $detbatch->qty; } } // create shipment lines @@ -981,7 +981,7 @@ class Expedition extends CommonObject $this->error=$linebatch->error; return -1; } - $linebatch->dluo_qty=$value['q']; + $linebatch->qty=$value['q']; $tab[]=$linebatch; if ($conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT) @@ -990,7 +990,7 @@ class Expedition extends CommonObject $prod_batch = new Productbatch($this->db); $prod_batch->fetch($value['id_batch']); - if ($prod_batch->qty < $linebatch->dluo_qty) + if ($prod_batch->qty < $linebatch->qty) { $langs->load("errors"); $this->errors[]=$langs->trans('ErrorStockIsNotEnoughToAddProductOnShipment', $prod_batch->fk_product); @@ -1214,7 +1214,7 @@ class Expedition extends CommonObject // We use warehouse selected for each line foreach($lotArray as $lot) { - $result=$mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $lot->dluo_qty, 0, $langs->trans("ShipmentDeletedInDolibarr", $this->ref), $lot->eatby, $lot->sellby, $lot->batch); // Price is set to 0, because we don't want to see WAP changed + $result=$mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $lot->qty, 0, $langs->trans("ShipmentDeletedInDolibarr", $this->ref), $lot->eatby, $lot->sellby, $lot->batch); // Price is set to 0, because we don't want to see WAP changed if ($result < 0) { $error++;$this->errors=$this->errors + $mouvS->errors; @@ -2648,7 +2648,7 @@ class ExpeditionLigne extends CommonObjectLine $this->errors[]='ErrorBadParameters'; $error++; } - $qty = price2num($this->detail_batch[0]->dluo_qty); + $qty = price2num($this->detail_batch[0]->qty); } } else if (! empty($this->detail_batch)) @@ -2662,7 +2662,7 @@ class ExpeditionLigne extends CommonObjectLine $this->errors[]='ErrorBadParameters'; $error++; } - $qty = price2num($this->detail_batch->dluo_qty); + $qty = price2num($this->detail_batch->qty); } // check parameters @@ -2700,7 +2700,7 @@ class ExpeditionLigne extends CommonObjectLine { if ($expedition_batch_id != $lot->id) { - $remainingQty += $lot->dluo_qty; + $remainingQty += $lot->qty; } } $qty += $remainingQty; @@ -2728,7 +2728,7 @@ class ExpeditionLigne extends CommonObjectLine $error++; } } - if (! $error && $this->detail_batch->dluo_qty > 0) + if (! $error && $this->detail_batch->qty > 0) { // create lot expedition line if (isset($lot->id)) @@ -2738,7 +2738,7 @@ class ExpeditionLigne extends CommonObjectLine $shipmentLot->eatby = $lot->eatby; $shipmentLot->sellby = $lot->sellby; $shipmentLot->entrepot_id = $this->detail_batch->entrepot_id; - $shipmentLot->dluo_qty = $this->detail_batch->dluo_qty; + $shipmentLot->qty = $this->detail_batch->qty; $shipmentLot->fk_origin_stock = $batch_id; if ($shipmentLot->create($this->id) < 0) { diff --git a/htdocs/expedition/class/expeditionbatch.class.php b/htdocs/expedition/class/expeditionbatch.class.php index 611a9a750df..942625cac5e 100644 --- a/htdocs/expedition/class/expeditionbatch.class.php +++ b/htdocs/expedition/class/expeditionbatch.class.php @@ -38,7 +38,7 @@ class ExpeditionLineBatch extends CommonObject var $sellby; var $eatby; var $batch; - var $dluo_qty; + var $qty; var $entrepot_id; var $fk_origin_stock; var $fk_expeditiondet; @@ -61,41 +61,41 @@ class ExpeditionLineBatch extends CommonObject */ function fetchFromStock($id_stockdluo) { - $sql = "SELECT"; - $sql.= " pb.batch,"; - $sql.= " pl.sellby,"; - $sql.= " pl.eatby,"; - $sql.= " ps.fk_entrepot"; + $sql = "SELECT"; + $sql.= " pb.batch,"; + $sql.= " pl.sellby,"; + $sql.= " pl.eatby,"; + $sql.= " ps.fk_entrepot"; - $sql.= " FROM ".MAIN_DB_PREFIX."product_batch as pb"; - $sql.= " JOIN ".MAIN_DB_PREFIX."product_stock as ps on pb.fk_product_stock=ps.rowid"; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."product_lot as pl on pl.batch = pb.batch AND pl.fk_product = ps.fk_product"; - $sql.= " WHERE pb.rowid = ".(int) $id_stockdluo; + $sql.= " FROM ".MAIN_DB_PREFIX."product_batch as pb"; + $sql.= " JOIN ".MAIN_DB_PREFIX."product_stock as ps on pb.fk_product_stock=ps.rowid"; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."product_lot as pl on pl.batch = pb.batch AND pl.fk_product = ps.fk_product"; + $sql.= " WHERE pb.rowid = ".(int) $id_stockdluo; - dol_syslog(get_class($this)."::fetch", LOG_DEBUG); - $resql=$this->db->query($sql); - if ($resql) - { - if ($this->db->num_rows($resql)) - { - $obj = $this->db->fetch_object($resql); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); + $resql=$this->db->query($sql); + if ($resql) + { + if ($this->db->num_rows($resql)) + { + $obj = $this->db->fetch_object($resql); $this->sellby = $this->db->jdate($obj->sellby); $this->eatby = $this->db->jdate($obj->eatby); $this->batch = $obj->batch; $this->entrepot_id= $obj->fk_entrepot; $this->fk_origin_stock=(int) $id_stockdluo; - } - $this->db->free($resql); + } + $this->db->free($resql); - return 1; - } - else - { - $this->error="Error ".$this->db->lasterror(); - return -1; - } - } + return 1; + } + else + { + $this->error="Error ".$this->db->lasterror(); + return -1; + } + } /** * Create an expeditiondet_batch DB record link to an expedtiondet record @@ -121,7 +121,7 @@ class ExpeditionLineBatch extends CommonObject $sql.= " ".(! isset($this->sellby) || dol_strlen($this->sellby)==0?'NULL':("'".$this->db->idate($this->sellby))."'").","; $sql.= " ".(! isset($this->eatby) || dol_strlen($this->eatby)==0?'NULL':("'".$this->db->idate($this->eatby))."'").","; $sql.= " ".(! isset($this->batch)?'NULL':("'".$this->db->escape($this->batch)."'")).","; - $sql.= " ".(! isset($this->dluo_qty)?'NULL':$this->dluo_qty).","; + $sql.= " ".(! isset($this->qty)?'NULL':$this->qty).","; $sql.= " ".(! isset($this->fk_origin_stock)?'NULL':$this->fk_origin_stock); $sql.= ")"; @@ -221,7 +221,7 @@ class ExpeditionLineBatch extends CommonObject $tmp->id = $obj->rowid; $tmp->fk_origin_stock = $obj->fk_origin_stock; $tmp->fk_expeditiondet = $obj->fk_expeditiondet; - $tmp->dluo_qty = $obj->qty; + $tmp->qty = $obj->qty; $ret[]=$tmp; $i++; diff --git a/htdocs/expensereport/payment/card.php b/htdocs/expensereport/payment/card.php index 2c053d5cc35..88272072ada 100644 --- a/htdocs/expensereport/payment/card.php +++ b/htdocs/expensereport/payment/card.php @@ -42,6 +42,13 @@ if ($user->societe_id) $socid=$user->societe_id; $object = new PaymentExpenseReport($db); +if ($id > 0) +{ + $result=$object->fetch($id); + if (! $result) dol_print_error($db,'Failed to get payment id '.$id); +} + + /* * Actions */ @@ -77,10 +84,10 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->expensere $db->commit(); $factures=array(); // TODO Get all id of invoices linked to this payment - foreach($factures as $id) + foreach($factures as $invoiceid) { $fac = new Facture($db); - $fac->fetch($id); + $fac->fetch($invoiceid); $outputlangs = $langs; if (! empty($_REQUEST['lang_id'])) @@ -110,12 +117,6 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->expensere llxHeader('', $langs->trans("ExpenseReportPayment")); -if ($id > 0) -{ - $result=$object->fetch($id); - if (! $result) dol_print_error($db,'Failed to get payment id '.$id); -} - $form = new Form($db); $head = payment_expensereport_prepare_head($object); @@ -265,9 +266,11 @@ if ($resql) print ''.$expensereport->getLibStatut(4,$objp->amount).''; print "\n"; + if ($objp->paid == 1) // If at least one invoice is paid, disable delete { - $disable_delete = 1; + $disable_delete = 2; + $title_button = $langs->trans("CantRemovePaymentWithOneInvoicePaid"); } $total = $total + $objp->amount; $i++; @@ -303,7 +306,7 @@ if ($action == '') } else { - print ''.$langs->trans('Delete').''; + print ''.$langs->trans('Delete').''; } } } diff --git a/htdocs/langs/es_ES/other.lang b/htdocs/langs/es_ES/other.lang index 137bbac42d6..acdc769a7c5 100644 --- a/htdocs/langs/es_ES/other.lang +++ b/htdocs/langs/es_ES/other.lang @@ -188,6 +188,7 @@ NumberOfUnitsSupplierInvoices=Número de unidades en las facturas de proveedores EMailTextInterventionAddedContact=Se le ha asignado la intervención %s EMailTextInterventionValidated=Ficha intervención %s validada EMailTextInvoiceValidated=Factura %s validada +EMailTextInvoicePayed=La factura %s ha sido pagada. EMailTextProposalValidated=El presupuesto %s que le concierne ha sido validado. EMailTextProposalClosedSigned=El presupuesto %s ha sido cerrado y firmado. EMailTextOrderValidated=El pedido %s que le concierne ha sido validado. diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 182cb6b08ff..b533c369cbd 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -1586,7 +1586,7 @@ elseif (! empty($module)) print '
'; - print ' '.$langs->trans("PageForLib").' : '.($realpathtolib?'':'').$pathtolib.($realpathtodocument?'':'').''; + print ' '.$langs->trans("PageForLib").' : '.($realpathtolib?'':'').$pathtolib.($realpathtolib?'':'').''; print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
'; print ' '.$langs->trans("Image").' : '.($realpathtopicto?'':'').$pathtopicto.($realpathtopicto?'':'').''; diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index 14c2a00d477..656fc6e2ebe 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -345,7 +345,7 @@ if ($resql) // Real stock print ''; if ($objp->seuil_stock_alerte != '' && ($objp->stock_physique < $objp->seuil_stock_alerte)) print img_warning($langs->trans("StockTooLow")).' '; - print $objp->stock_physique; + print $objp->stock_physique|0; print ''; // Details per warehouse diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php index 334ab91ebc4..08f28a7eb11 100644 --- a/htdocs/product/stock/productlot_card.php +++ b/htdocs/product/stock/productlot_card.php @@ -390,6 +390,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
'; print ''.$langs->trans("ShowLogOfMovementIfLot").'
'; + print '
'; } diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index e0234fcd1f9..47cdc8bb31e 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -413,7 +413,7 @@ if ($action == 'charge' && ! empty($conf->stripe->enabled)) $dol_type=(GETPOST('s', 'alpha') ? GETPOST('s', 'alpha') : GETPOST('source', 'alpha')); $dol_id=GETPOST('dol_id', 'int'); $vatnumber = GETPOST('vatnumber','alpha'); - $savesource=GETPOSTISSET('savesource')?GETPOST('savesource', 'int'):1; + $savesource=GETPOSTISSET('savesource')?GETPOST('savesource', 'int'):1; dol_syslog("POST stripeToken = ".$stripeToken, LOG_DEBUG, 0, '_stripe'); dol_syslog("POST email = ".$email, LOG_DEBUG, 0, '_stripe'); diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index dbc51c93816..1623aca4f30 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -104,7 +104,7 @@ class Societe extends CommonObject * Thirdparty name * @var string * @deprecated Use $name instead - * @see name + * @see $name */ public $nom; @@ -154,21 +154,21 @@ class Societe extends CommonObject * State code * @var string * @deprecated Use state_code instead - * @see state_code + * @see $state_code */ public $departement_code; /** * @var string * @deprecated Use state instead - * @see state + * @see $state */ public $departement; /** * @var string * @deprecated Use country instead - * @see country + * @see $country */ public $pays; @@ -359,7 +359,7 @@ class Societe extends CommonObject /** * @var string * @deprecated Note is split in public and private notes - * @see note_public, note_private + * @see $note_public, $note_private */ public $note; @@ -1956,24 +1956,33 @@ class Societe extends CommonObject if (! empty($conf->global->SOCIETE_ADD_REF_IN_LIST) && (!empty($withpicto))) { + $code = ''; if (($this->client) && (! empty ( $this->code_client )) && ($conf->global->SOCIETE_ADD_REF_IN_LIST == 1 || $conf->global->SOCIETE_ADD_REF_IN_LIST == 2 ) ) - $code = $this->code_client . ' - '; + { + $code = $this->code_client . ' - '; + } if (($this->fournisseur) && (! empty ( $this->code_fournisseur )) && ($conf->global->SOCIETE_ADD_REF_IN_LIST == 1 || $conf->global->SOCIETE_ADD_REF_IN_LIST == 3 ) ) - $code .= $this->code_fournisseur . ' - '; + { + $code .= $this->code_fournisseur . ' - '; + } if ($conf->global->SOCIETE_ADD_REF_IN_LIST == 1) + { $name =$code.' '.$name; + } else + { $name =$code; + } } if (!empty($this->name_alias)) $name .= ' ('.$this->name_alias.')'; diff --git a/test/phpunit/DateLibTest.php b/test/phpunit/DateLibTest.php index 30a8c8d1a1a..d7f2ad18877 100644 --- a/test/phpunit/DateLibTest.php +++ b/test/phpunit/DateLibTest.php @@ -205,6 +205,26 @@ class DateLibTest extends PHPUnit_Framework_TestCase $result=num_public_holiday($date1,$date2,'XX',1); print __METHOD__." result=".$result."\n"; $this->assertEquals(2,$result,'NumPublicHoliday for XX'); // 1 opened day, 2 closed days (even if country unknown) + + $conf->global->HOLIDAY_MORE_PUBLIC_HOLIDAYS='12-13,2019-12-14'; + + $date1=dol_mktime(0, 0, 0, 12, 13, 2018); + $date2=dol_mktime(0, 0, 0, 12, 13, 2018); + $result=num_public_holiday($date1,$date2,'YY',1); + print __METHOD__." result=".$result."\n"; + $this->assertEquals(1,$result,'NumPublicHoliday for YY the 2018-12-13'); // 0 opened day, 1 closed days (even if country unknown) + + $date1=dol_mktime(0, 0, 0, 12, 14, 2018); + $date2=dol_mktime(0, 0, 0, 12, 14, 2018); + $result=num_public_holiday($date1,$date2,'YY',1); + print __METHOD__." result=".$result."\n"; + $this->assertEquals(0,$result,'NumPublicHoliday for YY the 2018-12-14'); // 1 opened day, 0 closed days (even if country unknown) + + $date1=dol_mktime(0, 0, 0, 12, 14, 2019); + $date2=dol_mktime(0, 0, 0, 12, 14, 2019); + $result=num_public_holiday($date1,$date2,'YY',1); + print __METHOD__." result=".$result."\n"; + $this->assertEquals(1,$result,'NumPublicHoliday for YY the 2019-12-14'); // 0 opened day, 1 closed days (even if country unknown) } /**