Merge branch '12.0' of https://github.com/dolibarr/dolibarr into 12.0

This commit is contained in:
Laurent Destailleur 2021-01-28 00:18:35 +01:00
commit 19a5caf212
41 changed files with 161 additions and 82 deletions

1
.gitignore vendored
View File

@ -16,6 +16,7 @@ default.properties
.DS_Store
.idea
*.iml
*.orig
Thumbs.db
/dolibarr_genesis.mp4
# Log files

View File

@ -87,6 +87,7 @@ if (empty($search_date_start) && !GETPOSTISSET('formfilteraction'))
} else {
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
$year_start = dol_print_date(dol_now(), '%Y');
if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year
$year_end = $year_start + 1;
$month_end = $month_start - 1;
if ($month_end < 1)

View File

@ -66,6 +66,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
if ($action != 'updateedit' && !$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}

View File

@ -256,6 +256,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
$db->commit();
}
else

View File

@ -577,6 +577,7 @@ if ($id == 11)
// 'contract' => $langs->trans('Contract'),
'project' => $langs->trans('Project'),
'project_task' => $langs->trans('Task'),
'ticket' => $langs->trans('Ticket'),
'agenda' => $langs->trans('Agenda'),
'dolresource' => $langs->trans('Resource'),
// old deprecated
@ -1454,6 +1455,7 @@ if ($id)
foreach ($fieldlist as $field => $value)
{
//var_dump($fieldlist);
$class = '';
$showfield = 1;
$valuetoshow = $obj->{$fieldlist[$field]};

View File

@ -57,6 +57,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
if ($action != 'updateedit' && !$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}

View File

@ -273,7 +273,7 @@ if (!$error && $xml)
}
else
{
$out .= '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
$out .= '<tr class="oddeven"><td colspan="4" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
}
$out .= '</table>';
$out .= '</div>';
@ -328,7 +328,7 @@ if (!$error && $xml)
}
else
{
$out .= '<tr class="oddeven"><td colspan="6" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
$out .= '<tr class="oddeven"><td colspan="7" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
}
$out .= '</table>';
$out .= '</div>';
@ -383,7 +383,7 @@ if (!$error && $xml)
}
else
{
$out .= '<tr class="oddeven"><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
$out .= '<tr class="oddeven"><td colspan="6" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
}
$out .= '</table>';
$out .= '</div>';

View File

@ -185,6 +185,8 @@ if (empty($reshook))
unset($_POST['disable_stock_change']);
$object->fetchLines();
$object->calculateCosts();
}
}
}
@ -196,7 +198,7 @@ if (empty($reshook))
$error = 0;
// Set if we used free entry or predefined product
$qty = price2num(GETPOST('qty', 'int'));
$qty = price2num(GETPOST('qty', 'alpha'));
$qty_frozen = GETPOST('qty_frozen', 'int');
$disable_stock_change = GETPOST('disable_stock_change', 'int');
$efficiency = price2num(GETPOST('efficiency', 'int'));
@ -227,6 +229,8 @@ if (empty($reshook))
unset($_POST['disable_stock_change']);
$object->fetchLines();
$object->calculateCosts();
}
}
}

View File

@ -116,7 +116,6 @@ if ($conf->global->PRODUCT_USE_UNITS)
{
$coldisplay++;
print '<td class="nobottom linecoluseunit left">';
print $form->selectUnits($line->fk_unit, "units");
print '</td>';
}

View File

@ -112,7 +112,6 @@ if ($conf->global->PRODUCT_USE_UNITS)
{
$coldisplay++;
print '<td class="nobottom linecoluseunit left">';
print $form->selectUnits($line->fk_unit, "units");
print '</td>';
}

View File

@ -82,7 +82,7 @@ print '</td>';
if ($conf->global->PRODUCT_USE_UNITS)
{
print '<td class="linecoluseunit nowrap left">';
$label = $line->getLabelOfUnit('short');
$label = $tmpproduct->getLabelOfUnit('short');
if ($label !== '') {
print $langs->trans($label);
}

View File

@ -277,10 +277,8 @@ print '</td></tr>';
// Bank account
if (!empty($conf->banque->enabled))
{
if ($object->fk_account > 0)
{
if ($object->type_code == 'CHQ' && $bankline->fk_bordereau > 0)
{
if ($object->fk_account > 0) {
if ($object->type_code == 'CHQ' && $bankline->fk_bordereau > 0) {
dol_include_once('/compta/paiement/cheque/class/remisecheque.class.php');
$bordereau = new RemiseCheque($db);
$bordereau->fetch($bankline->fk_bordereau);
@ -297,7 +295,12 @@ if (!empty($conf->banque->enabled))
print '<tr>';
print '<td>'.$langs->trans('BankTransactionLine').'</td>';
print '<td>';
print $bankline->getNomUrl(1, 0, 'showconciliatedandaccounted');
if ($object->fk_account > 0) {
print $bankline->getNomUrl(1, 0, 'showconciliatedandaccounted');
} else {
$langs->load("admin");
print '<span class="opacitymedium">'.$langs->trans("NoRecordFoundIBankcAccount", $langs->transnoentitiesnoconv("Module85Name")).'</span>';
}
print '</td>';
print '</tr>';
}

View File

@ -224,7 +224,7 @@ if ($action == 'create')
print '<tr><td class="fieldrequired">'.$langs->trans("Date").'</td><td>';
$datepaye = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
$datepayment = empty($conf->global->MAIN_AUTOFILL_DATE) ? (empty($_POST["remonth"]) ?-1 : $datepaye) : 0;
$datepayment = empty($conf->global->MAIN_AUTOFILL_DATE) ? (empty($_POST["remonth"]) ?-1 : $datepaye) : '';
print $form->selectDate($datepayment, '', '', '', '', "add_payment", 1, 1);
print "</td>";
print '</tr>';

View File

@ -106,6 +106,7 @@ class box_shipments extends ModeleBoxes
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON e.fk_soc = sc.fk_soc";
$sql .= " WHERE e.entity IN (".getEntity('expedition').")";
if (!empty($conf->global->ORDER_BOX_LAST_SHIPMENTS_VALIDATED_ONLY)) $sql .= " AND e.fk_statut = 1";
if ($user->socid > 0) $sql.= " AND s.rowid = ".$user->socid;
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND sc.fk_user = ".$user->id;
else $sql .= " ORDER BY e.date_delivery, e.ref DESC ";
$sql .= $this->db->plimit($max, 0);

View File

@ -4725,7 +4725,7 @@ function price2num($amount, $rounding = '', $option = 0)
if ($option != 1) { // If not a PHP number or unknown, we change or clean format
//print 'PP'.$amount.' - '.$dec.' - '.$thousand.' - '.intval($amount).'<br>';
if (!is_numeric($amount)) {
$amount = preg_replace('/[a-zA-Z\/\\\*\(\)\<\>]/', '', $amount);
$amount = preg_replace('/[a-zA-Z\/\\\*\(\)\<\>\_]/', '', $amount);
}
if ($option == 2 && $thousand == '.' && preg_match('/\.(\d\d\d)$/', (string) $amount)) { // It means the . is used as a thousand separator and string come frominput data, so 1.123 is 1123

View File

@ -343,7 +343,7 @@ class pdf_strato extends ModelePDFContract
}
$txtpredefinedservice = '';
$txtpredefinedservice = $objectligne->product_label;
$txtpredefinedservice = $objectligne->product_ref;
if ($objectligne->product_label)
{
$txtpredefinedservice .= ' - ';

View File

@ -373,14 +373,15 @@ class pdf_rouget extends ModelePdfExpedition
$tab_top_alt = $tab_top;
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities("TrackingNumber")." : ".$object->tracking_number, 0, 1, false, true, 'L');
$tab_top_alt = $pdf->GetY();
//$tab_top_alt += 1;
// Tracking number
if (!empty($object->tracking_number))
{
$pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities("TrackingNumber")." : ".$object->tracking_number, 0, 1, false, true, 'L');
$tab_top_alt = $pdf->GetY();
$object->getUrlTrackingStatus($object->tracking_number);
if (!empty($object->tracking_url))
{

View File

@ -68,7 +68,7 @@ class mod_mo_advanced extends ModeleNumRefMos
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$texte .= '<input type="hidden" name="token" value="'.newToken().'">';
$texte .= '<input type="hidden" name="action" value="updateMask">';
$texte .= '<input type="hidden" name="maskconstBom" value="MRP_MO_ADVANCED_MASK">';
$texte .= '<input type="hidden" name="maskconstMo" value="MRP_MO_ADVANCED_MASK">';
$texte .= '<table class="nobordernopadding" width="100%">';
$tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("Mo"), $langs->transnoentities("Mo"));

View File

@ -209,7 +209,7 @@ if ($action == 'presend')
}
$formmail->withto = $liste;
$formmail->withtofree = (GETPOSTISSET('sendto') ? (GETPOST('sendto') ? GETPOST('sendto') : '1') : '1');
$formmail->withtofree = (GETPOSTISSET('sendto') ? (GETPOST('sendto', 'alpha') ? GETPOST('sendto', 'alpha') : '1') : '1');
$formmail->withtocc = $liste;
$formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC;
$formmail->withtopic = $topicmail;

View File

@ -55,7 +55,10 @@ foreach ($object->fields as $key => $val)
print '<td>';
if (in_array($val['type'], array('int', 'integer'))) $value = GETPOST($key, 'int');
elseif ($val['type'] == 'text' || $val['type'] == 'html') $value = GETPOST($key, 'none');
else $value = GETPOST($key, 'alpha');
elseif ($val['type'] == 'date') $value = dol_mktime(12, 0, 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int'));
elseif ($val['type'] == 'datetime') $value = dol_mktime(GETPOST($key.'hour', 'int'), GETPOST($key.'min', 'int'), 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int'));
elseif ($val['type'] == 'boolean') $value = (GETPOST($key) == 'on' ? 1 : 0);
else $value = GETPOST($key, 'alphanohtml');
if ($val['noteditable']) print $object->showOutputField($val, $key, $value, '', '', '', 0);
else print $object->showInputField($val, $key, $value, '', '', '', 0);
print '</td>';

View File

@ -38,6 +38,7 @@ if (!empty($extrafieldsobjectkey) && !empty($search_array_options) && is_array($
$mode_search = 0;
if (in_array($typ, array('int', 'double', 'real', 'price'))) $mode_search = 1; // Search on a numeric
if (in_array($typ, array('sellist', 'link')) && $crit != '0' && $crit != '-1') $mode_search = 2; // Search on a foreign key int
if (in_array($typ, array('sellist')) && !is_numeric($crit)) $mode_search = 0;// Search on a foreign key string
if (in_array($typ, array('chkbxlst', 'checkbox'))) $mode_search = 4; // Search on a multiselect field with sql type = text
if (is_array($crit)) $crit = implode(' ', $crit); // natural_search() expects a string
elseif ($typ === 'select' and is_string($crit) and strpos($crit, ' ') === false) {

View File

@ -251,11 +251,21 @@ class InterfaceTicketEmail extends DolibarrTriggers
if (empty($conf->global->TICKET_DISABLE_CUSTOMER_MAILS) && empty($object->context['disableticketemail']) && $object->notify_tiers_at_create)
{
$sendto = '';
if (empty($user->socid) && empty($user->email)) {
$object->fetch_thirdparty();
$sendto = $object->thirdparty->email;
} else {
$sendto = $user->email;
//if contact selected send to email's contact else send to email's thirdparty
$contactid = GETPOST('contactid', 'alpha');
if(!empty($contactid)) {
$contact = new Contact($this->db);
$res = $contact->fetch($contactid);
}
if($res > 0 && !empty($contact->email) && !empty($contact->statut)) {
$sendto = $contact->email;
} elseif (!empty($object->fk_soc)) {
$object->fetch_thirdparty();
$sendto = $object->thirdparty->email;
}
if ($sendto) {

View File

@ -340,7 +340,7 @@ if ($resql)
if ($search_product_category != '') $param .= '&search_product_category='.urlencode($search_product_category);
if ($search_categ_cus > 0) $param .= '&search_categ_cus='.urlencode($search_categ_cus);
if ($search_status != '') $param .= '&viewstatut='.urlencode($search_status);
if ($search_status != '') $param .= '&search_status='.urlencode($search_status);
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';

View File

@ -260,7 +260,13 @@ if (empty($reshook))
}
// Extrafields
$extrafields = new ExtraFields($db);
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object);
if ($ret < 0) {
$error++;
$action = 'create';
}
$array_options = $extrafields->getOptionalsFromPost($object->table_element);
$object->array_options = $array_options;

View File

@ -1107,7 +1107,7 @@ if (empty($reshook))
$tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
if (GETPOST('price_ht') != '')
if (GETPOST('price_ht') != '' || GETPOST('multicurrency_subprice') != '')
{
$up = price2num(GETPOST('price_ht'));
$price_base_type = 'HT';

View File

@ -155,9 +155,9 @@ class Odf
'<style:style style:name="subText" style:family="text"><style:text-properties style:text-position="sub 58%" /></style:style>',
'<style:style style:name="supText" style:family="text"><style:text-properties style:text-position="super 58%" /></style:style>'
);
$this->vars[$tag] = $this->_replaceHtmlWithOdtTag($this->_getDataFromHtml($value), $customStyles, $fontDeclarations);
foreach ($customStyles as $key => $val) {
array_push($automaticStyles, '<style:style style:name="customStyle' . $key . '" style:family="text">' . $val . '</style:style>');
}
@ -181,7 +181,7 @@ class Odf
$this->contentXml = str_replace('</office:font-face-decls>', $fonts . '</office:font-face-decls>', $this->contentXml);
}
else $this->vars[$tag] = preg_replace('/(\r\n|\r|\n)/i', "<text:line-break/>", $value);
return $this;
}
@ -804,6 +804,7 @@ IMG;
// Export to PDF using LibreOffice
if ($conf->global->MAIN_ODT_AS_PDF == 'libreoffice')
{
// Install prerequisites: apt install soffice libreoffice-common libreoffice-writer
// using windows libreoffice that must be in path
// using linux/mac libreoffice that must be in path
// Note PHP Config "fastcgi.impersonate=0" must set to 0 - Default is 1
@ -840,7 +841,7 @@ IMG;
}
else
{
// deprecated old method
// deprecated old method using odt2pdf.sh (native, jodconverter, ...)
$tmpname=preg_replace('/\.odt/i', '', $name);
if (!empty($conf->global->MAIN_DOL_SCRIPTS_ROOT))

View File

@ -343,6 +343,7 @@ ALTER TABLE llx_commande_fournisseurdet ADD INDEX idx_commande_fournisseurdet_fk
-- VMYSQL4.3 ALTER TABLE llx_c_shipment_mode MODIFY COLUMN tracking varchar(255) NULL;
-- VPGSQL8.2 ALTER TABLE llx_c_shipment_mode ALTER COLUMN tracking DROP NOT NULL;
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (9,'INPERSON', 'In person at your site', NULL, NULL, 0);
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (10,'FEDEX', 'Fedex', NULL, 'https://www.fedex.com/apps/fedextrack/index.html?tracknumbers={TRACKID}', 0);

View File

@ -176,3 +176,4 @@ BankColorizeMovement=Colorize movements
BankColorizeMovementDesc=If this function is enable, you can choose specific background color for debit or credit movements
BankColorizeMovementName1=Background color for debit movement
BankColorizeMovementName2=Background color for credit movement
NoRecordFoundIBankcAccount=No record found in bank account. Commonly, this occurs when a record has been deleted manually from the list of transaction in the bank account (for example during a reconciliation of the bank account). Another reason is that the payment was recorded when the module "%s" was disabled.

View File

@ -216,6 +216,7 @@ Value=Value
PersonalValue=Personal value
NewObject=New %s
NewValue=New value
OldValue=Old value %s
CurrentValue=Current value
Code=Code
Type=Type

View File

@ -848,6 +848,7 @@ Permission773=Supprimer les notes de frais
Permission774=Lire toutes les notes de frais (même pour les utilisateurs en dehors de ma hierarchie)
Permission775=Approuver les notes de frais
Permission776=Payer les notes de frais
Permission777=Lire les notes de frais de tout le monde
Permission779=Exporter les notes de frais
Permission1001=Consulter les stocks
Permission1002=Créer/modifier entrepôts

View File

@ -16,7 +16,7 @@
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2016 Meziane Sof <virtualsof@yahoo.fr>
* Copyright (C) 2017 Josep Lluís Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-2020 Thibault FOUCART <support@ptibogxiv.net>
*
* This program is free software; you can redistribute it and/or modify
@ -1297,11 +1297,10 @@ else
// Accountancy_code_buy
print '<tr><td>'.$langs->trans("ProductAccountancyBuyCode").'</td>';
print '<td>';
if ($type == 0)
{
if ($type == 0) {
$accountancy_code_buy = (GETPOST('accountancy_code_buy', 'alpha') ? (GETPOST('accountancy_code_buy', 'alpha')) : $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT);
} else {
$accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha');
$accountancy_code_buy = (GETPOST('accountancy_code_buy', 'alpha') ? (GETPOST('accountancy_code_buy', 'alpha')) : $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT);
}
print $formaccounting->select_account($accountancy_code_buy, 'accountancy_code_buy', 1, null, 1, 1, '');
print '</td></tr>';

View File

@ -195,9 +195,9 @@ $arrayfields = array(
'p.volume_units'=>array('label'=>$langs->trans('VolumeUnits'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_VOLUME) && $type != '1'), 'position'=>31),
'cu.label'=>array('label'=>$langs->trans("DefaultUnitToShow"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && !empty($conf->global->PRODUCT_USE_UNITS)), 'position'=>32),
'p.sellprice'=>array('label'=>$langs->trans("SellingPrice"), 'checked'=>1, 'enabled'=>empty($conf->global->PRODUIT_MULTIPRICES), 'position'=>40),
'p.minbuyprice'=>array('label'=>$langs->trans("BuyingPriceMinShort"), 'checked'=>1, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>41),
'p.numbuyprice'=>array('label'=>$langs->trans("BuyingPriceNumShort"), 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>42),
'p.tva_tx'=>array('label'=>$langs->trans("VATRate"), 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>43),
'p.tva_tx'=>array('label'=>$langs->trans("VATRate"), 'checked'=>0, 'enabled'=>empty($conf->global->PRODUIT_MULTIPRICES), 'position'=>41),
'p.minbuyprice'=>array('label'=>$langs->trans("BuyingPriceMinShort"), 'checked'=>1, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>42),
'p.numbuyprice'=>array('label'=>$langs->trans("BuyingPriceNumShort"), 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>43),
'p.pmp'=>array('label'=>$langs->trans("PMPValueShort"), 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>44),
'p.seuil_stock_alerte'=>array('label'=>$langs->trans("StockLimit"), 'checked'=>0, 'enabled'=>(!empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service'), 'position'=>50),
'p.desiredstock'=>array('label'=>$langs->trans("DesiredStock"), 'checked'=>1, 'enabled'=>(!empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service'), 'position'=>51),
@ -360,7 +360,7 @@ if ($search_barcode) $sql .= natural_search('p.barcode', $search_barcode);
if (isset($search_tosell) && dol_strlen($search_tosell) > 0 && $search_tosell != -1) $sql .= " AND p.tosell = ".((int) $search_tosell);
if (isset($search_tobuy) && dol_strlen($search_tobuy) > 0 && $search_tobuy != -1) $sql .= " AND p.tobuy = ".((int) $search_tobuy);
if (isset($search_tobatch) && dol_strlen($search_tobatch) > 0 && $search_tobatch != -1) $sql .= " AND p.tobatch = ".((int) $search_tobatch);
if ($search_vatrate) $sql .= natural_search('p.tva_tx', $search_vatrate);
if ($search_vatrate) $sql .= natural_search('p.tva_tx', $search_vatrate, 1);
if (dol_strlen($canvas) > 0) $sql .= " AND p.canvas = '".$db->escape($canvas)."'";
if ($catid > 0) $sql .= " AND cp.fk_categorie = ".$catid;
if ($catid == -2) $sql .= " AND cp.fk_categorie IS NULL";
@ -466,7 +466,11 @@ if ($resql)
}
}
llxHeader('', $title, $helpurl, '');
foreach ($searchCategoryProductList as $searchCategoryProduct) {
$paramsCat .= "&search_category_product_list[]=".urlencode($searchCategoryProduct);
}
llxHeader('', $title, $helpurl, '', 0, 0, "", "", $paramsCat);
// Displays product removal confirmation
if (GETPOST('delprod')) {
@ -877,7 +881,7 @@ if ($resql)
print_liste_field_titre($arrayfields['p.numbuyprice']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right ');
}
if (!empty($arrayfields['p.tva_tx']['checked'])) {
print_liste_field_titre($arrayfields['p.tva_tx']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre($arrayfields['p.tva_tx']['label'], $_SERVER["PHP_SELF"], 'p.tva_tx', "", $param, '', $sortfield, $sortorder, 'right ');
}
if (!empty($arrayfields['p.pmp']['checked'])) {
print_liste_field_titre($arrayfields['p.pmp']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right ');

View File

@ -176,7 +176,8 @@ if (empty($reshook))
if (!$error && $result > 0)
{
// Add myself as project leader
$result = $object->add_contact($user->id, 'PROJECTLEADER', 'internal');
$typeofcontact = 'PROJECTLEADER'; // TODO If use rename this code in dictionary, the add_contact will generate an error.
$result = $object->add_contact($user->id, $typeofcontact, 'internal');
if ($result < 0)
{
$langs->load("errors");

View File

@ -20,9 +20,8 @@
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
$sql = "SELECT p.fk_opp_status as opp_status, cls.code, COUNT(p.rowid) as nb, SUM(p.opp_amount) as opp_amount, SUM(p.opp_amount * p.opp_percent) as ponderated_opp_amount";
$sql .= " FROM ".MAIN_DB_PREFIX."projet as p, ".MAIN_DB_PREFIX."c_lead_status as cls";
$sql .= " FROM ".MAIN_DB_PREFIX."projet as p LEFT JOIN ".MAIN_DB_PREFIX."c_lead_status as cls ON p.fk_opp_status = cls.rowid"; // If lead status has been removed, we must show it in stats as unknown
$sql .= " WHERE p.entity IN (".getEntity('project').")";
$sql .= " AND p.fk_opp_status = cls.rowid";
$sql .= " AND p.fk_statut = 1"; // Opend projects only
if ($mine || empty($user->rights->projet->all->lire)) $sql .= " AND p.rowid IN (".$projectsListId.")";
if ($socid) $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
@ -66,7 +65,15 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder nohover centpercent">';
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("OpportunitiesStatusForOpenedProjects").'</th></tr>'."\n";
$listofstatus = array_keys($listofoppstatus);
// Complete with values found into database and not into the dictionary
foreach ($valsamount as $key => $val) {
if (!in_array($key, $listofstatus) && $key) {
$listofstatus[] = $key;
}
}
foreach ($listofstatus as $status)
{
$labelStatus = '';
@ -74,6 +81,7 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
$code = dol_getIdFromCode($db, $status, 'c_lead_status', 'rowid', 'code');
if ($code) $labelStatus = $langs->transnoentitiesnoconv("OppStatus".$code);
if (empty($labelStatus)) $labelStatus = $listofopplabel[$status];
if (empty($labelStatus)) $labelStatus = $langs->transnoentitiesnoconv('OldValue', $status); // When id is id of an entry no more in dictionary for example.
//$labelStatus .= ' ('.$langs->trans("Coeff").': '.price2num($listofoppstatus[$status]).')';
//$labelStatus .= ' - '.price2num($listofoppstatus[$status]).'%';

View File

@ -162,7 +162,7 @@ $morehtmlcenter = '';
if (!empty($conf->agenda->enabled))
{
$addActionBtnRight = !empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create);
$morehtmlcenter .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $addActionBtnRight);
$morehtmlcenter .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'&socid='.$object->socid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $addActionBtnRight);
}
//print '</div>';

View File

@ -1542,12 +1542,12 @@ else
//}
// Supplier
//if ($object->fournisseur) {
print '<tr class="visibleifsupplier"><td class="toptd">'.$form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0).'</td><td colspan="3">';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, 'parent', null, null, 1);
print $form->multiselectarray('suppcats', $cate_arbo, GETPOST('suppcats', 'array'), null, null, null, null, "90%");
print "</td></tr>";
//}
if (!empty($conf->fournisseur->enabled)) {
print '<tr class="visibleifsupplier"><td class="toptd">'.$form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0).'</td><td colspan="3">';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, 'parent', null, null, 1);
print $form->multiselectarray('suppcats', $cate_arbo, GETPOST('suppcats', 'array'), null, null, null, null, "90%");
print "</td></tr>";
}
}
// Multicurrency
@ -2180,17 +2180,19 @@ else
print "</td></tr>";
// Supplier
print '<tr class="visibleifsupplier"><td>'.$form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0).'</td>';
print '<td colspan="3">';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, null, null, null, 1);
$c = new Categorie($db);
$cats = $c->containing($object->id, Categorie::TYPE_SUPPLIER);
$arrayselected = array();
foreach ($cats as $cat) {
$arrayselected[] = $cat->id;
if (!empty($conf->fournisseur->enabled)) {
print '<tr class="visibleifsupplier"><td>'.$form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0).'</td>';
print '<td colspan="3">';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, null, null, null, 1);
$c = new Categorie($db);
$cats = $c->containing($object->id, Categorie::TYPE_SUPPLIER);
$arrayselected = array();
foreach($cats as $cat) {
$arrayselected[] = $cat->id;
}
print $form->multiselectarray('suppcats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%');
print "</td></tr>";
}
print $form->multiselectarray('suppcats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%');
print "</td></tr>";
}
// Multicurrency
@ -2560,7 +2562,7 @@ else
}
// Supplier
if ($object->fournisseur) {
if (!empty($conf->fournisseur->enabled) && $object->fournisseur) {
print '<tr><td>'.$langs->trans("SuppliersCategoriesShort").'</td>';
print '<td>';
print $form->showCategories($object->id, Categorie::TYPE_SUPPLIER, 1);

View File

@ -3654,7 +3654,7 @@ class Societe extends CommonObject
public function create_from_member(Adherent $member, $socname = '', $socalias = '', $customercode = '')
{
// phpcs:enable
global $user, $langs;
global $conf, $user, $langs;
dol_syslog(get_class($this)."::create_from_member", LOG_DEBUG);
@ -3687,6 +3687,23 @@ class Societe extends CommonObject
$result = $this->create($user);
if ($result >= 0)
{
// Auto-create contact on thirdparty creation
if (!empty($conf->global->THIRDPARTY_DEFAULT_CREATE_CONTACT))
{
// Fill fields needed by contact
$this->name_bis = $member->lastname;
$this->firstname = $member->firstname;
$this->civility_id = $member->civility_id;
dol_syslog("We ask to create a contact/address too", LOG_DEBUG);
$result = $this->create_individual($user);
if ($result < 0)
{
setEventMessages($this->error, $this->errors, 'errors');
$this->db->rollback();
return -1;
}
}
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent";
$sql .= " SET fk_soc=".$this->id;
$sql .= " WHERE rowid=".$member->id;

View File

@ -428,11 +428,11 @@ class Stripe extends CommonObject
// payment_method =
// payment_method_types = array('card')
//var_dump($dataforintent);
if ($off_session)
{
unset($dataforintent['setup_future_usage']);
$dataforintent["off_session"] = true;
}
if ($off_session)
{
unset($dataforintent['setup_future_usage']);
$dataforintent["setup_future_usage"] = "off_session";
}
if (!is_null($payment_method))
{
$dataforintent["payment_method"] = $payment_method;

View File

@ -560,17 +560,21 @@ if (empty($reshook)) {
// Action to update one extrafield
if ($action == "update_extras" && !empty($permissiontoadd)) {
$object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha'));
$attributekey = GETPOST('attribute', 'alpha');
$attributekeylong = 'options_' . $attributekey;
$object->array_options['options_' . $attributekey] = GETPOST($attributekeylong, ' alpha');
$result = $object->insertExtraFields(empty($triggermodname) ? '' : $triggermodname, $user);
if ($result > 0) {
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
$action = 'view';
} else {
$ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'none'));
if ($ret < 0) $error++;
if (!$error)
{
$result = $object->insertExtraFields(empty($triggermodname) ? '' : $triggermodname, $user);
if ($result < 0) { $error++; }
}
if ($error) {
setEventMessages($object->error, $object->errors, 'errors');
$action = 'edit_extras';
} else {
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
$action = 'view';
}
}

View File

@ -346,11 +346,12 @@ foreach ($search as $key => $val)
$newarrayofstatus[] = $val2;
}
if ($search['fk_statut'] == 'openall' || in_array('openall', $search['fk_statut'])) {
$newarrayofstatus[] = Ticket::STATUS_NOT_READ;
$newarrayofstatus[] = Ticket::STATUS_ASSIGNED;
$newarrayofstatus[] = Ticket::STATUS_IN_PROGRESS;
$newarrayofstatus[] = Ticket::STATUS_NEED_MORE_INFO;
$newarrayofstatus[] = Ticket::STATUS_WAITING;
$newarrayofstatus[] = Ticket::STATUS_NOT_READ;
$newarrayofstatus[] = Ticket::STATUS_READ;
$newarrayofstatus[] = Ticket::STATUS_ASSIGNED;
$newarrayofstatus[] = Ticket::STATUS_IN_PROGRESS;
$newarrayofstatus[] = Ticket::STATUS_NEED_MORE_INFO;
$newarrayofstatus[] = Ticket::STATUS_WAITING;
}
if ($search['fk_statut'] == 'closeall' || in_array('closeall', $search['fk_statut'])) {
$newarrayofstatus[] = Ticket::STATUS_CLOSED;

View File

@ -675,6 +675,10 @@ class UserGroup extends CommonObject
{
global $user, $conf;
if (empty($this->nom) && !empty($this->name)) {
$this->nom = $this->name;
}
$entity = $conf->entity;
if (!empty($conf->multicompany->enabled) && $conf->entity == 1)
{