Merge branch '14.0' of github.com:Dolibarr/dolibarr into FIX_commandeFourn_Stats

This commit is contained in:
Adrien Raze 2021-11-29 15:50:53 +01:00
commit 6a3a56d2a2
30 changed files with 160 additions and 118 deletions

1
.gitignore vendored
View File

@ -55,3 +55,4 @@ yarn.lock
package-lock.json
doc/install.lock
/factory/

View File

@ -473,7 +473,8 @@ Following changes may create regressions for some external modules, but were nec
* Removed deprecated substitution key __REFCLIENT__ (replaced with __REF_CLIENT__)
* Removed constant MAIN_COUNTRIES_IN_EEC. You can now set if country is in Europe or not from the dictionary of countries.
* v14 seems to work correctly on PHP v8 but it generates a lot of verbose warnings. Currently, v14 i snot yet officialy supported with PHP 8.
* To execute shell or command line command, your code must never use method like exec, shell_exec, popen, .. but must use the built-in
method executeCLI() available into core/class/utils.class.php
***** ChangeLog for 13.0.5 compared to 13.0.4 *****

View File

@ -284,7 +284,8 @@ class Dolistore
$download_link .= '<br><br><a target="_blank" href="'.urlencode($this->shop_url.$product->id).'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>';
}
//checking versions
// Set and check version
$version = '';
if ($this->version_compare($product->dolibarr_min, DOL_VERSION) <= 0) {
if ($this->version_compare($product->dolibarr_max, DOL_VERSION) >= 0) {
//compatible
@ -319,14 +320,21 @@ class Dolistore
//.'<br><a class="inline-block valignmiddle" target="_blank" href="'.$this->shop_url.$product->id.'"><span class="details button">'.$langs->trans("SeeInMarkerPlace").'</span></a>
//output template
$html .= '<tr class="app oddeven '.dol_escape_htmltag($compatible).'">
<td class="center" width="210"><div class="newAppParent">'.dol_escape_htmltag($newapp.$images).'</div></td>
<td class="margeCote"><h2 class="appTitle">'.dol_escape_htmltag($product->name->language[$this->lang - 1])
.'<br><small>'.dol_escape_htmltag($version).'</small></h2>
<small> '.dol_print_date(dol_stringtotime($product->date_upd), 'dayhour').' - '.$langs->trans('Ref').': '.dol_escape_htmltag($product->reference).' - '.dol_escape_htmltag($langs->trans('Id')).': '.((int) $product->id).'</small><br><br>'.dol_escape_htmltag($product->description_short->language[$this->lang - 1]).'</td>';
$html .= '<tr class="app oddeven '.dol_escape_htmltag($compatible).'">';
$html .= '<td class="center" width="210"><div class="newAppParent">';
$html .= $newapp.$images; // No dol_escape_htmltag, it is already escape html
$html .= '</div></td>';
$html .= '<td class="margeCote"><h2 class="appTitle">';
$html .= dol_escape_htmltag($product->name->language[$this->lang - 1]);
$html .= '<br><small>';
$html .= $version; // No dol_escape_htmltag, it is already escape html
$html .= '</small></h2>';
$html .= '<small> '.dol_print_date(dol_stringtotime($product->date_upd), 'dayhour').' - '.$langs->trans('Ref').': '.dol_escape_htmltag($product->reference).' - '.dol_escape_htmltag($langs->trans('Id')).': '.((int) $product->id).'</small><br><br>'.dol_escape_htmltag($product->description_short->language[$this->lang - 1]).'</td>';
// do not load if display none
//$html .= '<td style="display:none;" class="long_description">'.$product->description->language[$this->lang - 1].'</td>';
$html .= '<td class="margeCote center">'.dol_escape_htmltag($price).'</td>';
$html .= '<td class="margeCote center">';
$html .= $price;
$html .= '</td>';
$html .= '<td class="margeCote">'.$download_link.'</td>';
$html .= '</tr>';
}

View File

@ -526,7 +526,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
$moreforfilter = '<div class="valignmiddle">';
$moreforfilter .= '<div class="floatright right pagination --module-list"><ul><li>';
$moreforfilter .= '<div class="floatright right pagination paddingtop --module-list"><ul><li>';
$moreforfilter .= dolGetButtonTitle($langs->trans('CheckForModuleUpdate'), $langs->trans('CheckForModuleUpdate').'<br>'.$langs->trans('CheckForModuleUpdateHelp'), 'fa fa-sync', $_SERVER["PHP_SELF"].'?action=checklastversion&token='.newToken().'&mode='.$mode.$param, '', 1, array('morecss'=>'reposition'));
$moreforfilter .= dolGetButtonTitleSeparator();
$moreforfilter .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=commonkanban'.$param, '', ($mode == 'commonkanban' ? 2 : 1), array('morecss'=>'reposition'));
@ -1051,7 +1051,9 @@ if ($mode == 'marketplace') {
<div id="category-tree-left">
<ul class="tree">
<?php echo dol_escape_htmltag($dolistore->get_categories()); ?>
<?php
echo $dolistore->get_categories(); // Do not use dol_escape_htmltag here, it is already a structured content
?>
</ul>
</div>
<div id="listing-content">

View File

@ -88,9 +88,9 @@ if (function_exists('exec')) {
}
print '<br>';
print "<strong>PHP session.use_strict_mode</strong> = ".(ini_get('session.use_strict_mode') ? ini_get('session.use_strict_mode') : yn(0)).' &nbsp; <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", '1').")</span><br>\n";
print "<strong>PHP session.use_only_cookies</strong> = ".(ini_get('session.use_only_cookies') ? ini_get('session.use_only_cookies') : yn(0)).' &nbsp; <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", '1').")</span><br>\n";
print "<strong>PHP session.cookie_httponly</strong> = ".(ini_get('session.cookie_httponly') ? ini_get('session.cookie_httponly') : '').' &nbsp; <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", '1').")</span><br>\n";
print "<strong>PHP session.use_strict_mode</strong> = ".(ini_get('session.use_strict_mode') ? '' : img_warning().' ').(ini_get('session.use_strict_mode') ? ini_get('session.use_strict_mode') : yn(0)).' &nbsp; <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", '1').")</span><br>\n";
print "<strong>PHP session.use_only_cookies</strong> = ".(ini_get('session.use_only_cookies') ? '' : img_warning().' ').(ini_get('session.use_only_cookies') ? ini_get('session.use_only_cookies') : yn(0)).' &nbsp; <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", '1').")</span><br>\n";
print "<strong>PHP session.cookie_httponly</strong> = ".(ini_get('session.cookie_httponly') ? '' : img_warning().' ').(ini_get('session.cookie_httponly') ? ini_get('session.cookie_httponly') : '').' &nbsp; <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", '1').")</span><br>\n";
print "<strong>PHP session.cookie_samesite</strong> = ".(ini_get('session.cookie_samesite') ? ini_get('session.cookie_samesite') : 'None');
if (!ini_get('session.cookie_samesite') || ini_get('session.cookie_samesite') == 'Lax') {
print ' &nbsp; <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", 'Lax').")</span>";

View File

@ -70,9 +70,14 @@ if ($labeluser && $labelgroup) {
if (function_exists('exec')) {
$arrayout = array(); $varout = 0;
exec('id', $arrayout, $varout);
print '<tr><td>'.$langs->trans("WebUserGroup")." (real, 'id' command)</td><td>";
if (empty($varout)) { // Test command is ok. Work only on Linux OS.
print '<tr><td>'.$langs->trans("WebUserGroup")." (real, 'id' command)</td><td>".join(',', $arrayout)."</td></tr>\n";
print join(',', $arrayout);
} else {
$langs->load("errors");
print '<span class="opacitymedium">'.$langs->trans("ErrorExecIdFailed").'</span>';
}
print "</td></tr>\n";
}
print '</table>';
print '</div>';

View File

@ -186,7 +186,7 @@ foreach ($fulltree as $key => $val) {
? $categstatic->getObjectsInCateg("account", 1) // Categorie::TYPE_ACCOUNT is "bank_account" instead of "account"
: $categstatic->getObjectsInCateg($type, 1);
$counter = "<td class='left' width='40px;'>".(is_countable($elements) ? count($elements) : '0')."</td>";
$counter = "<td class='left' width='40px;'>".(is_array($elements) ? count($elements) : '0')."</td>";
}
$color = $categstatic->color ? ' style="background: #'.sprintf("%06s", $categstatic->color).';"' : ' style="background: #bbb"';

View File

@ -378,7 +378,7 @@ if ($cats < 0) {
? $categstatic->getObjectsInCateg("account", 1) // Categorie::TYPE_ACCOUNT is "bank_account" instead of "account"
: $categstatic->getObjectsInCateg($type, 1);
$counter = "<td class='left' width='40px;'>".(is_countable($elements) ? count($elements) : '0')."</td>";
$counter = "<td class='left' width='40px;'>".(is_array($elements) ? count($elements) : '0')."</td>";
}
$color = $categstatic->color ? ' style="background: #'.sprintf("%06s", $categstatic->color).';"' : ' style="background: #bbb"';

View File

@ -1066,7 +1066,7 @@ if ($action == 'create') {
// Autogeneration
$title = $langs->trans("Recurrence");
print load_fiche_titre('<span class="fa fa-calendar"></span> '.$title, '', '');
print load_fiche_titre(img_picto('', 'recurring', 'class="pictofixedwidth"').$title, '', '');
print dol_get_fiche_head(null, '', '', 0);
@ -1457,7 +1457,7 @@ if ($action == 'create') {
print '<table class="border centpercent tableforfield">';
print '<tr><td colspan="2"><span class="fa fa-calendar"></span> '.$title.'</td></tr>';
print '<tr><td colspan="2">'.img_picto('', 'recurring', 'class="pictofixedwidth"').$title.'</td></tr>';
// if "frequency" is empty or = 0, the reccurence is disabled
print '<tr><td style="width: 50%">';

View File

@ -131,7 +131,7 @@ $arrayfields = array(
'f.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>1),
'f.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>0),
'f.fk_cond_reglement'=>array('label'=>"PaymentTerm", 'checked'=>0),
'recurring'=>array('label'=>"RecurringInvoiceTemplate", 'checked'=>1),
'recurring'=>array('label'=>"RecurringInvoice", 'checked'=>1),
'f.frequency'=>array('label'=>"Frequency", 'checked'=>1),
'f.unit_frequency'=>array('label'=>"FrequencyUnit", 'checked'=>1),
'f.nb_gen_done'=>array('label'=>"NbOfGenerationDoneShort", 'checked'=>1),
@ -329,7 +329,11 @@ if ($search_status != '' && $search_status >= -1) {
$sql .= dolSqlDateFilter('f.date_last_gen', $search_day, $search_month, $search_year);
$sql .= dolSqlDateFilter('f.date_when', $search_day_date_when, $search_month_date_when, $search_year_date_when);
$sql .= $db->order($sortfield, $sortorder);
$tmpsortfield = $sortfield;
if ($tmpsortfield == 'recurring') {
$tmpsortfield = 'f.frequency';
}
$sql .= $db->order($tmpsortfield, $sortorder);
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
@ -723,8 +727,9 @@ if ($resql) {
$totalarray['nbfield']++;
}
}
// Is it a recurring invoice
if (!empty($arrayfields['recurring']['checked'])) {
print '<td class="center">'.yn($objp->frequency ? 1 : 0).'</td>';
print '<td class="center">'.($objp->frequency ? img_picto($langs->trans("Frequency").': '.$objp->frequency.' '.$objp->unit_frequency, 'recurring', 'class="opacitymedium"').' ' : '').yn($objp->frequency ? 1 : 0).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}

View File

@ -76,7 +76,7 @@ $search_phone_mobile = GETPOST("search_phone_mobile", 'alpha');
$search_fax = GETPOST("search_fax", 'alpha');
$search_email = GETPOST("search_email", 'alpha');
if (!empty($conf->mailing->enabled)) {
$search_no_email = GETPOST("search_no_email", 'int');
$search_no_email = GETPOSTISSET("search_no_email") ? GETPOST("search_no_email", 'int') : -1;
} else {
$search_no_email = -1;
}

View File

@ -860,7 +860,7 @@ abstract class CommonObject
if (!empty($conf->socialnetworks->enabled)) {
$outsocialnetwork = '';
if (!empty($this->socialnetworks) && is_countable($this->socialnetworks) && count($this->socialnetworks) > 0) {
if (!empty($this->socialnetworks) && is_array($this->socialnetworks) && count($this->socialnetworks) > 0) {
$socialnetworksdict = getArrayOfSocialNetworks();
foreach ($this->socialnetworks as $key => $value) {
if ($value) {
@ -7522,7 +7522,7 @@ abstract class CommonObject
if ($display_type == 'card') {
$out .= '<tr '.($html_id ? 'id="'.$html_id.'" ' : '').$csstyle.' class="valuefieldcreate '.$class.$this->element.'_extras_'.$key.' trextrafields_collapse'.$extrafields_collapse_num.(!empty($this->id)?'_'.$this->id:'').'" '.$domData.' >';
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER) && ($action == 'view' || $action == 'editline')) {
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER) && ($action == 'view' || $action == 'valid' || $action == 'editline')) {
$out .= '<td></td>';
}
$out .= '<td class="wordbreak';

View File

@ -650,8 +650,9 @@ function modules_prepare_head($nbofactivatedmodules, $nboftotalmodules)
$mode = empty($conf->global->MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT) ? 'commonkanban' : 'common';
$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$mode;
if ($nbofactivatedmodules <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) { // If only minimal initial modules enabled)
$head[$h][1] = $form->textwithpicto($langs->trans("AvailableModules"), $desc);
$head[$h][1] .= img_warning($langs->trans("YouMustEnableOneModule"));
//$head[$h][1] = $form->textwithpicto($langs->trans("AvailableModules"), $desc);
$head[$h][1] = $langs->trans("AvailableModules");
$head[$h][1] .= $form->textwithpicto('', $langs->trans("YouMustEnableOneModule").'.<br><br><span class="opacitymedium">'.$desc.'</span>', 1, warning);
} else {
//$head[$h][1] = $langs->trans("AvailableModules").$form->textwithpicto('<span class="badge marginleftonly">'.$nbofactivatedmodules.' / '.$nboftotalmodules.'</span>', $desc, 1, 'help', '', 1, 3);
$head[$h][1] = $langs->trans("AvailableModules").'<span class="badge marginleftonly">'.$nbofactivatedmodules.' / '.$nboftotalmodules.'</span>';

View File

@ -3604,7 +3604,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'salary', 'shipment', 'state', 'supplier_invoice', 'supplier_invoicea', 'supplier_invoicer', 'supplier_invoiced',
'technic', 'ticket',
'error', 'warning',
'recent', 'reception', 'recruitmentcandidature', 'recruitmentjobposition', 'resource',
'recent', 'reception', 'recruitmentcandidature', 'recruitmentjobposition', 'resource', 'recurring',
'shapes', 'supplier', 'supplier_proposal', 'supplier_order', 'supplier_invoice',
'timespent', 'title_setup', 'title_accountancy', 'title_bank', 'title_hrm', 'title_agenda',
'uncheck', 'user-cog', 'website', 'workstation',
@ -3650,7 +3650,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'partnership'=>'handshake', 'payment'=>'money-check-alt', 'phoning'=>'phone', 'phoning_mobile'=>'mobile-alt', 'phoning_fax'=>'fax', 'previous'=>'arrow-alt-circle-left', 'printer'=>'print', 'product'=>'cube', 'service'=>'concierge-bell',
'recent' => 'question', 'reception'=>'dolly', 'recruitmentjobposition'=>'id-card-alt', 'recruitmentcandidature'=>'id-badge',
'resize'=>'crop', 'supplier_order'=>'dol-order_supplier', 'supplier_proposal'=>'file-signature',
'refresh'=>'redo', 'region'=>'map-marked', 'resource'=>'laptop-house',
'refresh'=>'redo', 'region'=>'map-marked', 'resource'=>'laptop-house', 'recurring'=>'history',
'state'=>'map-marked-alt', 'security'=>'key', 'salary'=>'wallet', 'shipment'=>'dolly', 'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'stripe'=>'stripe-s',
'supplier'=>'building', 'supplier_invoice'=>'file-invoice-dollar', 'technic'=>'cogs', 'ticket'=>'ticket-alt',
'timespent'=>'clock', 'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach',

View File

@ -93,7 +93,7 @@ function dol_setcache($memoryid, $data, $expire = 0)
$dolmemcache->add($memoryid, $data, $expire); // This fails if key already exists
$rescode = $dolmemcache->getResultCode();
if ($rescode == 0) {
return is_countable($data) ? count($data) : 0;
return is_array($data) ? count($data) : (is_scalar($data) ? strlen($data) : 0);
} else {
return -$rescode;
}
@ -113,7 +113,7 @@ function dol_setcache($memoryid, $data, $expire = 0)
//$dolmemcache->setOption(Memcached::OPT_COMPRESSION, false);
$result = $dolmemcache->add($memoryid, $data, false, $expire); // This fails if key already exists
if ($result) {
return is_countable($data) ? count($data) : 0;
return is_array($data) ? count($data) : (is_scalar($data) ? strlen($data) : 0);
} else {
return -1;
}

View File

@ -9,7 +9,7 @@
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014-2017 Francis Appels <francis.appels@yahoo.com>
* Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2016-2021 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2020 Lenin Rivas <lenin@leninrivas.com>
@ -371,11 +371,11 @@ class Expedition extends CommonObject
$num = count($this->lines);
for ($i = 0; $i < $num; $i++) {
if (!isset($this->lines[$i]->detail_batch)) { // no batch management
if (!$this->create_line($this->lines[$i]->entrepot_id, $this->lines[$i]->origin_line_id, $this->lines[$i]->qty, $this->lines[$i]->rang, $this->lines[$i]->array_options) > 0) {
if ($this->create_line($this->lines[$i]->entrepot_id, $this->lines[$i]->origin_line_id, $this->lines[$i]->qty, $this->lines[$i]->rang, $this->lines[$i]->array_options) <= 0) {
$error++;
}
} else { // with batch management
if (!$this->create_line_batch($this->lines[$i], $this->lines[$i]->array_options) > 0) {
if ($this->create_line_batch($this->lines[$i], $this->lines[$i]->array_options) <= 0) {
$error++;
}
}
@ -417,7 +417,6 @@ class Expedition extends CommonObject
}
} else {
$error++;
$this->error = $this->db->lasterror()." - sql=$sql";
$this->db->rollback();
return -3;
}
@ -2770,21 +2769,23 @@ class ExpeditionLigne extends CommonObjectLine
// End call triggers
}
if (!$error) {
$this->db->commit();
return $this->id;
if ($error) {
foreach ($this->errors as $errmsg) {
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
}
}
foreach ($this->errors as $errmsg) {
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
}
$this->db->rollback();
return -1 * $error;
} else {
$error++;
}
if ($error) {
$this->db->rollback();
return -1;
} else {
$this->db->commit();
return $this->id;
}
}
/**

View File

@ -34,7 +34,7 @@ if (!defined('DOL_APPLICATION_TITLE')) {
define('DOL_APPLICATION_TITLE', 'Dolibarr');
}
if (!defined('DOL_VERSION')) {
define('DOL_VERSION', '14.0.3'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
define('DOL_VERSION', '14.0.4'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
}
if (!defined('EURO')) {

View File

@ -10,7 +10,7 @@
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018-2021 Ferran Marcet <fmarcet@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -2270,6 +2270,7 @@ class FactureFournisseur extends CommonInvoice
if ($result) {
if ($this->db->num_rows($result)) {
$obj = $this->db->fetch_object($result);
$this->id = $obj->rowid;
if ($obj->fk_user_author) {
$cuser = new User($this->db);
@ -2286,8 +2287,8 @@ class FactureFournisseur extends CommonInvoice
$muser->fetch($obj->fk_user_modif);
$this->user_modification = $muser;
}
$this->date_creation = $this->db->idate($obj->datec);
$this->date_modification = $this->db->idate($obj->datem);
$this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->datem);
//$this->date_validation = $obj->datev; // This field is not available. Should be store into log table and using this function should be replaced with showing content of log (like for supplier orders)
}
$this->db->free($result);

View File

@ -271,6 +271,7 @@ SetMode=Set Payment Type
SetRevenuStamp=Set revenue stamp
Billed=Billed
RecurringInvoices=Recurring invoices
RecurringInvoice=Recurring invoice
RepeatableInvoice=Template invoice
RepeatableInvoices=Template invoices
Repeatable=Template

View File

@ -270,6 +270,7 @@ ErrorActionCommBadType=Selected event type (id: %n, code: %s) do not exist in Ev
CheckVersionFail=Version check fail
ErrorWrongFileName=Name of the file cannot have __SOMETHING__ in it
ErrorNotInDictionaryPaymentConditions=Not in Payment Terms Dictionary, please modify.
ErrorExecIdFailed=Can't execute command "id"
# Warnings
WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup.

View File

@ -23,7 +23,9 @@ ReceptionsAndReceivingForSameOrder=Receptions and receipts for this order
ReceptionsToValidate=Receptions to validate
StatusReceptionCanceled=Canceled
StatusReceptionDraft=Draft
StatusReceptionValidated=Validated (products to ship or already shipped)
StatusReceptionValidated=Validated (products to receive or already received)
StatusReceptionValidatedToReceive=Validated (products to receive)
StatusReceptionValidatedReceived=Validated (products received)
StatusReceptionProcessed=Processed
StatusReceptionDraftShort=Draft
StatusReceptionValidatedShort=Validated
@ -45,3 +47,6 @@ ReceptionsNumberingModules=Numbering module for receptions
ReceptionsReceiptModel=Document templates for receptions
NoMorePredefinedProductToDispatch=No more predefined products to dispatch
ReceptionExist=A reception exists
ReceptionBackToDraftInDolibarr=Reception %s back to draft
ReceptionClassifyClosedInDolibarr=Reception %s classified Closed
ReceptionUnClassifyCloseddInDolibarr=Reception %s re-open

View File

@ -140,7 +140,7 @@ class MouvementStock extends CommonObject
* @param int $price Unit price HT of product, used to calculate average weighted price (AWP or PMP in french). If 0, average weighted price is not changed.
* @param string $label Label of stock movement
* @param string $inventorycode Inventory code
* @param string $datem Force date of movement
* @param integer|string $datem Force date of movement
* @param integer|string $eatby eat-by date. Will be used if lot does not exists yet and will be created.
* @param integer|string $sellby sell-by date. Will be used if lot does not exists yet and will be created.
* @param string $batch batch number
@ -428,7 +428,7 @@ class MouvementStock extends CommonObject
$sql .= " datem, fk_product, batch, eatby, sellby,";
$sql .= " fk_entrepot, value, type_mouvement, fk_user_author, label, inventorycode, price, fk_origin, origintype, fk_projet";
$sql .= ")";
$sql .= " VALUES ('".$this->db->idate($now)."', ".$this->product_id.", ";
$sql .= " VALUES ('".$this->db->idate($this->datem)."', ".$this->product_id.", ";
$sql .= " ".($batch ? "'".$this->db->escape($batch)."'" : "null").", ";
$sql .= " ".($eatby ? "'".$this->db->idate($eatby)."'" : "null").", ";
$sql .= " ".($sellby ? "'".$this->db->idate($sellby)."'" : "null").", ";
@ -755,19 +755,19 @@ class MouvementStock extends CommonObject
/**
* Decrease stock for product and subproducts
*
* @param User $user Object user
* @param int $fk_product Id product
* @param int $entrepot_id Warehouse id
* @param int $qty Quantity
* @param int $price Price
* @param string $label Label of stock movement
* @param string $datem Force date of movement
* @param integer $eatby eat-by date
* @param integer $sellby sell-by date
* @param string $batch batch number
* @param int $id_product_batch Id product_batch
* @param string $inventorycode Inventory code
* @return int <0 if KO, >0 if OK
* @param User $user Object user
* @param int $fk_product Id product
* @param int $entrepot_id Warehouse id
* @param int $qty Quantity
* @param int $price Price
* @param string $label Label of stock movement
* @param integer|string $datem Force date of movement
* @param integer $eatby eat-by date
* @param integer $sellby sell-by date
* @param string $batch batch number
* @param int $id_product_batch Id product_batch
* @param string $inventorycode Inventory code
* @return int <0 if KO, >0 if OK
*/
public function livraison($user, $fk_product, $entrepot_id, $qty, $price = 0, $label = '', $datem = '', $eatby = '', $sellby = '', $batch = '', $id_product_batch = 0, $inventorycode = '')
{
@ -790,7 +790,7 @@ class MouvementStock extends CommonObject
* @param integer|string $eatby eat-by date
* @param integer|string $sellby sell-by date
* @param string $batch batch number
* @param string $datem Force date of movement
* @param integer|string $datem Force date of movement
* @param int $id_product_batch Id product_batch
* @param string $inventorycode Inventory code
* @return int <0 if KO, >0 if OK
@ -804,28 +804,6 @@ class MouvementStock extends CommonObject
return $this->_create($user, $fk_product, $entrepot_id, $qty, 3, $price, $label, $inventorycode, $datem, $eatby, $sellby, $batch, $skip_batch, $id_product_batch);
}
// /**
// * Return nb of subproducts lines for a product
// *
// * @param int $id Id of product
// * @return int <0 if KO, nb of subproducts if OK
// * @deprecated A count($product->getChildsArbo($id,1)) is same. No reason to have this in this class.
// */
// public function nbOfSubProducts($id)
// {
// $nbSP=0;
// $resql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."product_association";
// $resql.= " WHERE fk_product_pere = ".((int) $id);
// if ($this->db->query($resql))
// {
// $obj=$this->db->fetch_object($resql);
// $nbSP=$obj->nb;
// }
// return $nbSP;
// }
/**
* Count number of product in stock before a specific date
*

View File

@ -1163,10 +1163,10 @@ if ($resql) {
print '<tr class="oddeven">';
// Id movement
if (!empty($arrayfields['m.rowid']['checked'])) {
print '<td>';
print '<td class="nowraponall">';
print img_picto($langs->trans("StockMovement"), 'movement', 'class="pictofixedwidth"');
print $objp->mid;
print '</td>'; // This is primary not movement id
print '</td>'; // This is primary key not movement ref
}
if (!empty($arrayfields['m.datem']['checked'])) {
// Date

View File

@ -729,7 +729,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) {
print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">';
print '<table class="border tableforfield centpercent">';
// Description
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';

View File

@ -1640,7 +1640,14 @@ if ($action == 'create') {
}
print '</td>';
} else {
if ($object->statut <= 1) {
$statusreceived = $object::STATUS_CLOSED;
if (getDolGlobalInt("STOCK_CALCULATE_ON_RECEPTION")) {
$statusreceived = $object::STATUS_VALIDATED;
}
if (getDolGlobalInt("STOCK_CALCULATE_ON_RECEPTION_CLOSE")) {
$statusreceived = $object::STATUS_CLOSED;
}
if ($object->statut < $statusreceived) {
print '<td class="center">'.$langs->trans("QtyToReceive").'</td>';
} else {
print '<td class="center">'.$langs->trans("QtyReceived").'</td>';
@ -1979,14 +1986,14 @@ if ($action == 'create') {
if ($object->statut == Reception::STATUS_DRAFT && $num_prod > 0) {
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->reception->creer))
|| (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->reception->reception_advance->validate))) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=valid">'.$langs->trans("Validate").'</a>';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=valid&token='.newToken().'">'.$langs->trans("Validate").'</a>';
} else {
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans("Validate").'</a>';
}
}
// Edit
// Back to draft
if ($object->statut == Reception::STATUS_VALIDATED && $user->rights->reception->creer) {
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.'&amp;action=modif">'.$langs->trans('Modify').'</a></div>';
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.'&action=modif&token='.newToken().'">'.$langs->trans('SetToDraft').'</a></div>';
}
// TODO add alternative status

View File

@ -138,7 +138,14 @@ class Reception extends CommonObject
$this->statuts = array();
$this->statuts[-1] = 'StatusReceptionCanceled';
$this->statuts[0] = 'StatusReceptionDraft';
// product to receive if stock increase is on close or already received if stock increase is on validation
$this->statuts[1] = 'StatusReceptionValidated';
if (getDolGlobalInt("STOCK_CALCULATE_ON_RECEPTION")) {
$this->statuts[1] = 'StatusReceptionValidatedReceived';
}
if (getDolGlobalInt("STOCK_CALCULATE_ON_RECEPTION_CLOSE")) {
$this->statuts[1] = 'StatusReceptionValidatedToReceive';
}
$this->statuts[2] = 'StatusReceptionProcessed';
// List of short language codes for status
@ -589,7 +596,8 @@ class Reception extends CommonObject
// line without batch detail
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record.
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionValidatedInDolibarr", $numref));
$inventorycode = '';
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionValidatedInDolibarr", $numref), '', '', '', '', 0, $inventorycode);
if ($result < 0) {
$error++;
$this->errors[] = $mouvS->error;
@ -601,7 +609,8 @@ class Reception extends CommonObject
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record.
// Note: ->fk_origin_stock = id into table llx_product_batch (may be rename into llx_product_stock_batch in another version)
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionValidatedInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch);
$inventorycode = '';
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionValidatedInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, '', 0, $inventorycode);
if ($result < 0) {
$error++;
$this->errors[] = $mouvS->error;
@ -1432,7 +1441,7 @@ class Reception extends CommonObject
}
/**
* Classify the reception as closed.
* Classify the reception as closed (this record also the stock movement)
*
* @return int <0 if KO, >0 if OK
*/
@ -1514,7 +1523,8 @@ class Reception extends CommonObject
// line without batch detail
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionClassifyClosedInDolibarr", $numref));
$inventorycode = '';
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionClassifyClosedInDolibarr", $this->ref), '', '', '', '', 0, $inventorycode);
if ($result < 0) {
$this->error = $mouvS->error;
$this->errors = $mouvS->errors;
@ -1524,7 +1534,8 @@ class Reception extends CommonObject
// line with batch detail
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionClassifyClosedInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch);
$inventorycode = '';
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionClassifyClosedInDolibarr", $this->ref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, '', 0, $inventorycode);
if ($result < 0) {
$this->error = $mouvS->error;
@ -1676,7 +1687,9 @@ class Reception extends CommonObject
// line without batch detail
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, -$qty, $obj->subprice, $langs->trans("ReceptionUnClassifyCloseddInDolibarr", $numref));
$inventorycode = '';
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, -$qty, $obj->subprice, $langs->trans("ReceptionUnClassifyCloseddInDolibarr", $numref), '', '', '', '', 0, $inventorycode);
if ($result < 0) {
$this->error = $mouvS->error;
$this->errors = $mouvS->errors;
@ -1686,7 +1699,8 @@ class Reception extends CommonObject
// line with batch detail
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, -$qty, $obj->subprice, $langs->trans("ReceptionUnClassifyCloseddInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, $obj->fk_origin_stock);
$inventorycode = '';
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, -$qty, $obj->subprice, $langs->trans("ReceptionUnClassifyCloseddInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, '', $obj->fk_origin_stock, $inventorycode);
if ($result < 0) {
$this->error = $mouvS->error;
$this->errors = $mouvS->errors;
@ -1708,10 +1722,15 @@ class Reception extends CommonObject
}
}
if ($this->origin == 'order_supplier') {
if (!$error && $this->origin == 'order_supplier') {
$commande = new CommandeFournisseur($this->db);
$commande->fetch($this->origin_id);
$commande->setStatus($user, 4);
$result = $commande->setStatus($user, 4);
if ($result < 0) {
$error++;
$this->error = $commande->error;
$this->errors = $commande->errors;
}
}
} else {
$error++;
@ -1798,7 +1817,8 @@ class Reception extends CommonObject
// line without batch detail
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, -$qty, $obj->subprice, $langs->trans("ReceptionBackToDraftInDolibarr", $this->ref));
$inventorycode = '';
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, -$qty, $obj->subprice, $langs->trans("ReceptionBackToDraftInDolibarr", $this->ref), '', '', '', '', 0, $inventorycode);
if ($result < 0) {
$this->error = $mouvS->error;
$this->errors = $mouvS->errors;
@ -1809,7 +1829,8 @@ class Reception extends CommonObject
// line with batch detail
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, -$qty, $obj->subprice, $langs->trans("ReceptionBackToDraftInDolibarr", $this->ref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch);
$inventorycode = '';
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, -$qty, $obj->subprice, $langs->trans("ReceptionBackToDraftInDolibarr", $this->ref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, '', 0, $inventorycode);
if ($result < 0) {
$this->error = $mouvS->error;
$this->errors = $mouvS->errors;

View File

@ -343,6 +343,7 @@ if (empty($reshook)) {
$search_town = "";
$search_zip = "";
$search_state = "";
$search_region = "";
$search_country = '';
$search_email = '';
$search_phone = '';
@ -492,7 +493,7 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_effectif as staff on (staff.id = s.fk_effectif)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as region on (region. code_region = state.fk_region)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as region on (region.code_region = state.fk_region)";
// We'll need this table joined to the select in order to filter by categ
if (!empty($search_categ_cus) && $search_categ_cus != '-1') {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
@ -774,6 +775,9 @@ if ($search_url != '') {
if ($search_state != '') {
$param .= "&search_state=".urlencode($search_state);
}
if ($search_region != '') {
$param .= "&search_region=".urlencode($search_region);
}
if ($search_country != '') {
$param .= "&search_country=".urlencode($search_country);
}

View File

@ -2366,7 +2366,7 @@ if ($action == 'generatesitemaps' && $usercanedit) {
}
if ($tmpshortlangcode != $shortlangcode) {
$xhtmllink = $domtree->createElement('xhtml:link', '');
$xhtmllink->setAttribute("rel", "alternante");
$xhtmllink->setAttribute("rel", "alternate");
$xhtmllink->setAttribute("hreflang", $tmpshortlangcode);
$xhtmllink->setAttribute("href", $domainname.($objp->fk_default_home == $tmppage->id ? '/' : (($tmpshortlangcode != substr($object->lang, 0, 2)) ? '/'.$tmpshortlangcode : '').'/'.$tmppage->pageurl.'.php'));
$url->appendChild($xhtmllink);

View File

@ -594,7 +594,7 @@ class SecurityTest extends PHPUnit\Framework\TestCase
print __METHOD__." login=".$login."\n";
$this->assertEquals($login, 'admin', 'The test to check if pass of user "admin" is "admin" has failed');
$login=checkLoginPassEntity('admin', 'admin', 1, array('http','dolibarr')); // Should work because of second authetntication method
$login=checkLoginPassEntity('admin', 'admin', 1, array('http','dolibarr')); // Should work because of second authentication method
print __METHOD__." login=".$login."\n";
$this->assertEquals($login, 'admin');
@ -749,42 +749,42 @@ class SecurityTest extends PHPUnit\Framework\TestCase
$url = 'https://www.dolibarr.fr'; // This is a redirect 301 page
$tmp = getURLContent($url, 'GET', '', 0); // We do NOT follow
print __METHOD__." url=".$url."\n";
$this->assertEquals(301, $tmp['http_code'], 'GET url 301 without following -> 301');
$this->assertEquals(301, $tmp['http_code'], 'Should GET url 301 without following -> 301');
$url = 'https://www.dolibarr.fr'; // This is a redirect 301 page
$tmp = getURLContent($url); // We DO follow
$tmp = getURLContent($url); // We DO follow a page with return 300 so result should be 200
print __METHOD__." url=".$url."\n";
$this->assertEquals(200, $tmp['http_code'], 'GET url 301 with following -> 200'); // Test error if return does not contains 'not supported'
$this->assertEquals(200, $tmp['http_code'], 'Should GET url 301 with following -> 200 but we get '.$tmp['http_code']);
$url = 'http://localhost';
$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL
print __METHOD__." url=".$url."\n";
$this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that resolves to a local URL'); // Test we receive an error because localtest.me is not an external URL
$this->assertEquals(400, $tmp['http_code'], 'Should GET url to '.$url.' that resolves to a local URL'); // Test we receive an error because localtest.me is not an external URL
$url = 'http://127.0.0.1';
$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL
print __METHOD__." url=".$url."\n";
$this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.0.1 is not an external URL
$this->assertEquals(400, $tmp['http_code'], 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.0.1 is not an external URL
$url = 'http://127.0.2.1';
$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL
print __METHOD__." url=".$url."\n";
$this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.2.1 is not an external URL
$this->assertEquals(400, $tmp['http_code'], 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.2.1 is not an external URL
$url = 'https://169.254.0.1';
$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL
print __METHOD__." url=".$url."\n";
$this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that is a local URL'); // Test we receive an error because 169.254.0.1 is not an external URL
$this->assertEquals(400, $tmp['http_code'], 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 169.254.0.1 is not an external URL
$url = 'http://[::1]';
$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL
print __METHOD__." url=".$url."\n";
$this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that is a local URL'); // Test we receive an error because [::1] is not an external URL
$this->assertEquals(400, $tmp['http_code'], 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because [::1] is not an external URL
/*$url = 'localtest.me';
$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL
print __METHOD__." url=".$url."\n";
$this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that resolves to a local URL'); // Test we receive an error because localtest.me is not an external URL
$this->assertEquals(400, $tmp['http_code'], 'Should GET url to '.$url.' that resolves to a local URL'); // Test we receive an error because localtest.me is not an external URL
*/
return 0;