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

This commit is contained in:
Laurent Destailleur 2023-06-16 01:36:46 +02:00
commit 6b94d60d9a
37 changed files with 142 additions and 71 deletions

View File

@ -217,7 +217,7 @@ Following changes may create regressions for some external modules, but were nec
***** ChangeLog for 17.0.2 compared to 17.0.1 *****
FIX : Add hidden conf to add extrafields in canelle template : INVOICE_ADD_EXTRAFIELD_IN_NOTE
FIX: #24414
FIX: #24798 Deleting member subscription is not possible
FIX: add a test for updating date on task update in tab time consummed pro…

View File

@ -1976,7 +1976,11 @@ CREATE TABLE `llx_c_holiday_types` (
LOCK TABLES `llx_c_holiday_types` WRITE;
/*!40000 ALTER TABLE `llx_c_holiday_types` DISABLE KEYS */;
INSERT INTO `llx_c_holiday_types` VALUES (1,'LEAVE_SICK','Sick leave',0,0,0.00000,NULL,1,NULL),(2,'LEAVE_OTHER','Other leave',0,0,0.00000,NULL,1,NULL),(3,'LEAVE_PAID','Paid vacation',1,7,0.00000,NULL,1,NULL),(4,'LEAVE_RTT_FR','RTT',1,7,0.83000,1,0,NULL),(5,'LEAVE_PAID_FR','Paid vacation',1,30,2.08334,1,0,NULL);
INSERT INTO `llx_c_holiday_types` VALUES (1,'LEAVE_SICK','Sick leave',0,0,0.00000,NULL,0,1,NULL);
INSERT INTO `llx_c_holiday_types` VALUES (2,'LEAVE_OTHER','Other leave',0,0,0.00000,NULL,0,1,NULL);
INSERT INTO `llx_c_holiday_types` VALUES (3,'LEAVE_PAID','Paid vacation',1,7,0.00000,NULL,0,1,NULL);
INSERT INTO `llx_c_holiday_types` VALUES (4,'LEAVE_RTT_FR','RTT',1,7,0.83000,1,0,0,NULL);
INSERT INTO `llx_c_holiday_types` VALUES (5,'LEAVE_PAID_FR','Paid vacation',1,30,2.08334,1,0,0,NULL);
/*!40000 ALTER TABLE `llx_c_holiday_types` ENABLE KEYS */;
UNLOCK TABLES;

View File

@ -1690,9 +1690,18 @@ if ($action == 'create') {
print load_fiche_titre($langs->trans("NewProp"), '', 'propal');
$cond_reglement_id = $mode_reglement_id = 0;
$soc = new Societe($db);
if ($socid > 0) {
$res = $soc->fetch($socid);
if (GETPOSTINT('cond_reglement_id') == 0) {
$cond_reglement_id = $soc->cond_reglement_id;
}
if (GETPOSTINT('mode_reglement_id') == 0) {
$mode_reglement_id = $soc->mode_reglement_id;
}
}
// Load objectsrc
@ -1764,6 +1773,15 @@ if ($action == 'create') {
}
}
// when payment term is empty (means not override by payment mode form a other object, like third-party), try to use default value
if (empty($cond_reglement_id)) {
$cond_reglement_id = GETPOST("cond_reglement_id", 'int');
}
// when payment mode is empty (means not override by payment mode form a other object, like third-party), try to use default value
if (empty($mode_reglement_id)) {
$mode_reglement_id = GETPOST("mode_reglement_id", 'int');
}
//Warehouse default if null
if ($soc->fk_warehouse > 0) {
$warehouse_id = $soc->fk_warehouse;
@ -1868,15 +1886,13 @@ if ($action == 'create') {
print '<tr class="field_cond_reglement_id"><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>';
print img_picto('', 'payment', 'class="pictofixedwidth"');
// at last resort we take the payment term id which may be filled by default values set (if not getpostisset)
$paymentTermId = (GETPOSTISSET('cond_reglement_id') && GETPOST('cond_reglement_id', 'int') != 0) ? GETPOST('cond_reglement_id', 'int') : (!empty($soc->cond_reglement_id) ? $soc->cond_reglement_id : GETPOST('cond_reglement_id', 'int'));
print $form->getSelectConditionsPaiements($paymentTermId, 'cond_reglement_id', 1, 1, 0, '', (GETPOSTISSET('cond_reglement_id_deposit_percent') ? GETPOST('cond_reglement_id_deposit_percent', 'alpha') : $soc->deposit_percent));
print $form->getSelectConditionsPaiements($cond_reglement_id, 'cond_reglement_id', 1, 1, 0, '', (GETPOSTISSET('cond_reglement_id_deposit_percent') ? GETPOST('cond_reglement_id_deposit_percent', 'alpha') : $soc->deposit_percent));
print '</td></tr>';
// Mode of payment
print '<tr class="field_mode_reglement_id"><td class="titlefieldcreate">'.$langs->trans('PaymentMode').'</td><td class="valuefieldcreate">';
print img_picto('', 'bank', 'class="pictofixedwidth"');
$paymentMethod = (GETPOSTISSET('mode_reglement_id') && GETPOST('mode_reglement_id', 'int') != 0) ? GETPOST('mode_reglement_id', 'int') : (!empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : GETPOST('mode_reglement_id', 'int'));
print $form->select_types_paiements($paymentMethod, 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx', 1);
print $form->select_types_paiements($mode_reglement_id, 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx', 1);
print '</td></tr>';
// Bank Account

View File

@ -2108,7 +2108,7 @@ class Propal extends CommonObject
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET datep = '".$this->db->idate($date)."'";
$sql .= " WHERE rowid = ".((int) $this->id)." AND fk_statut = ".self::STATUS_DRAFT;
$sql .= " WHERE rowid = ".((int) $this->id);
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
@ -2166,9 +2166,10 @@ class Propal extends CommonObject
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fin_validite = ".($date_end_validity != '' ? "'".$this->db->idate($date_end_validity)."'" : 'null');
$sql .= " WHERE rowid = ".((int) $this->id)." AND fk_statut = ".((int) self::STATUS_DRAFT);
$sql .= " WHERE rowid = ".((int) $this->id);
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$this->errors[] = $this->db->error();

View File

@ -106,7 +106,7 @@ $search_multicurrency_montant_ttc = GETPOST('search_multicurrency_montant_ttc',
$search_login = GETPOST('search_login', 'alpha');
$search_categ_cus = GETPOST("search_categ_cus", 'int');
$optioncss = GETPOST('optioncss', 'alpha');
$search_billed = GETPOSTISSET('search_billed') ? GETPOST('search_billed', 'int') : GETPOST('billed', 'int');
$search_billed = GETPOST('search_billed', 'int');
$search_status = GETPOST('search_status', 'int');
$search_btn = GETPOST('button_search', 'alpha');
$search_remove_btn = GETPOST('button_removefilter', 'alpha');

View File

@ -192,15 +192,16 @@ for ($annee = $year_start; $annee <= $year_end; $annee++) {
}
print '</tr>';
for ($annee = $year_start; $annee <= $year_end; $annee++) {
$totsorties[$annee] = 0;
$totentrees[$annee] = 0;
}
for ($mois = 1; $mois < 13; $mois++) {
print '<tr class="oddeven">';
print "<td>".dol_print_date(dol_mktime(1, 1, 1, $mois, 1, 2000), "%B")."</td>";
for ($annee = $year_start; $annee <= $year_end; $annee++) {
if ($mois == 1) {
$totsorties[$annee] = 0;
$totentrees[$annee] = 0;
}
$case = sprintf("%04s-%02s", $annee, $mois);
print '<td class="right" width="10%">&nbsp;';

View File

@ -434,11 +434,11 @@ if ($resql) {
if ($num) {
require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
$bac = new CompanyBankAccount($db);
while ($i < $num && $i < $limit) {
$obj = $db->fetch_object($resql);
$bac = new CompanyBankAccount($db); // Must include the new in loop so the fetch is clean
$bac->fetch(0, $obj->socid);
$invoicestatic->id = $obj->rowid;

View File

@ -6618,6 +6618,11 @@ abstract class CommonObject
$this->array_options["options_".$key] = null;
}
break;
case 'link':
if ($this->array_options["options_".$key] === '') {
$this->array_options["options_".$key] = null;
}
break;
/*
case 'link':
$param_list = array_keys($attributeParam['options']);
@ -8443,16 +8448,19 @@ abstract class CommonObject
{
global $user;
$module = $this->module;
$element = $this->element;
if ($element == 'facturerec') {
$element = 'facture';
} elseif ($element == 'invoice_supplier_rec') {
return $user->rights->fournisseur->facture;
} elseif ($element == 'evaluation') {
return $user->rights->hrm->evaluation;
} elseif ($module && !empty($user->rights->$module->$element)) {
// for modules built with ModuleBuilder
return $user->rights->$module->$element;
}
return $user->rights->{$element};
return $user->rights->$element;
}
/**

View File

@ -2088,7 +2088,7 @@ class ExtraFields
continue;
}
if (!empty($onlykey) && $onlykey == '@GETPOSTISSET' && !GETPOSTISSET('options_'.$key) && (! in_array($this->attributes[$object->table_element]['type'][$key], array('boolean', 'chkbxlst')))) {
if (!empty($onlykey) && $onlykey == '@GETPOSTISSET' && !GETPOSTISSET('options_'.$key) && (! in_array($this->attributes[$object->table_element]['type'][$key], array('boolean', 'checkbox', 'chkbxlst')))) {
//when unticking boolean field, it's not set in POST
continue;
}
@ -2115,7 +2115,7 @@ class ExtraFields
if (empty($enabled)
|| (
$onlykey === '@GETPOSTISSET'
&& in_array($this->attributes[$object->table_element]['type'][$key], array('boolean', 'chkbxlst'))
&& in_array($this->attributes[$object->table_element]['type'][$key], array('boolean', 'checkbox', 'chkbxlst'))
&& in_array(abs($enabled), array(2, 5))
&& ! GETPOSTISSET('options_' . $key) // Update hidden checkboxes and multiselect only if they are provided
)

View File

@ -243,7 +243,7 @@ class FormSetup
*/
public function saveConfFromPost($noMessageInUpdate = false)
{
global $hookmanager;
global $hookmanager, $conf;
$parameters = array();
$reshook = $hookmanager->executeHooks('formSetupBeforeSaveConfFromPost', $parameters, $this); // Note that $action and $object may have been modified by some hooks
@ -264,6 +264,10 @@ class FormSetup
$this->db->begin();
$error = 0;
foreach ($this->items as $item) {
if ($item->getType() == 'yesno' && !empty($conf->use_javascript_ajax)) {
continue;
}
$res = $item->setValueFromPost();
if ($res > 0) {
$item->saveConfValue();

View File

@ -52,19 +52,8 @@ function establishment_prepare_head($object)
$head[$h][2] = 'info';
$h++;
// $head[$h][0] = dol_buildpath("/hrm/admin/setup.php", 1);
// $head[$h][1] = $langs->trans("Settings");
// $head[$h][2] = 'settings';
// $h++;
// $head[$h][0] = dol_buildpath("/hrm/admin/about.php", 1);
// $head[$h][1] = $langs->trans("About");
// $head[$h][2] = 'about';
// $h++;
complete_head_from_modules($conf, $langs, null, $head, $h, 'hrm');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'establishment', 'remove');
return $head;
@ -77,7 +66,7 @@ function establishment_prepare_head($object)
*/
function hrm_admin_prepare_head()
{
global $langs, $conf, $user;
global $langs, $conf;
$langs->load('hrm');

View File

@ -360,6 +360,9 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '',
} else {
$objectid = $object; // $objectid can be X or 'X,Y,Z'
}
if ($objectid == "-1") {
$objectid = 0;
}
if ($objectid) {
$objectid = preg_replace('/[^0-9\.\,]/', '', $objectid); // For the case value is coming from a non sanitized user input
}

View File

@ -139,7 +139,8 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("stock")', __HANDLER__, 'left', 3102__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/list.php?mainmenu=products', 'List', 1, 'stocks', '$user->rights->stock->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("stock")', __HANDLER__, 'left', 3104__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/movement_list.php?mainmenu=products', 'Movements', 1, 'stocks', '$user->rights->stock->mouvement->lire', '', 2, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("stock") && isModEnabled("supplier_order")', __HANDLER__, 'left', 3105__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/replenish.php?mainmenu=products', 'Replenishments', 1, 'stocks', '$user->rights->stock->mouvement->creer && $user->rights->fournisseur->lire', '', 2, 4, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("stock")', __HANDLER__, 'left', 3106__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/massstockmove.php?init=1&amp;mainmenu=products', 'MassStockTransferShort', 1, 'stocks', '$user->rights->stock->mouvement->creer', '', 2, 5, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("stock")', __HANDLER__, 'left', 3106__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/stockatdate.php?mainmenu=products', 'StockAtDate', 1, 'stocks', '$user->rights->produit->lire && $user->rights->stock->lire', '', 2, 4, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("stock")', __HANDLER__, 'left', 3107__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/massstockmove.php?init=1&amp;mainmenu=products', 'MassStockTransferShort', 1, 'stocks', '$user->rights->stock->mouvement->creer', '', 2, 5, __ENTITY__);
-- Product - Categories
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("categorie")', __HANDLER__, 'left', 3200__+MAX_llx_menu__, 'products', 'cat', 3__+MAX_llx_menu__, '/categories/index.php?mainmenu=products&amp;leftmenu=cat&amp;type=0', 'Categories', 0, 'categories', '$user->hasRight("categorie","lire")', '', 2, 4, __ENTITY__);

View File

@ -375,7 +375,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t
}
if (isModEnabled('accounting') && $user->hasRight('accounting', 'comptarapport', 'lire') && $mainmenu == 'accountancy') { // Entry in accountancy journal for each bank account
$newmenu->add('', $langs->trans("RegistrationInAccounting"), 1, $user->hasRight('accounting', 'comptarapport', 'lire'), '', 'accountancy', 'accountancy', 10);
$newmenu->add('', $langs->trans("RegistrationInAccounting"), 1, $user->hasRight('accounting', 'comptarapport', 'lire'), '', 'accountancy', 'accountancy_journal', 10);
// Multi journal
$sql = "SELECT rowid, code, label, nature";

View File

@ -1677,7 +1677,7 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef
// Journals
if (isModEnabled('accounting') && $user->hasRight('accounting', 'comptarapport', 'lire') && $mainmenu == 'accountancy') {
$newmenu->add('', $langs->trans("RegistrationInAccounting"), 1, $user->hasRight('accounting', 'comptarapport', 'lire'), '', '', '');
$newmenu->add('', $langs->trans("RegistrationInAccounting"), 1, $user->hasRight('accounting', 'comptarapport', 'lire'), '', $mainmenu, 'accountancy_journal');
// Multi journal
$sql = "SELECT rowid, code, label, nature";

View File

@ -32,7 +32,7 @@ class mailing_partnership extends MailingTargets
public $require_admin = 0;
public $require_module = array(); // This module allows to select by categories must be also enabled if category module is not activated
public $require_module = array('partnership'); // This module allows to select by categories must be also enabled if category module is not activated
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png

View File

@ -364,6 +364,14 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
// Displays notes
$notetoshow = empty($object->note_public) ? '' : $object->note_public;
// Extrafields in note
if (!empty($conf->global->INVOICE_ADD_EXTRAFIELD_IN_NOTE)) {
$extranote = $this->getExtrafieldsInHtml($object, $outputlangs);
if (!empty($extranote)) {
$notetoshow = dol_concatdesc($notetoshow, $extranote);
}
}
if ($notetoshow) {
$tab_top -= 2;

View File

@ -326,6 +326,10 @@ if ($massaction == 'edit_extrafields') {
if (!empty($extrafields_list)) {
$myParamExtra = $object->showOptionals($extrafields, 'create');
foreach ($extrafields_list as $extraKey => $extraLabel) {
$extrafields_list[$extraKey] = $langs->trans($extraLabel);
}
$formquestion[] = array(
'type' => 'other',
'value' => $form->selectarray('extrafield-key-to-update', $extrafields_list, GETPOST('extrafield-key-to-update'), 1)

View File

@ -423,7 +423,8 @@ if ($nolinesbefore) {
$coldisplay++;
?>
<td class="nobottom linecolqty right">
<input type="text" name="qty" id="qty" class="flat width40 right" value="<?php echo (GETPOSTISSET("qty") ? GETPOST("qty", 'alpha', 2) : 1); ?>">
<?php $default_qty = (empty($conf->global->MAIN_OBJECTLINE_CREATE_EMPTY_QTY_BY_DEFAULT) ? 1 : ''); ?>
<input type="text" name="qty" id="qty" class="flat width40 right" value="<?php echo (GETPOSTISSET("qty") ? GETPOST("qty", 'alpha', 2) : $default_qty); ?>">
</td>
<?php
if (getDolGlobalInt('PRODUCT_USE_UNITS')) {

View File

@ -291,7 +291,7 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 2
-- SLOVAKIA (id country=201)
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2011, 201, '0', '0', 'VAT rate 0', 1);
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2012, 201, '10', '0', 'VAT rate - reduced', 1);
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2013, 201, '19', '0', 'VAT rate - standard', 1);
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2013, 201, '20', '0', 'VAT rate - standard', 1);
-- SLOVENIA (id country=202)
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2021, 202, '0', '0', 'VAT rate 0', 1);

View File

@ -29,7 +29,7 @@ FreeTextOnDonations=Free text to show in footer
FrenchOptions=Options for France
DONATION_ART200=Show article 200 from CGI if you are concerned
DONATION_ART238=Show article 238 from CGI if you are concerned
DONATION_ART885=Show article 885 from CGI if you are concerned
DONATION_ART978=Show article 978 from CGI if you are concerned
DonationPayment=Donation payment
DonationValidated=Donation %s validated
DonationUseThirdparties=Use an existing thirdparty as coordinates of donators

View File

@ -1467,7 +1467,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<tr><td>'.$langs->trans("DefaultWarehouse").'</td><td>';
print img_picto($langs->trans("DefaultWarehouse"), 'stock', 'class="pictofixedwidth"');
print $formproduct->selectWarehouses(GETPOST('fk_default_warehouse', 'int'), 'fk_default_warehouse', 'warehouseopen', 1, 0, 0, '', 0, 0, array(), 'minwidth300 widthcentpercentminusxx maxwidth500');
print ' <a href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create&token='.newToken().'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit&token='.newToken()).'">';
print ' <a href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create&token='.newToken().'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$object->id.'&action=create&token='.newToken()).'">';
print '<span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddWarehouse").'"></span>';
print '</a>';
print '</td>';
@ -2034,7 +2034,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<tr><td>'.$langs->trans("DefaultWarehouse").'</td><td>';
print img_picto($langs->trans("DefaultWarehouse"), 'stock', 'class="pictofixedwidth"');
print $formproduct->selectWarehouses((GETPOSTISSET('fk_default_warehouse') ? GETPOST('fk_default_warehouse') : $object->fk_default_warehouse), 'fk_default_warehouse', 'warehouseopen', 1);
print ' <a href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create&amp;backtopage='.urlencode($_SERVER['PHP_SELF'].'?action=create&type='.GETPOST('type', 'int')).'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddWarehouse").'"></span></a>';
print ' <a href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create&amp;backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit&token='.newToken().'&type='.GETPOST('type', 'int')).'">';
print '<span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddWarehouse").'"></span></a>';
print '</td></tr>';
/*
print "<tr>".'<td>'.$langs->trans("StockLimit").'</td><td>';

View File

@ -3101,11 +3101,12 @@ class Product extends CommonObject
if (!empty($conf->global->DECREASE_ONLY_UNINVOICEDPRODUCTS)) {
// If option DECREASE_ONLY_UNINVOICEDPRODUCTS is on, we make a compensation but only if order not yet invoice.
$adeduire = 0;
$sql = "SELECT sum(fd.qty) as count FROM ".$this->db->prefix()."facturedet as fd ";
$sql .= " JOIN ".$this->db->prefix()."facture as f ON fd.fk_facture = f.rowid ";
$sql = "SELECT SUM(".$this->db->ifsql('f.type=2', -1, 1)." * fd.qty) as count FROM ".$this->db->prefix()."facturedet as fd ";
$sql .= " JOIN ".$this->db->prefix()."facture as f ON fd.fk_facture = f.rowid";
$sql .= " JOIN ".$this->db->prefix()."element_element as el ON ((el.fk_target = f.rowid AND el.targettype = 'facture' AND sourcetype = 'commande') OR (el.fk_source = f.rowid AND el.targettype = 'commande' AND sourcetype = 'facture'))";
$sql .= " JOIN ".$this->db->prefix()."commande as c ON el.fk_source = c.rowid ";
$sql .= " JOIN ".$this->db->prefix()."commande as c ON el.fk_source = c.rowid";
$sql .= " WHERE c.fk_statut IN (".$this->db->sanitize($filtrestatut).") AND c.facture = 0 AND fd.fk_product = ".((int) $this->id);
dol_syslog(__METHOD__.":: sql $sql", LOG_NOTICE);
$resql = $this->db->query($sql);
if ($resql) {
@ -3122,11 +3123,12 @@ class Product extends CommonObject
// For every order having invoice already validated we need to decrease stock cause it's in physical stock
$adeduire = 0;
$sql = 'SELECT sum(fd.qty) as count FROM '.MAIN_DB_PREFIX.'facturedet as fd ';
$sql .= ' JOIN '.MAIN_DB_PREFIX.'facture as f ON fd.fk_facture = f.rowid ';
$sql .= ' JOIN '.MAIN_DB_PREFIX."element_element as el ON ((el.fk_target = f.rowid AND el.targettype = 'facture' AND sourcetype = 'commande') OR (el.fk_source = f.rowid AND el.targettype = 'commande' AND sourcetype = 'facture'))";
$sql .= ' JOIN '.MAIN_DB_PREFIX.'commande as c ON el.fk_source = c.rowid ';
$sql .= ' WHERE c.fk_statut IN ('.$this->db->sanitize($filtrestatut).') AND f.fk_statut > '.Facture::STATUS_DRAFT.' AND fd.fk_product = '.((int) $this->id);
$sql = "SELECT sum(".$this->db->ifsql('f.type=2', -1, 1)." * fd.qty) as count FROM ".MAIN_DB_PREFIX."facturedet as fd ";
$sql .= " JOIN ".MAIN_DB_PREFIX."facture as f ON fd.fk_facture = f.rowid";
$sql .= " JOIN ".MAIN_DB_PREFIX."element_element as el ON ((el.fk_target = f.rowid AND el.targettype = 'facture' AND sourcetype = 'commande') OR (el.fk_source = f.rowid AND el.targettype = 'commande' AND sourcetype = 'facture'))";
$sql .= " JOIN ".MAIN_DB_PREFIX."commande as c ON el.fk_source = c.rowid";
$sql .= " WHERE c.fk_statut IN (".$this->db->sanitize($filtrestatut).") AND f.fk_statut > ".Facture::STATUS_DRAFT." AND fd.fk_product = ".((int) $this->id);
dol_syslog(__METHOD__.":: sql $sql", LOG_NOTICE);
$resql = $this->db->query($sql);
if ($resql) {
@ -3134,6 +3136,9 @@ class Product extends CommonObject
$obj = $this->db->fetch_object($resql);
$adeduire += $obj->count;
}
} else {
$this->error = $this->db->error();
return -1;
}
$this->stats_commande['qty'] -= $adeduire;

View File

@ -201,7 +201,7 @@ if (empty($reshook)) {
$object->label = GETPOST("libelle");
$object->fk_parent = GETPOST("fk_parent");
$object->fk_project = GETPOST('projectid');
$object->description = GETPOST("desc");
$object->description = GETPOST("desc", 'restricthtml');
$object->statut = GETPOST("statut");
$object->lieu = GETPOST("lieu");
$object->address = GETPOST("address");

View File

@ -270,17 +270,17 @@ if (!empty($searchCategoryWarehouseList)) {
$listofcategoryid = '';
foreach ($searchCategoryWarehouseList as $searchCategoryWarehouse) {
if (intval($searchCategoryWarehouse) == -2) {
$searchCategoryWarehouseSqlList[] = "NOT EXISTS (SELECT ck.fk_warehouse FROM ".MAIN_DB_PREFIX."categorie_warehouse as ck WHERE p.rowid = ck.fk_warehouse)";
$searchCategoryWarehouseSqlList[] = " NOT EXISTS (SELECT ck.fk_warehouse FROM ".MAIN_DB_PREFIX."categorie_warehouse as ck WHERE t.rowid = ck.fk_warehouse)";
} elseif (intval($searchCategoryWarehouse) > 0) {
if ($searchCategoryWarehouseOperator == 0) {
$searchCategoryWarehouseSqlList[] = " EXISTS (SELECT ck.fk_warehouse FROM ".MAIN_DB_PREFIX."categorie_warehouse as ck WHERE p.rowid = ck.fk_warehouse AND ck.fk_categorie = ".((int) $searchCategoryWarehouse).")";
$searchCategoryWarehouseSqlList[] = " EXISTS (SELECT ck.fk_warehouse FROM ".MAIN_DB_PREFIX."categorie_warehouse as ck WHERE t.rowid = ck.fk_warehouse AND ck.fk_categorie = ".((int) $searchCategoryWarehouse).")";
} else {
$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryWarehouse);
}
}
}
if ($listofcategoryid) {
$searchCategoryWarehouseSqlList[] = " EXISTS (SELECT ck.fk_warehouse FROM ".MAIN_DB_PREFIX."categorie_warehouse as ck WHERE p.rowid = ck.fk_warehouse AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))";
$searchCategoryWarehouseSqlList[] = " EXISTS (SELECT ck.fk_warehouse FROM ".MAIN_DB_PREFIX."categorie_warehouse as ck WHERE t.rowid = ck.fk_warehouse AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))";
}
if ($searchCategoryWarehouseOperator == 1) {
if (!empty($searchCategoryWarehouseSqlList)) {

View File

@ -579,7 +579,7 @@ print '<span class="opacitymedium">'.$langs->trans("ReplenishmentStatusDesc").'<
//$link = '<a title=' .$langs->trans("MenuNewWarehouse"). ' href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create">'.$langs->trans("MenuNewWarehouse").'</a>';
if (empty($fk_warhouse) && !empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) {
if (empty($fk_entrepot) && !empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) {
print '<span class="opacitymedium">'.$langs->trans("ReplenishmentStatusDescPerWarehouse").'</span>'."\n";
}
print '<br><br>';

View File

@ -145,8 +145,9 @@ if ($date && $dateIsValid) { // Avoid heavy sql if mandatory date is not defined
$sql .= " SUM(ps.reel) AS stock";
$sql .= " FROM ".MAIN_DB_PREFIX."product_stock as ps";
$sql .= ", ".MAIN_DB_PREFIX."entrepot as w";
$sql .= ", ".MAIN_DB_PREFIX."product as p";
$sql .= " WHERE w.entity IN (".getEntity('stock').")";
$sql .= " AND w.rowid = ps.fk_entrepot";
$sql .= " AND w.rowid = ps.fk_entrepot AND p.rowid = ps.fk_product";
if (!empty($conf->global->ENTREPOT_EXTRA_STATUS) && count($warehouseStatus)) {
$sql .= " AND w.statut IN (".$db->sanitize(implode(',', $warehouseStatus)).")";
}
@ -156,6 +157,12 @@ if ($date && $dateIsValid) { // Avoid heavy sql if mandatory date is not defined
if (! empty($search_fk_warehouse)) {
$sql .= " AND ps.fk_entrepot IN (".$db->sanitize(join(",", $search_fk_warehouse)).")";
}
if ($search_ref) {
$sql .= natural_search("p.ref", $search_ref);
}
if ($search_nom) {
$sql .= natural_search("p.label", $search_nom);
}
$sql .= " GROUP BY fk_product, fk_entrepot";
//print $sql;
@ -195,8 +202,9 @@ if ($date && $dateIsValid) {
$sql = "SELECT sm.fk_product, sm.fk_entrepot, SUM(sm.value) AS stock, COUNT(sm.rowid) AS nbofmovement";
$sql .= " FROM ".MAIN_DB_PREFIX."stock_mouvement as sm";
$sql .= ", ".MAIN_DB_PREFIX."entrepot as w";
$sql .= ", ".MAIN_DB_PREFIX."product as p";
$sql .= " WHERE w.entity IN (".getEntity('stock').")";
$sql .= " AND w.rowid = sm.fk_entrepot";
$sql .= " AND w.rowid = sm.fk_entrepot AND p.rowid = sm.fk_product ";
if (!empty($conf->global->ENTREPOT_EXTRA_STATUS) && count($warehouseStatus)) {
$sql .= " AND w.statut IN (".$db->sanitize(implode(',', $warehouseStatus)).")";
}
@ -211,7 +219,14 @@ if ($date && $dateIsValid) {
if (!empty($search_fk_warehouse)) {
$sql .= " AND sm.fk_entrepot IN (".$db->sanitize(join(",", $search_fk_warehouse)).")";
}
if ($search_ref) {
$sql .= " AND p.ref LIKE '%".$db->escape($search_ref)."%' ";
}
if ($search_nom) {
$sql .= " AND p.label LIKE '%".$db->escape($search_nom)."%' ";
}
$sql .= " GROUP BY sm.fk_product, sm.fk_entrepot";
$resql = $db->query($sql);
if ($resql) {

View File

@ -1,8 +1,9 @@
<?php
/* Copyright (C) 2005-2018 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2010-2012 Destailleur Laurent <eldy@users.sourceforge.net>
* Copyright (C) 2014 Henry Florian <florian.henry@open-concept.pro>
* Copyright (C) 2010-2012 Destailleur Laurent <eldy@users.sourceforge.net>
* Copyright (C) 2014 Henry Florian <florian.henry@open-concept.pro>
* Copyright (C) 2023 Benjamin Falière <benjamin.faliere@altairis.fr>
*
* 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
@ -136,6 +137,8 @@ if (empty($reshook)) {
$object->label = GETPOST("libelle-" . $key);
$object->description = dol_htmlcleanlastbr(GETPOST("desc-" . $key, 'restricthtml'));
$object->other = dol_htmlcleanlastbr(GETPOST("other-" . $key, 'restricthtml'));
$object->update($object->id, $user);
} else {
$object->multilangs[$key]["label"] = GETPOST("libelle-" . $key);
$object->multilangs[$key]["description"] = dol_htmlcleanlastbr(GETPOST("desc-" . $key, 'restricthtml'));

View File

@ -485,7 +485,7 @@ print img_picto('', 'projecttask', 'class="pictofixedwidth"');
$formproject->selectTasks($socid ? $socid : -1, $taskid, 'taskid', 32, 0, '-- '.$langs->trans("ChooseANotYetAssignedTask").' --', 1, 0, 0, '', '', 'all', $usertoprocess);
print '</div>';
print ' ';
print $formcompany->selectTypeContact($object, '', 'type', 'internal', 'rowid', 0, 'maxwidth150onsmartphone');
print $formcompany->selectTypeContact($object, '', 'type', 'internal', 'position', 0, 'maxwidth150onsmartphone');
print '<input type="submit" class="button valignmiddle smallonsmartphone small" name="assigntask" value="'.dol_escape_htmltag($titleassigntask).'">';
print '</div>';

View File

@ -399,7 +399,7 @@ print img_picto('', 'projecttask', 'class="pictofixedwidth"');
$formproject->selectTasks($socid ? $socid : -1, $taskid, 'taskid', 32, 0, '-- '.$langs->trans("ChooseANotYetAssignedTask").' --', 1);
print '</div>';
print ' ';
print $formcompany->selectTypeContact($object, '', 'type', 'internal', 'rowid', 0, 'maxwidth150onsmartphone');
print $formcompany->selectTypeContact($object, '', 'type', 'internal', 'position', 0, 'maxwidth150onsmartphone');
print '<input type="submit" class="button valignmiddle smallonsmartphone small" name="assigntask" value="'.dol_escape_htmltag($titleassigntask).'">';
print '</div>';

View File

@ -499,7 +499,7 @@ print img_picto('', 'projecttask', 'class="pictofixedwidth"');
$formproject->selectTasks($socid ? $socid : -1, $taskid, 'taskid', 32, 0, '-- '.$langs->trans("ChooseANotYetAssignedTask").' --', 1, 0, 0, '', '', 'all', $usertoprocess);
print '</div>';
print ' ';
print $formcompany->selectTypeContact($object, '', 'type', 'internal', 'rowid', 0, 'maxwidth150onsmartphone');
print $formcompany->selectTypeContact($object, '', 'type', 'internal', 'position', 0, 'maxwidth150onsmartphone');
print '<input type="submit" class="button valignmiddle smallonsmartphone small" name="assigntask" value="'.dol_escape_htmltag($titleassigntask).'">';
print '</div>';

View File

@ -777,7 +777,7 @@ if ($action == 'create' && $user->rights->projet->creer) {
}
// Budget
print '<tr class="classusetask classusebilltime"><td>'.$langs->trans("Budget").'</td>';
print '<tr><td>'.$langs->trans("Budget").'</td>';
print '<td><input class="width75 right" type="text" name="budget_amount" value="'.dol_escape_htmltag(GETPOSTISSET('budget_amount') ? GETPOST('budget_amount') : '').'">';
print ' '.$langs->getCurrencySymbol($conf->currency);
print '</td>';
@ -1148,7 +1148,7 @@ if ($action == 'create' && $user->rights->projet->creer) {
}
// Budget
print '<tr class="classusetask classusebilltime"><td>'.$langs->trans("Budget").'</td>';
print '<tr><td>'.$langs->trans("Budget").'</td>';
print '<td><input class="width75 right" type="text" name="budget_amount" value="'.(GETPOSTISSET('budget_amount') ? GETPOST('budget_amount') : (strcmp($object->budget_amount, '') ? price2num($object->budget_amount) : '')).'">';
print $langs->getCurrencySymbol($conf->currency);
print '</td>';

View File

@ -411,7 +411,7 @@ if ($id > 0 || !empty($ref)) {
print $form->select_dolusers((GETPOSTISSET('userid') ? GETPOST('userid', 'int') : $user->id), 'userid', 0, '', 0, '', $contactsofproject, 0, 0, 0, '', 1, $langs->trans("ResourceNotAssignedToProject"));
print '</td>';
print '<td>';
$formcompany->selectTypeContact($object, '', 'type', 'internal', 'rowid');
$formcompany->selectTypeContact($object, '', 'type', 'internal', 'position');
print '</td>';
print '<td class="right" colspan="3" ><input type="submit" class="button button-add" value="'.$langs->trans("Add").'" name="addsourceinternal"></td>';
print '</tr>';
@ -436,7 +436,7 @@ if ($id > 0 || !empty($ref)) {
$nbofcontacts = $form->num;
print '</td>';
print '<td>';
$formcompany->selectTypeContact($object, '', 'typecontact', 'external', 'rowid');
$formcompany->selectTypeContact($object, '', 'typecontact', 'external', 'position');
print '</td>';
print '<td class="right" colspan="3" ><input type="submit" class="button" id="add-customer-contact" name="addsourceexternal" value="'.$langs->trans("Add").'"';
if (!$nbofcontacts) {

View File

@ -284,7 +284,7 @@ if (empty($reshook)) {
// TODO Mutualise the list into object societe.class.php
$objects = array(
'Adherent' => '/adherents/class/adherent.class.php',
'Don' => '/don/class/don.class.php',
'Don' => array('file' => '/don/class/don.class.php', 'enabled' => isModEnabled('don')),
'Societe' => '/societe/class/societe.class.php',
//'Categorie' => '/categories/class/categorie.class.php',
'ActionComm' => '/comm/action/class/actioncomm.class.php',
@ -305,7 +305,7 @@ if (empty($reshook)) {
'Delivery' => '/delivery/class/delivery.class.php',
'Product' => '/product/class/product.class.php',
'Project' => '/projet/class/project.class.php',
'Ticket' => '/ticket/class/ticket.class.php',
'Ticket' => array('file' => '/ticket/class/ticket.class.php', 'enabled' => isModEnabled('ticket')),
'User' => '/user/class/user.class.php',
'Account' => '/compta/bank/class/account.class.php',
'ConferenceOrBoothAttendee' => '/eventorganization/class/conferenceorboothattendee.class.php'
@ -313,6 +313,13 @@ if (empty($reshook)) {
//First, all core objects must update their tables
foreach ($objects as $object_name => $object_file) {
if (is_array($object_file)) {
if (empty($object_file['enabled'])) {
continue;
}
$object_file = $object_file['file'];
}
require_once DOL_DOCUMENT_ROOT.$object_file;
if (!$error && !$object_name::replaceThirdparty($db, $soc_origin->id, $object->id)) {

View File

@ -6466,7 +6466,7 @@ input.select2-input {
}
div.select2-drop-above
{
background: var(--colorbackvmenu1);e
background: var(--colorbackvmenu1);
-webkit-box-shadow: none !important;
box-shadow: none !important;
}

View File

@ -571,4 +571,3 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) {
border: 1px solid #e0e0e0;
}
}
}

View File

@ -119,7 +119,8 @@ $data = $stats->getAmountByMonthWithPrevYear($endyear, $startyear);
//var_dump($data);
// $data = array(array('Lib',val1,val2,val3),...)
if (empty($user->rights->societe->client->voir) || $user->socid) {
/*if (empty($user->rights->societe->client->voir) || $user->socid) {
$filenameamount = $dir.'/ticketsamountinyear-'.$user->id.'-'.$year.'.png';
$fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=ticketstats&file=ticketsamountinyear-'.$user->id.'-'.$year.'.png';
} else {
@ -182,7 +183,7 @@ if (!$mesg) {
$px3->SetTitle($langs->trans("AmountAverage"));
$px3->draw($filename_avg, $fileurl_avg);
}
}*/