Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2022-01-24 23:59:02 +01:00
commit 66287d645e
30 changed files with 239 additions and 162 deletions

View File

@ -39,15 +39,13 @@ RUN chmod +x /usr/local/bin/docker-run.sh
RUN pecl install xdebug && docker-php-ext-enable xdebug RUN pecl install xdebug && docker-php-ext-enable xdebug
RUN echo 'zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20180731/xdebug.so"' >> ${PHP_INI_DIR}/php.ini RUN echo 'zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20180731/xdebug.so"' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.remote_autostart=1' >> ${PHP_INI_DIR}/php.ini RUN echo 'xdebug.mode=debug' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.remote_enable=1' >> ${PHP_INI_DIR}/php.ini RUN echo 'xdebug.start_with_request=yes' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.default_enable=1' >> ${PHP_INI_DIR}/php.ini RUN echo 'xdebug.client_host=host.docker.internal' >> ${PHP_INI_DIR}/php.ini
#RUN echo 'xdebug.remote_host=docker.host' >> ${PHP_INI_DIR}/php.ini RUN echo 'xdebug.client_port=9003' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.remote_port=9000' >> ${PHP_INI_DIR}/php.ini RUN echo 'xdebug.discover_client_host=true' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.remote_connect_back=1' >> ${PHP_INI_DIR}/php.ini #RUN echo 'xdebug.log="/tmp/xdebug.log"' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.profiler_enable=0' >> ${PHP_INI_DIR}/php.ini RUN echo 'xdebug.idekey="netbeans-xdebug"' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.remote_log="/tmp/xdebug.log"' >> ${PHP_INI_DIR}/php.ini
#RUN echo 'localhost docker.host' >> /etc/hosts
# set up sendmail config, to use maildev # set up sendmail config, to use maildev
RUN echo "account default" > /etc/msmtprc RUN echo "account default" > /etc/msmtprc

View File

@ -48,6 +48,7 @@ services:
- external-pod - external-pod
extra_hosts: extra_hosts:
- "localhost.localdomain:127.0.0.1" - "localhost.localdomain:127.0.0.1"
- "host.docker.internal:host-gateway"
mail: mail:
image: maildev/maildev image: maildev/maildev

View File

@ -94,9 +94,15 @@ class AdherentType extends CommonObject
*/ */
public $amount; public $amount;
/** @var string Public note */ /**
* @var string Public note
* @deprecated
*/
public $note; public $note;
/** @var string Public note */
public $note_public;
/** @var integer Can vote */ /** @var integer Can vote */
public $vote; public $vote;
@ -358,6 +364,10 @@ class AdherentType extends CommonObject
$this->label = trim($this->label); $this->label = trim($this->label);
if (empty($this->note_public) && !empty($this->note)) { // For backward compatibility
$this->note_public = $this->note;
}
$this->db->begin(); $this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent_type "; $sql = "UPDATE ".MAIN_DB_PREFIX."adherent_type ";
@ -368,14 +378,14 @@ class AdherentType extends CommonObject
$sql .= "subscription = '".$this->db->escape($this->subscription)."',"; $sql .= "subscription = '".$this->db->escape($this->subscription)."',";
$sql .= "amount = ".((empty($this->amount) && $this->amount == '') ? 'null' : ((float) $this->amount)).","; $sql .= "amount = ".((empty($this->amount) && $this->amount == '') ? 'null' : ((float) $this->amount)).",";
$sql .= "duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."',"; $sql .= "duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."',";
$sql .= "note = '".$this->db->escape($this->note)."',"; $sql .= "note = '".$this->db->escape($this->note_public)."',";
$sql .= "vote = ".(integer) $this->db->escape($this->vote).","; $sql .= "vote = ".(integer) $this->db->escape($this->vote).",";
$sql .= "mail_valid = '".$this->db->escape($this->mail_valid)."'"; $sql .= "mail_valid = '".$this->db->escape($this->mail_valid)."'";
$sql .= " WHERE rowid =".((int) $this->id); $sql .= " WHERE rowid =".((int) $this->id);
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) { if ($result) {
$this->description = $this->db->escape($this->note); $this->description = $this->db->escape($this->note_public);
// Multilangs // Multilangs
if (!empty($conf->global->MAIN_MULTILANGS)) { if (!empty($conf->global->MAIN_MULTILANGS)) {
@ -461,7 +471,7 @@ class AdherentType extends CommonObject
{ {
global $langs, $conf; global $langs, $conf;
$sql = "SELECT d.rowid, d.libelle as label, d.morphy, d.statut as status, d.duration, d.subscription, d.amount, d.mail_valid, d.note, d.vote"; $sql = "SELECT d.rowid, d.libelle as label, d.morphy, d.statut as status, d.duration, d.subscription, d.amount, d.mail_valid, d.note as note_public, d.vote";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
$sql .= " WHERE d.rowid = ".(int) $rowid; $sql .= " WHERE d.rowid = ".(int) $rowid;
@ -483,7 +493,8 @@ class AdherentType extends CommonObject
$this->subscription = $obj->subscription; $this->subscription = $obj->subscription;
$this->amount = $obj->amount; $this->amount = $obj->amount;
$this->mail_valid = $obj->mail_valid; $this->mail_valid = $obj->mail_valid;
$this->note = $obj->note; $this->note = $obj->note_public; // deprecated
$this->note_public = $obj->note_public;
$this->vote = $obj->vote; $this->vote = $obj->vote;
// multilangs // multilangs
@ -792,12 +803,16 @@ class AdherentType extends CommonObject
// Object classes // Object classes
$info["objectclass"] = explode(',', $conf->global->LDAP_MEMBER_TYPE_OBJECT_CLASS); $info["objectclass"] = explode(',', $conf->global->LDAP_MEMBER_TYPE_OBJECT_CLASS);
if (empty($this->note_public) && !empty($this->note)) { // For backward compatibility
$this->note_public = $this->note;
}
// Champs // Champs
if ($this->label && !empty($conf->global->LDAP_MEMBER_TYPE_FIELD_FULLNAME)) { if ($this->label && !empty($conf->global->LDAP_MEMBER_TYPE_FIELD_FULLNAME)) {
$info[$conf->global->LDAP_MEMBER_TYPE_FIELD_FULLNAME] = $this->label; $info[$conf->global->LDAP_MEMBER_TYPE_FIELD_FULLNAME] = $this->label;
} }
if ($this->note && !empty($conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION)) { if ($this->note_public && !empty($conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION)) {
$info[$conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION] = dol_string_nohtmltag($this->note, 0, 'UTF-8', 1); $info[$conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION] = dol_string_nohtmltag($this->note_public, 0, 'UTF-8', 1);
} }
if (!empty($conf->global->LDAP_MEMBER_TYPE_FIELD_GROUPMEMBERS)) { if (!empty($conf->global->LDAP_MEMBER_TYPE_FIELD_GROUPMEMBERS)) {
$valueofldapfield = array(); $valueofldapfield = array();
@ -829,7 +844,7 @@ class AdherentType extends CommonObject
$this->specimen = 1; $this->specimen = 1;
$this->label = 'MEMBERS TYPE SPECIMEN'; $this->label = 'MEMBERS TYPE SPECIMEN';
$this->note = 'This is a note'; $this->note_public = 'This is a public note';
$this->mail_valid = 'This is welcome email'; $this->mail_valid = 'This is welcome email';
$this->subscription = 1; $this->subscription = 1;
$this->vote = 0; $this->vote = 0;

View File

@ -215,7 +215,7 @@ class Subscription extends CommonObject
$sql .= " tms,"; $sql .= " tms,";
$sql .= " dateadh as dateh,"; $sql .= " dateadh as dateh,";
$sql .= " datef,"; $sql .= " datef,";
$sql .= " subscription, note, fk_bank"; $sql .= " subscription, note as note_public, fk_bank";
$sql .= " FROM ".MAIN_DB_PREFIX."subscription"; $sql .= " FROM ".MAIN_DB_PREFIX."subscription";
$sql .= " WHERE rowid=".((int) $rowid); $sql .= " WHERE rowid=".((int) $rowid);
@ -235,7 +235,8 @@ class Subscription extends CommonObject
$this->dateh = $this->db->jdate($obj->dateh); $this->dateh = $this->db->jdate($obj->dateh);
$this->datef = $this->db->jdate($obj->datef); $this->datef = $this->db->jdate($obj->datef);
$this->amount = $obj->subscription; $this->amount = $obj->subscription;
$this->note = $obj->note; $this->note = $obj->note_public; // deprecated
$this->note_public = $obj->note_public;
$this->fk_bank = $obj->fk_bank; $this->fk_bank = $obj->fk_bank;
return 1; return 1;
} else { } else {
@ -266,10 +267,14 @@ class Subscription extends CommonObject
return -1; return -1;
} }
if (empty($this->note_public) && !empty($this->note)) { // For backward compatibility
$this->note_public = $this->note;
}
$sql = "UPDATE ".MAIN_DB_PREFIX."subscription SET "; $sql = "UPDATE ".MAIN_DB_PREFIX."subscription SET ";
$sql .= " fk_type = ".((int) $this->fk_type).","; $sql .= " fk_type = ".((int) $this->fk_type).",";
$sql .= " fk_adherent = ".((int) $this->fk_adherent).","; $sql .= " fk_adherent = ".((int) $this->fk_adherent).",";
$sql .= " note=".($this->note ? "'".$this->db->escape($this->note)."'" : 'null').","; $sql .= " note=".($this->note_public ? "'".$this->db->escape($this->note_public)."'" : 'null').",";
$sql .= " subscription = ".price2num($this->amount).","; $sql .= " subscription = ".price2num($this->amount).",";
$sql .= " dateadh='".$this->db->idate($this->dateh)."',"; $sql .= " dateadh='".$this->db->idate($this->dateh)."',";
$sql .= " datef='".$this->db->idate($this->datef)."',"; $sql .= " datef='".$this->db->idate($this->datef)."',";

View File

@ -158,18 +158,6 @@ if ($action == 'updateMask') {
$error++; $error++;
} }
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
} elseif ($action == "setshippableiconinlist") {
// Activate Set Shippable Icon In List
$setshippableiconinlist = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "SHIPPABLE_ORDER_ICON_IN_LIST", $setshippableiconinlist, 'yesno', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
if (!$error) { if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
@ -646,25 +634,6 @@ print '<input type="submit" class="button button-edit" value="'.$langs->trans("M
print "</td></tr>\n"; print "</td></tr>\n";
print '</form>'; print '</form>';
// Shippable Icon in List
/* Kept as hidden feature for the moment, result seems bugged.
Where is definition of "shippable" according to all different STOCK_CALCULATE_... options ?
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ShippableOrderIconInList").'</td>';
print '<td>&nbsp;</td>';
print '<td class="center">';
if (!empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=setshippableiconinlist&token='.newToken().'&value=0">';
print img_picto($langs->trans("Activated"),'switch_on');
} else {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=setshippableiconinlist&token='.newToken().'&value=1">';
print img_picto($langs->trans("Disabled"),'switch_off');
}
print '</a></td>';
print '</tr>';
*/
/* /*
// Seems to be not so used. So kept hidden for the moment to avoid dangerous options inflation. // Seems to be not so used. So kept hidden for the moment to avoid dangerous options inflation.
// Ask for payment bank during order // Ask for payment bank during order

View File

@ -400,8 +400,6 @@ print '</td>';
print '</tr>'; print '</tr>';
print '</table>'; print '</table>';
print '</td></tr>';
print '</table>';
@ -538,6 +536,8 @@ if (!empty($_SESSION["commandbackuptorun"])) {
print "</div> <!-- end div center button -->\n"; print "</div> <!-- end div center button -->\n";
print '</td></tr>';
print '</table>';
print "</div> <!-- end div fichehalfleft -->\n"; print "</div> <!-- end div fichehalfleft -->\n";

View File

@ -261,6 +261,11 @@ class Commande extends CommonOrder
//! key of pos source ('0', '1', ...) //! key of pos source ('0', '1', ...)
public $pos_source; public $pos_source;
/**
* @var array Array with line of all shipments
*/
public $expeditions;
/** /**
* 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') * 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
@ -2010,9 +2015,9 @@ class Commande extends CommonOrder
/** /**
* Load array lines * Load array lines
* *
* @param int $only_product Return only physical products, not services * @param int $only_product Return only physical products, not services
* @param int $loadalsotranslation Return translation for products * @param int $loadalsotranslation Return translation for products
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function fetch_lines($only_product = 0, $loadalsotranslation = 0) public function fetch_lines($only_product = 0, $loadalsotranslation = 0)
{ {
@ -2207,9 +2212,10 @@ class Commande extends CommonOrder
* Note: For a dedicated shipment, the fetch_lines can be used to load the qty_asked and qty_shipped. This function is use to return qty_shipped cumulated for the order * Note: For a dedicated shipment, the fetch_lines can be used to load the qty_asked and qty_shipped. This function is use to return qty_shipped cumulated for the order
* *
* @param int $filtre_statut Filter on shipment status * @param int $filtre_statut Filter on shipment status
* @param int $fk_product Add a filter on a product
* @return int <0 if KO, Nb of lines found if OK * @return int <0 if KO, Nb of lines found if OK
*/ */
public function loadExpeditions($filtre_statut = -1) public function loadExpeditions($filtre_statut = -1, $fk_product = 0)
{ {
$this->expeditions = array(); $this->expeditions = array();

View File

@ -1854,10 +1854,13 @@ if ($resql) {
print '<td class="center">'; print '<td class="center">';
if (!empty($show_shippable_command) && !empty($conf->stock->enabled)) { if (!empty($show_shippable_command) && !empty($conf->stock->enabled)) {
if (($obj->fk_statut > $generic_commande::STATUS_DRAFT) && ($obj->fk_statut < $generic_commande::STATUS_CLOSED)) { if (($obj->fk_statut > $generic_commande::STATUS_DRAFT) && ($obj->fk_statut < $generic_commande::STATUS_CLOSED)) {
$generic_commande->getLinesArray(); // This set ->lines $generic_commande->getLinesArray(); // Load array ->lines
$generic_commande->loadExpeditions(); // Load array ->expeditions
$numlines = count($generic_commande->lines); // Loop on each line of order $numlines = count($generic_commande->lines); // Loop on each line of order
for ($lig = 0; $lig < $numlines; $lig++) { for ($lig = 0; $lig < $numlines; $lig++) {
$reliquat = $generic_commande->lines[$lig]->qty - $generic_commande->expeditions[$generic_commande->lines[$lig]->id];
if ($generic_commande->lines[$lig]->product_type == 0 && $generic_commande->lines[$lig]->fk_product > 0) { // If line is a product and not a service if ($generic_commande->lines[$lig]->product_type == 0 && $generic_commande->lines[$lig]->fk_product > 0) { // If line is a product and not a service
$nbprod++; // order contains real products $nbprod++; // order contains real products
$generic_product->id = $generic_commande->lines[$lig]->fk_product; $generic_product->id = $generic_commande->lines[$lig]->fk_product;
@ -1872,15 +1875,15 @@ if ($resql) {
$generic_product->stock_theorique = $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_theorique; $generic_product->stock_theorique = $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_theorique;
} }
if ($reliquat > $generic_product->stock_reel) {
$notshippable++;
}
if (empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) { // Default code. Default should be this case. if (empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) { // Default code. Default should be this case.
$text_info .= $generic_commande->lines[$lig]->qty.' X '.$generic_commande->lines[$lig]->product_ref.'&nbsp;'.dol_trunc($generic_commande->lines[$lig]->product_label, 25); $text_info .= $reliquat.' x '.$generic_commande->lines[$lig]->product_ref.'&nbsp;'.dol_trunc($generic_commande->lines[$lig]->product_label, 20);
$text_info .= ' - '.$langs->trans("Stock").': <span class="'.($generic_product->stock_reel > 0 ? 'ok' : 'error').'">'.$generic_product->stock_reel.'</span>'; $text_info .= ' - '.$langs->trans("Stock").': <span class="'.($generic_product->stock_reel > 0 ? 'ok' : 'error').'">'.$generic_product->stock_reel.'</span>';
$text_info .= ' - '.$langs->trans("VirtualStock").': <span class="'.($generic_product->stock_theorique > 0 ? 'ok' : 'error').'">'.$generic_product->stock_theorique.'</span>'; $text_info .= ' - '.$langs->trans("VirtualStock").': <span class="'.($generic_product->stock_theorique > 0 ? 'ok' : 'error').'">'.$generic_product->stock_theorique.'</span>';
$text_info .= ($reliquat != $generic_commande->lines[$lig]->qty ? ' <span class="opacitymedium">('.$langs->trans("QtyInOtherShipments").' '.($generic_commande->lines[$lig]->qty - $reliquat).')</span>' : '');
$text_info .= '<br>'; $text_info .= '<br>';
if ($generic_commande->lines[$lig]->qty > $generic_product->stock_reel) {
$notshippable++;
}
} else { // BUGGED CODE. } else { // BUGGED CODE.
// DOES NOT TAKE INTO ACCOUNT MANUFACTURING. THIS CODE SHOULD BE USELESS. PREVIOUS CODE SEEMS COMPLETE. // DOES NOT TAKE INTO ACCOUNT MANUFACTURING. THIS CODE SHOULD BE USELESS. PREVIOUS CODE SEEMS COMPLETE.
// COUNT STOCK WHEN WE SHOULD ALREADY HAVE VALUE // COUNT STOCK WHEN WE SHOULD ALREADY HAVE VALUE
@ -1908,32 +1911,31 @@ if ($resql) {
$stock_order_supplier = $generic_product->stats_commande_fournisseur['qty']; $stock_order_supplier = $generic_product->stats_commande_fournisseur['qty'];
} }
} }
$text_info .= $generic_commande->lines[$lig]->qty.' X '.$generic_commande->lines[$lig]->ref.'&nbsp;'.dol_trunc($generic_commande->lines[$lig]->product_label, 25); $text_info .= $reliquat.' x '.$generic_commande->lines[$lig]->ref.'&nbsp;'.dol_trunc($generic_commande->lines[$lig]->product_label, 20);
$text_stock_reel = $generic_product->stock_reel.'/'.$stock_order; $text_stock_reel = $generic_product->stock_reel.'/'.$stock_order;
if ($stock_order > $generic_product->stock_reel && !($generic_product->stock_reel < $generic_commande->lines[$lig]->qty)) { if ($stock_order > $generic_product->stock_reel && !($generic_product->stock_reel < $generic_commande->lines[$lig]->qty)) {
$warning++; $warning++;
$text_warning .= '<span class="warning">'.$langs->trans('Available').'&nbsp;:&nbsp;'.$text_stock_reel.'</span>'; $text_warning .= '<span class="warning">'.$langs->trans('Available').'&nbsp;:&nbsp;'.$text_stock_reel.'</span>';
} }
if ($generic_product->stock_reel < $generic_commande->lines[$lig]->qty) { if ($reliquat > $generic_product->stock_reel) {
$notshippable++;
$text_info .= '<span class="warning">'.$langs->trans('Available').'&nbsp;:&nbsp;'.$text_stock_reel.'</span>'; $text_info .= '<span class="warning">'.$langs->trans('Available').'&nbsp;:&nbsp;'.$text_stock_reel.'</span>';
} else { } else {
$text_info .= '<span class="ok">'.$langs->trans('Available').'&nbsp;:&nbsp;'.$text_stock_reel.'</span>'; $text_info .= '<span class="ok">'.$langs->trans('Available').'&nbsp;:&nbsp;'.$text_stock_reel.'</span>';
} }
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled)) { if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled)) {
$text_info .= '&nbsp;'.$langs->trans('SupplierOrder').'&nbsp;:&nbsp;'.$stock_order_supplier.'<br>'; $text_info .= '&nbsp;'.$langs->trans('SupplierOrder').'&nbsp;:&nbsp;'.$stock_order_supplier;
} else {
$text_info .= '<br>';
} }
$text_info .= ($reliquat != $generic_commande->lines[$lig]->qty ? ' <span class="opacitymedium">('.$langs->trans("QtyInOtherShipments").' '.($generic_commande->lines[$lig]->qty - $reliquat).')</span>' : '');
$text_info .= '<br>';
} }
} }
} }
if ($notshippable == 0) { if ($notshippable == 0) {
$text_icon = img_picto('', 'dolly', '', false, 0, 0, '', 'green paddingleft'); $text_icon = img_picto('', 'dolly', '', false, 0, 0, '', 'green paddingleft');
$text_info = $langs->trans('Shippable').'<br>'.$text_info; $text_info = $text_icon.' '.$langs->trans('Shippable').'<br>'.$text_info;
} else { } else {
$text_icon = img_picto('', 'dolly', '', false, 0, 0, '', 'error paddingleft'); $text_icon = img_picto('', 'dolly', '', false, 0, 0, '', 'error paddingleft');
$text_info = $langs->trans('NonShippable').'<br>'.$text_info; $text_info = $text_icon.' '.$langs->trans('NonShippable').'<br>'.$text_info;
} }
} }

View File

@ -245,6 +245,8 @@ if ($id > 0) {
$newcardbutton = ''; $newcardbutton = '';
if (!empty($conf->agenda->enabled)) { if (!empty($conf->agenda->enabled)) {
if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) { if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) {
$backtopage = $_SERVER['PHP_SELF'].'?id='.$object->id;
$out = '&origin='.$object->element.'&originid='.$object->id.'&backtopage='.urlencode($backtopage);
$newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out); $newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out);
} }
} }

View File

@ -7598,7 +7598,7 @@ abstract class CommonObject
} else { return true; } } else { return true; }
} elseif (in_array($type, array('double', 'real', 'price'))) { } elseif (in_array($type, array('double', 'real', 'price'))) {
// is numeric // is numeric
if (!$validate->isDuration($fieldValue)) { if (!$validate->isNumeric($fieldValue)) {
$this->setFieldError($fieldKey, $validate->error); $this->setFieldError($fieldKey, $validate->error);
return false; return false;
} else { return true; } } else { return true; }

View File

@ -55,18 +55,17 @@ class Validate
{ {
global $langs; global $langs;
if ($outputLang) { if (empty($outputLang)) {
$this->outputLang = $langs; $this->outputLang = $langs;
} else { } else {
$this->outputLang = $outputLang; $this->outputLang = $outputLang;
} }
if (!is_object($this->outputLang) || !method_exists($outputLang, 'load')) { if (!is_object($this->outputLang) || !method_exists($this->outputLang, 'load')) {
return false; return false;
} }
/** @var Translate $outputLang */ $this->outputLang->loadLangs(array('validate', 'errors'));
$outputLang->load('validate');
$this->db = $db; $this->db = $db;
} }
@ -229,6 +228,21 @@ class Validate
return true; return true;
} }
/**
* Check numeric validity
*
* @param mixed $string to validate
* @return boolean Validity is ok or not
*/
public function isNumeric($string)
{
if (!is_numeric($string)) {
$this->error = $this->outputLang->trans('RequireValidNumeric');
return false;
}
return true;
}
/** /**
* Check for boolean validity * Check for boolean validity
* *

View File

@ -1545,6 +1545,7 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename =
// This is when PHP session is ran outside a web server, like from Linux command line (Not always defined, but usefull if OS defined it). // This is when PHP session is ran outside a web server, like from Linux command line (Not always defined, but usefull if OS defined it).
$data['ip'] = '???@'.$_SERVER['LOGNAME']; $data['ip'] = '???@'.$_SERVER['LOGNAME'];
} }
// Loop on each log handler and send output // Loop on each log handler and send output
foreach ($conf->loghandlers as $loghandlerinstance) { foreach ($conf->loghandlers as $loghandlerinstance) {
if ($restricttologhandler && $loghandlerinstance->code != $restricttologhandler) { if ($restricttologhandler && $loghandlerinstance->code != $restricttologhandler) {

View File

@ -1252,20 +1252,30 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$pdf->SetXY($this->marge_gauche, $posy); $pdf->SetXY($this->marge_gauche, $posy);
// Logo // Logo
$logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO)) {
if ($this->emetteur->logo) { if ($this->emetteur->logo) {
if (is_readable($logo)) { $logodir = $conf->mycompany->dir_output;
$height = pdf_getHeightForLogo($logo); if (!empty($conf->mycompany->multidir_output[$object->entity])) {
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) $logodir = $conf->mycompany->multidir_output[$object->entity];
}
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) {
$logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
} else {
$logo = $logodir.'/logos/'.$this->emetteur->logo;
}
if (is_readable($logo)) {
$height = pdf_getHeightForLogo($logo);
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
} else {
$pdf->SetTextColor(200, 0, 0);
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
}
} else { } else {
$pdf->SetTextColor(200, 0, 0); $text = $this->emetteur->name;
$pdf->SetFont('', 'B', $default_font_size - 2); $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToModuleSetup"), 0, 'L');
} }
} else {
$text = $this->emetteur->name;
$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection);
} }
$pdf->SetFont('', 'B', $default_font_size + 3); $pdf->SetFont('', 'B', $default_font_size + 3);

View File

@ -1160,20 +1160,30 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$pdf->SetXY($this->marge_gauche, $posy); $pdf->SetXY($this->marge_gauche, $posy);
// Logo // Logo
$logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO)) {
if ($this->emetteur->logo) { if ($this->emetteur->logo) {
if (is_readable($logo)) { $logodir = $conf->mycompany->dir_output;
$height = pdf_getHeightForLogo($logo); if (!empty($conf->mycompany->multidir_output[$object->entity])) {
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) $logodir = $conf->mycompany->multidir_output[$object->entity];
}
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) {
$logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
} else {
$logo = $logodir.'/logos/'.$this->emetteur->logo;
}
if (is_readable($logo)) {
$height = pdf_getHeightForLogo($logo);
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
} else {
$pdf->SetTextColor(200, 0, 0);
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
}
} else { } else {
$pdf->SetTextColor(200, 0, 0); $text = $this->emetteur->name;
$pdf->SetFont('', 'B', $default_font_size - 2); $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToModuleSetup"), 0, 'L');
} }
} else {
$text = $this->emetteur->name;
$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection);
} }
$pdf->SetFont('', 'B', $default_font_size + 3); $pdf->SetFont('', 'B', $default_font_size + 3);

View File

@ -1295,20 +1295,30 @@ class pdf_aurore extends ModelePDFSupplierProposal
$pdf->SetXY($this->marge_gauche, $posy); $pdf->SetXY($this->marge_gauche, $posy);
// Logo // Logo
$logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO)) {
if ($this->emetteur->logo) { if ($this->emetteur->logo) {
if (is_readable($logo)) { $logodir = $conf->mycompany->dir_output;
$height = pdf_getHeightForLogo($logo); if (!empty($conf->mycompany->multidir_output[$object->entity])) {
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) $logodir = $conf->mycompany->multidir_output[$object->entity];
}
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) {
$logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
} else {
$logo = $logodir.'/logos/'.$this->emetteur->logo;
}
if (is_readable($logo)) {
$height = pdf_getHeightForLogo($logo);
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
} else {
$pdf->SetTextColor(200, 0, 0);
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
}
} else { } else {
$pdf->SetTextColor(200, 0, 0); $text = $this->emetteur->name;
$pdf->SetFont('', 'B', $default_font_size - 2); $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
} }
} else {
$text = $this->emetteur->name;
$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
} }
$pdf->SetFont('', 'B', $default_font_size + 3); $pdf->SetFont('', 'B', $default_font_size + 3);

View File

@ -1126,16 +1126,19 @@ if ($action == 'create') {
$product_static->status_buy = $line->product_tobuy; $product_static->status_buy = $line->product_tobuy;
$product_static->status_batch = $line->product_tobatch; $product_static->status_batch = $line->product_tobatch;
$showdescinproductdesc = (getDolGlobalString('PRODUIT_DESC_IN_FORM') == 2 ? 1 : 0);
$text = $product_static->getNomUrl(1); $text = $product_static->getNomUrl(1);
$text .= ' - '.(!empty($line->label) ? $line->label : $line->product_label); $text .= ' - '.(!empty($line->label) ? $line->label : $line->product_label);
$description = ($conf->global->PRODUIT_DESC_IN_FORM ? '' : dol_htmlentitiesbr($line->desc)); $description = ($showdescinproductdesc ? '' : dol_htmlentitiesbr($line->desc));
print $form->textwithtooltip($text, $description, 3, '', '', $i); print $form->textwithtooltip($text, $description, 3, '', '', $i);
// Show range // Show range
print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end)); print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
// Add description in form // Add description in form
if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) { if ($showdescinproductdesc) {
print ($line->desc && $line->desc != $line->product_label) ? '<br>'.dol_htmlentitiesbr($line->desc) : ''; print ($line->desc && $line->desc != $line->product_label) ? '<br>'.dol_htmlentitiesbr($line->desc) : '';
} }

View File

@ -1370,29 +1370,35 @@ class CommandeFournisseur extends CommonOrder
// insert products details into database // insert products details into database
for ($i = 0; $i < $num; $i++) { for ($i = 0; $i < $num; $i++) {
$this->special_code = $this->lines[$i]->special_code; // TODO : remove this in 9.0 and add special_code param to addline() $line = $this->lines[$i];
if (!is_object($line)) {
$line = (object) $line;
}
$this->special_code = $line->special_code; // TODO : remove this in 9.0 and add special_code param to addline()
// This include test on qty if option SUPPLIER_ORDER_WITH_NOPRICEDEFINED is not set // This include test on qty if option SUPPLIER_ORDER_WITH_NOPRICEDEFINED is not set
$result = $this->addline( $result = $this->addline(
$this->lines[$i]->desc, $line->desc,
$this->lines[$i]->subprice, $line->subprice,
$this->lines[$i]->qty, $line->qty,
$this->lines[$i]->tva_tx, $line->tva_tx,
$this->lines[$i]->localtax1_tx, $line->localtax1_tx,
$this->lines[$i]->localtax2_tx, $line->localtax2_tx,
$this->lines[$i]->fk_product, $line->fk_product,
0, 0,
$this->lines[$i]->ref_fourn, // $this->lines[$i]->ref_fourn comes from field ref into table of lines. Value may ba a ref that does not exists anymore, so we first try with value of product $line->ref_fourn, // $line->ref_fourn comes from field ref into table of lines. Value may ba a ref that does not exists anymore, so we first try with value of product
$this->lines[$i]->remise_percent, $line->remise_percent,
'HT', 'HT',
0, 0,
$this->lines[$i]->product_type, $line->product_type,
$this->lines[$i]->info_bits, $line->info_bits,
false, false,
$this->lines[$i]->date_start, $line->date_start,
$this->lines[$i]->date_end, $line->date_end,
$this->lines[$i]->array_options, $line->array_options,
$this->lines[$i]->fk_unit $line->fk_unit
); );
if ($result < 0) { if ($result < 0) {
dol_syslog(get_class($this)."::create ".$this->error, LOG_WARNING); // do not use dol_print_error here as it may be a functionnal error dol_syslog(get_class($this)."::create ".$this->error, LOG_WARNING); // do not use dol_print_error here as it may be a functionnal error

View File

@ -101,6 +101,10 @@ $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element); $extrafields->fetch_name_optionals_label($object->table_element);
if ($user->socid) {
$socid = $user->socid;
}
// Load object // Load object
if ($id > 0 || !empty($ref)) { if ($id > 0 || !empty($ref)) {
$ret = $object->fetch($id, $ref); $ret = $object->fetch($id, $ref);
@ -124,7 +128,9 @@ if ($id > 0 || !empty($ref)) {
} }
} }
$result = restrictedArea($user, 'fournisseur', $id, 'commande_fournisseur', 'commande'); // Security check
$isdraft = (isset($object->statut) && ($object->statut == $object::STATUS_DRAFT) ? 1 : 0);
$result = restrictedArea($user, 'fournisseur', $id, 'commande_fournisseur', 'commande', 'fk_soc', 'rowid', $isdraft);
// Common permissions // Common permissions
$usercanread = ($user->rights->fournisseur->commande->lire || $user->rights->supplier_order->lire); $usercanread = ($user->rights->fournisseur->commande->lire || $user->rights->supplier_order->lire);
@ -842,8 +848,7 @@ if (empty($reshook)) {
} else { } else {
$db->rollback(); $db->rollback();
dol_print_error($db, $object->error); setEventMessages($object->error, $object->errors, 'errors');
exit;
} }
} }

View File

@ -11,17 +11,28 @@ use OAuth\Common\Http\Exception\TokenResponseException;
use OAuth\OAuth2\Service\Exception\InvalidAccessTypeException; use OAuth\OAuth2\Service\Exception\InvalidAccessTypeException;
use OAuth\Common\Http\Uri\Uri; use OAuth\Common\Http\Uri\Uri;
/**
* Class For WordPress OAuth
*/
class WordPress extends AbstractService class WordPress extends AbstractService
{ {
/**
* @var string
*/
protected $accessType = 'online'; protected $accessType = 'online';
public function __construct( /**
CredentialsInterface $credentials, * Construct
ClientInterface $httpClient, *
TokenStorageInterface $storage, * @param CredentialsInterface $credentials credentials
$scopes = array(), * @param ClientInterface $httpClient httpClient
UriInterface $baseApiUri = null * @param TokenStorageInterface $storage storage
) { * @param $scopes scope
* @param UriInterface|null $baseApiUri baseApiUri
* @throws Exception\InvalidScopeException
*/
public function __construct(CredentialsInterface $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null)
{
parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri, true); parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri, true);
if (null === $baseApiUri) { if (null === $baseApiUri) {
@ -41,7 +52,7 @@ class WordPress extends AbstractService
}*/ }*/
/** /**
* {@inheritdoc} * @return Uri
*/ */
public function getAuthorizationEndpoint() public function getAuthorizationEndpoint()
{ {
@ -49,7 +60,7 @@ class WordPress extends AbstractService
} }
/** /**
* {@inheritdoc} * @return Uri
*/ */
public function getAccessTokenEndpoint() public function getAccessTokenEndpoint()
{ {
@ -57,7 +68,7 @@ class WordPress extends AbstractService
} }
/** /**
* {@inheritdoc} * @return int
*/ */
protected function getAuthorizationMethod() protected function getAuthorizationMethod()
{ {
@ -66,7 +77,9 @@ class WordPress extends AbstractService
} }
/** /**
* {@inheritdoc} * @param $responseBody responseBody
* @return StdOAuth2Token
* @throws TokenResponseException
*/ */
protected function parseAccessTokenResponse($responseBody) protected function parseAccessTokenResponse($responseBody)
{ {

View File

@ -479,5 +479,3 @@ table.tablesupport {
width: 100%; width: 100%;
} }
} }
}

View File

@ -484,9 +484,9 @@ ALTER TABLE llx_delivery DROP FOREIGN KEY fk_livraison_fk_user_author;
ALTER TABLE llx_delivery DROP FOREIGN KEY fk_livraison_fk_user_valid; ALTER TABLE llx_delivery DROP FOREIGN KEY fk_livraison_fk_user_valid;
-- add constraint -- add constraint
ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid);
ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid); ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid);
ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_user_valid FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid); ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_user_valid FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid);
ALTER TABLE llx_deliverydet DROP FOREIGN KEY fk_livraisondet_fk_livraison; ALTER TABLE llx_deliverydet DROP FOREIGN KEY fk_livraisondet_fk_livraison;
ALTER TABLE llx_deliverydet DROP INDEX idx_livraisondet_fk_expedition; ALTER TABLE llx_deliverydet DROP INDEX idx_livraisondet_fk_expedition;

View File

@ -1,7 +1,7 @@
-- --
-- Be carefull to requests order. -- Be carefull to requests order.
-- This file must be loaded by calling /install/index.php page -- This file must be loaded by calling /install/index.php page
-- when current version is 14.0.0 or higher. -- when current version is 15.0.0 or higher.
-- --
-- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y -- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y
-- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y -- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y
@ -38,4 +38,4 @@ UPDATE llx_rights_def SET perms = 'writeall' WHERE perms = 'writeall_advance' AN
-- v16 -- v16
ALTER TABLE llx_projet_task_time ADD COLUMN fk_product integer NULL;

View File

@ -24,6 +24,7 @@ create table llx_projet_task_time
task_datehour datetime, -- day + hour task_datehour datetime, -- day + hour
task_date_withhour integer DEFAULT 0, -- 0 by default, 1 if date was entered with start hour task_date_withhour integer DEFAULT 0, -- 0 by default, 1 if date was entered with start hour
task_duration double, task_duration double,
fk_product integer NULL,
fk_user integer, fk_user integer,
thm double(24,8), thm double(24,8),
invoice_id integer DEFAULT NULL, -- If we need to invoice each line of timespent, we can save invoice id here invoice_id integer DEFAULT NULL, -- If we need to invoice each line of timespent, we can save invoice id here

View File

@ -315,6 +315,7 @@ RequireAtLeastXString = Requires at least %s character(s)
RequireXStringMax = Requires %s character(s) max RequireXStringMax = Requires %s character(s) max
RequireAtLeastXDigits = Requires at least %s digit(s) RequireAtLeastXDigits = Requires at least %s digit(s)
RequireXDigitsMax = Requires %s digit(s) max RequireXDigitsMax = Requires %s digit(s) max
RequireValidNumeric = Requires a numeric value
RequireValidEmail = Email address is not valid RequireValidEmail = Email address is not valid
RequireMaxLength = Length must be less than %s chars RequireMaxLength = Length must be less than %s chars
RequireMinLength = Length must be more than %s char(s) RequireMinLength = Length must be more than %s char(s)

View File

@ -132,7 +132,7 @@ $upload_dir = $conf->mymodule->multidir_output[isset($object->entity) ? $object-
// Security check (enable the most restrictive one) // Security check (enable the most restrictive one)
//if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid; //if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); //$isdraft = (isset($object->status) && ($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); //restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
//if (empty($conf->mymodule->enabled)) accessforbidden(); //if (empty($conf->mymodule->enabled)) accessforbidden();
//if (!$permissiontoread) accessforbidden(); //if (!$permissiontoread) accessforbidden();

View File

@ -630,7 +630,10 @@ if ($object->id > 0) {
errortab3 = []; errortab3 = [];
errortab4 = []; errortab4 = [];
if(textarray[0] != ""){ textarray = textarray.filter(function(value){
return value != "";
});
if(textarray.some((element) => element != "")){
$(".expectedqty").each(function(){ $(".expectedqty").each(function(){
id = this.id; id = this.id;
console.log("Analyze line "+id+" in inventory"); console.log("Analyze line "+id+" in inventory");
@ -851,7 +854,7 @@ if ($object->id > 0) {
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Warehouse").'</td>'; print '<td>'.$langs->trans("Warehouse").'</td>';
print '<td>'.$langs->trans("Product").'</td>'; print '<td>'.$langs->trans("Product").'</td>';
if ($conf->productbatch->enabled) { if (!empty($conf->productbatch->enabled)) {
print '<td>'; print '<td>';
print $langs->trans("Batch"); print $langs->trans("Batch");
print '</td>'; print '</td>';
@ -881,7 +884,7 @@ if ($object->id > 0) {
print '<td>'; print '<td>';
print $form->select_produits((GETPOSTISSET('fk_product') ? GETPOST('fk_product', 'int') : $object->fk_product), 'fk_product', '', 0, 0, -1, 2, '', 0, null, 0, '1', 0, 'maxwidth300'); print $form->select_produits((GETPOSTISSET('fk_product') ? GETPOST('fk_product', 'int') : $object->fk_product), 'fk_product', '', 0, 0, -1, 2, '', 0, null, 0, '1', 0, 'maxwidth300');
print '</td>'; print '</td>';
if ($conf->productbatch->enabled) { if (!empty($conf->productbatch->enabled)) {
print '<td>'; print '<td>';
print '<input type="text" name="batch" class="maxwidth100" value="'.(GETPOSTISSET('batch') ? GETPOST('batch') : '').'">'; print '<input type="text" name="batch" class="maxwidth100" value="'.(GETPOSTISSET('batch') ? GETPOST('batch') : '').'">';
print '</td>'; print '</td>';
@ -927,6 +930,7 @@ if ($object->id > 0) {
} }
// Load real stock we have now // Load real stock we have now
$option = '';
if (isset($cacheOfProducts[$obj->fk_product])) { if (isset($cacheOfProducts[$obj->fk_product])) {
$product_static = $cacheOfProducts[$obj->fk_product]; $product_static = $cacheOfProducts[$obj->fk_product];
} else { } else {
@ -948,7 +952,7 @@ if ($object->id > 0) {
print $product_static->getNomUrl(1).' - '.$product_static->label; print $product_static->getNomUrl(1).' - '.$product_static->label;
print '</td>'; print '</td>';
if ($conf->productbatch->enabled) { if (!empty($conf->productbatch->enabled)) {
print '<td id="id_'.$obj->rowid.'_batch">'; print '<td id="id_'.$obj->rowid.'_batch">';
print $obj->batch; print $obj->batch;
print '</td>'; print '</td>';
@ -959,7 +963,7 @@ if ($object->id > 0) {
$valuetoshow = $obj->qty_stock; $valuetoshow = $obj->qty_stock;
// For inventory not yet close, we overwrite with the real value in stock now // For inventory not yet close, we overwrite with the real value in stock now
if ($object->status == $object::STATUS_DRAFT || $object->status == $object::STATUS_VALIDATED) { if ($object->status == $object::STATUS_DRAFT || $object->status == $object::STATUS_VALIDATED) {
if ($conf->productbatch->enabled && $product_static->hasbatch()) { if (!empty($conf->productbatch->enabled) && $product_static->hasbatch()) {
$valuetoshow = $product_static->stock_warehouse[$obj->fk_warehouse]->detail_batch[$obj->batch]->qty; $valuetoshow = $product_static->stock_warehouse[$obj->fk_warehouse]->detail_batch[$obj->batch]->qty;
} else { } else {
$valuetoshow = $product_static->stock_warehouse[$obj->fk_warehouse]->real; $valuetoshow = $product_static->stock_warehouse[$obj->fk_warehouse]->real;

View File

@ -204,6 +204,7 @@ if (!empty($conf->projet->enabled)) {
} }
} else { } else {
if (!empty($object->fk_project)) { if (!empty($object->fk_project)) {
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
$proj = new Project($db); $proj = new Project($db);
$proj->fetch($object->fk_project); $proj->fetch($object->fk_project);
$morehtmlref .= $proj->getNomUrl(1); $morehtmlref .= $proj->getNomUrl(1);

View File

@ -524,7 +524,7 @@ class User extends CommonObject
$this->admin = $obj->admin; $this->admin = $obj->admin;
$this->note_public = $obj->note_public; $this->note_public = $obj->note_public;
$this->note_private = $obj->note_private; $this->note_private = $obj->note_private;
$this->note = $obj->note_private; $this->note = $obj->note_private; // deprecated
$this->statut = $obj->statut; $this->statut = $obj->statut;
$this->photo = $obj->photo; $this->photo = $obj->photo;
$this->openid = $obj->openid; $this->openid = $obj->openid;
@ -1905,7 +1905,7 @@ class User extends CommonObject
// Update password // Update password
if (!empty($this->pass)) { if (!empty($this->pass)) {
if ($this->pass != $this->pass_indatabase && $this->pass != $this->pass_indatabase_crypted) { if ($this->pass != $this->pass_indatabase && $this->pass != $this->pass_indatabase_crypted) {
// Si mot de passe saisi et different de celui en base // If a new value for password is set and different than the one crypted into database
$result = $this->setPassword($user, $this->pass, 0, $notrigger, $nosyncmemberpass); $result = $this->setPassword($user, $this->pass, 0, $notrigger, $nosyncmemberpass);
if ($result < 0) { if ($result < 0) {
return -5; return -5;
@ -3080,7 +3080,7 @@ class User extends CommonObject
$this->personal_mobile = '0999999996'; $this->personal_mobile = '0999999996';
$this->admin = 0; $this->admin = 0;
$this->login = 'dolibspec'; $this->login = 'dolibspec';
$this->pass = 'dolibspec'; $this->pass = 'dolibSpec+@123';
//$this->pass_indatabase='dolibspec'; Set after a fetch //$this->pass_indatabase='dolibspec'; Set after a fetch
//$this->pass_indatabase_crypted='e80ca5a88c892b0aaaf7e154853bccab'; Set after a fetch //$this->pass_indatabase_crypted='e80ca5a88c892b0aaaf7e154853bccab'; Set after a fetch
$this->datec = $now; $this->datec = $now;

View File

@ -143,11 +143,13 @@ class UserTest extends PHPUnit\Framework\TestCase
$langs=$this->savlangs; $langs=$this->savlangs;
$db=$this->savdb; $db=$this->savdb;
print __METHOD__." USER_PASSWORD_GENERATED=".getDolGlobalString('USER_PASSWORD_GENERATED')."\n";
$localobject=new User($this->savdb); $localobject=new User($this->savdb);
$localobject->initAsSpecimen(); $localobject->initAsSpecimen();
$result=$localobject->create($user); $result=$localobject->create($user);
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0, 'Creation of user has failed: '.$localobject->error);
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
return $result; return $result;
} }

View File

@ -1,2 +1,2 @@
# Remove this line and replace the ABC with X5 to get a file that is detected by antiviruses. # Remove this line and replace the "AB" with "X5" at begin of line to get a file that is detected by antiviruses.
ABO!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H* ABO!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*