Merge pull request #1 from Dolibarr/develop

Sync forked repo
This commit is contained in:
MaximilienR-easya 2023-02-01 09:39:36 +01:00 committed by GitHub
commit b6cc2fdeab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
568 changed files with 6095 additions and 3327 deletions

View File

@ -18,7 +18,7 @@ jobs:
fetch-depth: 1 fetch-depth: 1
#php-version: '7.1' #php-version: '7.1'
- name: 'Qodana Scan' - name: 'Qodana Scan'
uses: JetBrains/qodana-action@v2022.3.0 uses: JetBrains/qodana-action@v2022.3.2
#with: #with:
# php-version: '7.1' # php-version: '7.1'
env: env:

View File

@ -209,6 +209,11 @@ with
with with
foreach ($value[1] as $k => $v) { foreach ($value[1] as $k => $v) {
* Fix by replacing
if ($res[0] == PDF_TYPE_OBJECT)
with
if ($res && $res[0] == PDF_TYPE_OBJECT)
JSGANTT: JSGANTT:

View File

@ -493,7 +493,7 @@ if (empty($reshook)) {
if ($conf->global->ACCOUNTING_REEXPORT == 1) { if ($conf->global->ACCOUNTING_REEXPORT == 1) {
setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsEnable"), null, 'mesgs'); setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsEnable"), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsDisable"), null, 'mesgs'); setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsDisable"), null, 'warnings');
} }
} else { } else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
@ -1002,11 +1002,14 @@ $newcardbutton = empty($hookmanager->resPrint) ? '' : $hookmanager->resPrint;
if (empty($reshook)) { if (empty($reshook)) {
// Button re-export // Button re-export
if (!empty($conf->global->ACCOUNTING_REEXPORT)) { if (!empty($conf->global->ACCOUNTING_REEXPORT)) {
$newcardbutton .= '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=0'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("Activated"), 'switch_on').'</a> '; $newcardbutton .= '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=0'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("ClickToHideAlreadyExportedLines"), 'switch_off', 'class="small size15x valignmiddle"');
$newcardbutton .= '<span class="valignmiddle marginrightonly paddingleft">'.$langs->trans("ClickToHideAlreadyExportedLines").'</span>';
$newcardbutton .= '</a>';
} else { } else {
$newcardbutton .= '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=1'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a> '; $newcardbutton .= '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=1'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("DocsAlreadyExportedAreExcluded"), 'switch_on', 'class="warning size15x valignmiddle"').'';
$newcardbutton .= '<span class="valignmiddle marginrightonly paddingleft">'.$langs->trans("DocsAlreadyExportedAreExcluded").'</span>';
$newcardbutton .= '</a>';
} }
$newcardbutton .= '<span class="valignmiddle marginrightonly">'.$langs->trans("IncludeDocsAlreadyExported").'</span>';
if ($user->hasRight('accounting', 'mouvements', 'export')) { if ($user->hasRight('accounting', 'mouvements', 'export')) {
$newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file&token='.newToken().($param ? '&'.$param : ''), $user->hasRight('accounting', 'mouvements', 'export')); $newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file&token='.newToken().($param ? '&'.$param : ''), $user->hasRight('accounting', 'mouvements', 'export'));
@ -1040,7 +1043,7 @@ if ($massaction == 'preunletteringauto') {
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
if ($massactionbutton && $contextpage != 'poslist') { if ($massactionbutton && $contextpage != 'poslist') {
$selectedfields .= $form->showCheckAddButtons('checkforselect', 1); $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
} }
@ -1066,7 +1069,7 @@ print $moreforfilter;
print '</div>'; print '</div>';
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="tagtable liste centpercent">'; print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">';
// Filters lines // Filters lines
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
@ -1222,8 +1225,7 @@ print "</tr>\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn ');}
}
if (!empty($arrayfields['t.piece_num']['checked'])) { if (!empty($arrayfields['t.piece_num']['checked'])) {
print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder); print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
} }

View File

@ -5,7 +5,7 @@
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Pierre-Henry Favre <phf@atm-consulting.fr> * Copyright (C) 2016 Pierre-Henry Favre <phf@atm-consulting.fr>
* Copyright (C) 2016-2022 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2016-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2022 Lionel Vessiller <lvessiller@open-dsi.fr> * Copyright (C) 2022 Lionel Vessiller <lvessiller@open-dsi.fr>
* Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com> * Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2017 Elarifr. Ari Elbaz <github@accedinfo.com> * Copyright (C) 2017 Elarifr. Ari Elbaz <github@accedinfo.com>
@ -203,7 +203,7 @@ class AccountancyExport
'ACCOUNTING_EXPORT_FORMAT' => empty($conf->global->ACCOUNTING_EXPORT_FORMAT) ? 'txt' : $conf->global->ACCOUNTING_EXPORT_FORMAT, 'ACCOUNTING_EXPORT_FORMAT' => empty($conf->global->ACCOUNTING_EXPORT_FORMAT) ? 'txt' : $conf->global->ACCOUNTING_EXPORT_FORMAT,
'ACCOUNTING_EXPORT_SEPARATORCSV' => empty($conf->global->ACCOUNTING_EXPORT_SEPARATORCSV) ? ',' : $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV, 'ACCOUNTING_EXPORT_SEPARATORCSV' => empty($conf->global->ACCOUNTING_EXPORT_SEPARATORCSV) ? ',' : $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV,
'ACCOUNTING_EXPORT_ENDLINE' => empty($conf->global->ACCOUNTING_EXPORT_ENDLINE) ? 1 : $conf->global->ACCOUNTING_EXPORT_ENDLINE, 'ACCOUNTING_EXPORT_ENDLINE' => empty($conf->global->ACCOUNTING_EXPORT_ENDLINE) ? 1 : $conf->global->ACCOUNTING_EXPORT_ENDLINE,
'ACCOUNTING_EXPORT_DATE' => empty($conf->global->ACCOUNTING_EXPORT_DATE) ? '%d%m%Y' : $conf->global->ACCOUNTING_EXPORT_DATE, 'ACCOUNTING_EXPORT_DATE' => getDolGlobalString('ACCOUNTING_EXPORT_DATE', '%Y-%m-%d'),
), ),
self::$EXPORT_TYPE_CEGID => array( self::$EXPORT_TYPE_CEGID => array(
'label' => $langs->trans('Modelcsv_CEGID'), 'label' => $langs->trans('Modelcsv_CEGID'),
@ -682,7 +682,7 @@ class AccountancyExport
/** /**
* Export format : Quadratus (Format ASCII) * Export format : Quadratus (Format ASCII)
* Format since 2015 compatible QuadraCOMPTA * Format since 2015 compatible QuadraCOMPTA
* Last review for this format : 2021/09/13 Alexandre Spangaro (aspangaro@open-dsi.fr) * Last review for this format : 2023/01/28 Alexandre Spangaro (aspangaro@open-dsi.fr)
* *
* Help : https://docplayer.fr/20769649-Fichier-d-entree-ascii-dans-quadracompta.html * Help : https://docplayer.fr/20769649-Fichier-d-entree-ascii-dans-quadracompta.html
* In QuadraCompta | Use menu : "Outils" > "Suivi des dossiers" > "Import ASCII(Compta)" * In QuadraCompta | Use menu : "Outils" > "Suivi des dossiers" > "Import ASCII(Compta)"
@ -703,6 +703,14 @@ class AccountancyExport
// $date_ecriture = dol_print_date(dol_now(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy // $date_ecriture = dol_print_date(dol_now(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
// $date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy // $date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
foreach ($TData as $data) { foreach ($TData as $data) {
// Clean some data
$data->doc_ref = dol_string_unaccent($data->doc_ref);
$data->label_operation = dol_string_unaccent($data->label_operation);
$data->numero_compte = dol_string_unaccent($data->numero_compte);
$data->label_compte = dol_string_unaccent($data->label_compte);
$data->subledger_account = dol_string_unaccent($data->subledger_account);
$data->subledger_label = dol_string_unaccent($data->subledger_label);
$code_compta = $data->numero_compte; $code_compta = $data->numero_compte;
if (!empty($data->subledger_account)) { if (!empty($data->subledger_account)) {
$code_compta = $data->subledger_account; $code_compta = $data->subledger_account;
@ -734,9 +742,9 @@ class AccountancyExport
if ($data->doc_type == 'customer_invoice') { if ($data->doc_type == 'customer_invoice') {
$Tab['type_compte'] = 'C'; $Tab['type_compte'] = 'C';
} elseif ($data->doc_type == 'supplier_invoice') { } elseif ($data->doc_type == 'supplier_invoice') {
$Tab['coll_compte'] = 'F'; $Tab['type_compte'] = 'F';
} else { } else {
$Tab['coll_compte'] = 'G'; $Tab['type_compte'] = 'G';
} }
$Tab['filler3'] = str_repeat(' ', 235); $Tab['filler3'] = str_repeat(' ', 235);
@ -761,7 +769,7 @@ class AccountancyExport
//$Tab['date_ecriture'] = $date_ecriture; //$Tab['date_ecriture'] = $date_ecriture;
$Tab['date_ecriture'] = dol_print_date($data->doc_date, '%d%m%y'); $Tab['date_ecriture'] = dol_print_date($data->doc_date, '%d%m%y');
$Tab['filler'] = ' '; $Tab['filler'] = ' ';
$Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 20), 20); $Tab['libelle_ecriture'] = str_pad(self::trunc($data->doc_ref.' '.$data->label_operation, 20), 20);
// Credit invoice - invert sens // Credit invoice - invert sens
/* /*
@ -811,8 +819,8 @@ class AccountancyExport
// TODO: we should filter more than only accent to avoid wrong line size // TODO: we should filter more than only accent to avoid wrong line size
// TODO: remove invoice number doc_ref in libelle, // TODO: remove invoice number doc_ref in libelle,
// TODO: we should offer an option for customer to build the libelle using invoice number / name / date in accounting software // TODO: we should offer an option for customer to build the libelle using invoice number / name / date in accounting software
//$Tab['libelle_ecriture2'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref) . ' ' . dol_string_unaccent($data->label_operation), 30), 30); //$Tab['libelle_ecriture2'] = str_pad(self::trunc($data->doc_ref . ' ' . $data->label_operation, 30), 30);
$Tab['libelle_ecriture2'] = str_pad(self::trunc(dol_string_unaccent($data->label_operation), 30), 30); $Tab['libelle_ecriture2'] = str_pad(self::trunc($data->label_operation, 30), 30);
$Tab['codetva'] = str_repeat(' ', 2); $Tab['codetva'] = str_repeat(' ', 2);
// We need to keep the 10 lastest number of invoice doc_ref not the beginning part that is the unusefull almost same part // We need to keep the 10 lastest number of invoice doc_ref not the beginning part that is the unusefull almost same part

View File

@ -723,7 +723,7 @@ class AccountingAccount extends CommonObject
} }
/** /**
* Return Suggest accounting accounts to bind * Return a suggested account (from chart of accounts) to bind
* *
* @param Societe $buyer Object buyer * @param Societe $buyer Object buyer
* @param Societe $seller Object seller * @param Societe $seller Object seller
@ -733,6 +733,8 @@ class AccountingAccount extends CommonObject
* @param array $accountingAccount Array of Accounting account * @param array $accountingAccount Array of Accounting account
* @param string $type Customer / Supplier * @param string $type Customer / Supplier
* @return array|int Accounting accounts suggested or < 0 if technical error. * @return array|int Accounting accounts suggested or < 0 if technical error.
* 'suggestedaccountingaccountbydefaultfor'=>Will be used for the label to show on tooltip for account by default on any product
* 'suggestedaccountingaccountfor'=>Is the account suggested for this product
*/ */
public function getAccountingCodeToBind(Societe $buyer, Societe $seller, Product $product, $facture, $factureDet, $accountingAccount = array(), $type = '') public function getAccountingCodeToBind(Societe $buyer, Societe $seller, Product $product, $facture, $factureDet, $accountingAccount = array(), $type = '')
{ {

View File

@ -43,10 +43,11 @@ $langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other",
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha'); $massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array'); $toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'accountancycustomerlist'; // To manage different context of search
$optioncss = GETPOST('optioncss', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha');
$default_account = GETPOST('default_account', 'int'); $default_account = GETPOST('default_account', 'int');
// Select Box // Select Box
@ -73,8 +74,6 @@ $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_en
$search_country = GETPOST('search_country', 'alpha'); $search_country = GETPOST('search_country', 'alpha');
$search_tvaintra = GETPOST('search_tvaintra', 'alpha'); $search_tvaintra = GETPOST('search_tvaintra', 'alpha');
$btn_ventil = GETPOST('ventil', 'alpha');
// Load variable for pagination // Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST('sortfield', 'aZ09comma'); $sortfield = GETPOST('sortfield', 'aZ09comma');
@ -520,8 +519,8 @@ if ($result) {
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("VATIntraShort", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("VATIntraShort", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'nowraponall '); print_liste_field_titre("DataUsedToSuggestAccount", '', '', '', '', '', '', '', 'nowraponall ');
print_liste_field_titre("IntoAccount", '', '', '', '', '', '', '', 'center '); print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'center ');
$checkpicto = ''; $checkpicto = '';
if ($massactionbutton) { if ($massactionbutton) {
$checkpicto = $form->showCheckAddButtons('checkforselect', 1); $checkpicto = $form->showCheckAddButtons('checkforselect', 1);
@ -640,7 +639,7 @@ if ($result) {
print '<td class="center">'.dol_print_date($facture_static->date, 'day').'</td>'; print '<td class="center">'.dol_print_date($facture_static->date, 'day').'</td>';
// Ref Product // Ref Product
print '<td class="tdoverflowmax150">'; print '<td class="tdoverflowmax100">';
if ($product_static->id > 0) { if ($product_static->id > 0) {
print $product_static->getNomUrl(1); print $product_static->getNomUrl(1);
} }
@ -649,7 +648,7 @@ if ($result) {
} }
print '</td>'; print '</td>';
// Description // Description of line
print '<td class="tdoverflowonsmartphone small">'; print '<td class="tdoverflowonsmartphone small">';
$text = dolGetFirstLineOfText(dol_string_nohtmltag($facture_static_det->desc, 1)); $text = dolGetFirstLineOfText(dol_string_nohtmltag($facture_static_det->desc, 1));
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION; $trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
@ -683,15 +682,22 @@ if ($result) {
// Found accounts // Found accounts
print '<td class="small">'; print '<td class="small">';
// First show default account for any products
$s = '1. '.(($facture_static_det->product_type == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': '; $s = '1. '.(($facture_static_det->product_type == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
$shelp = ''; $shelp = ''; $ttype = 'help';
if ($suggestedaccountingaccountbydefaultfor == 'eec') { if ($suggestedaccountingaccountbydefaultfor == 'eec') {
$shelp .= $langs->trans("SaleEEC"); $shelp .= $langs->trans("SaleEEC");
} elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithvat') {
$shelp = $langs->trans("SaleEECWithVAT");
} elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithoutvatnumber') {
$shelp = $langs->trans("SaleEECWithoutVATNumber");
$ttype = 'warning';
} elseif ($suggestedaccountingaccountbydefaultfor == 'export') { } elseif ($suggestedaccountingaccountbydefaultfor == 'export') {
$shelp .= $langs->trans("SaleExport"); $shelp .= $langs->trans("SaleExport");
} }
$s .= ($code_sell_l > 0 ? length_accountg($code_sell_l) : '<span style="'.$code_sell_p_notset.'">'.$langs->trans("NotDefined").'</span>'); $s .= ($code_sell_l > 0 ? length_accountg($code_sell_l) : '<span style="'.$code_sell_p_notset.'">'.$langs->trans("NotDefined").'</span>');
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); print $form->textwithpicto($s, $shelp, 1, $ttype, '', 0, 2, '', 1);
// Now show account for product
if ($product_static->id > 0) { if ($product_static->id > 0) {
print '<br>'; print '<br>';
$s = '2. '.(($facture_static_det->product_type == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': '; $s = '2. '.(($facture_static_det->product_type == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';

View File

@ -58,6 +58,8 @@ $year_current = $year_start;
// Validate History // Validate History
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
// Security check // Security check
if (!isModEnabled('accounting')) { if (!isModEnabled('accounting')) {
accessforbidden(); accessforbidden();
@ -65,7 +67,7 @@ if (!isModEnabled('accounting')) {
if ($user->socid > 0) { if ($user->socid > 0) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->mouvements->lire)) { if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
accessforbidden(); accessforbidden();
} }
@ -74,7 +76,7 @@ if (empty($user->rights->accounting->mouvements->lire)) {
* Actions * Actions
*/ */
if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accounting->bind->write) { if (($action == 'clean' || $action == 'validatehistory') && $user->hasRight('accounting', 'bind', 'write')) {
// Clean database // Clean database
$db->begin(); $db->begin();
$sql1 = "UPDATE ".MAIN_DB_PREFIX."expensereport_det as erd"; $sql1 = "UPDATE ".MAIN_DB_PREFIX."expensereport_det as erd";
@ -110,8 +112,7 @@ if ($action == 'validatehistory') {
$sql1 = "SELECT erd.rowid, accnt.rowid as suggestedid"; $sql1 = "SELECT erd.rowid, accnt.rowid as suggestedid";
$sql1 .= " FROM ".MAIN_DB_PREFIX."expensereport_det as erd"; $sql1 .= " FROM ".MAIN_DB_PREFIX."expensereport_det as erd";
$sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_fees as t ON erd.fk_c_type_fees = t.id"; $sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_fees as t ON erd.fk_c_type_fees = t.id";
$sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as accnt ON t.accountancy_code = accnt.account_number AND accnt.active = 1 AND accnt.entity =".((int) $conf->entity); $sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as accnt ON t.accountancy_code = accnt.account_number AND accnt.active = 1 AND accnt.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND accnt.entity =".((int) $conf->entity);
$sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as syst ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid = ".((int) $conf->global->CHARTOFACCOUNTS).' AND syst.active = 1,';
$sql1 .= " ".MAIN_DB_PREFIX."expensereport as er"; $sql1 .= " ".MAIN_DB_PREFIX."expensereport as er";
$sql1 .= " WHERE erd.fk_expensereport = er.rowid AND er.entity = ".((int) $conf->entity); $sql1 .= " WHERE erd.fk_expensereport = er.rowid AND er.entity = ".((int) $conf->entity);
$sql1 .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.") AND erd.fk_code_ventilation <= 0"; $sql1 .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.") AND erd.fk_code_ventilation <= 0";
@ -182,6 +183,7 @@ llxHeader('', $langs->trans("ExpenseReportsVentilation"));
$textprevyear = '<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current - 1).'">'.img_previous().'</a>'; $textprevyear = '<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current - 1).'">'.img_previous().'</a>';
$textnextyear = '&nbsp;<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current + 1).'">'.img_next().'</a>'; $textnextyear = '&nbsp;<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current + 1).'">'.img_next().'</a>';
print load_fiche_titre($langs->trans("ExpenseReportsVentilation")."&nbsp;".$textprevyear."&nbsp;".$langs->trans("Year")."&nbsp;".$year_start."&nbsp;".$textnextyear, '', 'title_accountancy'); print load_fiche_titre($langs->trans("ExpenseReportsVentilation")."&nbsp;".$textprevyear."&nbsp;".$langs->trans("Year")."&nbsp;".$year_start."&nbsp;".$textnextyear, '', 'title_accountancy');
print '<span class="opacitymedium">'.$langs->trans("DescVentilExpenseReport").'</span><br>'; print '<span class="opacitymedium">'.$langs->trans("DescVentilExpenseReport").'</span><br>';
@ -253,7 +255,7 @@ $sql .= " AND aa.account_number IS NULL";
$sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label"; $sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label";
$sql .= ' ORDER BY aa.account_number'; $sql .= ' ORDER BY aa.account_number';
dol_syslog('/accountancy/expensereport/index.php:: sql='.$sql); dol_syslog('/accountancy/expensereport/index.php', LOG_DEBUG);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) { if ($resql) {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);

View File

@ -40,10 +40,9 @@ $langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other",
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha'); $massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array'); $toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'expensereportlist'; // To manage different context of search $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'accountancyexpensereportlist'; // To manage different context of search
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
@ -419,8 +418,8 @@ if ($result) {
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, '', $sortfield, $sortorder, 'right maxwidth50 '); print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, '', $sortfield, $sortorder, 'right maxwidth50 ');
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'nowraponall '); print_liste_field_titre("DataUsedToSuggestAccount", '', '', '', '', '', '', '', 'nowraponall ');
print_liste_field_titre("IntoAccount", '', '', '', '', '', '', '', ''); print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', '');
$checkpicto = ''; $checkpicto = '';
if ($massactionbutton) { if ($massactionbutton) {
$checkpicto = $form->showCheckAddButtons('checkforselect', 1); $checkpicto = $form->showCheckAddButtons('checkforselect', 1);

View File

@ -44,10 +44,11 @@ $langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other",
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha'); $massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array'); $toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'accountancysupplierlist'; // To manage different context of search
$optioncss = GETPOST('optioncss', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha');
$default_account = GETPOST('default_account', 'int'); $default_account = GETPOST('default_account', 'int');
// Select Box // Select Box
@ -75,8 +76,6 @@ $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_en
$search_country = GETPOST('search_country', 'alpha'); $search_country = GETPOST('search_country', 'alpha');
$search_tvaintra = GETPOST('search_tvaintra', 'alpha'); $search_tvaintra = GETPOST('search_tvaintra', 'alpha');
$btn_ventil = GETPOST('ventil', 'alpha');
// Load variable for pagination // Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST('sortfield', 'aZ09comma'); $sortfield = GETPOST('sortfield', 'aZ09comma');
@ -112,7 +111,7 @@ if (!isModEnabled('accounting')) {
if ($user->socid > 0) { if ($user->socid > 0) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->mouvements->lire)) { if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
accessforbidden(); accessforbidden();
} }
@ -532,8 +531,8 @@ if ($result) {
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("VATIntraShort", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("VATIntraShort", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'nowraponall '); print_liste_field_titre("DataUsedToSuggestAccount", '', '', '', '', '', '', '', 'nowraponall ');
print_liste_field_titre("IntoAccount", '', '', '', '', '', '', '', 'center '); print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'center ');
$checkpicto = ''; $checkpicto = '';
if ($massactionbutton) { if ($massactionbutton) {
$checkpicto = $form->showCheckAddButtons('checkforselect', 1); $checkpicto = $form->showCheckAddButtons('checkforselect', 1);
@ -712,14 +711,19 @@ if ($result) {
// Found accounts // Found accounts
print '<td class="small">'; print '<td class="small">';
$s = '1. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': '; $s = '1. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
$shelp = ''; $shelp = ''; $ttype = 'help';
if ($suggestedaccountingaccountbydefaultfor == 'eec') { if ($suggestedaccountingaccountbydefaultfor == 'eec') {
$shelp .= $langs->trans("SaleEEC"); $shelp .= $langs->trans("SaleEEC");
} elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithvat') {
$shelp = $langs->trans("SaleEECWithVAT");
} elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithoutvatnumber') {
$shelp = $langs->trans("SaleEECWithoutVATNumber");
$ttype = 'warning';
} elseif ($suggestedaccountingaccountbydefaultfor == 'export') { } elseif ($suggestedaccountingaccountbydefaultfor == 'export') {
$shelp .= $langs->trans("SaleExport"); $shelp .= $langs->trans("SaleExport");
} }
$s .= ($code_buy_l > 0 ? length_accountg($code_buy_l) : '<span style="'.$code_buy_p_notset.'">'.$langs->trans("NotDefined").'</span>'); $s .= ($code_buy_l > 0 ? length_accountg($code_buy_l) : '<span style="'.$code_buy_p_notset.'">'.$langs->trans("NotDefined").'</span>');
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); print $form->textwithpicto($s, $shelp, 1, $ttype, '', 0, 2, '', 1);
if ($product_static->id > 0) { if ($product_static->id > 0) {
print '<br>'; print '<br>';
$s = '2. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': '; $s = '2. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';

View File

@ -313,10 +313,6 @@ if (empty($reshook)) {
$object->socialnetworks[$key] = trim(GETPOST($key, 'alphanohtml')); $object->socialnetworks[$key] = trim(GETPOST($key, 'alphanohtml'));
} }
} }
//$object->skype = trim(GETPOST("skype", 'alpha'));
//$object->twitter = trim(GETPOST("twitter", 'alpha'));
//$object->facebook = trim(GETPOST("facebook", 'alpha'));
//$object->linkedin = trim(GETPOST("linkedin", 'alpha'));
$object->birth = $birthdate; $object->birth = $birthdate;
$object->default_lang = GETPOST('default_lang', 'alpha'); $object->default_lang = GETPOST('default_lang', 'alpha');
$object->typeid = GETPOST("typeid", 'int'); $object->typeid = GETPOST("typeid", 'int');
@ -488,11 +484,6 @@ if (empty($reshook)) {
} }
} }
// $object->skype = $skype;
// $object->twitter = $twitter;
// $object->facebook = $facebook;
// $object->linkedin = $linkedin;
$object->email = $email; $object->email = $email;
$object->url = $url; $object->url = $url;
$object->login = $login; $object->login = $login;

View File

@ -639,7 +639,7 @@ class AdherentType extends CommonObject
$sql .= ' AND ('.$excludefilter.')'; $sql .= ' AND ('.$excludefilter.')';
} }
dol_syslog(get_class($this)."::listUsersForGroup", LOG_DEBUG); dol_syslog(get_class($this)."::listMembersForMemberType", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
while ($obj = $this->db->fetch_object($resql)) { while ($obj = $this->db->fetch_object($resql)) {

View File

@ -171,4 +171,82 @@ class AdherentStats extends Stats
return $this->_getAllByYear($sql); return $this->_getAllByYear($sql);
} }
/**
* Return count of member by status group by adh type, total and average
*
* @param int $numberYears Years to scan
* @return array Array with total of draft, pending, uptodate, expired, resiliated for each member tag
*/
public function countMembersByTagAndStatus($numberYears = 2)
{
global $user;
$now = dol_now();
$endYear = date('Y');
$startYear = $endYear - $numberYears;
$sql = "SELECT c.rowid as fk_categorie, c.label as label";
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_DRAFT, "'members_draft'", 'NULL').") as members_draft";
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_VALIDATED." AND (d.datefin IS NULL AND t.subscription = '1')", "'members_pending'", 'NULL').") as members_pending";
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_VALIDATED." AND (d.datefin >= '".$this->db->idate($now)."' OR t.subscription = 0)", "'members_uptodate'", 'NULL').") as members_uptodate";
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_VALIDATED." AND (d.datefin < '".$this->db->idate($now)."' AND t.subscription = 1)", "'members_expired'", 'NULL').") as members_expired";
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_EXCLUDED, "'members_excluded'", 'NULL').") as members_excluded";
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_RESILIATED, "'members_resiliated'", 'NULL').") as members_resiliated";
$sql .= " FROM ".MAIN_DB_PREFIX."categorie as c";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_member as ct ON c.rowid = ct.fk_categorie";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent as d ON d.rowid = ct.fk_member";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent_type as t ON t.rowid = d.fk_adherent_type";
$sql .= " WHERE c.entity IN (".getEntity('member_type').")";
$sql .= " AND d.entity IN (" . getEntity('adherent') . ")";
$sql .= " AND t.entity IN (" . getEntity('adherent') . ")";
$sql .= " AND d.datefin > '".$this->db->idate(dol_get_first_day($startYear))."'";
$sql .= " AND c.fk_parent = 0";
$sql .= " GROUP BY c.rowid";
dol_syslog("box_members_by_type::select nb of members per type", LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
$num = $this->db->num_rows($result);
$i = 0;
$MembersCountArray = [];
$totalstatus = array(
'label' => 'Total',
'members_draft' => 0,
'members_pending' => 0,
'members_uptodate' => 0,
'members_expired' => 0,
'members_excluded' => 0,
'members_resiliated' => 0
);
while ($i < $num) {
$objp = $this->db->fetch_object($result);
$MembersCountArray[$objp->fk_categorie] = array(
'label' => $objp->label,
'members_draft' => (int) $objp->members_draft,
'members_pending' => (int) $objp->members_pending,
'members_uptodate' => (int) $objp->members_uptodate,
'members_expired' => (int) $objp->members_expired,
'members_excluded' => (int) $objp->members_excluded,
'members_resiliated' => (int) $objp->members_resiliated
);
$totalrow = 0;
foreach ($MembersCountArray[$objp->fk_categorie] as $key=>$nb) {
if ($key!='label') {
$totalrow += $nb;
$totalstatus[$key] += $nb;
}
}
$MembersCountArray[$objp->fk_categorie]['total_adhtype'] = $totalrow;
$i++;
}
$this->db->free($result);
$MembersCountArray['total'] = $totalstatus;
$MembersCountArray['total']['all'] = array_sum($totalstatus);
}
return $MembersCountArray;
}
} }

View File

@ -30,9 +30,9 @@
// Load Dolibarr environment // Load Dolibarr environment
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
@ -41,47 +41,51 @@ $langs->loadLangs(array("members", "companies"));
// Get parameters // Get parameters
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha'); $massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int'); $show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array'); $cancel = GETPOST('cancel', 'alpha');
$toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'memberslist'; // To manage different context of search $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'memberslist'; // To manage different context of search
$mode = GETPOST('mode', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha');
$optioncss = GETPOST('optioncss', 'aZ');
$mode = GETPOST('mode', 'alpha');
// Search fields // Search fields
$search = GETPOST("search", 'alpha'); $search = GETPOST("search", 'alpha');
$search_ref = GETPOST("search_ref", 'alpha'); $search_ref = GETPOST("search_ref", 'alpha');
$search_lastname = GETPOST("search_lastname", 'alpha'); $search_lastname = GETPOST("search_lastname", 'alpha');
$search_firstname = GETPOST("search_firstname", 'alpha'); $search_firstname = GETPOST("search_firstname", 'alpha');
$search_gender = GETPOST("search_gender", 'alpha'); $search_gender = GETPOST("search_gender", 'alpha');
$search_civility = GETPOST("search_civility", 'alpha'); $search_civility = GETPOST("search_civility", 'alpha');
$search_company = GETPOST('search_company', 'alphanohtml'); $search_company = GETPOST('search_company', 'alphanohtml');
$search_login = GETPOST("search_login", 'alpha'); $search_login = GETPOST("search_login", 'alpha');
$search_address = GETPOST("search_address", 'alpha'); $search_address = GETPOST("search_address", 'alpha');
$search_zip = GETPOST("search_zip", 'alpha'); $search_zip = GETPOST("search_zip", 'alpha');
$search_town = GETPOST("search_town", 'alpha'); $search_town = GETPOST("search_town", 'alpha');
$search_state = GETPOST("search_state", 'alpha'); $search_state = GETPOST("search_state", 'alpha'); // county / departement / federal state
$search_country = GETPOST("search_country", 'alpha'); $search_country = GETPOST("search_country", 'alpha');
$search_phone = GETPOST("search_phone", 'alpha'); $search_phone = GETPOST("search_phone", 'alpha');
$search_phone_perso = GETPOST("search_phone_perso", 'alpha'); $search_phone_perso = GETPOST("search_phone_perso", 'alpha');
$search_phone_mobile = GETPOST("search_phone_mobile", 'alpha'); $search_phone_mobile = GETPOST("search_phone_mobile", 'alpha');
$search_type = GETPOST("search_type", 'alpha'); $search_type = GETPOST("search_type", 'alpha');
$search_email = GETPOST("search_email", 'alpha'); $search_email = GETPOST("search_email", 'alpha');
$search_categ = GETPOST("search_categ", 'int'); $search_categ = GETPOST("search_categ", 'int');
$search_filter = GETPOST("search_filter", 'alpha'); $search_morphy = GETPOST("search_morphy", 'alpha');
$search_status = GETPOST("search_status", 'intcomma');
$search_morphy = GETPOST("search_morphy", 'alpha');
$search_import_key = trim(GETPOST("search_import_key", 'alpha')); $search_import_key = trim(GETPOST("search_import_key", 'alpha'));
$catid = GETPOST("catid", 'int');
$optioncss = GETPOST('optioncss', 'alpha'); $catid = GETPOST("catid", 'int');
$socid = GETPOST('socid', 'int'); $socid = GETPOST('socid', 'int');
$search_filter = GETPOST("search_filter", 'alpha');
$search_status = GETPOST("search_status", 'intcomma'); // statut
$filter = GETPOST("filter", 'alpha'); $filter = GETPOST("filter", 'alpha');
if ($filter) { if ($filter) {
$search_filter = $filter; // For backward compatibility $search_filter = $filter; // For backward compatibility
} }
$statut = GETPOST("statut", 'alpha'); $statut = GETPOST("statut", 'alpha');
if ($statut != '') { if ($statut != '') {
$search_status = $statut; // For backward compatibility $search_status = $statut; // For backward compatibility
@ -93,6 +97,7 @@ if ($search_status < -2) {
$search_status = ''; $search_status = '';
} }
// Pagination parameters
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma');

View File

@ -117,7 +117,7 @@ if ($action == 'updateMask') {
} elseif ($action == 'del') { } elseif ($action == 'del') {
$ret = delDocumentModel($value, $type); $ret = delDocumentModel($value, $type);
if ($ret > 0) { if ($ret > 0) {
if ($conf->global->COMMANDE_ADDON_PDF == "$value") { if (getDolGlobalString('COMMANDE_ADDON_PDF') == $value) {
dolibarr_del_const($db, 'COMMANDE_ADDON_PDF', $conf->entity); dolibarr_del_const($db, 'COMMANDE_ADDON_PDF', $conf->entity);
} }
} }
@ -461,7 +461,7 @@ foreach ($dirmodels as $reldir) {
// Default // Default
print '<td class="center">'; print '<td class="center">';
if ($conf->global->COMMANDE_ADDON_PDF == $name) { if (getDolGlobalString('COMMANDE_ADDON_PDF') == $name) {
print img_picto($langs->trans("Default"), 'on'); print img_picto($langs->trans("Default"), 'on');
} else { } else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';

View File

@ -195,7 +195,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
dolibarr_set_const($db, "MAIN_INFO_PROFID6", GETPOST("MAIN_INFO_PROFID6", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_PROFID6", GETPOST("MAIN_INFO_PROFID6", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_TVAINTRA", GETPOST("tva", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_TVAINTRA", GETPOST("tva", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_OBJECT", GETPOST("object", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_OBJECT", GETPOST("socialobject", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "SOCIETE_FISCAL_MONTH_START", GETPOST("SOCIETE_FISCAL_MONTH_START", 'int'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "SOCIETE_FISCAL_MONTH_START", GETPOST("SOCIETE_FISCAL_MONTH_START", 'int'), 'chaine', 0, '', $conf->entity);
@ -676,8 +676,8 @@ print '<input name="tva" id="intra_vat" class="minwidth200" value="'.dol_escape_
print '</td></tr>'; print '</td></tr>';
// Object of the company // Object of the company
print '<tr class="oddeven"><td><label for="object">'.$langs->trans("CompanyObject").'</label></td><td>'; print '<tr class="oddeven"><td><label for="socialobject">'.$langs->trans("CompanyObject").'</label></td><td>';
print '<textarea class="flat quatrevingtpercent" name="object" id="object" rows="'.ROWS_5.'">'.(!empty($conf->global->MAIN_INFO_SOCIETE_OBJECT) ? $conf->global->MAIN_INFO_SOCIETE_OBJECT : '').'</textarea></td></tr>'; print '<textarea class="flat quatrevingtpercent" name="socialobject" id="socialobject" rows="'.ROWS_5.'">'.(!empty($conf->global->MAIN_INFO_SOCIETE_OBJECT) ? $conf->global->MAIN_INFO_SOCIETE_OBJECT : '').'</textarea></td></tr>';
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';

View File

@ -84,6 +84,8 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))) {
* View * View
*/ */
$form = new Form($db);
$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; $wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
llxHeader('', $langs->trans("Setup"), $wikihelp); llxHeader('', $langs->trans("Setup"), $wikihelp);

View File

@ -387,7 +387,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$morehtmlref = '<div class="refidno">'; $morehtmlref = '<div class="refidno">';
$morehtmlref .= '</div>'; $morehtmlref .= '</div>';
$morehtml = $langs->trans("NbOfEmailsInInbox").' : '; $morehtml = '';
$sourcedir = $object->source_directory; $sourcedir = $object->source_directory;
$targetdir = ($object->target_directory ? $object->target_directory : ''); // Can be '[Gmail]/Trash' or 'mytag' $targetdir = ($object->target_directory ? $object->target_directory : ''); // Can be '[Gmail]/Trash' or 'mytag'
@ -404,6 +404,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$connectstringserver = $object->getConnectStringIMAP($usessl); $connectstringserver = $object->getConnectStringIMAP($usessl);
if ($action == 'scan') { if ($action == 'scan') {
$nbemail = '';
if (!empty($conf->global->MAIN_IMAP_USE_PHPIMAP)) { if (!empty($conf->global->MAIN_IMAP_USE_PHPIMAP)) {
if ($object->acces_type == 1) { if ($object->acces_type == 1) {
// Mode OAUth2 with PHP-IMAP // Mode OAUth2 with PHP-IMAP
@ -493,7 +494,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$f = $client->getFolders(false, $object->source_directory); $f = $client->getFolders(false, $object->source_directory);
$nbemail = $f[0]->examine()["exists"]; $nbemail = $f[0]->examine()["exists"];
$morehtml .= $nbemail;
} else { } else {
try { try {
if ($sourcedir) { if ($sourcedir) {
@ -525,15 +525,15 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
} }
if (!$connection) { if (!$connection) {
$morehtml .= 'Failed to open IMAP connection '.$connectstringsource; $nbemail .= 'Failed to open IMAP connection '.$connectstringsource;
if (function_exists('imap_last_error')) { if (function_exists('imap_last_error')) {
$morehtml .= '<br>'.imap_last_error(); $nbemail .= '<br>'.imap_last_error();
} }
dol_syslog("Error ".$morehtml, LOG_WARNING); dol_syslog("Error ".$morehtml, LOG_WARNING);
//var_dump(imap_errors()) //var_dump(imap_errors())
} else { } else {
dol_syslog("Imap connected. Now we call imap_num_msg()"); dol_syslog("Imap connected. Now we call imap_num_msg()");
$morehtml .= imap_num_msg($connection); $nbemail .= imap_num_msg($connection);
} }
if ($connection) { if ($connection) {
@ -541,12 +541,15 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
imap_close($connection); imap_close($connection);
} }
} }
} else {
$morehtml .= '<a class="flat" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=scan&token='.newToken().'">'.img_picto('', 'refresh', 'class="paddingrightonly"').$langs->trans("Refresh").'</a>';
} }
$morehtml .= $form->textwithpicto('', 'connect string '.$connectstringserver); $morehtml .= $form->textwithpicto($langs->trans("NbOfEmailsInInbox"), 'connect string '.$connectstringserver).': ';
$morehtml .= ($nbemail != '' ? $nbemail : '?');
$morehtml .= ' &nbsp; <a class="flat paddingleft marginleftonly" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=scan&token='.newToken().'">'.img_picto('', 'refresh', 'class="paddingrightonly"').$langs->trans("Refresh").'</a>';
} else { } else {
$morehtml .= $langs->trans("NbOfEmailsInInbox").': ';
$morehtml .= 'IMAP functions not available on your PHP. '; $morehtml .= 'IMAP functions not available on your PHP. ';
} }

View File

@ -601,13 +601,17 @@ while ($i < $imaxinloop) {
//if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
if (!empty($arrayfields['t.'.$key]['checked'])) { if (!empty($arrayfields['t.'.$key]['checked'])) {
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : ''); print '<td'.($cssforfield ? ' class="'.$cssforfield.(preg_match('/tdoverflow/', $cssforfield) ? ' classfortooltip' : '').'"' : '');
if (preg_match('/tdoverflow/', $cssforfield)) { if (preg_match('/tdoverflow/', $cssforfield)) {
print ' title="'.dol_escape_htmltag($object->$key).'"'; print ' title="'.dol_escape_htmltag($object->$key).'"';
} }
print '>'; print '>';
if ($key == 'status') { if ($key == 'status') {
print $object->getLibStatut(5); print $object->getLibStatut(5);
} elseif ($key == 'lastresult') {
print '<div class="twolinesmax">';
print $object->showOutputField($val, $key, $object->$key, '');
print '</div>';
} elseif ($key == 'rowid') { } elseif ($key == 'rowid') {
print $object->showOutputField($val, $key, $object->id, ''); print $object->showOutputField($val, $key, $object->id, '');
} else { } else {

View File

@ -416,7 +416,7 @@ if ($action != 'create') {
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" name="label" class="width300" value="'.GETPOST('label', 'alphanohtml').'" autofocus></td></tr>'; print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" name="label" class="width300" value="'.GETPOST('label', 'alphanohtml').'" autofocus></td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("Email").'</td><td>'; print '<tr><td class="fieldrequired">'.$langs->trans("Email").'</td><td>';
print img_picto('', 'email', 'class="pictofixedwidth"'); print img_picto('', 'email', 'class="pictofixedwidth"');
print '<input type="text" name="email" value="'.GETPOST('email', 'alphanohtml').'"></td></tr>'; print '<input type="text" name="email" class="width300" value="'.GETPOST('email', 'alphanohtml').'"></td></tr>';
print '<tr><td>'.$langs->trans("Signature").'</td><td>'; print '<tr><td>'.$langs->trans("Signature").'</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('signature', GETPOST('signature'), '', 138, 'dolibarr_notes', 'In', true, true, empty($conf->global->FCKEDITOR_ENABLE_USERSIGN) ? 0 : 1, ROWS_4, '90%'); $doleditor = new DolEditor('signature', GETPOST('signature'), '', 138, 'dolibarr_notes', 'In', true, true, empty($conf->global->FCKEDITOR_ENABLE_USERSIGN) ? 0 : 1, ROWS_4, '90%');

View File

@ -144,6 +144,7 @@ class DolibarrApiAccess implements iAuthenticate
throw new RestException(503, 'Error when searching login user from api key'); throw new RestException(503, 'Error when searching login user from api key');
} }
$genericmessageerroruser = 'Error user not valid (not found or bad status or bad validity dates) (conf->entity='.$conf->entity.')'; $genericmessageerroruser = 'Error user not valid (not found or bad status or bad validity dates) (conf->entity='.$conf->entity.')';
$fuser = new User($this->db); $fuser = new User($this->db);
@ -151,21 +152,27 @@ class DolibarrApiAccess implements iAuthenticate
if ($result <= 0) { if ($result <= 0) {
throw new RestException(503, $genericmessageerroruser); throw new RestException(503, $genericmessageerroruser);
} }
if ($fuser->statut == 0) {
throw new RestException(503, 'Error when fetching user. This user has been locked or disabled');
}
$now = dol_now(); // Check if user status is enabled
if ($fuser->statut != $fuser::STATUS_ENABLED) {
// Check date start validity // Status is disabled
if ($fuser->datestartvalidity && $this->db->jdate($fuser->datestartvalidity) > $now) { dol_syslog("The user has been disabled");
throw new RestException(503, $genericmessageerroruser);
}
// Check date end validity
if ($fuser->dateendvalidity && $this->db->jdate($fuser->dateendvalidity) < dol_get_first_hour($now)) {
throw new RestException(503, $genericmessageerroruser); throw new RestException(503, $genericmessageerroruser);
} }
// Check if session was unvalidated by a password change
if (($fuser->flagdelsessionsbefore && !empty($_SESSION["dol_logindate"]) && $fuser->flagdelsessionsbefore > $_SESSION["dol_logindate"])) {
// Session is no more valid
dol_syslog("The user has a date for session invalidation = ".$fuser->flagdelsessionsbefore." and a session date = ".$_SESSION["dol_logindate"].". We must invalidate its sessions.");
throw new RestException(503, $genericmessageerroruser);
}
// Check date validity
if ($fuser->isNotIntoValidityDateRange()) {
// User validity dates are no more valid
dol_syslog("The user login has a validity between [".$fuser->datestartvalidity." and ".$fuser->dateendvalidity."], curren date is ".dol_now());
throw new RestException(503, $genericmessageerroruser);
}
// User seems valid // User seems valid
$fuser->getrights(); $fuser->getrights();

View File

@ -1762,11 +1762,6 @@ class Setup extends DolibarrApi
throw new RestException(403, 'Error API open to admin users only or to the users with logins defined into constant API_LOGINS_ALLOWED_FOR_GET_COMPANY'); throw new RestException(403, 'Error API open to admin users only or to the users with logins defined into constant API_LOGINS_ALLOWED_FOR_GET_COMPANY');
} }
unset($mysoc->skype);
unset($mysoc->twitter);
unset($mysoc->facebook);
unset($mysoc->linkedin);
unset($mysoc->pays); unset($mysoc->pays);
unset($mysoc->note); unset($mysoc->note);
unset($mysoc->nom); unset($mysoc->nom);

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2017-2020 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2017-2023 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -275,302 +275,303 @@ if (empty($reshook)) {
$object->calculateCosts(); $object->calculateCosts();
} }
} }
}
/*
* View
*/
/* $form = new Form($db);
* View $formfile = new FormFile($db);
*/
$form = new Form($db);
$formfile = new FormFile($db);
$title = $langs->trans('BOM'); $title = $langs->trans('BOM');
$help_url ='EN:Module_BOM'; $help_url ='EN:Module_BOM';
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);
// Part to create // Part to create
if ($action == 'create') { if ($action == 'create') {
print load_fiche_titre($langs->trans("NewBOM"), '', 'bom'); print load_fiche_titre($langs->trans("NewBOM"), '', 'bom');
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
print dol_get_fiche_head(array(), ''); print dol_get_fiche_head(array(), '');
print '<table class="border centpercent tableforfieldcreate">'."\n"; print '<table class="border centpercent tableforfieldcreate">'."\n";
// Common attributes // Common attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php';
// Other attributes // Other attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
print '</table>'."\n"; print '</table>'."\n";
print dol_get_fiche_end(); print dol_get_fiche_end();
print $form->buttonsSaveCancel("Create"); print $form->buttonsSaveCancel("Create");
print '</form>'; print '</form>';
}
// Part to edit record
if (($id || $ref) && $action == 'edit') {
print load_fiche_titre($langs->trans("BillOfMaterials"), '', 'cubes');
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
print dol_get_fiche_head();
//$object->fields['keyfield']['disabled'] = 1;
print '<table class="border centpercent tableforfieldedit">'."\n";
// Common attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php';
// Other attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
print '</table>';
print dol_get_fiche_end();
print $form->buttonsSaveCancel("Create");
print '</form>';
}
// Part to show record
if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) {
$head = bomPrepareHead($object);
print dol_get_fiche_head($head, 'card', $langs->trans("BillOfMaterials"), -1, 'bom');
$formconfirm = '';
// Confirmation to delete
if ($action == 'delete') {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteBillOfMaterials'), $langs->trans('ConfirmDeleteBillOfMaterials'), 'confirm_delete', '', 0, 1);
}
// Confirmation to delete line
if ($action == 'deleteline') {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1);
} }
// Part to edit record // Confirmation of validation
if (($id || $ref) && $action == 'edit') { if ($action == 'validate') {
print load_fiche_titre($langs->trans("BillOfMaterials"), '', 'cubes'); // We check that object has a temporary ref
$ref = substr($object->ref, 1, 4);
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; if ($ref == 'PROV') {
print '<input type="hidden" name="token" value="'.newToken().'">'; $object->fetch_product();
print '<input type="hidden" name="action" value="update">'; $numref = $object->getNextNumRef($object->product);
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
print dol_get_fiche_head();
//$object->fields['keyfield']['disabled'] = 1;
print '<table class="border centpercent tableforfieldedit">'."\n";
// Common attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php';
// Other attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
print '</table>';
print dol_get_fiche_end();
print $form->buttonsSaveCancel("Create");
print '</form>';
}
// Part to show record
if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) {
$head = bomPrepareHead($object);
print dol_get_fiche_head($head, 'card', $langs->trans("BillOfMaterials"), -1, 'bom');
$formconfirm = '';
// Confirmation to delete
if ($action == 'delete') {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteBillOfMaterials'), $langs->trans('ConfirmDeleteBillOfMaterials'), 'confirm_delete', '', 0, 1);
}
// Confirmation to delete line
if ($action == 'deleteline') {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&lineid=' . $lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1);
}
// Confirmation of validation
if ($action == 'validate') {
// We check that object has a temporary ref
$ref = substr($object->ref, 1, 4);
if ($ref == 'PROV') {
$object->fetch_product();
$numref = $object->getNextNumRef($object->product);
} else {
$numref = $object->ref;
}
$text = $langs->trans('ConfirmValidateBom', $numref);
/*if (isModEnabled('notification'))
{
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
$notify = new Notify($db);
$text .= '<br>';
$text .= $notify->confirmMessage('BOM_VALIDATE', $object->socid, $object);
}*/
$formquestion = array();
if (isModEnabled('bom')) {
$langs->load("mrp");
$forcecombo = 0;
if ($conf->browser->name == 'ie') {
$forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
}
$formquestion = array(
// 'text' => $langs->trans("ConfirmClone"),
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
);
}
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('Validate'), $text, 'confirm_validate', $formquestion, 0, 1, 220);
}
// Confirmation of closing
if ($action == 'close') {
$text = $langs->trans('ConfirmCloseBom', $object->ref);
/*if (isModEnabled('notification'))
{
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
$notify = new Notify($db);
$text .= '<br>';
$text .= $notify->confirmMessage('BOM_CLOSE', $object->socid, $object);
}*/
$formquestion = array();
if (isModEnabled('bom')) {
$langs->load("mrp");
$forcecombo = 0;
if ($conf->browser->name == 'ie') {
$forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
}
$formquestion = array(
// 'text' => $langs->trans("ConfirmClone"),
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
);
}
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('Close'), $text, 'confirm_close', $formquestion, 0, 1, 220);
}
// Confirmation of reopen
if ($action == 'reopen') {
$text = $langs->trans('ConfirmReopenBom', $object->ref);
/*if (isModEnabled('notification'))
{
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
$notify = new Notify($db);
$text .= '<br>';
$text .= $notify->confirmMessage('BOM_CLOSE', $object->socid, $object);
}*/
$formquestion = array();
if (isModEnabled('bom')) {
$langs->load("mrp");
require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
$forcecombo = 0;
if ($conf->browser->name == 'ie') {
$forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
}
$formquestion = array(
// 'text' => $langs->trans("ConfirmClone"),
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
);
}
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ReOpen'), $text, 'confirm_reopen', $formquestion, 0, 1, 220);
}
// Clone confirmation
if ($action == 'clone') {
// Create an array for form
$formquestion = array();
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneBillOfMaterials', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
}
// Confirmation of action xxxx
if ($action == 'setdraft') {
$text = $langs->trans('ConfirmSetToDraft', $object->ref);
$formquestion = array();
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('SetToDraft'), $text, 'confirm_setdraft', $formquestion, 0, 1, 220);
}
// Call Hook formConfirm
$parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
$formconfirm .= $hookmanager->resPrint;
} elseif ($reshook > 0) {
$formconfirm = $hookmanager->resPrint;
}
// Print form confirm
print $formconfirm;
// Object card
// ------------------------------------------------------------
$linkback = '<a href="' . DOL_URL_ROOT . '/bom/bom_list.php?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
$morehtmlref = '<div class="refidno">';
/*
// Ref bis
$morehtmlref.=$form->editfieldkey("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->bom->creer, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->bom->creer, 'string', '', null, null, '', 1);
// Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1);
// Project
if (isModEnabled('project'))
{
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($permissiontoadd)
{
if ($action != 'classify')
$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token='.newToken().'&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.='<input type="hidden" name="token" value="'.newToken().'">';
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref.='</form>';
} else {
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else { } else {
if (! empty($object->fk_project)) { $numref = $object->ref;
$proj = new Project($db); }
$proj->fetch($object->fk_project);
$morehtmlref.=$proj->getNomUrl(); $text = $langs->trans('ConfirmValidateBom', $numref);
} else { /*if (isModEnabled('notification'))
$morehtmlref.=''; {
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
$notify = new Notify($db);
$text .= '<br>';
$text .= $notify->confirmMessage('BOM_VALIDATE', $object->socid, $object);
}*/
$formquestion = array();
if (isModEnabled('bom')) {
$langs->load("mrp");
$forcecombo = 0;
if ($conf->browser->name == 'ie') {
$forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
} }
$formquestion = array(
// 'text' => $langs->trans("ConfirmClone"),
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
);
} }
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('Validate'), $text, 'confirm_validate', $formquestion, 0, 1, 220);
}
// Confirmation of closing
if ($action == 'close') {
$text = $langs->trans('ConfirmCloseBom', $object->ref);
/*if (isModEnabled('notification'))
{
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
$notify = new Notify($db);
$text .= '<br>';
$text .= $notify->confirmMessage('BOM_CLOSE', $object->socid, $object);
}*/
$formquestion = array();
if (isModEnabled('bom')) {
$langs->load("mrp");
$forcecombo = 0;
if ($conf->browser->name == 'ie') {
$forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
}
$formquestion = array(
// 'text' => $langs->trans("ConfirmClone"),
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
);
} }
*/
$morehtmlref .= '</div>'; $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('Close'), $text, 'confirm_close', $formquestion, 0, 1, 220);
}
// Confirmation of reopen
if ($action == 'reopen') {
$text = $langs->trans('ConfirmReopenBom', $object->ref);
/*if (isModEnabled('notification'))
{
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
$notify = new Notify($db);
$text .= '<br>';
$text .= $notify->confirmMessage('BOM_CLOSE', $object->socid, $object);
}*/
$formquestion = array();
if (isModEnabled('bom')) {
$langs->load("mrp");
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$forcecombo = 0;
if ($conf->browser->name == 'ie') {
$forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
}
$formquestion = array(
// 'text' => $langs->trans("ConfirmClone"),
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
);
}
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ReOpen'), $text, 'confirm_reopen', $formquestion, 0, 1, 220);
}
// Clone confirmation
if ($action == 'clone') {
// Create an array for form
$formquestion = array();
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneBillOfMaterials', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
}
// Confirmation of action xxxx
if ($action == 'setdraft') {
$text = $langs->trans('ConfirmSetToDraft', $object->ref);
$formquestion = array();
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('SetToDraft'), $text, 'confirm_setdraft', $formquestion, 0, 1, 220);
}
// Call Hook formConfirm
$parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
$formconfirm .= $hookmanager->resPrint;
} elseif ($reshook > 0) {
$formconfirm = $hookmanager->resPrint;
}
// Print form confirm
print $formconfirm;
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); // Object card
// ------------------------------------------------------------
$linkback = '<a href="'.DOL_URL_ROOT.'/bom/bom_list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '<div class="refidno">';
/*
// Ref bis
$morehtmlref.=$form->editfieldkey("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->bom->creer, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->bom->creer, 'string', '', null, null, '', 1);
// Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1);
// Project
if (isModEnabled('project'))
{
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($permissiontoadd)
{
if ($action != 'classify')
$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token='.newToken().'&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.='<input type="hidden" name="token" value="'.newToken().'">';
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref.='</form>';
} else {
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else {
if (! empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref.=$proj->getNomUrl();
} else {
$morehtmlref.='';
}
}
}
*/
$morehtmlref .= '</div>';
print '<div class="fichecenter">'; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">' . "\n";
// Common attributes
$keyforbreak = 'duration'; print '<div class="fichecenter">';
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php'; print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">'."\n";
// Common attributes
$keyforbreak = 'duration';
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
$object->calculateCosts();
print '<tr><td>'.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).'</td><td><span class="amount">'.price($object->total_cost).'</span></td></tr>';
print '<tr><td>'.$langs->trans("UnitCost").'</td><td>'.price($object->unit_cost).'</td></tr>';
// Other attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
print '</table>';
print '</div>';
print '</div>';
print '<div class="clearboth"></div>';
print dol_get_fiche_end();
/*
* Lines
*/
if (!empty($object->table_element_line)) {
// Products
$res = $object->fetchLinesbytypeproduct(0);
$object->calculateCosts(); $object->calculateCosts();
print '<tr><td>' . $form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")) . '</td><td><span class="amount">' . price($object->total_cost) . '</span></td></tr>';
print '<tr><td>' . $langs->trans("UnitCost") . '</td><td>' . price($object->unit_cost) . '</td></tr>';
// Other attributes print ($res == 0 && $object->status >= $object::STATUS_VALIDATED) ? '' : load_fiche_titre($langs->trans('BOMProductsList'), '', 'product');
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
print '</table>'; print ' <form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '' : '') . '" method="POST">
print '</div>';
print '</div>';
print '<div class="clearboth"></div>';
print dol_get_fiche_end();
/*
* Lines
*/
if (!empty($object->table_element_line)) {
//Products
$res = $object->fetchLinesbytypeproduct(0);
$object->calculateCosts();
print ($res == 0 && $object->status >= $object::STATUS_VALIDATED) ? '' : load_fiche_titre($langs->trans('BOMProductsList'), '', 'product');
print ' <form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '' : '') . '" method="POST">
<input type="hidden" name="token" value="' . newToken() . '"> <input type="hidden" name="token" value="' . newToken() . '">
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '"> <input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '">
<input type="hidden" name="mode" value=""> <input type="hidden" name="mode" value="">
@ -578,81 +579,30 @@ if (empty($reshook)) {
<input type="hidden" name="id" value="' . $object->id . '"> <input type="hidden" name="id" value="' . $object->id . '">
'; ';
if (!empty($conf->use_javascript_ajax) && $object->status == 0) { if (!empty($conf->use_javascript_ajax) && $object->status == 0) {
include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
} }
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) { if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) {
print '<table id="tablelines" class="noborder noshadow" width="100%">'; print '<table id="tablelines" class="noborder noshadow centpercent">';
} }
if (!empty($object->lines)) { if (!empty($object->lines)) {
$object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1, '/bom/tpl'); $object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1, '/bom/tpl');
} }
// Form to add new line // Form to add new line
if ($object->status == 0 && $permissiontoadd && $action != 'selectlines') { if ($object->status == 0 && $permissiontoadd && $action != 'selectlines') {
if ($action != 'editline') { if ($action != 'editline') {
// Add products/services form // Add products/services form
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook)) if (empty($reshook))
$object->formAddObjectLine(1, $mysoc, null, '/bom/tpl'); $object->formAddObjectLine(1, $mysoc, null, '/bom/tpl');
}
}
if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) {
print '</table>';
}
print '</div>';
print "</form>\n";
mrpCollapseBomManagement();
//Services
$filtertype = 1;
$res = $object->fetchLinesbytypeproduct(1);
$object->calculateCosts();
print ($res == 0 && $object->status >= $object::STATUS_VALIDATED) ? '' : load_fiche_titre($langs->trans('BOMServicesList'), '', 'service');
print ' <form name="addservice" id="addservice" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '' : '') . '" method="POST">
<input type="hidden" name="token" value="' . newToken() . '">
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '">
<input type="hidden" name="mode" value="">
<input type="hidden" name="page_y" value=""> <input type="hidden" name="id" value="' . $object->id . '">
';
if (!empty($conf->use_javascript_ajax) && $object->status == 0) {
$tagidfortablednd = 'tablelinesservice';
include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
}
print '<div class="div-table-responsive-no-min">';
if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) {
print '<table id="tablelinesservice" class="noborder noshadow" width="100%">';
}
if (!empty($object->lines)) {
$object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1, '/bom/tpl');
}
// Form to add new line
if ($object->status == 0 && $permissiontoadd && $action != 'selectlines') {
if ($action != 'editline') {
// Add services form
$parameters = array();
$reshook = $hookmanager->executeHooks('formAddObjectServiceLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
$object->formAddObjectLine(1, $mysoc, null, '/bom/tpl');
}
} }
} }
@ -663,149 +613,199 @@ if (empty($reshook)) {
print "</form>\n"; print "</form>\n";
mrpCollapseBomManagement(); // Services
$filtertype = 1;
$res = $object->fetchLinesbytypeproduct(1);
$object->calculateCosts();
$res = $object->fetchLines(); print ($res == 0 && $object->status >= $object::STATUS_VALIDATED) ? '' : load_fiche_titre($langs->trans('BOMServicesList'), '', 'service');
// Buttons for actions print ' <form name="addservice" id="addservice" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '' : '') . '" method="POST">
<input type="hidden" name="token" value="' . newToken() . '">
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '">
<input type="hidden" name="mode" value="">
<input type="hidden" name="page_y" value=""> <input type="hidden" name="id" value="' . $object->id . '">
';
if ($action != 'presend' && $action != 'editline') { if (!empty($conf->use_javascript_ajax) && $object->status == 0) {
print '<div class="tabsAction">' . "\n"; $tagidfortablednd = 'tablelinesservice';
$parameters = array(); include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook }
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); print '<div class="div-table-responsive-no-min">';
if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) {
print '<table id="tablelinesservice" class="noborder noshadow centpercent">';
}
if (!empty($object->lines)) {
$object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1, '/bom/tpl');
}
// Form to add new line
if ($object->status == 0 && $permissiontoadd && $action != 'selectlines') {
if ($action != 'editline') {
// Add services form
$parameters = array();
$reshook = $hookmanager->executeHooks('formAddObjectServiceLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
$object->formAddObjectLine(1, $mysoc, null, '/bom/tpl');
} }
}
}
if (empty($reshook)) { if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) {
// Send print '</table>';
//if (empty($user->socid)) { }
// print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a>'."\n"; print '</div>';
print "</form>\n";
mrpCollapseBomManagement();
$res = $object->fetchLines();
// Buttons for actions
if ($action != 'presend' && $action != 'editline') {
print '<div class="tabsAction">'."\n";
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) {
// Send
//if (empty($user->socid)) {
// print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a>'."\n";
//} //}
// Back to draft // Back to draft
if ($object->status == $object::STATUS_VALIDATED) { if ($object->status == $object::STATUS_VALIDATED) {
if ($permissiontoadd) { if ($permissiontoadd) {
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=setdraft&token=' . newToken() . '">' . $langs->trans("SetToDraft") . '</a>' . "\n"; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=setdraft&token='.newToken().'">'.$langs->trans("SetToDraft").'</a>'."\n";
}
} }
}
// Modify // Modify
if ($object->status == $object::STATUS_DRAFT) { if ($object->status == $object::STATUS_DRAFT) {
if ($permissiontoadd) { if ($permissiontoadd) {
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=edit&token=' . newToken() . '">' . $langs->trans("Modify") . '</a>' . "\n"; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>'."\n";
} else { } else {
print '<a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("NotEnoughPermissions")) . '">' . $langs->trans('Modify') . '</a>' . "\n"; print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Modify').'</a>'."\n";
}
} }
}
// Validate // Validate
if ($object->status == $object::STATUS_DRAFT) { if ($object->status == $object::STATUS_DRAFT) {
if ($permissiontoadd) { if ($permissiontoadd) {
if (is_array($object->lines) && count($object->lines) > 0) { if (is_array($object->lines) && count($object->lines) > 0) {
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&amp;action=validate&amp;token=' . newToken() . '">' . $langs->trans("Validate") . '</a>' . "\n"; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=validate&amp;token='.newToken().'">'.$langs->trans("Validate").'</a>'."\n";
} else { } else {
$langs->load("errors"); $langs->load("errors");
print '<a class="butActionRefused" href="" title="' . $langs->trans("ErrorAddAtLeastOneLineFirst") . '">' . $langs->trans("Validate") . '</a>' . "\n"; print '<a class="butActionRefused" href="" title="'.$langs->trans("ErrorAddAtLeastOneLineFirst").'">'.$langs->trans("Validate").'</a>'."\n";
}
} }
} }
}
// Re-open // Re-open
if ($permissiontoadd && $object->status == $object::STATUS_CANCELED) { if ($permissiontoadd && $object->status == $object::STATUS_CANCELED) {
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=reopen&token=' . newToken() . '">' . $langs->trans("ReOpen") . '</a>' . "\n"; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=reopen&token='.newToken().'">'.$langs->trans("ReOpen").'</a>'."\n";
} }
// Create MO // Create MO
if (isModEnabled('mrp')) { if (isModEnabled('mrp')) {
if ($object->status == $object::STATUS_VALIDATED && !empty($user->rights->mrp->write)) { if ($object->status == $object::STATUS_VALIDATED && !empty($user->rights->mrp->write)) {
print '<a class="butAction" href="' . DOL_URL_ROOT . '/mrp/mo_card.php?action=create&fk_bom=' . $object->id . '&token=' . newToken() . '&backtopageforcancel=' . urlencode($_SERVER["PHP_SELF"] . '?id=' . $object->id) . '">' . $langs->trans("CreateMO") . '</a>' . "\n"; print '<a class="butAction" href="'.DOL_URL_ROOT.'/mrp/mo_card.php?action=create&fk_bom='.$object->id.'&token='.newToken().'&backtopageforcancel='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'">'.$langs->trans("CreateMO").'</a>'."\n";
}
} }
}
// Clone // Clone
if ($permissiontoadd) { if ($permissiontoadd) {
print dolGetButtonAction($langs->trans("ToClone"), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . (!empty($object->socid) ? '&socid=' . $object->socid : "") . '&action=clone&object=bom', 'clone', $permissiontoadd); print dolGetButtonAction($langs->trans("ToClone"), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.(!empty($object->socid) ? '&socid='.$object->socid : "").'&action=clone&object=bom', 'clone', $permissiontoadd);
} }
// Close / Cancel // Close / Cancel
if ($permissiontoadd && $object->status == $object::STATUS_VALIDATED) { if ($permissiontoadd && $object->status == $object::STATUS_VALIDATED) {
print '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=close&token=' . newToken() . '">' . $langs->trans("Disable") . '</a>' . "\n"; print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=close&token='.newToken().'">'.$langs->trans("Disable").'</a>'."\n";
} }
/* /*
if ($user->rights->bom->write) if ($user->rights->bom->write)
{ {
if ($object->status == 1) if ($object->status == 1)
{ {
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=disable&token='.newToken().'">'.$langs->trans("Disable").'</a>'."\n"; print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=disable&token='.newToken().'">'.$langs->trans("Disable").'</a>'."\n";
} }
else else
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=enable&token='.newToken().'">'.$langs->trans("Enable").'</a>'."\n"; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=enable&token='.newToken().'">'.$langs->trans("Enable").'</a>'."\n";
} }
} }
*/ */
// Delete // Delete
print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=delete&token=' . newToken(), 'delete', $permissiontodelete); print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete);
}
print '</div>' . "\n";
} }
print '</div>'."\n";
// Select mail models is same action as presend
if (GETPOST('modelselected')) {
$action = 'presend';
}
if ($action != 'presend') {
print '<div class="fichecenter"><div class="fichehalfleft">';
print '<a name="builddoc"></a>'; // ancre
// Documents
$objref = dol_sanitizeFileName($object->ref);
$relativepath = $objref . '/' . $objref . '.pdf';
$filedir = $conf->bom->dir_output . '/' . $objref;
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
$genallowed = $user->rights->bom->read; // If you can read, you can build the PDF to read content
$delallowed = $user->rights->bom->write; // If you can create/edit, you can remove a file on card
print $formfile->showdocuments('bom', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
// Show links to link elements
$linktoelem = $form->showLinkToObjectBlock($object, null, array('bom'));
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
print '</div><div class="fichehalfright">';
$MAXEVENT = 10;
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT . '/bom/bom_agenda.php?id=' . $object->id);
// List of actions on element
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, $object->element, 0, 1, '', $MAXEVENT, '', $morehtmlcenter);
print '</div></div>';
}
//Select mail models is same action as presend
if (GETPOST('modelselected')) {
$action = 'presend';
}
// Presend form
$modelmail = 'bom';
$defaulttopic = 'InformationMessage';
$diroutput = $conf->bom->dir_output;
$trackid = 'bom' . $object->id;
include DOL_DOCUMENT_ROOT . '/core/tpl/card_presend.tpl.php';
} }
// Select mail models is same action as presend
if (GETPOST('modelselected')) {
$action = 'presend';
}
if ($action != 'presend') {
print '<div class="fichecenter"><div class="fichehalfleft">';
print '<a name="builddoc"></a>'; // ancre
// Documents
$objref = dol_sanitizeFileName($object->ref);
$relativepath = $objref.'/'.$objref.'.pdf';
$filedir = $conf->bom->dir_output.'/'.$objref;
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
$genallowed = $user->rights->bom->read; // If you can read, you can build the PDF to read content
$delallowed = $user->rights->bom->write; // If you can create/edit, you can remove a file on card
print $formfile->showdocuments('bom', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
// Show links to link elements
$linktoelem = $form->showLinkToObjectBlock($object, null, array('bom'));
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
print '</div><div class="fichehalfright">';
$MAXEVENT = 10;
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/bom/bom_agenda.php?id='.$object->id);
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, $object->element, 0, 1, '', $MAXEVENT, '', $morehtmlcenter);
print '</div></div>';
}
//Select mail models is same action as presend
if (GETPOST('modelselected')) {
$action = 'presend';
}
// Presend form
$modelmail = 'bom';
$defaulttopic = 'InformationMessage';
$diroutput = $conf->bom->dir_output;
$trackid = 'bom'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
} }
// End of page // End of page
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -517,7 +517,7 @@ if ($search_all) {
$fieldstosearchall[$key] = $langs->trans($val); $fieldstosearchall[$key] = $langs->trans($val);
$setupstring .= $key."=".$val.";"; $setupstring .= $key."=".$val.";";
} }
print '<!-- Search done like if PRODUCT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n"; print '<!-- Search done like if BOM_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n"; print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n";
} }

View File

@ -187,8 +187,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print dol_get_fiche_end(); print dol_get_fiche_end();
$viewlink = dolGetButtonTitle($langs->trans('GroupByProduct'), '', 'fa fa-bars imgforviewmode', $_SERVER['PHP_SELF'].'?id='.$object->id.'&token='.newToken(), '', 1, array('morecss' => 'reposition '.($action !== 'treeview' ? 'btnTitleSelected':''))); $viewlink = dolGetButtonTitle($langs->trans('GroupByX', $langs->transnoentitiesnoconv("Products")), '', 'fa fa-bars imgforviewmode', $_SERVER['PHP_SELF'].'?id='.$object->id.'&token='.newToken(), '', 1, array('morecss' => 'reposition '.($action !== 'treeview' ? 'btnTitleSelected':'')));
$viewlink .= dolGetButtonTitle($langs->trans('TreeStructure'), '', 'fa fa-stream imgforviewmode', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=treeview&token='.newToken(), '', 1, array('morecss' => 'reposition marginleftonly '.($action == 'treeview' ? 'btnTitleSelected':''))); $viewlink .= dolGetButtonTitle($langs->trans('TreeView'), '', 'fa fa-stream imgforviewmode', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=treeview&token='.newToken(), '', 1, array('morecss' => 'reposition marginleftonly '.($action == 'treeview' ? 'btnTitleSelected':'')));
print load_fiche_titre($langs->trans("BOMNetNeeds"), $viewlink, ''); print load_fiche_titre($langs->trans("BOMNetNeeds"), $viewlink, '');

View File

@ -102,9 +102,9 @@ class BOM extends CommonObject
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'2', 'autofocusoncreate'=>1, 'css'=>'minwidth300 maxwidth400', 'csslist'=>'tdoverflowmax200'), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'2', 'autofocusoncreate'=>1, 'css'=>'minwidth300 maxwidth400', 'csslist'=>'tdoverflowmax200'),
'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassemble'), 'css'=>'minwidth175', 'csslist'=>'minwidth175 center'), 'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassemble'), 'css'=>'minwidth175', 'csslist'=>'minwidth175 center'),
//'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'position'=>32, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing')), //'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'position'=>32, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing')),
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1:(finished IS NULL or finished <> 0)', 'label'=>'Product', 'picto'=>'product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax100'), 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1:((finished:is:null) or (finished:!=:0))', 'label'=>'Product', 'picto'=>'product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax100'),
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,), 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,),
'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1', 'css'=>'maxwidth75imp'), 'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1', 'css'=>'maxwidth50imp right'),
//'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>-1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLossForProductProduced'), //'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>-1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLossForProductProduced'),
'duration' => array('type'=>'duration', 'label'=>'EstimatedDuration', 'enabled'=>1, 'visible'=>-1, 'position'=>101, 'notnull'=>-1, 'css'=>'maxwidth50imp', 'help'=>'EstimatedDurationDesc'), 'duration' => array('type'=>'duration', 'label'=>'EstimatedDuration', 'enabled'=>1, 'visible'=>-1, 'position'=>101, 'notnull'=>-1, 'css'=>'maxwidth50imp', 'help'=>'EstimatedDurationDesc'),
'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:0', 'label'=>'WarehouseForProduction', 'picto'=>'stock', 'enabled'=>1, 'visible'=>-1, 'position'=>102, 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax100'), 'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:0', 'label'=>'WarehouseForProduction', 'picto'=>'stock', 'enabled'=>1, 'visible'=>-1, 'position'=>102, 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax100'),

View File

@ -107,7 +107,7 @@ print '<td class="bordertop nobottom linecoldescription minwidth500imp">';
if (isModEnabled("product") || isModEnabled("service")) { if (isModEnabled("product") || isModEnabled("service")) {
if ($filtertype == 1) { if ($filtertype == 1) {
print $langs->trans("Service"); print $langs->trans("Service");
} elseif (!empty($conf->global->BOM_SUB_BOM)) { } else {
print $langs->trans("Product"); print $langs->trans("Product");
} }
echo '<span class="prod_entry_mode_predef">'; echo '<span class="prod_entry_mode_predef">';

View File

@ -171,7 +171,7 @@ $tmpbom->calculateCosts();
print '<td id="costline_'.$line->id.'" class="linecolcost nowrap right">'; print '<td id="costline_'.$line->id.'" class="linecolcost nowrap right">';
$coldisplay++; $coldisplay++;
if (!empty($line->fk_bom_child)) { if (!empty($line->fk_bom_child)) {
echo '<span class="amount">'.price($tmpbom->total_cost).'</span>'; echo '<span class="amount">'.price($tmpbom->total_cost * $line->qty).'</span>';
} else { } else {
echo '<span class="amount">'.price($line->total_cost).'</span>'; echo '<span class="amount">'.price($line->total_cost).'</span>';
} }
@ -269,16 +269,20 @@ if ($resql) {
$label = $sub_bom_product->getLabelOfUnit('long'); $label = $sub_bom_product->getLabelOfUnit('long');
if ($sub_bom_line->qty_frozen > 0) { if ($sub_bom_line->qty_frozen > 0) {
print '<td class="linecolqty nowrap right" id="sub_bom_qty_'.$sub_bom_line->id.'">'.price($sub_bom_line->qty, 0, '', 0, 0).'</td>'; print '<td class="linecolqty nowrap right" id="sub_bom_qty_'.$sub_bom_line->id.'">'.price($sub_bom_line->qty, 0, '', 0, 0).'</td>';
print '<td class="linecoluseunit nowrap left">'; if (!empty($conf->global->PRODUCT_USE_UNITS)) {
if ($label !== '') print $langs->trans($label); print '<td class="linecoluseunit nowrap left">';
print '</td>'; if ($label !== '') print $langs->trans($label);
print '</td>';
}
print '<td class="linecolqtyfrozen nowrap right" id="sub_bom_qty_frozen_'.$sub_bom_line->id.'">'.$langs->trans('Yes').'</td>'; print '<td class="linecolqtyfrozen nowrap right" id="sub_bom_qty_frozen_'.$sub_bom_line->id.'">'.$langs->trans('Yes').'</td>';
} else { } else {
print '<td class="linecolqty nowrap right" id="sub_bom_qty_'.$sub_bom_line->id.'">'.price($sub_bom_line->qty * $line->qty, 0, '', 0, 0).'</td>'; print '<td class="linecolqty nowrap right" id="sub_bom_qty_'.$sub_bom_line->id.'">'.price($sub_bom_line->qty * $line->qty, 0, '', 0, 0).'</td>';
print '<td class="linecoluseunit nowrap left">'; if (!empty($conf->global->PRODUCT_USE_UNITS)) {
if ($label !== '') print $langs->trans($label); print '<td class="linecoluseunit nowrap left">';
print '</td>'; if ($label !== '') print $langs->trans($label);
print '</td>'; print '</td>';
}
print '<td class="linecolqtyfrozen nowrap right" id="sub_bom_qty_frozen_'.$sub_bom_line->id.'">&nbsp;</td>'; print '<td class="linecolqtyfrozen nowrap right" id="sub_bom_qty_frozen_'.$sub_bom_line->id.'">&nbsp;</td>';
} }

View File

@ -470,7 +470,7 @@ if ($search_all) {
$fieldstosearchall[$key] = $langs->trans($val); $fieldstosearchall[$key] = $langs->trans($val);
$setupstring .= $key."=".$val.";"; $setupstring .= $key."=".$val.";";
} }
print '<!-- Search done like if PRODUCT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n"; print '<!-- Search done like if BOOKCAL_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n"; print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n";
} }

View File

@ -470,7 +470,7 @@ if ($search_all) {
$fieldstosearchall[$key] = $langs->trans($val); $fieldstosearchall[$key] = $langs->trans($val);
$setupstring .= $key."=".$val.";"; $setupstring .= $key."=".$val.";";
} }
print '<!-- Search done like if PRODUCT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n"; print '<!-- Search done like if BOOKCAL_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n"; print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n";
} }

View File

@ -29,15 +29,18 @@ require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php';
$langs->loadLangs(array('bookmarks', 'admin')); $langs->loadLangs(array('bookmarks', 'admin'));
// Get Parameters // Get Parameters
$action = GETPOST('action', 'aZ09'); $id = GETPOST("id", 'int');
$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha'); $massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int'); $show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array'); $cancel = GETPOST('cancel', 'alpha');
$toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bookmarklist'; // To manage different context of search $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bookmarklist'; // To manage different context of search
$id = GETPOST("id", 'int'); $backtopage = GETPOST('backtopage', 'alpha');
$optioncss = GETPOST('optioncss', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha');
$mode = GETPOST('mode', 'aZ09'); $mode = GETPOST('mode', 'aZ09');
// Load variable for pagination // Load variable for pagination
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;

View File

@ -33,18 +33,22 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("users", "companies", "agenda", "commercial", "other", "orders", "bills")); $langs->loadLangs(array("users", "companies", "agenda", "commercial", "other", "orders", "bills"));
$action = GETPOST('action', 'aZ09'); // Get Parameters
$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha'); $massaction = GETPOST('massaction', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'alpha');
$toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'actioncommlist'; // To manage different context of search $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'actioncommlist'; // To manage different context of search
$optioncss = GETPOST('optioncss', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha');
$toselect = GETPOST('toselect', 'array');
$confirm = GETPOST('confirm', 'alpha');
$disabledefaultvalues = GETPOST('disabledefaultvalues', 'int'); $disabledefaultvalues = GETPOST('disabledefaultvalues', 'int');
@ -70,6 +74,7 @@ if (GETPOST('search_actioncode', 'array')) {
$actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : ((empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE)); $actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : ((empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
} }
// Search Fields
$search_id = GETPOST('search_id', 'alpha'); $search_id = GETPOST('search_id', 'alpha');
$search_title = GETPOST('search_title', 'alpha'); $search_title = GETPOST('search_title', 'alpha');
$search_note = GETPOST('search_note', 'alpha'); $search_note = GETPOST('search_note', 'alpha');
@ -106,6 +111,7 @@ if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS)) {
$filtert = $user->id; $filtert = $user->id;
} }
// Pagination parameters
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma');

View File

@ -948,26 +948,6 @@ while ($currentdaytoshow < $lastdaytoshow) {
$usernames[] = $tmpuser; $usernames[] = $tmpuser;
} }
/*
if ($filtert > 0)
{
$tmpuser = new User($db);
$tmpuser->fetch($filtert);
$usernames[] = $tmpuser;
}
else if ($usergroup)
{
$tmpgroup = new UserGroup($db);
$tmpgroup->fetch($usergroup);
$usernames = $tmpgroup->listUsersForGroup();
}
else
{
$tmpgroup = new UserGroup($db);
//$tmpgroup->fetch($usergroup); No fetch, we want all users for all groups
$usernames = $tmpgroup->listUsersForGroup();
}*/
// Load array of colors by type // Load array of colors by type
$colorsbytype = array(); $colorsbytype = array();
$labelbytype = array(); $labelbytype = array();

View File

@ -1419,7 +1419,7 @@ if ($object->id > 0) {
$sql .= ', f.total_tva'; $sql .= ', f.total_tva';
$sql .= ', f.total_ttc'; $sql .= ', f.total_ttc';
$sql .= ', f.entity'; $sql .= ', f.entity';
$sql .= ', f.datef as df, f.datec as dc, f.paye as paye, f.fk_statut as status'; $sql .= ', f.datef as df, f.date_lim_reglement as dl, f.datec as dc, f.paye as paye, f.fk_statut as status';
$sql .= ', s.nom, s.rowid as socid'; $sql .= ', s.nom, s.rowid as socid';
$sql .= ', SUM(pf.amount) as am'; $sql .= ', SUM(pf.amount) as am';
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
@ -1427,7 +1427,7 @@ if ($object->id > 0) {
$sql .= " WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $object->id); $sql .= " WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $object->id);
$sql .= " AND f.entity IN (".getEntity('invoice').")"; $sql .= " AND f.entity IN (".getEntity('invoice').")";
$sql .= ' GROUP BY f.rowid, f.ref, f.type, f.total_ht, f.total_tva, f.total_ttc,'; $sql .= ' GROUP BY f.rowid, f.ref, f.type, f.total_ht, f.total_tva, f.total_ttc,';
$sql .= ' f.entity, f.datef, f.datec, f.paye, f.fk_statut,'; $sql .= ' f.entity, f.datef, f.date_lim_reglement, f.datec, f.paye, f.fk_statut,';
$sql .= ' s.nom, s.rowid'; $sql .= ' s.nom, s.rowid';
$sql .= " ORDER BY f.datef DESC, f.datec DESC"; $sql .= " ORDER BY f.datef DESC, f.datec DESC";
@ -1441,7 +1441,7 @@ if ($object->id > 0) {
print '<table class="noborder centpercent lastrecordtable">'; print '<table class="noborder centpercent lastrecordtable">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td colspan="5"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastCustomersBills", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id.'">'.$langs->trans("AllBills").'<span class="badge marginleftonlyshort">'.$num.'</span></a></td>'; print '<td colspan="5"><table class="centpercent nobordernopadding"><tr><td>'.$langs->trans("LastCustomersBills", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id.'">'.$langs->trans("AllBills").'<span class="badge marginleftonlyshort">'.$num.'</span></a></td>';
print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/compta/facture/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"), 'stats').'</a></td>'; print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/compta/facture/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"), 'stats').'</a></td>';
print '</tr></table></td>'; print '</tr></table></td>';
print '</tr>'; print '</tr>';
@ -1458,6 +1458,8 @@ if ($object->id > 0) {
$facturestatic->total_tva = $objp->total_tva; $facturestatic->total_tva = $objp->total_tva;
$facturestatic->total_ttc = $objp->total_ttc; $facturestatic->total_ttc = $objp->total_ttc;
$facturestatic->statut = $objp->status; $facturestatic->statut = $objp->status;
$facturestatic->date = $db->jdate($objp->df);
$facturestatic->date_lim_reglement = $db->jdate($objp->dl);
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td class="nowraponall">'; print '<td class="nowraponall">';
@ -1493,9 +1495,14 @@ if ($object->id > 0) {
//print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir); //print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir);
print '</td>'; print '</td>';
if ($objp->df > 0) { if ($objp->df > 0) {
print '<td class="right" width="80px">'.dol_print_date($db->jdate($objp->df), 'day').'</td>'; print '<td width="80px" title="'.dol_escape_htmltag($langs->trans('DateInvoice')).'">'.dol_print_date($db->jdate($objp->df), 'day').'</td>';
} else { } else {
print '<td class="right"><b>!!!</b></td>'; print '<td><b>!!!</b></td>';
}
if ($objp->dl > 0) {
print '<td width="80px" title="'.dol_escape_htmltag($langs->trans('DateMaxPayment')).'">'.dol_print_date($db->jdate($objp->dl), 'day').'</td>';
} else {
print '<td><b>!!!</b></td>';
} }
print '<td class="right" style="min-width: 60px">'; print '<td class="right" style="min-width: 60px">';
print price($objp->total_ht); print price($objp->total_ht);

View File

@ -27,20 +27,24 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/comm/mailing/class/mailing.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/mailing/class/mailing.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->load("mails"); $langs->load('mails');
$sortfield = GETPOST('sortfield', 'aZ09comma'); // Get Parameters
$sortorder = GETPOST('sortorder', 'aZ09comma');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$optioncss = GETPOST('optioncss', 'alpha');
$massaction = GETPOST('massaction', 'alpha'); $massaction = GETPOST('massaction', 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $optioncss = GETPOST('optioncss', 'alpha');
// Pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) {
$page = 0; $page = 0;
} // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
$offset = $limit * $page; $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
if (!$sortorder) { if (!$sortorder) {
$sortorder = "DESC"; $sortorder = "DESC";
} }
@ -48,10 +52,12 @@ if (!$sortfield) {
$sortfield = "m.date_creat"; $sortfield = "m.date_creat";
} }
// Search Fields
$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
$search_ref = GETPOST("search_ref", "alpha") ? GETPOST("search_ref", "alpha") : GETPOST("sref", "alpha"); $search_ref = GETPOST("search_ref", "alpha") ? GETPOST("search_ref", "alpha") : GETPOST("sref", "alpha");
$filteremail = GETPOST('filteremail', 'alpha'); $filteremail = GETPOST('filteremail', 'alpha');
// Initialize objects
$object = new Mailing($db); $object = new Mailing($db);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
@ -128,7 +134,9 @@ if (empty($reshook)) {
* View * View
*/ */
llxHeader('', $langs->trans("Mailing"), 'EN:Module_EMailing|FR:Module_Mailing|ES:M&oacute;dulo_Mailing'); // Page Header
$help_url = 'EN:Module_EMailing|FR:Module_Mailing|ES:M&oacute;dulo_Mailing';
llxHeader('', $langs->trans("Mailing"), $help_url);
$form = new Form($db); $form = new Form($db);

View File

@ -62,21 +62,23 @@ if (isModEnabled("expedition")) {
$langs->loadLangs(array('sendings')); $langs->loadLangs(array('sendings'));
} }
// Get Parameters
$socid = GETPOST('socid', 'int'); $socid = GETPOST('socid', 'int');
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha'); $massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int'); $show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array'); $cancel = GETPOST('cancel', 'alpha');
$toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'proposallist'; $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'proposallist';
$mode = GETPOST('mode', 'alpha'); $mode = GETPOST('mode', 'alpha');
$search_user = GETPOST('search_user', 'int'); // Search Fields
$search_sale = GETPOST('search_sale', 'int'); $search_user = GETPOST('search_user', 'int');
$search_ref = GETPOST('sf_ref') ?GETPOST('sf_ref', 'alpha') : GETPOST('search_ref', 'alpha'); $search_sale = GETPOST('search_sale', 'int');
$search_ref = GETPOST('sf_ref') ?GETPOST('sf_ref', 'alpha') : GETPOST('search_ref', 'alpha');
$search_refcustomer = GETPOST('search_refcustomer', 'alpha'); $search_refcustomer = GETPOST('search_refcustomer', 'alpha');
$search_refproject = GETPOST('search_refproject', 'alpha'); $search_refproject = GETPOST('search_refproject', 'alpha');
$search_project = GETPOST('search_project', 'alpha'); $search_project = GETPOST('search_project', 'alpha');
@ -140,15 +142,15 @@ $search_date_signature_endyear = GETPOST('search_date_signature_endyear', 'int')
$search_date_signature_start = dol_mktime(0, 0, 0, $search_date_signature_startmonth, $search_date_signature_startday, $search_date_signature_startyear); $search_date_signature_start = dol_mktime(0, 0, 0, $search_date_signature_startmonth, $search_date_signature_startday, $search_date_signature_startyear);
$search_date_signature_end = dol_mktime(23, 59, 59, $search_date_signature_endmonth, $search_date_signature_endday, $search_date_signature_endyear); $search_date_signature_end = dol_mktime(23, 59, 59, $search_date_signature_endmonth, $search_date_signature_endday, $search_date_signature_endyear);
$search_status = GETPOST('search_status', 'alpha'); $search_status = GETPOST('search_status', 'alpha');
$optioncss = GETPOST('optioncss', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha');
$object_statut = GETPOST('search_statut', 'alpha'); $object_statut = GETPOST('search_statut', 'alpha');
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
$mesg = (GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg")); $mesg = (GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg"));
// Pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma');
@ -263,6 +265,7 @@ foreach ($object->fields as $key => $val) {
$fieldstosearchall['t.'.$key] = $val['label']; $fieldstosearchall['t.'.$key] = $val['label'];
} }
}*/ }*/
// Definition of array of fields for columns // Definition of array of fields for columns
/*$arrayfields = array(); /*$arrayfields = array();
foreach ($object->fields as $key => $val) { foreach ($object->fields as $key => $val) {
@ -278,9 +281,11 @@ foreach ($object->fields as $key => $val) {
); );
} }
}*/ }*/
// Extra fields // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
// Permissions
$permissiontoread = $user->rights->propal->lire; $permissiontoread = $user->rights->propal->lire;
$permissiontoadd = $user->rights->propal->creer; $permissiontoadd = $user->rights->propal->creer;
$permissiontodelete = $user->rights->propal->supprimer; $permissiontodelete = $user->rights->propal->supprimer;

View File

@ -137,10 +137,10 @@ $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
if (!$sortfield) { if (!$sortfield) {
$sortfield = 'c.ref'; $sortfield = 'pr.ref';
} }
if (!$sortorder) { if (!$sortorder) {
$sortorder = 'DESC'; $sortorder = 'ASC';
} }
$show_shippable_command = GETPOST('show_shippable_command', 'aZ09'); $show_shippable_command = GETPOST('show_shippable_command', 'aZ09');

View File

@ -72,6 +72,10 @@ if (is_array($remains)) {
unset($remains[$key]); unset($remains[$key]);
} }
} }
} elseif ($remains) {
$remains = array(price2num($remains));
} else {
$remains = array();
} }
// Treatment // Treatment

View File

@ -423,7 +423,7 @@ if ($search_all) {
$fieldstosearchall[$key] = $langs->trans($val); $fieldstosearchall[$key] = $langs->trans($val);
$setupstring .= $key."=".$val.";"; $setupstring .= $key."=".$val.";";
} }
print '<!-- Search done like if PRODUCT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n"; print '<!-- Search done like if BOOKCAL_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n"; print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n";
} }

View File

@ -144,9 +144,12 @@ $form = new Form($db);
$title = $langs->trans("LT".$object->ltt)." - ".$langs->trans("Card"); $title = $langs->trans("LT".$object->ltt)." - ".$langs->trans("Card");
$help_url = ''; $help_url = '';
llxHeader('', $title, $helpurl); llxHeader('', $title, $help_url);
if ($action == 'create') { if ($action == 'create') {
$datev = dol_mktime(12, 0, 0, GETPOST("datevmonth"), GETPOST("datevday"), GETPOST("datevyear"));
$datep = dol_mktime(12, 0, 0, GETPOST("datepmonth"), GETPOST("datepday"), GETPOST("datepyear"));
print load_fiche_titre($langs->transcountry($lttype == 2 ? "newLT2Payment" : "newLT1Payment", $mysoc->country_code)); print load_fiche_titre($langs->transcountry($lttype == 2 ? "newLT2Payment" : "newLT1Payment", $mysoc->country_code));
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" name="formlocaltax" method="post">'."\n"; print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" name="formlocaltax" method="post">'."\n";

View File

@ -46,6 +46,11 @@ $action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$backtopage = GETPOST('backtopage', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha');
$socid = GETPOST('socid', 'int');
if ($socid < 0) {
$socid = 0;
}
$object = new Paiement($db); $object = new Paiement($db);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('paymentcard', 'globalcard')); $hookmanager->initHooks(array('paymentcard', 'globalcard'));

View File

@ -513,6 +513,7 @@ foreach ($arrayfields as $column) {
$i = 0; $i = 0;
$totalarray = array(); $totalarray = array();
$totalarray['nbfield'] = 0;
while ($i < min($num, $limit)) { while ($i < min($num, $limit)) {
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
@ -620,7 +621,11 @@ while ($i < min($num, $limit)) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
$totalarray['pos'][$checkedCount] = 'amount'; $totalarray['pos'][$checkedCount] = 'amount';
$totalarray['val']['amount'] += $objp->amount; if (empty($totalarray['val']['amount'])) {
$totalarray['val']['amount'] = $objp->amount;
} else {
$totalarray['val']['amount'] += $objp->amount;
}
} }
// Status // Status

View File

@ -272,7 +272,7 @@ if ($id > 0 || $ref) {
print $formconfirm; print $formconfirm;
if (empty($object->date_trans) && $user->rights->prelevement->bons->send && $action == 'settransmitted') { if (empty($object->date_trans) && (($user->rights->prelevement->bons->send && $object->type != 'bank-transfer') || ($user->rights->paymentbybanktransfer->send && $object->type == 'bank-transfer')) && $action == 'settransmitted') {
print '<form method="post" name="userfile" action="card.php?id='.$object->id.'" enctype="multipart/form-data">'; print '<form method="post" name="userfile" action="card.php?id='.$object->id.'" enctype="multipart/form-data">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="infotrans">'; print '<input type="hidden" name="action" value="infotrans">';
@ -291,7 +291,7 @@ if ($id > 0 || $ref) {
print '<br>'; print '<br>';
} }
if (!empty($object->date_trans) && empty($object->date_credit) && $user->rights->prelevement->bons->credit && $action == 'setcredited') { if (!empty($object->date_trans) && empty($object->date_credit) && (($user->rights->prelevement->bons->credit && $object->type != 'bank-transfer') || ($user->rights->paymentbybanktransfer->debit && $object->type == 'bank-transfer')) && $action == 'setcredited') {
$btnLabel = ($object->type == 'bank-transfer') ? $langs->trans("ClassDebited") : $langs->trans("ClassCredited"); $btnLabel = ($object->type == 'bank-transfer') ? $langs->trans("ClassDebited") : $langs->trans("ClassCredited");
print '<form name="infocredit" method="post" action="card.php?id='.$object->id.'">'; print '<form name="infocredit" method="post" action="card.php?id='.$object->id.'">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';

View File

@ -213,11 +213,6 @@ if (empty($reshook)) {
$object->town = (string) GETPOST("town", 'alpha'); $object->town = (string) GETPOST("town", 'alpha');
$object->country_id = (int) GETPOST("country_id", 'int'); $object->country_id = (int) GETPOST("country_id", 'int');
$object->state_id = (int) GETPOST("state_id", 'int'); $object->state_id = (int) GETPOST("state_id", 'int');
//$object->jabberid = GETPOST("jabberid", 'alpha');
//$object->skype = GETPOST("skype", 'alpha');
//$object->twitter = GETPOST("twitter", 'alpha');
//$object->facebook = GETPOST("facebook", 'alpha');
//$object->linkedin = GETPOST("linkedin", 'alpha');
$object->socialnetworks = array(); $object->socialnetworks = array();
if (isModEnabled('socialnetworks')) { if (isModEnabled('socialnetworks')) {
foreach ($socialnetworks as $key => $value) { foreach ($socialnetworks as $key => $value) {
@ -419,11 +414,6 @@ if (empty($reshook)) {
$object->email = (string) GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL); $object->email = (string) GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL);
$object->no_email = GETPOST("no_email", "int"); $object->no_email = GETPOST("no_email", "int");
//$object->jabberid = GETPOST("jabberid", 'alpha');
//$object->skype = GETPOST("skype", 'alpha');
//$object->twitter = GETPOST("twitter", 'alpha');
//$object->facebook = GETPOST("facebook", 'alpha');
//$object->linkedin = GETPOST("linkedin", 'alpha');
$object->socialnetworks = array(); $object->socialnetworks = array();
if (isModEnabled('socialnetworks')) { if (isModEnabled('socialnetworks')) {
foreach ($socialnetworks as $key => $value) { foreach ($socialnetworks as $key => $value) {

View File

@ -702,22 +702,6 @@ class Contact extends CommonObject
$tmpobj->socialnetworks = $this->socialnetworks; $tmpobj->socialnetworks = $this->socialnetworks;
$usermustbemodified++; $usermustbemodified++;
} }
// if ($tmpobj->skype != $this->skype) {
// $tmpobj->skype = $this->skype;
// $usermustbemodified++;
// }
// if ($tmpobj->twitter != $this->twitter) {
// $tmpobj->twitter = $this->twitter;
// $usermustbemodified++;
// }
// if ($tmpobj->facebook != $this->facebook) {
// $tmpobj->facebook = $this->facebook;
// $usermustbemodified++;
// }
// if ($tmpobj->linkedin != $this->linkedin) {
// $tmpobj->linkedin = $this->linkedin;
// $usermustbemodified++;
// }
if ($usermustbemodified) { if ($usermustbemodified) {
$result = $tmpobj->update($user, 0, 1, 1, 1); $result = $tmpobj->update($user, 0, 1, 1, 1);
if ($result < 0) { if ($result < 0) {
@ -850,9 +834,6 @@ class Contact extends CommonObject
if ($this->fax && !empty($conf->global->LDAP_CONTACT_FIELD_FAX)) { if ($this->fax && !empty($conf->global->LDAP_CONTACT_FIELD_FAX)) {
$info[$conf->global->LDAP_CONTACT_FIELD_FAX] = $this->fax; $info[$conf->global->LDAP_CONTACT_FIELD_FAX] = $this->fax;
} }
if ($this->skype && !empty($conf->global->LDAP_CONTACT_FIELD_SKYPE)) {
$info[$conf->global->LDAP_CONTACT_FIELD_SKYPE] = $this->skype;
}
if ($this->note_private && !empty($conf->global->LDAP_CONTACT_FIELD_DESCRIPTION)) { if ($this->note_private && !empty($conf->global->LDAP_CONTACT_FIELD_DESCRIPTION)) {
$info[$conf->global->LDAP_CONTACT_FIELD_DESCRIPTION] = dol_string_nohtmltag($this->note_private, 2); $info[$conf->global->LDAP_CONTACT_FIELD_DESCRIPTION] = dol_string_nohtmltag($this->note_private, 2);
} }

View File

@ -143,7 +143,16 @@ if (empty($reshook)) {
include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once
if ($action == 'confirm_active' && $confirm == 'yes' && $user->rights->contrat->activer) { if ($action == 'confirm_active' && $confirm == 'yes' && $user->rights->contrat->activer) {
$result = $object->active_line($user, GETPOST('ligne', 'int'), GETPOST('date'), GETPOST('dateend'), GETPOST('comment')); $date_start = '';
$date_end = '';
if (GETPOST('startmonth') && GETPOST('startday') && GETPOST('startyear')) {
$date_start = dol_mktime(GETPOST('starthour'), GETPOST('startmin'), 0, GETPOST('startmonth'), GETPOST('startday'), GETPOST('startyear'));
}
if (GETPOST('endmonth') && GETPOST('endday') && GETPOST('endyear')) {
$date_end = dol_mktime(GETPOST('endhour'), GETPOST('endmin'), 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
}
$result = $object->active_line($user, GETPOST('ligne', 'int'), $date_start, $date_end, GETPOST('comment'));
if ($result > 0) { if ($result > 0) {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
@ -152,12 +161,16 @@ if (empty($reshook)) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} elseif ($action == 'confirm_closeline' && $confirm == 'yes' && $user->rights->contrat->activer) { } elseif ($action == 'confirm_closeline' && $confirm == 'yes' && $user->rights->contrat->activer) {
if (!GETPOST('dateend')) { $date_end = '';
if (GETPOST('endmonth') && GETPOST('endday') && GETPOST('endyear')) {
$date_end = dol_mktime(GETPOST('endhour'), GETPOST('endmin'), 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
}
if (!$date_end) {
$error++; $error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateEnd")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateEnd")), null, 'errors');
} }
if (!$error) { if (!$error) {
$result = $object->close_line($user, GETPOST('ligne', 'int'), GETPOST('dateend'), urldecode(GETPOST('comment'))); $result = $object->close_line($user, GETPOST('ligne', 'int'), $date_end, urldecode(GETPOST('comment')));
if ($result > 0) { if ($result > 0) {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit; exit;
@ -1838,34 +1851,6 @@ if ($action == 'create') {
print '<table class="notopnoleftnoright" width="100%"><tr class="oddeven" height="6"><td></td></tr></table>'; print '<table class="notopnoleftnoright" width="100%"><tr class="oddeven" height="6"><td></td></tr></table>';
} }
/*
* Confirmation de la validation activation
*/
if ($action == 'active' && !$cancel && $user->rights->contrat->activer && $object->lines[$cursorline - 1]->id == GETPOST('ligne', 'int')) {
$dateactstart = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
$dateactend = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
$comment = GETPOST('comment', 'alpha');
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&ligne=".GETPOST('ligne', 'int')."&date=".$dateactstart."&dateend=".$dateactend."&comment=".urlencode($comment), $langs->trans("ActivateService"), $langs->trans("ConfirmActivateService", dol_print_date($dateactstart, "%A %d %B %Y")), "confirm_active", '', 0, 1);
print '<table class="notopnoleftnoright" width="100%"><tr class="oddeven" height="6"><td></td></tr></table>';
}
/*
* Confirmation de la validation fermeture
*/
if ($action == 'closeline' && !$cancel && $user->rights->contrat->activer && $object->lines[$cursorline - 1]->id == GETPOST('ligne', 'int')) {
$dateactstart = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
$dateactend = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
$comment = GETPOST('comment', 'alpha');
if (empty($dateactend)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateEndReal")), null, 'errors');
} else {
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&ligne=".GETPOST('ligne', 'int')."&date=".$dateactstart."&dateend=".$dateactend."&comment=".urlencode($comment), $langs->trans("CloseService"), $langs->trans("ConfirmCloseService", dol_print_date($dateactend, "%A %d %B %Y")), "confirm_closeline", '', 0, 1);
}
print '<table class="notopnoleftnoright" width="100%"><tr class="oddeven" height="6"><td></td></tr></table>';
}
// Area with status and activation info of line // Area with status and activation info of line
if ($object->statut > 0) { if ($object->statut > 0) {
print '<table class="notopnoleftnoright tableforservicepart2'.($cursorline < $nbofservices ? ' boxtablenobottom' : '').'" width="100%">'; print '<table class="notopnoleftnoright tableforservicepart2'.($cursorline < $nbofservices ? ' boxtablenobottom' : '').'" width="100%">';
@ -1931,8 +1916,12 @@ if ($action == 'create') {
// Form to activate line // Form to activate line
if ($user->rights->contrat->activer && $action == 'activateline' && $object->lines[$cursorline - 1]->id == GETPOST('ligne', 'int')) { if ($user->rights->contrat->activer && $action == 'activateline' && $object->lines[$cursorline - 1]->id == GETPOST('ligne', 'int')) {
print '<form name="active" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;ligne='.GETPOST('ligne', 'int').'&amp;action=active" method="post">'; print '<form name="active" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="confirm_active">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<input type="hidden" name="ligne" value="'.GETPOST('ligne', 'int').'">';
print '<input type="hidden" name="confirm" value="yes">';
print '<table class="noborder tableforservicepart2'.($cursorline < $nbofservices ? ' boxtablenobottom' : '').'" width="100%">'; print '<table class="noborder tableforservicepart2'.($cursorline < $nbofservices ? ' boxtablenobottom' : '').'" width="100%">';
@ -1957,7 +1946,7 @@ if ($action == 'create') {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td class="nohover">'.$langs->trans("DateServiceActivate").'</td><td class="nohover">'; print '<td class="nohover">'.$langs->trans("DateServiceActivate").'</td><td class="nohover">';
print $form->selectDate($dateactstart, '', $usehm, $usehm, '', "active", 1, 0); print $form->selectDate($dateactstart, 'start', $usehm, $usehm, '', "active", 1, 0);
print '</td>'; print '</td>';
print '<td class="nohover">'.$langs->trans("DateEndPlanned").'</td><td class="nohover">'; print '<td class="nohover">'.$langs->trans("DateEndPlanned").'</td><td class="nohover">';
print $form->selectDate($dateactend, "end", $usehm, $usehm, '', "active", 1, 0); print $form->selectDate($dateactend, "end", $usehm, $usehm, '', "active", 1, 0);
@ -1985,10 +1974,10 @@ if ($action == 'create') {
* Disable a contract line * Disable a contract line
*/ */
print '<!-- Form to disabled a line -->'."\n"; print '<!-- Form to disabled a line -->'."\n";
print '<form name="closeline" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;ligne='.$object->lines[$cursorline - 1]->id.'" method="post">'; print '<form name="confirm_closeline" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;ligne='.$object->lines[$cursorline - 1]->id.'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="closeline">'; print '<input type="hidden" name="confirm" value="yes">';
print '<input type="hidden" name="action" value="confirm_closeline">';
print '<table class="noborder tableforservicepart2'.($cursorline < $nbofservices ? ' boxtablenobottom' : '').'" width="100%">'; print '<table class="noborder tableforservicepart2'.($cursorline < $nbofservices ? ' boxtablenobottom' : '').'" width="100%">';

View File

@ -225,9 +225,10 @@ class Contrat extends CommonObject
*/ */
public $fields = array( public $fields = array(
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
'ref' =>array('type'=>'varchar(50)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'showoncombobox'=>1, 'position'=>15), 'ref' =>array('type'=>'varchar(50)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'showoncombobox'=>1, 'position'=>15, 'searchall'=>1),
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>20), 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>20),
'ref_supplier' =>array('type'=>'varchar(50)', 'label'=>'Ref supplier', 'enabled'=>1, 'visible'=>-1, 'position'=>25), 'ref_customer' =>array('type'=>'varchar(50)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>25, 'searchall'=>1),
'ref_supplier' =>array('type'=>'varchar(50)', 'label'=>'RefSupplier', 'enabled'=>1, 'visible'=>-1, 'position'=>26, 'searchall'=>1),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>30, 'index'=>1), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>30, 'index'=>1),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35), 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>40), 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
@ -237,12 +238,11 @@ class Contrat extends CommonObject
'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative Signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80), 'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative Signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
'fk_commercial_suivi' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative follower', 'enabled'=>1, 'visible'=>-1, 'position'=>85), 'fk_commercial_suivi' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative follower', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90), 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90),
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105), 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105, 'searchall'=>1),
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110), 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110, 'searchall'=>1),
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>115), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>115),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>120), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>120),
'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>125), 'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>125),
'ref_customer' =>array('type'=>'varchar(50)', 'label'=>'Ref customer', 'enabled'=>1, 'visible'=>-1, 'position'=>130),
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135), 'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135),
'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'Last main doc', 'enabled'=>1, 'visible'=>-1, 'position'=>140), 'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'Last main doc', 'enabled'=>1, 'visible'=>-1, 'position'=>140),
'statut' =>array('type'=>'smallint(6)', 'label'=>'Statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500, 'notnull'=>1, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 2=>'Closed')) 'statut' =>array('type'=>'smallint(6)', 'label'=>'Statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500, 'notnull'=>1, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 2=>'Closed'))
@ -320,15 +320,15 @@ class Contrat extends CommonObject
* *
* @param User $user Objet User who activate contract * @param User $user Objet User who activate contract
* @param int $line_id Id of line to activate * @param int $line_id Id of line to activate
* @param int $date Opening date * @param int $date_start Opening date
* @param int|string $date_end Expected end date * @param int|string $date_end Expected end date
* @param string $comment A comment typed by user * @param string $comment A comment typed by user
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function active_line($user, $line_id, $date, $date_end = '', $comment = '') public function active_line($user, $line_id, $date_start, $date_end = '', $comment = '')
{ {
// phpcs:enable // phpcs:enable
$result = $this->lines[$this->lines_id_index_mapper[$line_id]]->active_line($user, $date, $date_end, $comment); $result = $this->lines[$this->lines_id_index_mapper[$line_id]]->active_line($user, $date_start, $date_end, $comment);
if ($result < 0) { if ($result < 0) {
$this->error = $this->lines[$this->lines_id_index_mapper[$line_id]]->error; $this->error = $this->lines[$this->lines_id_index_mapper[$line_id]]->error;
$this->errors = $this->lines[$this->lines_id_index_mapper[$line_id]]->errors; $this->errors = $this->lines[$this->lines_id_index_mapper[$line_id]]->errors;
@ -2249,15 +2249,15 @@ class Contrat extends CommonObject
$warning_delay = $conf->contrat->services->inactifs->warning_delay; $warning_delay = $conf->contrat->services->inactifs->warning_delay;
$label = $langs->trans("BoardNotActivatedServices"); $label = $langs->trans("BoardNotActivatedServices");
$labelShort = $langs->trans("BoardNotActivatedServicesShort"); $labelShort = $langs->trans("BoardNotActivatedServicesShort");
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=0&sortfield=cd.date_fin_validite&sortorder=asc'; $url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&search_status=0&sortfield=cd.date_fin_validite&sortorder=asc';
} elseif ($mode == 'expired') { } elseif ($mode == 'expired') {
$warning_delay = $conf->contrat->services->expires->warning_delay; $warning_delay = $conf->contrat->services->expires->warning_delay;
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=4&filter=expired&sortfield=cd.date_fin_validite&sortorder=asc'; $url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&search_status=4&filter=expired&sortfield=cd.date_fin_validite&sortorder=asc';
$label = $langs->trans("BoardExpiredServices"); $label = $langs->trans("BoardExpiredServices");
$labelShort = $langs->trans("BoardExpiredServicesShort"); $labelShort = $langs->trans("BoardExpiredServicesShort");
} else { } else {
$warning_delay = $conf->contrat->services->expires->warning_delay; $warning_delay = $conf->contrat->services->expires->warning_delay;
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=4&sortfield=cd.date_fin_validite&sortorder=asc'; $url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&search_status=4&sortfield=cd.date_fin_validite&sortorder=asc';
//$url.= '&op2day='.$arraydatetouse['mday'].'&op2month='.$arraydatetouse['mon'].'&op2year='.$arraydatetouse['year']; //$url.= '&op2day='.$arraydatetouse['mday'].'&op2month='.$arraydatetouse['mon'].'&op2year='.$arraydatetouse['year'];
//if ($warning_delay >= 0) $url.='&amp;filter=expired'; //if ($warning_delay >= 0) $url.='&amp;filter=expired';
$label = $langs->trans("BoardRunningServices"); $label = $langs->trans("BoardRunningServices");
@ -3587,7 +3587,7 @@ class ContratLigne extends CommonObjectLine
* Activate a contract line * Activate a contract line
* *
* @param User $user Objet User who activate contract * @param User $user Objet User who activate contract
* @param int $date Date activation * @param int $date Date real activation
* @param int|string $date_end Date planned end. Use '-1' to keep it unchanged. * @param int|string $date_end Date planned end. Use '-1' to keep it unchanged.
* @param string $comment A comment typed by user * @param string $comment A comment typed by user
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
@ -3602,13 +3602,13 @@ class ContratLigne extends CommonObjectLine
$this->db->begin(); $this->db->begin();
$this->statut = ContratLigne::STATUS_OPEN; $this->statut = ContratLigne::STATUS_OPEN;
$this->date_start = $date; $this->date_start_real = $date;
$this->date_end = $date_end; $this->date_end = $date_end;
$this->fk_user_ouverture = $user->id; $this->fk_user_ouverture = $user->id;
$this->date_end_real = null; $this->date_end_real = null;
$this->commentaire = $comment; $this->commentaire = $comment;
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET statut = ".$this->statut.","; $sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET statut = ".((int) $this->statut).",";
$sql .= " date_ouverture = ".(dol_strlen($this->date_start_real) != 0 ? "'".$this->db->idate($this->date_start_real)."'" : "null").","; $sql .= " date_ouverture = ".(dol_strlen($this->date_start_real) != 0 ? "'".$this->db->idate($this->date_start_real)."'" : "null").",";
if ($date_end >= 0) { if ($date_end >= 0) {
$sql .= " date_fin_validite = ".(dol_strlen($this->date_end) != 0 ? "'".$this->db->idate($this->date_end)."'" : "null").","; $sql .= " date_fin_validite = ".(dol_strlen($this->date_end) != 0 ? "'".$this->db->idate($this->date_end)."'" : "null").",";
@ -3647,7 +3647,7 @@ class ContratLigne extends CommonObjectLine
* Close a contract line * Close a contract line
* *
* @param User $user Objet User who close contract * @param User $user Objet User who close contract
* @param int $date_end_real Date end * @param int $date_end_real Date end
* @param string $comment A comment typed by user * @param string $comment A comment typed by user
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK

View File

@ -194,7 +194,7 @@ foreach ($listofstatus as $status) {
if (empty($conf->use_javascript_ajax)) { if (empty($conf->use_javascript_ajax)) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$staticcontratligne->LibStatut($status, 0, ($bool ? 1 : 0)).'</td>'; print '<td>'.$staticcontratligne->LibStatut($status, 0, ($bool ? 1 : 0)).'</td>';
print '<td class="right"><a href="services_list.php?mode='.$status.($bool ? '&filter=expired' : '').'">'.($nb[$status.$bool] ? $nb[$status.$bool] : 0).' '.$staticcontratligne->LibStatut($status, 3, ($bool ? 1 : 0)).'</a></td>'; print '<td class="right"><a href="services_list.php?search_status='.((int) $status).($bool ? '&filter=expired' : '').'">'.($nb[$status.$bool] ? $nb[$status.$bool] : 0).' '.$staticcontratligne->LibStatut($status, 3, ($bool ? 1 : 0)).'</a></td>';
print "</tr>\n"; print "</tr>\n";
} }
if ($status == 4 && !$bool) { if ($status == 4 && !$bool) {
@ -224,7 +224,7 @@ foreach ($listofstatus as $status) {
if (empty($conf->use_javascript_ajax)) { if (empty($conf->use_javascript_ajax)) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$staticcontratligne->LibStatut($status, 0, ($bool ? 1 : 0)).'</td>'; print '<td>'.$staticcontratligne->LibStatut($status, 0, ($bool ? 1 : 0)).'</td>';
print '<td class="right"><a href="services_list.php?mode='.$status.($bool ? '&filter=expired' : '').'">'.($nb[$status.$bool] ? $nb[$status.$bool] : 0).' '.$staticcontratligne->LibStatut($status, 3, ($bool ? 1 : 0)).'</a></td>'; print '<td class="right"><a href="services_list.php?search_status='.((int) $status).($bool ? '&filter=expired' : '').'">'.($nb[$status.$bool] ? $nb[$status.$bool] : 0).' '.$staticcontratligne->LibStatut($status, 3, ($bool ? 1 : 0)).'</a></td>';
if ($status == 4 && !$bool) { if ($status == 4 && !$bool) {
$bool = true; $bool = true;
} else { } else {
@ -622,7 +622,7 @@ if ($resql) {
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><th colspan="4">'.$langs->trans("ListOfExpiredServices").' <a href="'.DOL_URL_ROOT.'/contrat/services_list.php?mode=4&amp;filter=expired"><span class="badge">'.$num.'</span></a></th>'; print '<tr class="liste_titre"><th colspan="4">'.$langs->trans("ListOfExpiredServices").' <a href="'.DOL_URL_ROOT.'/contrat/services_list.php?search_status=4&amp;filter=expired"><span class="badge">'.$num.'</span></a></th>';
print "</tr>\n"; print "</tr>\n";
while ($i < $num) { while ($i < $num) {

View File

@ -63,7 +63,7 @@ $search_type_thirdparty = GETPOST("search_type_thirdparty", 'int');
$search_contract = GETPOST('search_contract', 'alpha'); $search_contract = GETPOST('search_contract', 'alpha');
$search_ref_customer = GETPOST('search_ref_customer', 'alpha'); $search_ref_customer = GETPOST('search_ref_customer', 'alpha');
$search_ref_supplier = GETPOST('search_ref_supplier', 'alpha'); $search_ref_supplier = GETPOST('search_ref_supplier', 'alpha');
$sall = (GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'); $search_all = (GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml');
$search_status = GETPOST('search_status', 'alpha'); $search_status = GETPOST('search_status', 'alpha');
$socid = GETPOST('socid', 'int'); $socid = GETPOST('socid', 'int');
$search_user = GETPOST('search_user', 'int'); $search_user = GETPOST('search_user', 'int');
@ -133,16 +133,23 @@ $extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// List of fields to search into when doing a "search in all" // List of fields to search into when doing a "search in all"
$fieldstosearchall = array( $fieldstosearchall = array();
'c.ref'=>'Ref', foreach ($object->fields as $key => $val) {
'c.ref_customer'=>'RefCustomer', if (!empty($val['searchall'])) {
'c.ref_supplier'=>'RefSupplier', $fieldstosearchall['c.'.$key] = $val['label'];
's.nom'=>"ThirdParty", }
'c.note_public'=>'NotePublic', }
); $fieldstosearchall["s.nom"] = "ThirdParty";
if (empty($user->socid)) { if (empty($user->socid)) {
$fieldstosearchall["c.note_private"] = "NotePrivate"; $fieldstosearchall["c.note_private"] = "NotePrivate";
} }
$parameters = array('fieldstosearchall'=>$fieldstosearchall);
$reshook = $hookmanager->executeHooks('completeFieldsToSearchAll', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$fieldstosearchall = $hookmanager->resArray['fieldstosearchall'];
} elseif ($reshook == 0) {
$fieldstosearchall = array_merge($fieldstosearchall, $hookmanager->resArray['fieldstosearchall']);
}
$arrayfields = array( $arrayfields = array(
'c.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1, 'position'=>10), 'c.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1, 'position'=>10),
@ -167,9 +174,12 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
$object->fields = dol_sort_array($object->fields, 'position'); $object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position');
$permissiontoread = $user->rights->contrat->lire;
$permissiontodelete = $user->rights->contrat->supprimer;
/* /*
* Action * Actions
*/ */
if (GETPOST('cancel', 'alpha')) { if (GETPOST('cancel', 'alpha')) {
@ -213,7 +223,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_date_endyear = ''; $search_date_endyear = '';
$search_date_start = ''; $search_date_start = '';
$search_date_end = ''; $search_date_end = '';
$sall = ""; $search_all = "";
$search_status = ""; $search_status = "";
$toselect = array(); $toselect = array();
$search_type_thirdparty = ''; $search_type_thirdparty = '';
@ -224,8 +234,6 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
if (empty($reshook)) { if (empty($reshook)) {
$objectclass = 'Contrat'; $objectclass = 'Contrat';
$objectlabel = 'Contracts'; $objectlabel = 'Contracts';
$permissiontoread = $user->rights->contrat->lire;
$permissiontodelete = $user->rights->contrat->supprimer;
$uploaddir = $conf->contrat->dir_output; $uploaddir = $conf->contrat->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
} }
@ -265,6 +273,9 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint; $sql .= $hookmanager->resPrint;
$sqlfields = $sql; // $sql fields to remove for count total
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
@ -325,8 +336,8 @@ if ($search_country && $search_country != '-1') {
if ($search_sale > 0) { if ($search_sale > 0) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale); $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale);
} }
if ($sall) { if ($search_all) {
$sql .= natural_search(array_keys($fieldstosearchall), $sall); $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
} }
if ($search_user > 0) { if ($search_user > 0) {
$sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='contrat' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".((int) $search_user); $sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='contrat' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".((int) $search_user);
@ -456,13 +467,18 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
} }
} }
} else { } else {
$sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/Ui', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql); /* The fast and low memory method to get and count full list converts the sql into a sql count */
$sqlforcount = preg_replace('/LEFT JOIN '.MAIN_DB_PREFIX.'contratdet as cd ON c.rowid = cd.fk_contrat/', '', $sqlforcount); $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
$sqlforcount = preg_replace('/LEFT JOIN '.MAIN_DB_PREFIX.'contratdet as cd ON c.rowid = cd.fk_contrat /', '', $sqlforcount);
$sqlforcount = preg_replace('/GROUP BY.*$/', '', $sqlforcount); $sqlforcount = preg_replace('/GROUP BY.*$/', '', $sqlforcount);
$resql = $db->query($sqlforcount); $resql = $db->query($sqlforcount);
$objforcount = $db->fetch_object($resql); if ($resql) {
$nbtotalofrecords = $objforcount->nbtotalofrecords; $objforcount = $db->fetch_object($resql);
$nbtotalofrecords = $objforcount->nbtotalofrecords;
} else {
dol_print_error($db);
}
} }
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
@ -485,7 +501,7 @@ if (!$resql) {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
// Direct jump if only one record found // Direct jump if only one record found
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall && !$page) { if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$id = $obj->rowid; $id = $obj->rowid;
header("Location: ".DOL_URL_ROOT.'/contrat/card.php?id='.$id); header("Location: ".DOL_URL_ROOT.'/contrat/card.php?id='.$id);
@ -520,8 +536,8 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.urlencode($limit);
} }
if ($sall != '') { if ($search_all != '') {
$param .= '&sall='.urlencode($sall); $param .= '&search_all='.urlencode($search_all);
} }
if ($search_contract != '') { if ($search_contract != '') {
$param .= '&search_contract='.urlencode($search_contract); $param .= '&search_contract='.urlencode($search_contract);
@ -598,10 +614,10 @@ $arrayofmassactions = array(
'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), 'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), 'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
); );
if ($user->rights->contrat->supprimer) { if (!empty($permissiontodelete)) {
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
} }
if (in_array($massaction, array('presend', 'predelete'))) { if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
$arrayofmassactions = array(); $arrayofmassactions = array();
} }
$massactionbutton = $form->selectMassAction('', $arrayofmassactions); $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
@ -615,7 +631,7 @@ $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars i
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('NewContractSubscription'), '', 'fa fa-plus-circle', $url, '', $user->rights->contrat->creer); $newcardbutton .= dolGetButtonTitle($langs->trans('NewContractSubscription'), '', 'fa fa-plus-circle', $url, '', $user->rights->contrat->creer);
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">'; print '<form method="POST" id="searchFormList" action="'.$_SERVER['PHP_SELF'].'">';
if ($optioncss != '') { if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
} }
@ -624,7 +640,9 @@ print '<input type="hidden" name="formfilteraction" id="formfilteraction" value=
print '<input type="hidden" name="action" value="list">'; print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="page_y" value="">';
print '<input type="hidden" name="mode" value="'.$mode.'">'; print '<input type="hidden" name="mode" value="'.$mode.'">';
print_barre_liste($langs->trans("Contracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'contract', 0, $newcardbutton, '', $limit, 0, 0, 1); print_barre_liste($langs->trans("Contracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'contract', 0, $newcardbutton, '', $limit, 0, 0, 1);
@ -635,11 +653,14 @@ $objecttmp = new Contrat($db);
$trackid = 'con'.$object->id; $trackid = 'con'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($sall) { if ($search_all) {
$setupstring = '';
foreach ($fieldstosearchall as $key => $val) { foreach ($fieldstosearchall as $key => $val) {
$fieldstosearchall[$key] = $langs->trans($val); $fieldstosearchall[$key] = $langs->trans($val);
$setupstring .= $key."=".$val.";";
} }
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>'; print '<!-- Search done like if CONTRACT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n";
} }
$moreforfilter = ''; $moreforfilter = '';

View File

@ -36,6 +36,7 @@ require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php";
$langs->loadLangs(array('products', 'contracts', 'companies')); $langs->loadLangs(array('products', 'contracts', 'companies'));
$optioncss = GETPOST('optioncss', 'aZ09'); $optioncss = GETPOST('optioncss', 'aZ09');
$mode = GETPOST("mode");
$massaction = GETPOST('massaction', 'alpha'); $massaction = GETPOST('massaction', 'alpha');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
@ -55,11 +56,10 @@ if (!$sortorder) {
$sortorder = "ASC"; $sortorder = "ASC";
} }
$mode = GETPOST("mode"); $filter = GETPOST("filter", 'alpha');
$filter = GETPOST("filter");
$search_name = GETPOST("search_name", 'alpha'); $search_name = GETPOST("search_name", 'alpha');
$search_subprice = GETPOST("search_subprice", 'alpha'); $search_subprice = GETPOST("search_subprice", 'alpha');
$search_qty = GETPOST("search_name", 'alpha'); $search_qty = GETPOST("search_qty", 'alpha');
$search_total_ht = GETPOST("search_total_ht", 'alpha'); $search_total_ht = GETPOST("search_total_ht", 'alpha');
$search_total_tva = GETPOST("search_total_tva", 'alpha'); $search_total_tva = GETPOST("search_total_tva", 'alpha');
$search_total_ttc = GETPOST("search_total_ttc", 'alpha'); $search_total_ttc = GETPOST("search_total_ttc", 'alpha');
@ -110,7 +110,6 @@ $result = restrictedArea($user, 'contrat', $contratid);
if ($search_status != '') { if ($search_status != '') {
$tmp = explode('&', $search_status); $tmp = explode('&', $search_status);
$mode = $tmp[0];
if (empty($tmp[1])) { if (empty($tmp[1])) {
$filter = ''; $filter = '';
} else { } else {
@ -121,14 +120,6 @@ if ($search_status != '') {
$filter = 'expired'; $filter = 'expired';
} }
} }
} else {
$search_status = $mode;
if ($filter == 'expired') {
$search_status .= '&filter=expired';
}
if ($filter == 'notexpired') {
$search_status .= '&filter=notexpired';
}
} }
$staticcontrat = new Contrat($db); $staticcontrat = new Contrat($db);
@ -144,10 +135,10 @@ $arrayfields = array(
'cd.qty'=>array('label'=>"Qty", 'checked'=>1, 'position'=>108), 'cd.qty'=>array('label'=>"Qty", 'checked'=>1, 'position'=>108),
'cd.total_ht'=>array('label'=>"TotalHT", 'checked'=>-1, 'position'=>109, 'isameasure'=>1), 'cd.total_ht'=>array('label'=>"TotalHT", 'checked'=>-1, 'position'=>109, 'isameasure'=>1),
'cd.total_tva'=>array('label'=>"TotalVAT", 'checked'=>-1, 'position'=>110), 'cd.total_tva'=>array('label'=>"TotalVAT", 'checked'=>-1, 'position'=>110),
'cd.date_ouverture_prevue'=>array('label'=>"DateStartPlannedShort", 'checked'=>(($mode == "" || $mode == -1) || $mode == "0"), 'position'=>150), 'cd.date_ouverture_prevue'=>array('label'=>"DateStartPlannedShort", 'checked'=>1, 'position'=>150),
'cd.date_ouverture'=>array('label'=>"DateStartRealShort", 'checked'=>(($mode == "" || $mode == -1) || $mode > 0), 'position'=>160), 'cd.date_ouverture'=>array('label'=>"DateStartRealShort", 'checked'=>1, 'position'=>160),
'cd.date_fin_validite'=>array('label'=>"DateEndPlannedShort", 'checked'=>(($mode == "" || $mode == -1) || $mode < 5), 'position'=>170), 'cd.date_fin_validite'=>array('label'=>"DateEndPlannedShort", 'checked'=>1, 'position'=>170),
'cd.date_cloture'=>array('label'=>"DateEndRealShort", 'checked'=>(($mode == "" || $mode == -1) || $mode >= 5), 'position'=>180), 'cd.date_cloture'=>array('label'=>"DateEndRealShort", 'checked'=>1, 'position'=>180),
//'cd.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), //'cd.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'cd.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500), 'cd.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
'status'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000) 'status'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000)
@ -209,7 +200,6 @@ if (empty($reshook)) {
$opclotureday = ""; $opclotureday = "";
$opclotureyear = ""; $opclotureyear = "";
$filter_opcloture = ""; $filter_opcloture = "";
$mode = '';
$filter = ''; $filter = '';
$toselect = array(); $toselect = array();
$search_array_options = array(); $search_array_options = array();
@ -275,13 +265,13 @@ $sql .= " AND c.fk_soc = s.rowid";
if (empty($user->rights->societe->client->voir) && !$socid) { if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
} }
if ($mode == "0") { if ($search_status == "0") {
$sql .= " AND cd.statut = 0"; $sql .= " AND cd.statut = 0";
} }
if ($mode == "4") { if ($search_status == "4") {
$sql .= " AND cd.statut = 4"; $sql .= " AND cd.statut = 4";
} }
if ($mode == "5") { if ($search_status == "5") {
$sql .= " AND cd.statut = 5"; $sql .= " AND cd.statut = 5";
} }
if ($filter == "expired") { if ($filter == "expired") {
@ -294,7 +284,7 @@ if ($search_subprice) {
$sql .= natural_search("cd.subprice", $search_subprice, 1); $sql .= natural_search("cd.subprice", $search_subprice, 1);
} }
if ($search_qty) { if ($search_qty) {
$sql .= natural_search("cd.total_qty", $search_qty, 1); $sql .= natural_search("cd.qty", $search_qty, 1);
} }
if ($search_total_ht) { if ($search_total_ht) {
$sql .= natural_search("cd.total_ht", $search_total_ht, 1); $sql .= natural_search("cd.total_ht", $search_total_ht, 1);
@ -417,6 +407,9 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.$limit; $param .= '&limit='.$limit;
} }
if ($mode) {
$param .= '&amp;mode='.urlencode($mode);
}
if ($search_contract) { if ($search_contract) {
$param .= '&amp;search_contract='.urlencode($search_contract); $param .= '&amp;search_contract='.urlencode($search_contract);
} }
@ -441,8 +434,8 @@ if ($search_total_ttc) {
if ($search_service) { if ($search_service) {
$param .= '&amp;search_service='.urlencode($search_service); $param .= '&amp;search_service='.urlencode($search_service);
} }
if ($mode) { if ($search_status) {
$param .= '&amp;mode='.urlencode($mode); $param .= '&amp;search_status='.urlencode($search_status);
} }
if ($filter) { if ($filter) {
$param .= '&amp;filter='.urlencode($filter); $param .= '&amp;filter='.urlencode($filter);
@ -500,16 +493,16 @@ print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
$title = $langs->trans("ListOfServices"); $title = $langs->trans("ListOfServices");
if ($mode == "0") { if ($search_status == "0") {
$title = $langs->trans("ListOfInactiveServices"); // Must use == "0" $title = $langs->trans("ListOfInactiveServices"); // Must use == "0"
} }
if ($mode == "4" && $filter != "expired") { if ($search_status == "4" && $filter != "expired") {
$title = $langs->trans("ListOfRunningServices"); $title = $langs->trans("ListOfRunningServices");
} }
if ($mode == "4" && $filter == "expired") { if ($search_status == "4" && $filter == "expired") {
$title = $langs->trans("ListOfExpiredServices"); $title = $langs->trans("ListOfExpiredServices");
} }
if ($mode == "5") { if ($search_status == "5") {
$title = $langs->trans("ListOfClosedServices"); $title = $langs->trans("ListOfClosedServices");
} }
@ -563,7 +556,7 @@ if (!empty($arrayfields['c.ref']['checked'])) {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input type="hidden" name="filter" value="'.$filter.'">'; print '<input type="hidden" name="filter" value="'.$filter.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">'; print '<input type="hidden" name="mode" value="'.$mode.'">';
print '<input type="text" class="flat" size="3" name="search_contract" value="'.dol_escape_htmltag($search_contract).'">'; print '<input type="text" class="flat maxwidth75" name="search_contract" value="'.dol_escape_htmltag($search_contract).'">';
print '</td>'; print '</td>';
} }
// Service label // Service label
@ -822,6 +815,9 @@ while ($i < min($num, $limit)) {
if (!$i) { if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'cd.qty'; $totalarray['pos'][$totalarray['nbfield']] = 'cd.qty';
} }
if (!$i) {
$totalarray['val']['cd.qty'] = $obj->qty;
}
$totalarray['val']['cd.qty'] += $obj->qty; $totalarray['val']['cd.qty'] += $obj->qty;
} }
if (!empty($arrayfields['cd.total_ht']['checked'])) { if (!empty($arrayfields['cd.total_ht']['checked'])) {
@ -961,6 +957,17 @@ while ($i < min($num, $limit)) {
// Show total line // Show total line
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
// If no record found
if ($num == 0) {
$colspan = 1;
foreach ($arrayfields as $key => $val) {
if (!empty($val['checked'])) {
$colspan++;
}
}
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
$db->free($resql); $db->free($resql);
$parameters = array('sql' => $sql); $parameters = array('sql' => $sql);

View File

@ -753,7 +753,7 @@ if (!$error && $massaction == "builddoc" && $permissiontoread && !GETPOST('butto
$arrayofinclusion[] = '^'.preg_quote(dol_sanitizeFileName($tmppdf), '/').'\.pdf$'; $arrayofinclusion[] = '^'.preg_quote(dol_sanitizeFileName($tmppdf), '/').'\.pdf$';
} }
foreach ($listofobjectref as $tmppdf) { foreach ($listofobjectref as $tmppdf) {
$arrayofinclusion[] = '^'.preg_quote(dol_sanitizeFileName($tmppdf), '/').'_[a-zA-Z0-9-_]+\.pdf$'; // To include PDF generated from ODX files $arrayofinclusion[] = '^'.preg_quote(dol_sanitizeFileName($tmppdf), '/').'_[a-zA-Z0-9\-\_\']+\.pdf$'; // To include PDF generated from ODX files
} }
$listoffiles = dol_dir_list($uploaddir, 'all', 1, implode('|', $arrayofinclusion), '\.meta$|\.png', 'date', SORT_DESC, 0, true); $listoffiles = dol_dir_list($uploaddir, 'all', 1, implode('|', $arrayofinclusion), '\.meta$|\.png', 'date', SORT_DESC, 0, true);

View File

@ -0,0 +1,278 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015-2020 Frederic France <frederic.france@netlogic.fr>
* Copyright (C) 2021-2022 Waël Almoman <info@almoman.com>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/core/boxes/box_members_by_tags.php
* \ingroup adherent
* \brief Module to show box of members
*/
include_once DOL_DOCUMENT_ROOT . '/core/boxes/modules_boxes.php';
/**
* Class to manage the box to show last modofied members
*/
class box_members_by_tags extends ModeleBoxes
{
public $boxcode = "box_members_by_tags";
public $boximg = "object_user";
public $boxlabel = "BoxTitleMembersByTags";
public $depends = array("adherent", "categorie");
/**
* @var DoliDB Database handler.
*/
public $db;
public $param;
public $enabled = 1;
public $info_box_head = array();
public $info_box_contents = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
public function __construct($db, $param = '')
{
global $conf, $user;
$this->db = $db;
// disable module for such cases
$listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
if (!in_array('adherent', $listofmodulesforexternal) && !empty($user->socid)) {
$this->enabled = 0; // disabled for external users
}
$this->hidden = !(isModEnabled('adherent') && $user->rights->adherent->lire);
}
/**
* Load data into info_box_contents array to show array later.
*
* @param int $max Maximum number of records to load
* @return void
*/
public function loadBox($max = 5)
{
global $user, $langs, $conf;
$langs->load("boxes");
$this->max = $max;
include_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
$staticmember = new Adherent($this->db);
$year = date('Y');
$numberyears = empty(getDolGlobalInt("MAIN_NB_OF_YEAR_IN_WIDGET_GRAPH")) ? 2 : getDolGlobalInt("MAIN_NB_OF_YEAR_IN_WIDGET_GRAPH");
$this->info_box_head = array('text' => $langs->trans("BoxTitleMembersByTags").' ('.$year-$numberyears.' - '.$year.')');
if ($user->rights->adherent->lire) {
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherentstats.class.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$stats = new AdherentStats($this->db, $user->socid, $user->id);
// Show array
$sumMembers= $stats->countMembersByTagAndStatus($numberyears);
if ($sumMembers) {
$line = 0;
$this->info_box_contents[$line][] = array(
'td' => 'class=""',
'text' => '',
);
// Members Status To Valid
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_DRAFT, 0, 0, 1);
$this->info_box_contents[$line][] = array(
'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($labelstatus).'"',
'text' => $labelstatus
);
// Waiting for subscription
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_VALIDATED, 1, 0, 1);
$this->info_box_contents[$line][] = array(
'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($labelstatus).'"',
'text' => $labelstatus,
);
// Up to date
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_VALIDATED, 1, dol_now() + 86400, 1);
$this->info_box_contents[$line][] = array(
'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($labelstatus).'"',
'text' => $labelstatus,
);
// Expired
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_VALIDATED, 1, dol_now() - 86400, 1);
$this->info_box_contents[$line][] = array(
'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($labelstatus).'"',
'text' => $labelstatus
);
// Excluded
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_EXCLUDED, 0, 0, 1);
$this->info_box_contents[$line][] = array(
'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($labelstatus).'"',
'text' => $labelstatus
);
// Resiliated
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_RESILIATED, 0, 0, 1);
$this->info_box_contents[$line][] = array(
'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($labelstatus).'"',
'text' => $labelstatus
);
// Total row
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_RESILIATED, 0, 0, 1);
$this->info_box_contents[$line][] = array(
'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($langs->trans("Total")).'"',
'text' => $langs->trans("Total")
);
$line++;
foreach ($sumMembers as $key => $data) {
$adhtype = new AdherentType($this->db);
$adhtype->id = $key;
if ($key=='total') {
break;
}
$adhtype->label = $data['label'];
$AdherentType[$key] = $adhtype;
$this->info_box_contents[$line][] = array(
'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
'text' => $adhtype->getNomUrl(1, dol_size(32)),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => (isset($data['members_draft']) && $data['members_draft'] > 0 ? $data['members_draft'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_DRAFT, 1, 0, 3),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => (isset($data['members_pending']) && $data['members_pending'] > 0 ? $data['members_pending'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, $now, 3),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => (isset($data['members_uptodate']) && $data['members_uptodate'] > 0 ? $data['members_uptodate'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 0, 0, 3),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => (isset($data['members_expired']) && $data['members_expired'] > 0 ? $data['members_expired'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, 1, 3),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => (isset($data['members_excluded']) && $data['members_excluded'] > 0 ? $data['members_excluded'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_EXCLUDED, 1, $now, 3),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => (isset($data['members_resiliated']) && $data['members_resiliated'] > 0 ? $data['members_resiliated'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_RESILIATED, 1, 0, 3),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => (isset($data['total_adhtype']) && $data['total_adhtype'] > 0 ? $data['total_adhtype'] : ''),
'asis' => 1,
);
$line++;
}
if (count($sumMembers) == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center" colspan="6"',
'text' => $langs->trans("NoRecordedMembersByType")
);
} else {
$this->info_box_contents[$line][] = array(
'tr' => 'class="liste_total"',
'td' => 'class="liste_total"',
'text' => $langs->trans("Total")
);
$this->info_box_contents[$line][] = array(
'td' => 'class="liste_total right"',
'text' => $sumMembers['total']['members_draft'].' '.$staticmember->LibStatut(Adherent::STATUS_DRAFT, 1, 0, 3),
'asis' => 1
);
$this->info_box_contents[$line][] = array(
'td' => 'class="liste_total right"',
'text' => $sumMembers['total']['members_pending'].' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, $now, 3),
'asis' => 1
);
$this->info_box_contents[$line][] = array(
'td' => 'class="liste_total right"',
'text' => $sumMembers['total']['members_uptodate'].' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 0, 0, 3),
'asis' => 1
);
$this->info_box_contents[$line][] = array(
'td' => 'class="liste_total right"',
'text' => $sumMembers['total']['members_expired'].' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, 1, 3),
'asis' => 1
);
$this->info_box_contents[$line][] = array(
'td' => 'class="liste_total right"',
'text' => $sumMembers['total']['members_excluded'].' '.$staticmember->LibStatut(Adherent::STATUS_EXCLUDED, 1, 0, 3),
'asis' => 1
);
$this->info_box_contents[$line][] = array(
'td' => 'class="liste_total right"',
'text' => $sumMembers['total']['members_resiliated'].' '.$staticmember->LibStatut(Adherent::STATUS_RESILIATED, 1, 0, 3),
'asis' => 1
);
$this->info_box_contents[$line][] = array(
'td' => 'class="liste_total right"',
'text' => $sumMembers['total']['all'],
'asis' => 1
);
}
} else {
$this->info_box_contents[0][0] = array(
'td' => '',
'maxlength' => 500,
'text' => ($this->db->error() . ' sql=' . $sql)
);
}
} else {
$this->info_box_contents[0][0] = array(
'td' => 'class="nohover opacitymedium left"',
'text' => $langs->trans("ReadPermissionNotAllowed")
);
}
}
/**
* Method to show box
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return string
*/
public function showBox($head = null, $contents = null, $nooutput = 0)
{
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@ -464,6 +464,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" box
closedir($handle); closedir($handle);
} }
} }
//echo "<pre>";print_r($modules);echo "</pre>";
asort($orders); asort($orders);

View File

@ -443,7 +443,7 @@ abstract class CommonDocGenerator
} }
} }
$date = ($object->element == 'contrat' ? $object->date_contrat : $object->date); $date = (isset($object->element) && $object->element == 'contrat' && isset($object->date_contrat)) ? $object->date_contrat : (isset($object->date) ? $object->date : null);
$resarray = array( $resarray = array(
$array_key.'_id'=>$object->id, $array_key.'_id'=>$object->id,
@ -452,7 +452,7 @@ abstract class CommonDocGenerator
$array_key.'_ref_ext' => (property_exists($object, 'ref_ext') ? $object->ref_ext : ''), $array_key.'_ref_ext' => (property_exists($object, 'ref_ext') ? $object->ref_ext : ''),
$array_key.'_ref_customer'=>(!empty($object->ref_client) ? $object->ref_client : (empty($object->ref_customer) ? '' : $object->ref_customer)), $array_key.'_ref_customer'=>(!empty($object->ref_client) ? $object->ref_client : (empty($object->ref_customer) ? '' : $object->ref_customer)),
$array_key.'_ref_supplier'=>(!empty($object->ref_fournisseur) ? $object->ref_fournisseur : (empty($object->ref_supplier) ? '' : $object->ref_supplier)), $array_key.'_ref_supplier'=>(!empty($object->ref_fournisseur) ? $object->ref_fournisseur : (empty($object->ref_supplier) ? '' : $object->ref_supplier)),
$array_key.'_source_invoice_ref'=>$invoice_source->ref, $array_key.'_source_invoice_ref'=>((empty($invoice_source) || empty($invoice_source->ref)) ? '' : $invoice_source->ref),
// Dates // Dates
$array_key.'_hour'=>dol_print_date($date, 'hour'), $array_key.'_hour'=>dol_print_date($date, 'hour'),
$array_key.'_date'=>dol_print_date($date, 'day'), $array_key.'_date'=>dol_print_date($date, 'day'),
@ -1104,7 +1104,7 @@ abstract class CommonDocGenerator
public function getColumnContentXStart($colKey) public function getColumnContentXStart($colKey)
{ {
$colDef = $this->cols[$colKey]; $colDef = $this->cols[$colKey];
return $colDef['xStartPos'] + $colDef['content']['padding'][3]; return (isset($colDef['xStartPos']) ? $colDef['xStartPos'] : 0) + $colDef['content']['padding'][3];
} }
/** /**
@ -1279,7 +1279,7 @@ abstract class CommonDocGenerator
$extrafieldOptionsKey = $extrafieldsKeyPrefix.$extrafieldKey; $extrafieldOptionsKey = $extrafieldsKeyPrefix.$extrafieldKey;
// Load extrafiels if not allready does // Load extra fields if they haven't been loaded already.
if (empty($this->extrafieldsCache)) { if (empty($this->extrafieldsCache)) {
$this->extrafieldsCache = new ExtraFields($this->db); $this->extrafieldsCache = new ExtraFields($this->db);
} }
@ -1605,7 +1605,7 @@ abstract class CommonDocGenerator
return 0; return 0;
} }
// Load extrafiels if not allready does // Load extra fields if they haven't been loaded already.
if (empty($this->extrafieldsCache)) { if (empty($this->extrafieldsCache)) {
$this->extrafieldsCache = new ExtraFields($this->db); $this->extrafieldsCache = new ExtraFields($this->db);
} }
@ -1615,7 +1615,7 @@ abstract class CommonDocGenerator
$extrafields = $this->extrafieldsCache; $extrafields = $this->extrafieldsCache;
if (!empty($extrafields->attributes[$object->table_element]) && is_array($extrafields->attributes[$object->table_element]['label'])) { if (!empty($extrafields->attributes[$object->table_element]) && is_array($extrafields->attributes[$object->table_element]) && array_key_exists('label', $extrafields->attributes[$object->table_element]) && is_array($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label) {
// Dont display separator yet even is set to be displayed (not compatible yet) // Dont display separator yet even is set to be displayed (not compatible yet)
if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate') { if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate') {

View File

@ -332,6 +332,7 @@ abstract class CommonInvoice extends CommonObject
$field = 'fk_facture'; $field = 'fk_facture';
$field2 = 'fk_paiement'; $field2 = 'fk_paiement';
$field3 = ', p.ref_ext'; $field3 = ', p.ref_ext';
$field4 = ', p.fk_bank'; // Bank line id
$sharedentity = 'facture'; $sharedentity = 'facture';
if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier') { if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier') {
$table = 'paiementfourn_facturefourn'; $table = 'paiementfourn_facturefourn';
@ -342,7 +343,7 @@ abstract class CommonInvoice extends CommonObject
$sharedentity = 'facture_fourn'; $sharedentity = 'facture_fourn';
} }
$sql = "SELECT p.ref, pf.amount, pf.multicurrency_amount, p.fk_paiement, p.datep, p.num_paiement as num, t.code".$field3; $sql = "SELECT p.ref, pf.amount, pf.multicurrency_amount, p.fk_paiement, p.datep, p.num_paiement as num, t.code".$field3 . $field4;
$sql .= " FROM ".$this->db->prefix().$table." as pf, ".$this->db->prefix().$table2." as p, ".$this->db->prefix()."c_paiement as t"; $sql .= " FROM ".$this->db->prefix().$table." as pf, ".$this->db->prefix().$table2." as p, ".$this->db->prefix()."c_paiement as t";
$sql .= " WHERE pf.".$field." = ".((int) $this->id); $sql .= " WHERE pf.".$field." = ".((int) $this->id);
$sql .= " AND pf.".$field2." = p.rowid"; $sql .= " AND pf.".$field2." = p.rowid";
@ -363,6 +364,9 @@ abstract class CommonInvoice extends CommonObject
if (!empty($field3)) { if (!empty($field3)) {
$tmp['ref_ext'] = $obj->ref_ext; $tmp['ref_ext'] = $obj->ref_ext;
} }
if (!empty($field4)) {
$tmp['fk_bank_line'] = $obj->fk_bank;
}
$retarray[] = $tmp; $retarray[] = $tmp;
$i++; $i++;
} }
@ -1079,10 +1083,12 @@ abstract class CommonInvoice extends CommonObject
if ($companypaymentmode->type == 'ban') { if ($companypaymentmode->type == 'ban') {
$sepaMode = true; $sepaMode = true;
// Check into societe_rib if a payment mode for Stripe and ban payment exists // Check into societe_rib if a payment mode for Stripe and ban payment exists
// To make a Stripe SEPA payment request, we must have the payment mode source already saved into societe_rib and retreived with ->sepaStripe
// The payment mode source is created when we create the bank account on Stripe with paymentmodes.php?action=create
$stripecard = $stripe->sepaStripe($customer, $companypaymentmode, $stripeacc, $servicestatus, 0); $stripecard = $stripe->sepaStripe($customer, $companypaymentmode, $stripeacc, $servicestatus, 0);
} }
if ($stripecard) { // Can be src_... (for sepa). Note that card_... (old card mode) or pm_... (new card mode) should not happen here. if ($stripecard) { // Can be src_... (for sepa) or pm_... (new card mode). Note that card_... (old card mode) should not happen here.
$FULLTAG = 'INV=' . $this->id . '-CUS=' . $thirdparty->id; $FULLTAG = 'INV=' . $this->id . '-CUS=' . $thirdparty->id;
$description = 'Stripe payment from makeStripeSepaRequest: ' . $FULLTAG . ' ref=' . $this->ref; $description = 'Stripe payment from makeStripeSepaRequest: ' . $FULLTAG . ' ref=' . $this->ref;
@ -1097,7 +1103,7 @@ abstract class CommonInvoice extends CommonObject
$paymentintent = $stripe->getPaymentIntent($amounttopay, $currency, $FULLTAG, $description, $this, $customer->id, $stripeacc, $servicestatus, 0, 'automatic', true, $stripecard->id, 1); $paymentintent = $stripe->getPaymentIntent($amounttopay, $currency, $FULLTAG, $description, $this, $customer->id, $stripeacc, $servicestatus, 0, 'automatic', true, $stripecard->id, 1);
$charge = new stdClass(); $charge = new stdClass();
//erics add processing sepa is like success ?
if ($paymentintent->status === 'succeeded' || $paymentintent->status === 'processing') { if ($paymentintent->status === 'succeeded' || $paymentintent->status === 'processing') {
$charge->status = 'ok'; $charge->status = 'ok';
$charge->id = $paymentintent->id; $charge->id = $paymentintent->id;
@ -1173,9 +1179,9 @@ abstract class CommonInvoice extends CommonObject
$postactionmessages[] = $errmsg . ' (' . $stripearrayofkeys['publishable_key'] . ')'; $postactionmessages[] = $errmsg . ' (' . $stripearrayofkeys['publishable_key'] . ')';
$this->errors[] = $errmsg; $this->errors[] = $errmsg;
} else { } else {
dol_syslog('Successfuly charge direct debit ' . $stripecard->id); dol_syslog('Successfuly request direct debit ' . $stripecard->id);
$postactionmessages[] = 'Success to charge direct debit (' . $charge->id . ' with ' . $stripearrayofkeys['publishable_key'] . ')'; $postactionmessages[] = 'Success to request direct debit (' . $charge->id . ' with ' . $stripearrayofkeys['publishable_key'] . ')';
// Save a stripe payment was done in realy life so later we will be able to force a commit on recorded payments // Save a stripe payment was done in realy life so later we will be able to force a commit on recorded payments
// even if in batch mode (method doTakePaymentStripe), we will always make all action in one transaction with a forced commit. // even if in batch mode (method doTakePaymentStripe), we will always make all action in one transaction with a forced commit.
@ -1185,7 +1191,7 @@ abstract class CommonInvoice extends CommonObject
$description = 'Stripe payment request OK (' . $charge->id . ') from makeStripeSepaRequest: ' . $FULLTAG; $description = 'Stripe payment request OK (' . $charge->id . ') from makeStripeSepaRequest: ' . $FULLTAG;
// TODO Save request to status pending. Done should be set with a webhook. // @TODO LMR Save request to status pending instead of done. Done should be set with a webhook.
$db = $this->db; $db = $this->db;
@ -1227,6 +1233,7 @@ abstract class CommonInvoice extends CommonObject
$ispostactionok = 1; $ispostactionok = 1;
// Creation of payment line // Creation of payment line
// TODO LMR This must be move into the stripe server listening hooks public/stripe/ipn.php
include_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php'; include_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
$paiement = new Paiement($this->db); $paiement = new Paiement($this->db);
$paiement->datepaye = $now; $paiement->datepaye = $now;

View File

@ -961,27 +961,6 @@ abstract class CommonObject
} }
$outdone++; $outdone++;
} }
} else { // Old code to remove
if (!empty($this->skype)) {
$outsocialnetwork .= dol_print_socialnetworks($this->skype, $this->id, $object->id, 'skype');
}
$outdone++;
if (!empty($this->jabberid)) {
$outsocialnetwork .= dol_print_socialnetworks($this->jabberid, $this->id, $object->id, 'jabber');
}
$outdone++;
if (!empty($this->twitter)) {
$outsocialnetwork .= dol_print_socialnetworks($this->twitter, $this->id, $object->id, 'twitter');
}
$outdone++;
if (!empty($this->facebook)) {
$outsocialnetwork .= dol_print_socialnetworks($this->facebook, $this->id, $object->id, 'facebook');
}
$outdone++;
if (!empty($this->linkedin)) {
$outsocialnetwork .= dol_print_socialnetworks($this->linkedin, $this->id, $object->id, 'linkedin');
}
$outdone++;
} }
if ($outsocialnetwork) { if ($outsocialnetwork) {
@ -1291,11 +1270,11 @@ abstract class CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Delete all links between an object $this and all its contacts * Delete all links between an object $this and all its contacts in llx_element_contact
* *
* @param string $source '' or 'internal' or 'external' * @param string $source '' or 'internal' or 'external'
* @param string $code Type of contact (code or id) * @param string $code Type of contact (code or id)
* @return int >0 if OK, <0 if KO * @return int <0 if KO, 0=Nothing done, >0 if OK
*/ */
public function delete_linked_contact($source = '', $code = '') public function delete_linked_contact($source = '', $code = '')
{ {
@ -1311,11 +1290,15 @@ abstract class CommonObject
$listId = implode(",", $temp); $listId = implode(",", $temp);
} }
// If $listId is empty, we have not criteria on fk_c_type_contact so we will delete record on element_id for
// any type or record instead of only the ones of the current object. So we do nothing in such a case.
if (empty($listId)) {
return 0;
}
$sql = "DELETE FROM ".$this->db->prefix()."element_contact"; $sql = "DELETE FROM ".$this->db->prefix()."element_contact";
$sql .= " WHERE element_id = ".((int) $this->id); $sql .= " WHERE element_id = ".((int) $this->id);
if (!empty($listId)) { $sql .= " AND fk_c_type_contact IN (".$this->db->sanitize($listId).")";
$sql .= " AND fk_c_type_contact IN (".$this->db->sanitize($listId).")";
}
dol_syslog(get_class($this)."::delete_linked_contact", LOG_DEBUG); dol_syslog(get_class($this)."::delete_linked_contact", LOG_DEBUG);
if ($this->db->query($sql)) { if ($this->db->query($sql)) {
@ -8652,7 +8635,10 @@ abstract class CommonObject
// Find name of thumb file // Find name of thumb file
$photo_vignette = basename(getImageFileNameForSize($dir.$file, '_small')); $photo_vignette = basename(getImageFileNameForSize($dir.$file, '_small'));
if (!dol_is_file($dirthumb.$photo_vignette)) { if (!dol_is_file($dirthumb.$photo_vignette)) {
$photo_vignette = ''; // The thumb does not exists, so we will use the original file
$dirthumb = $dir;
$pdirthumb = $pdir;
$photo_vignette = basename($file);
} }
// Get filesize of original file // Get filesize of original file

View File

@ -27,6 +27,12 @@
*/ */
trait CommonSocialNetworks trait CommonSocialNetworks
{ {
/**
* @var array array of socialnetworks
*/
public $socialnetworks;
/** /**
* Show social network part if the module is enabled with hiding functionality * Show social network part if the module is enabled with hiding functionality
* *

View File

@ -785,6 +785,11 @@ class Conf
$this->global->USE_STRICT_CSV_RULES = 2; $this->global->USE_STRICT_CSV_RULES = 2;
} }
// By default, option is on. Once set by user, this code is useless
if (!isset($this->global->ACCOUNTING_REEXPORT)) {
$this->global->ACCOUNTING_REEXPORT = 1;
}
// Use a SCA ready workflow with Stripe module (STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION by default if nothing defined) // Use a SCA ready workflow with Stripe module (STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION by default if nothing defined)
if (!isset($this->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION) && empty($this->global->STRIPE_USE_NEW_CHECKOUT)) { if (!isset($this->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION) && empty($this->global->STRIPE_USE_NEW_CHECKOUT)) {
$this->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION = 1; $this->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION = 1;

View File

@ -5109,7 +5109,7 @@ class Form
$more .= '</div></div>'."\n"; $more .= '</div></div>'."\n";
} elseif ($input['type'] == 'checkbox') { } elseif ($input['type'] == 'checkbox') {
$more .= '<div class="tagtr">'; $more .= '<div class="tagtr">';
$more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].' </div><div class="tagtd">'; $more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'"><label for="'.dol_escape_htmltag($input['name']).'">'.$input['label'].'</label></div><div class="tagtd">';
$more .= '<input type="checkbox" class="flat'.($morecss ? ' '.$morecss : '').'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$moreattr; $more .= '<input type="checkbox" class="flat'.($morecss ? ' '.$morecss : '').'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$moreattr;
if (!is_bool($input['value']) && $input['value'] != 'false' && $input['value'] != '0' && $input['value'] != '') { if (!is_bool($input['value']) && $input['value'] != 'false' && $input['value'] != '0' && $input['value'] != '') {
$more .= ' checked'; $more .= ' checked';
@ -6287,7 +6287,7 @@ class Form
if (!empty($conf->global->SERVICE_ARE_ECOMMERCE_200238EC)) { // If option to have vat for end customer for services is on if (!empty($conf->global->SERVICE_ARE_ECOMMERCE_200238EC)) { // If option to have vat for end customer for services is on
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
if (!isInEEC($societe_vendeuse) && (!is_object($societe_acheteuse) || (isInEEC($societe_acheteuse) && !$societe_acheteuse->isACompany()))) { if (!isInEEC($societe_vendeuse) && (!is_object($societe_acheteuse) || (isInEEC($societe_acheteuse) && !$societe_acheteuse->isACompany()))) {
// We also add the buyer // We also add the buyer country code
if (is_numeric($type)) { if (is_numeric($type)) {
if ($type == 1) { // We know product is a service if ($type == 1) { // We know product is a service
$code_country .= ",'".$societe_acheteuse->country_code."'"; $code_country .= ",'".$societe_acheteuse->country_code."'";
@ -7801,7 +7801,7 @@ class Form
} }
/** /**
* Function to forge a SQL criteria * Function to forge a SQL criteria from a Dolibarr filter syntax string.
* *
* @param array $matches Array of found string by regex search. Example: "t.ref:like:'SO-%'" or "t.date_creation:<:'20160101'" or "t.nature:is:NULL" * @param array $matches Array of found string by regex search. Example: "t.ref:like:'SO-%'" or "t.date_creation:<:'20160101'" or "t.nature:is:NULL"
* @return string Forged criteria. Example: "t.field like 'abc%'" * @return string Forged criteria. Example: "t.field like 'abc%'"
@ -7816,17 +7816,30 @@ class Form
} }
$tmp = explode(':', $matches[1]); $tmp = explode(':', $matches[1]);
if (count($tmp) < 3) { if (count($tmp) < 3) {
return ''; return '1=2'; // An always false request
} }
$tmpescaped = $tmp[2]; $tmpescaped = $tmp[2];
$regbis = array(); $regbis = array();
if (preg_match('/^\'(.*)\'$/', $tmpescaped, $regbis)) { if (preg_match('/^\'(.*)\'$/', $tmpescaped, $regbis)) {
$tmpescaped = "'".$db->escape($regbis[1])."'"; $tmpescaped = "'".$db->escape($regbis[1])."'";
} else { } else {
$tmpescaped = $db->escape($tmpescaped); $tmpescaped = $db->escape($tmpescaped);
} }
return $db->escape($tmp[0]).' '.strtoupper($db->escape($tmp[1]))." ".$tmpescaped;
if ($tmp[1] == '!=') {
$tmp[1] = '<>';
}
if (preg_match('/[\(\)]/', $tmp[0])) {
return '1=2'; // An always false request
}
if (! in_array($tmp[1], array('<', '>', '<>', 'is', 'isnot', '=', 'like'))) {
return '1=2'; // An always false request
}
return $db->escape($tmp[0]).' '.strtoupper($db->escape($tmp[1])).' '.$tmpescaped;
} }
/** /**

View File

@ -39,6 +39,9 @@ class FormProjets
*/ */
public $error = ''; public $error = '';
public $errors = array();
public $nboftasks; public $nboftasks;
@ -622,6 +625,8 @@ class FormProjets
if ($resql) { if ($resql) {
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
$i = 0; $i = 0;
$sellist = '';
if ($num > 0) { if ($num > 0) {
$sellist = '<select class="flat elementselect css'.$table_element.($morecss ? ' '.$morecss : '').'" name="elementselect">'; $sellist = '<select class="flat elementselect css'.$table_element.($morecss ? ' '.$morecss : '').'" name="elementselect">';
$sellist .= '<option value="-1"'.($placeholder ? ' class="optiongrey"' : '').'>'.$placeholder.'</option>'; $sellist .= '<option value="-1"'.($placeholder ? ' class="optiongrey"' : '').'>'.$placeholder.'</option>';

View File

@ -21,7 +21,6 @@
*/ */
class FormSetup class FormSetup
{ {
/** /**
* @var DoliDB Database handler. * @var DoliDB Database handler.
*/ */
@ -1082,16 +1081,18 @@ class FormSetupItem
} }
} }
} elseif (preg_match('/emailtemplate:/', $this->type)) { } elseif (preg_match('/emailtemplate:/', $this->type)) {
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; if ($this->fieldValue > 0) {
$formmail = new FormMail($this->db); include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
$formmail = new FormMail($this->db);
$tmp = explode(':', $this->type); $tmp = explode(':', $this->type);
$template = $formmail->getEMailTemplate($this->db, $tmp[1], $user, $this->langs, $this->fieldValue); $template = $formmail->getEMailTemplate($this->db, $tmp[1], $user, $this->langs, $this->fieldValue);
if (is_numeric($template) && $template < 0) { if (is_numeric($template) && $template < 0) {
$this->setErrors($formmail->errors); $this->setErrors($formmail->errors);
}
$out.= $this->langs->trans($template->label);
} }
$out.= $this->langs->trans($template->label);
} elseif (preg_match('/category:/', $this->type)) { } elseif (preg_match('/category:/', $this->type)) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$c = new Categorie($this->db); $c = new Categorie($this->db);
@ -1117,6 +1118,7 @@ class FormSetupItem
} }
} elseif ($this->type == 'product') { } elseif ($this->type == 'product') {
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
$product = new Product($this->db); $product = new Product($this->db);
$resprod = $product->fetch($this->fieldValue); $resprod = $product->fetch($this->fieldValue);
if ($resprod > 0) { if ($resprod > 0) {

View File

@ -1291,7 +1291,6 @@ class Ldap
$this->firstname = $this->convToOutputCharset($result[0][$this->attr_firstname][0], $this->ldapcharset); $this->firstname = $this->convToOutputCharset($result[0][$this->attr_firstname][0], $this->ldapcharset);
$this->login = $this->convToOutputCharset($result[0][$this->attr_login][0], $this->ldapcharset); $this->login = $this->convToOutputCharset($result[0][$this->attr_login][0], $this->ldapcharset);
$this->phone = $this->convToOutputCharset($result[0][$this->attr_phone][0], $this->ldapcharset); $this->phone = $this->convToOutputCharset($result[0][$this->attr_phone][0], $this->ldapcharset);
$this->skype = $this->convToOutputCharset($result[0][$this->attr_skype][0], $this->ldapcharset);
$this->fax = $this->convToOutputCharset($result[0][$this->attr_fax][0], $this->ldapcharset); $this->fax = $this->convToOutputCharset($result[0][$this->attr_fax][0], $this->ldapcharset);
$this->mail = $this->convToOutputCharset($result[0][$this->attr_mail][0], $this->ldapcharset); $this->mail = $this->convToOutputCharset($result[0][$this->attr_mail][0], $this->ldapcharset);
$this->mobile = $this->convToOutputCharset($result[0][$this->attr_mobile][0], $this->ldapcharset); $this->mobile = $this->convToOutputCharset($result[0][$this->attr_mobile][0], $this->ldapcharset);

View File

@ -705,7 +705,7 @@ class DoliDBMysqli extends DoliDB
} }
$tmpdatabase = preg_replace('/[^a-z0-9\.\-\_]/i', '', $database); $tmpdatabase = preg_replace('/[^a-z0-9\.\-\_]/i', '', $database);
$sql = "SHOW TABLES FROM ".$tmpdatabase." ".$like.";"; $sql = "SHOW TABLES FROM `".$tmpdatabase."` ".$like.";";
//print $sql; //print $sql;
$result = $this->query($sql); $result = $this->query($sql);
if ($result) { if ($result) {

View File

@ -1433,13 +1433,17 @@ function dol_string_nounprintableascii($str, $removetabcrlf = 1)
/** /**
* Returns text escaped for inclusion into javascript code * Returns text escaped for inclusion into javascript code
* *
* @param string $stringtoescape String to escape * @param string $stringtoescape String to escape
* @param int $mode 0=Escape also ' and " into ', 1=Escape ' but not " for usage into 'string', 2=Escape " but not ' for usage into "string", 3=Escape ' and " with \ * @param int $mode 0=Escape also ' and " into ', 1=Escape ' but not " for usage into 'string', 2=Escape " but not ' for usage into "string", 3=Escape ' and " with \
* @param int $noescapebackslashn 0=Escape also \n. 1=Do not escape \n. * @param int $noescapebackslashn 0=Escape also \n. 1=Do not escape \n.
* @return string Escaped string. Both ' and " are escaped into ' if they are escaped. * @return string Escaped string. Both ' and " are escaped into ' if they are escaped.
*/ */
function dol_escape_js($stringtoescape, $mode = 0, $noescapebackslashn = 0) function dol_escape_js($stringtoescape, $mode = 0, $noescapebackslashn = 0)
{ {
if (is_null($stringtoescape)) {
return '';
}
// escape quotes and backslashes, newlines, etc. // escape quotes and backslashes, newlines, etc.
$substitjs = array("&#039;"=>"\\'", "\r"=>'\\r'); $substitjs = array("&#039;"=>"\\'", "\r"=>'\\r');
//$substitjs['</']='<\/'; // We removed this. Should be useless. //$substitjs['</']='<\/'; // We removed this. Should be useless.
@ -4085,7 +4089,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'delete', 'dolly', 'dollyrevert', 'donation', 'download', 'dynamicprice', 'delete', 'dolly', 'dollyrevert', 'donation', 'download', 'dynamicprice',
'edit', 'ellipsis-h', 'email', 'entity', 'envelope', 'eraser', 'establishment', 'expensereport', 'external-link-alt', 'external-link-square-alt', 'eye', 'edit', 'ellipsis-h', 'email', 'entity', 'envelope', 'eraser', 'establishment', 'expensereport', 'external-link-alt', 'external-link-square-alt', 'eye',
'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'autofill', 'folder', 'folder-open', 'folder-plus', 'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'autofill', 'folder', 'folder-open', 'folder-plus',
'generate', 'globe', 'globe-americas', 'graph', 'grip', 'grip_title', 'group', 'gears', 'generate', 'globe', 'globe-americas', 'graph', 'grip', 'grip_title', 'group',
'help', 'holiday', 'help', 'holiday',
'id-card', 'images', 'incoterm', 'info', 'intervention', 'inventory', 'intracommreport', 'knowledgemanagement', 'id-card', 'images', 'incoterm', 'info', 'intervention', 'inventory', 'intracommreport', 'knowledgemanagement',
'label', 'language', 'line', 'link', 'list', 'list-alt', 'listlight', 'loan', 'lock', 'lot', 'long-arrow-alt-right', 'label', 'language', 'line', 'link', 'list', 'list-alt', 'listlight', 'loan', 'lock', 'lot', 'long-arrow-alt-right',
@ -5743,9 +5747,9 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $
// If force rounding // If force rounding
if ((string) $forcerounding != '-1') { if ((string) $forcerounding != '-1') {
if ($forcerounding == 'MU') { if ($forcerounding === 'MU') {
$nbdecimal = $conf->global->MAIN_MAX_DECIMALS_UNIT; $nbdecimal = $conf->global->MAIN_MAX_DECIMALS_UNIT;
} elseif ($forcerounding == 'MT') { } elseif ($forcerounding === 'MT') {
$nbdecimal = $conf->global->MAIN_MAX_DECIMALS_TOT; $nbdecimal = $conf->global->MAIN_MAX_DECIMALS_TOT;
} elseif ($forcerounding >= 0) { } elseif ($forcerounding >= 0) {
$nbdecimal = $forcerounding; $nbdecimal = $forcerounding;
@ -6490,7 +6494,7 @@ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer,
if (!empty($conf->global->SERVICE_ARE_ECOMMERCE_200238EC)) { if (!empty($conf->global->SERVICE_ARE_ECOMMERCE_200238EC)) {
if ($seller_in_cee && $buyer_in_cee) { if ($seller_in_cee && $buyer_in_cee) {
$isacompany = $thirdparty_buyer->isACompany(); $isacompany = $thirdparty_buyer->isACompany();
if ($isacompany && !empty($conf->global->MAIN_USE_VAT_COMPANIES_IN_EEC_WITH_INVALID_VAT_ID_ARE_INDIVIDUAL)) { if ($isacompany && getDolGlobalString('MAIN_USE_VAT_COMPANIES_IN_EEC_WITH_INVALID_VAT_ID_ARE_INDIVIDUAL')) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
if (!isValidVATID($thirdparty_buyer)) { if (!isValidVATID($thirdparty_buyer)) {
$isacompany = 0; $isacompany = 0;
@ -6539,7 +6543,7 @@ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer,
// If (seller and buyer in European Community) and (buyer = company) then VAT by default=0. End of rule // If (seller and buyer in European Community) and (buyer = company) then VAT by default=0. End of rule
if (($seller_in_cee && $buyer_in_cee)) { if (($seller_in_cee && $buyer_in_cee)) {
$isacompany = $thirdparty_buyer->isACompany(); $isacompany = $thirdparty_buyer->isACompany();
if ($isacompany && !empty($conf->global->MAIN_USE_VAT_COMPANIES_IN_EEC_WITH_INVALID_VAT_ID_ARE_INDIVIDUAL)) { if ($isacompany && getDolGlobalString('MAIN_USE_VAT_COMPANIES_IN_EEC_WITH_INVALID_VAT_ID_ARE_INDIVIDUAL')) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
if (!isValidVATID($thirdparty_buyer)) { if (!isValidVATID($thirdparty_buyer)) {
$isacompany = 0; $isacompany = 0;
@ -9943,7 +9947,7 @@ function showDirectDownloadLink($object)
* @param string $file Original filename (full or relative path) * @param string $file Original filename (full or relative path)
* @param string $extName Extension to differenciate thumb file name ('', '_small', '_mini') * @param string $extName Extension to differenciate thumb file name ('', '_small', '_mini')
* @param string $extImgTarget Force image extension for thumbs. Use '' to keep same extension than original image (default). * @param string $extImgTarget Force image extension for thumbs. Use '' to keep same extension than original image (default).
* @return string New file name (full or relative path, including the thumbs/) * @return string New file name (full or relative path, including the thumbs/). May be the original path if no thumb can exists.
*/ */
function getImageFileNameForSize($file, $extName, $extImgTarget = '') function getImageFileNameForSize($file, $extName, $extImgTarget = '')
{ {
@ -11929,8 +11933,8 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n
'contact_id'=>$obj->fk_contact, 'contact_id'=>$obj->fk_contact,
'socpeopleassigned' => $contactaction->socpeopleassigned, 'socpeopleassigned' => $contactaction->socpeopleassigned,
'lastname'=>$obj->lastname, 'lastname' => (empty($obj->lastname) ? '' : $obj->lastname),
'firstname'=>$obj->firstname, 'firstname' => (empty($obj->firstname) ? '' : $obj->firstname),
'fk_element'=>$obj->fk_element, 'fk_element'=>$obj->fk_element,
'elementtype'=>$obj->elementtype, 'elementtype'=>$obj->elementtype,
// Type of event // Type of event

View File

@ -170,7 +170,16 @@ function getValidOnlinePaymentMethods($paymentmethod = '')
'validpaymentmethod' => &$validpaymentmethod 'validpaymentmethod' => &$validpaymentmethod
]; ];
$tmpobject = new stdClass(); $tmpobject = new stdClass();
$hookmanager->executeHooks('doValidatePayment', $parameters, $tmpobject, $action); $reshook = $hookmanager->executeHooks('getValidPayment', $parameters, $tmpobject, $action);
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
} elseif (!empty($hookmanager->resArray['validpaymentmethod'])) {
if ($reshook == 0) {
$validpaymentmethod = array_merge($validpaymentmethod, $hookmanager->resArray['validpaymentmethod']);
} else {
$validpaymentmethod = $hookmanager->resArray['validpaymentmethod'];
}
}
return $validpaymentmethod; return $validpaymentmethod;
} }

View File

@ -344,7 +344,9 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '',
} else { } else {
$objectid = $object; // $objectid can be X or 'X,Y,Z' $objectid = $object; // $objectid can be X or 'X,Y,Z'
} }
$objectid = preg_replace('/[^0-9\.\,]/', '', $objectid); // For the case value is coming from a non sanitized user input if ($objectid) {
$objectid = preg_replace('/[^0-9\.\,]/', '', $objectid); // For the case value is coming from a non sanitized user input
}
//dol_syslog("functions.lib:restrictedArea $feature, $objectid, $dbtablename, $feature2, $dbt_socfield, $dbt_select, $isdraft"); //dol_syslog("functions.lib:restrictedArea $feature, $objectid, $dbtablename, $feature2, $dbt_socfield, $dbt_select, $isdraft");
//print "user_id=".$user->id.", features=".$features.", feature2=".$feature2.", objectid=".$objectid; //print "user_id=".$user->id.", features=".$features.", feature2=".$feature2.", objectid=".$objectid;

View File

@ -96,7 +96,8 @@ function checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $auth
// Call function to check user/password // Call function to check user/password
$function = 'check_user_password_'.$mode; $function = 'check_user_password_'.$mode;
$login = call_user_func($function, $usertotest, $passwordtotest, $entitytotest, $context); $login = call_user_func($function, $usertotest, $passwordtotest, $entitytotest, $context);
if ($login && $login != '--bad-login-validity--') { // Login is successfull if ($login && $login != '--bad-login-validity--') {
// Login is successfull with this method
$test = false; // To stop once at first login success $test = false; // To stop once at first login success
$conf->authmode = $mode; // This properties is defined only when logged to say what mode was successfully used $conf->authmode = $mode; // This properties is defined only when logged to say what mode was successfully used
/*$dol_tz = GETPOST('tz'); /*$dol_tz = GETPOST('tz');

View File

@ -74,24 +74,6 @@ function check_user_password_dolibarr($usertotest, $passwordtotest, $entitytotes
if ($resql) { if ($resql) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if ($obj) { if ($obj) {
$now = dol_now();
// Check date start validity
if ($obj->datestartvalidity && $db->jdate($obj->datestartvalidity) > $now) {
// Load translation files required by the page
$langs->loadLangs(array('main', 'errors'));
$_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorLoginDateValidity");
dol_syslog("functions_dolibarr::check_user_password_dolibarr bad datestart validity", LOG_WARNING);
return '--bad-login-validity--';
}
// Check date end validity
if ($obj->dateendvalidity && $db->jdate($obj->dateendvalidity) < dol_get_first_hour($now)) {
// Load translation files required by the page
$langs->loadLangs(array('main', 'errors'));
$_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorLoginDateValidity");
dol_syslog("functions_dolibarr::check_user_password_dolibarr bad date end validity", LOG_WARNING);
return '--bad-login-validity--';
}
$passclear = $obj->pass; $passclear = $obj->pass;
$passcrypted = $obj->pass_crypted; $passcrypted = $obj->pass_crypted;
$passtyped = $passwordtotest; $passtyped = $passwordtotest;
@ -121,7 +103,7 @@ function check_user_password_dolibarr($usertotest, $passwordtotest, $entitytotes
if ((!$passcrypted || $passtyped) if ((!$passcrypted || $passtyped)
&& ($passclear && ($passtyped == $passclear))) { && ($passclear && ($passtyped == $passclear))) {
$passok = true; $passok = true;
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ok - found pass in database"); dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ok - found old pass in database", LOG_WARNING);
} }
} }

View File

@ -205,10 +205,10 @@ 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 ('', '$conf->contrat->enabled', __HANDLER__, 'left', 1401__+MAX_llx_menu__, 'commercial', '', 1400__+MAX_llx_menu__, '/contrat/card.php?mainmenu=commercial&amp;action=create&amp;leftmenu=contracts', 'NewContract', 1, 'contracts', '$user->rights->contrat->creer', '', 2, 0, __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 ('', '$conf->contrat->enabled', __HANDLER__, 'left', 1401__+MAX_llx_menu__, 'commercial', '', 1400__+MAX_llx_menu__, '/contrat/card.php?mainmenu=commercial&amp;action=create&amp;leftmenu=contracts', 'NewContract', 1, 'contracts', '$user->rights->contrat->creer', '', 2, 0, __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 ('', '$conf->contrat->enabled', __HANDLER__, 'left', 1402__+MAX_llx_menu__, 'commercial', '', 1400__+MAX_llx_menu__, '/contrat/list.php?mainmenu=commercial&amp;leftmenu=contracts', 'List', 1, 'contracts', '$user->rights->contrat->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 ('', '$conf->contrat->enabled', __HANDLER__, 'left', 1402__+MAX_llx_menu__, 'commercial', '', 1400__+MAX_llx_menu__, '/contrat/list.php?mainmenu=commercial&amp;leftmenu=contracts', 'List', 1, 'contracts', '$user->rights->contrat->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 ('', '$conf->contrat->enabled', __HANDLER__, 'left', 1403__+MAX_llx_menu__, 'commercial', '', 1400__+MAX_llx_menu__, '/contrat/services_list.php?mainmenu=commercial&amp;leftmenu=contracts', 'MenuServices', 1, 'contracts', '$user->rights->contrat->lire', '', 2, 2, __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 ('', '$conf->contrat->enabled', __HANDLER__, 'left', 1403__+MAX_llx_menu__, 'commercial', '', 1400__+MAX_llx_menu__, '/contrat/services_list.php?mainmenu=commercial&amp;leftmenu=contracts', 'MenuServices', 1, 'contracts', '$user->rights->contrat->lire', '', 2, 2, __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 ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1404__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services_list.php?mainmenu=commercial&amp;leftmenu=contracts&amp;mode=0', 'MenuInactiveServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 0, __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 ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1404__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services_list.php?mainmenu=commercial&amp;leftmenu=contracts&amp;search_status=0', 'MenuInactiveServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 0, __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 ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1405__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services_list.php?mainmenu=commercial&amp;leftmenu=contracts&amp;mode=4', 'MenuRunningServices', 2, 'contracts', '$user->rights->contrat->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 ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1405__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services_list.php?mainmenu=commercial&amp;leftmenu=contracts&amp;search_status=4', 'MenuRunningServices', 2, 'contracts', '$user->rights->contrat->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 ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1406__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services_list.php?mainmenu=commercial&amp;leftmenu=contracts&amp;mode=4&amp;filter=expired', 'MenuExpiredServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 2, __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 ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1406__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services_list.php?mainmenu=commercial&amp;leftmenu=contracts&amp;search_status=4&amp;filter=expired', 'MenuExpiredServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 2, __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 ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1407__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services_list.php?mainmenu=commercial&amp;leftmenu=contracts&amp;mode=5', 'MenuClosedServices', 2, 'contracts', '$user->rights->contrat->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 ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1407__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services_list.php?mainmenu=commercial&amp;leftmenu=contracts&amp;search_status=5', 'MenuClosedServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 3, __ENTITY__);
-- Commercial - Interventions -- Commercial - Interventions
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->ficheinter->enabled', __HANDLER__, 'left', 1500__+MAX_llx_menu__, 'commercial', 'ficheinter', 5__+MAX_llx_menu__, '/fichinter/list.php?mainmenu=commercial&amp;leftmenu=ficheinter', 'Interventions', 0, 'interventions', '$user->rights->ficheinter->lire', '', 2, 8, __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 ('', '$conf->ficheinter->enabled', __HANDLER__, 'left', 1500__+MAX_llx_menu__, 'commercial', 'ficheinter', 5__+MAX_llx_menu__, '/fichinter/list.php?mainmenu=commercial&amp;leftmenu=ficheinter', 'Interventions', 0, 'interventions', '$user->rights->ficheinter->lire', '', 2, 8, __ENTITY__);

View File

@ -1385,10 +1385,10 @@ function get_left_menu_commercial($mainmenu, &$newmenu, $usemenuhider = 1, $left
$newmenu->add("/contrat/list.php?leftmenu=contracts", $langs->trans("List"), 1, $user->hasRight('contrat', 'lire')); $newmenu->add("/contrat/list.php?leftmenu=contracts", $langs->trans("List"), 1, $user->hasRight('contrat', 'lire'));
$newmenu->add("/contrat/services_list.php?leftmenu=contracts", $langs->trans("MenuServices"), 1, $user->hasRight('contrat', 'lire')); $newmenu->add("/contrat/services_list.php?leftmenu=contracts", $langs->trans("MenuServices"), 1, $user->hasRight('contrat', 'lire'));
if ($usemenuhider || empty($leftmenu) || $leftmenu == "contracts") { if ($usemenuhider || empty($leftmenu) || $leftmenu == "contracts") {
$newmenu->add("/contrat/services_list.php?leftmenu=contracts&amp;mode=0", $langs->trans("MenuInactiveServices"), 2, $user->hasRight('contrat', 'lire')); $newmenu->add("/contrat/services_list.php?leftmenu=contracts&amp;search_status=0", $langs->trans("MenuInactiveServices"), 2, $user->hasRight('contrat', 'lire'));
$newmenu->add("/contrat/services_list.php?leftmenu=contracts&amp;mode=4", $langs->trans("MenuRunningServices"), 2, $user->hasRight('contrat', 'lire')); $newmenu->add("/contrat/services_list.php?leftmenu=contracts&amp;search_status=4", $langs->trans("MenuRunningServices"), 2, $user->hasRight('contrat', 'lire'));
$newmenu->add("/contrat/services_list.php?leftmenu=contracts&amp;mode=4&amp;filter=expired", $langs->trans("MenuExpiredServices"), 2, $user->hasRight('contrat', 'lire')); $newmenu->add("/contrat/services_list.php?leftmenu=contracts&amp;search_status=4&amp;filter=expired", $langs->trans("MenuExpiredServices"), 2, $user->hasRight('contrat', 'lire'));
$newmenu->add("/contrat/services_list.php?leftmenu=contracts&amp;mode=5", $langs->trans("MenuClosedServices"), 2, $user->hasRight('contrat', 'lire')); $newmenu->add("/contrat/services_list.php?leftmenu=contracts&amp;search_status=5", $langs->trans("MenuClosedServices"), 2, $user->hasRight('contrat', 'lire'));
} }
} }
@ -1729,7 +1729,10 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef
if ($nature) { if ($nature) {
$langs->load('accountancy'); $langs->load('accountancy');
$journallabel = $langs->transnoentities($objp->label); // Label of bank account in llx_accounting_journal $journallabel = '';
if ($objp->label) {
$journallabel = '<span class="opacitymedium">('.$langs->transnoentities($objp->label).')</span>'; // Label of bank account in llx_accounting_journal
}
$key = $langs->trans("AccountingJournalType".strtoupper($objp->nature)); $key = $langs->trans("AccountingJournalType".strtoupper($objp->nature));
$transferlabel = ($objp->nature && $key != "AccountingJournalType".strtoupper($langs->trans($objp->nature)) ? $key.($journallabel != $key ? ' '.$journallabel : ''): $journallabel); $transferlabel = ($objp->nature && $key != "AccountingJournalType".strtoupper($langs->trans($objp->nature)) ? $key.($journallabel != $key ? ' '.$journallabel : ''): $journallabel);

View File

@ -162,7 +162,7 @@ class html_cerfafr extends ModeleDon
$form = str_replace('__MAIN_INFO_SOCIETE_ADDRESS__', $mysoc->address, $form); $form = str_replace('__MAIN_INFO_SOCIETE_ADDRESS__', $mysoc->address, $form);
$form = str_replace('__MAIN_INFO_SOCIETE_ZIP__', $mysoc->zip, $form); $form = str_replace('__MAIN_INFO_SOCIETE_ZIP__', $mysoc->zip, $form);
$form = str_replace('__MAIN_INFO_SOCIETE_TOWN__', $mysoc->town, $form); $form = str_replace('__MAIN_INFO_SOCIETE_TOWN__', $mysoc->town, $form);
$form = str_replace('__MAIN_INFO_SOCIETE_OBJECT__', $mysoc->object, $form); $form = str_replace('__MAIN_INFO_SOCIETE_OBJECT__', $mysoc->socialobject, $form);
$form = str_replace('__DONATOR_FIRSTNAME__', $don->firstname, $form); $form = str_replace('__DONATOR_FIRSTNAME__', $don->firstname, $form);
$form = str_replace('__DONATOR_LASTNAME__', $don->lastname, $form); $form = str_replace('__DONATOR_LASTNAME__', $don->lastname, $form);
$form = str_replace('__DONATOR_SOCIETE__', $don->societe, $form); $form = str_replace('__DONATOR_SOCIETE__', $don->societe, $form);

View File

@ -139,7 +139,7 @@ class modAccounting extends DolibarrModules
$this->const[11] = array( $this->const[11] = array(
"ACCOUNTING_EXPORT_DATE", "ACCOUNTING_EXPORT_DATE",
"chaine", "chaine",
"%d%m%Y", "%Y-%m-%d",
"", 0, 'current', 0 "", 0, 'current', 0
); );
$this->const[12] = array( $this->const[12] = array(
@ -338,7 +338,7 @@ class modAccounting extends DolibarrModules
'b.sens'=>'C' // This field is still used by accounting export. We can remove it once it has been replace into accountancyexport.class.php by a detection using ->debit and ->credit 'b.sens'=>'C' // This field is still used by accounting export. We can remove it once it has been replace into accountancyexport.class.php by a detection using ->debit and ->credit
); );
// General ledger - Fichier FEC // General ledger - File FEC
$r++; $r++;
$this->import_code[$r] = $this->rights_class.'_'.$r; $this->import_code[$r] = $this->rights_class.'_'.$r;
$this->import_label[$r] = 'ImportAccountingEntriesFECFormat'; $this->import_label[$r] = 'ImportAccountingEntriesFECFormat';

View File

@ -198,6 +198,7 @@ class modAdherent extends DolibarrModules
4 => array('file'=>'box_members_last_subscriptions.php', 'enabledbydefaulton'=>'membersindex'), 4 => array('file'=>'box_members_last_subscriptions.php', 'enabledbydefaulton'=>'membersindex'),
5 => array('file'=>'box_members_subscriptions_by_year.php', 'enabledbydefaulton'=>'membersindex'), 5 => array('file'=>'box_members_subscriptions_by_year.php', 'enabledbydefaulton'=>'membersindex'),
6 => array('file'=>'box_members_by_type.php', 'enabledbydefaulton'=>'membersindex'), 6 => array('file'=>'box_members_by_type.php', 'enabledbydefaulton'=>'membersindex'),
7 => array('file'=>'box_members_by_tags.php', 'enabledbydefaulton'=>'membersindex'),
); );
// Permissions // Permissions

View File

@ -250,9 +250,17 @@ class modHRM extends DolibarrModules
$this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->hrm->compare_advance->read) $this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->hrm->compare_advance->read)
$r++; $r++;
// Evaluation
$this->rights[$r][0] = 4029; // Permission id (must not be already used)
$this->rights[$r][1] = 'Read all evaluations'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'evaluation';
$this->rights[$r][5] = 'readall'; // In php code, permission will be checked by test if ($user->rights->hrm->evaluation->read)
$r++;
// Read employee // Read employee
$this->rights[$r][0] = 4031; // Permission id (must not be already used) $this->rights[$r][0] = 4031; // Permission id (must not be already used)
$this->rights[$r][1] = 'Read personal information'; // Permission label $this->rights[$r][1] = 'Read personal/HR information'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'read_personal_information'; $this->rights[$r][4] = 'read_personal_information';
$this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->hrm->read_personal_information->read) $this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->hrm->read_personal_information->read)
@ -260,19 +268,11 @@ class modHRM extends DolibarrModules
// Write employee // Write employee
$this->rights[$r][0] = 4032; // Permission id (must not be already used) $this->rights[$r][0] = 4032; // Permission id (must not be already used)
$this->rights[$r][1] = 'Write personal information'; // Permission label $this->rights[$r][1] = 'Write personal/HR information'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'write_personal_information'; $this->rights[$r][4] = 'write_personal_information';
$this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->hrm->write_personal_information->write) $this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->hrm->write_personal_information->write)
$r++; $r++;
// Evaluation
$this->rights[$r][0] = 4033; // Permission id (must not be already used)
$this->rights[$r][1] = 'Read all evaluations'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'evaluation';
$this->rights[$r][5] = 'readall'; // In php code, permission will be checked by test if ($user->rights->hrm->evaluation->read)
$r++;
} }
/** /**

View File

@ -157,7 +157,7 @@ class modTicket extends DolibarrModules
'tabfieldvalue' => array("code,label,pos,use_default", "code,label,pos,use_default", "code,label,pos,use_default,public,fk_parent", "code,label,pos,use_default"), 'tabfieldvalue' => array("code,label,pos,use_default", "code,label,pos,use_default", "code,label,pos,use_default,public,fk_parent", "code,label,pos,use_default"),
'tabfieldinsert' => array("code,label,pos,use_default", "code,label,pos,use_default", "code,label,pos,use_default,public,fk_parent", "code,label,pos,use_default"), 'tabfieldinsert' => array("code,label,pos,use_default", "code,label,pos,use_default", "code,label,pos,use_default,public,fk_parent", "code,label,pos,use_default"),
'tabrowid' => array("rowid", "rowid", "rowid", "rowid"), 'tabrowid' => array("rowid", "rowid", "rowid", "rowid"),
'tabcond' => array($conf->ticket->enabled, $conf->ticket->enabled, $conf->ticket->enabled, $conf->ticket->enabled && !empty($conf->global->TICKET_ENABLE_RESOLUTION)), 'tabcond' => array($conf->ticket->enabled, $conf->ticket->enabled, $conf->ticket->enabled, $conf->ticket->enabled && getDolGlobalString('TICKET_ENABLE_RESOLUTION')),
'tabhelp' => array( 'tabhelp' => array(
array('code'=>$langs->trans("EnterAnyCode"), 'use_default'=>$langs->trans("Enter0or1")), array('code'=>$langs->trans("EnterAnyCode"), 'use_default'=>$langs->trans("Enter0or1")),
array('code'=>$langs->trans("EnterAnyCode"), 'use_default'=>$langs->trans("Enter0or1")), array('code'=>$langs->trans("EnterAnyCode"), 'use_default'=>$langs->trans("Enter0or1")),
@ -208,6 +208,13 @@ class modTicket extends DolibarrModules
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'manage'; $this->rights[$r][4] = 'manage';
$r++;
$this->rights[$r][0] = 56006; // id de la permission
$this->rights[$r][1] = "Export ticket"; // libelle de la permission
//$this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour)
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'export';
/* Seems not used and in conflict with societe->client->voir (see all thirdparties) /* Seems not used and in conflict with societe->client->voir (see all thirdparties)
$r++; $r++;
$this->rights[$r][0] = 56005; // id de la permission $this->rights[$r][0] = 56005; // id de la permission
@ -318,6 +325,27 @@ class modTicket extends DolibarrModules
'target' => '', 'target' => '',
'user' => 0); 'user' => 0);
$r++; $r++;
// Exports
//--------
$r = 1;
// Export list of tickets and attributes
$langs->load("ticket");
$this->export_code[$r]=$this->rights_class.'_'.$r;
$this->export_label[$r]='ExportDataset_ticket_1'; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_permission[$r] = array(array("ticket", "export"));
$this->export_icon[$r]='ticket';
$keyforclass = 'Ticket';$keyforclassfile='/ticket/class/ticket.class.php';$keyforelement='ticket';
include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
$keyforselect='ticket'; $keyforaliasextra='extra'; $keyforelement='ticket';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'ticket as t';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'ticket_extrafields as extra on (t.rowid = extra.fk_object)';
$this->export_sql_end[$r] .=' WHERE 1 = 1';
$this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('ticket').')';
$r++;
} }
/** /**

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@products.sourceforge.net> /* Copyright (C) 2017 Laurent Destailleur <eldy@products.sourceforge.net>
* Copyright (C) 2023 Anthony Berton <anthony.berton@bb2a.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -209,10 +210,10 @@ class pdf_standard extends ModelePDFProduct
$pdf->SetDrawColor(128, 128, 128); $pdf->SetDrawColor(128, 128, 128);
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
$pdf->SetSubject($outputlangs->transnoentities("Order")); $pdf->SetSubject($outputlangs->transnoentities("Product"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Order")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Product"));
if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false); $pdf->SetCompression(false);
} }
@ -242,6 +243,53 @@ class pdf_standard extends ModelePDFProduct
$pdf->writeHTMLCell(190, 3, $this->marge_gauche, $tab_top, dol_htmlentitiesbr($object->label), 0, 1); $pdf->writeHTMLCell(190, 3, $this->marge_gauche, $tab_top, dol_htmlentitiesbr($object->label), 0, 1);
$nexY = $pdf->GetY(); $nexY = $pdf->GetY();
// Show photo
if (getDolGlobalInt('PRODUCT_USE_OLD_PATH_FOR_PHOTO')) {
$pdir[0] = get_exdir($object->id, 2, 0, 0, $object, 'product').$object->id."/photos/";
$pdir[1] = get_exdir(0, 0, 0, 0, $object, 'product').dol_sanitizeFileName($object->ref).'/';
} else {
$pdir[0] = get_exdir(0, 0, 0, 0, $object, 'product'); // default
$pdir[1] = get_exdir($object->id, 2, 0, 0, $object, 'product').$object->id."/photos/"; // alternative
}
$arephoto = false;
foreach ($pdir as $midir) {
if (!$arephoto) {
if ($conf->entity != $object->entity) {
$dir = $conf->product->multidir_output[$object->entity].'/'.$midir; //Check repertories of current entities
} else {
$dir = $conf->product->dir_output.'/'.$midir; //Check repertory of the current product
}
foreach ($object->liste_photos($dir, 1) as $key => $obj) {
if (!getDolGlobalInt('CAT_HIGH_QUALITY_IMAGES')) { // If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo
if ($obj['photo_vignette']) {
$filename = $obj['photo_vignette'];
} else {
$filename = $obj['photo'];
}
} else {
$filename = $obj['photo'];
}
$realpath = $dir.$filename;
$arephoto = true;
}
}
}
// Define size of image if we need it
$imglinesize = array();
if (!empty($realpath) && $arephoto) {
$imgsize = pdf_getSizeForImage($realpath);
$imgsizewidth = $imgsize['width'] + 20;
$imgsizeheight = $imgsize['height'] + 20;
$midelpage = ($this->page_largeur - $this->marge_gauche - $this->marge_droite) / 2;
$posxphoto = $midelpage + ($midelpage / 2) - ($imgsizewidth / 2);
$posyphoto = $tab_top - 1;
$pdf->Image($realpath, $posxphoto, $posyphoto, $imgsizewidth, $imgsizeheight, '', '', '', 2, 300); // Use 300 dpi
$nexyafterphoto = $tab_top + $imgsizeheight;
}
// Description
$pdf->SetFont('', '', $default_font_size); $pdf->SetFont('', '', $default_font_size);
$pdf->writeHTMLCell(190, 3, $this->marge_gauche, $nexY, dol_htmlentitiesbr($object->description), 0, 1); $pdf->writeHTMLCell(190, 3, $this->marge_gauche, $nexY, dol_htmlentitiesbr($object->description), 0, 1);
$nexY = $pdf->GetY(); $nexY = $pdf->GetY();
@ -276,30 +324,22 @@ class pdf_standard extends ModelePDFProduct
$nexY = $pdf->GetY(); $nexY = $pdf->GetY();
} }
$tab_top = 88;
if (!empty($nexyafterphoto) && $nexyafterphoto > $tab_top) {
$tab_top = $nexyafterphoto;
}
// Show notes // Show notes
// TODO There is no public note on product yet // TODO There is no public note on product yet
$notetoshow = empty($object->note_public) ? '' : $object->note_public; $notetoshow = empty($object->note_public) ? '' : $object->note_public;
if (!empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) {
// Get first sale rep
if (is_object($object->thirdparty)) {
$salereparray = $object->thirdparty->getSalesRepresentatives($user);
$salerepobj = new User($this->db);
$salerepobj->fetch($salereparray[0]['id']);
if (!empty($salerepobj->signature)) {
$notetoshow = dol_concatdesc($notetoshow, $salerepobj->signature);
}
}
}
if ($notetoshow) { if ($notetoshow) {
$substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object); $substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object); complete_substitutions_array($substitutionarray, $outputlangs, $object);
$notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs); $notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs);
$notetoshow = convertBackOfficeMediasLinksToPublicLinks($notetoshow); $notetoshow = convertBackOfficeMediasLinksToPublicLinks($notetoshow);
$tab_top = 88;
$pdf->SetFont('', '', $default_font_size - 1); $pdf->SetFont('', '', $default_font_size - 1);
$pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1); $pdf->writeHTMLCell(190, 3, $this->marge_gauche - 1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1);
$nexY = $pdf->GetY(); $nexY = $pdf->GetY();
$height_note = $nexY - $tab_top; $height_note = $nexY - $tab_top;
@ -673,6 +713,9 @@ class pdf_standard extends ModelePDFProduct
{ {
global $conf, $langs, $hookmanager; global $conf, $langs, $hookmanager;
$ltrdirection = 'L';
if ($outputlangs->trans("DIRECTION") == 'rtl') $ltrdirection = 'R';
// Load traductions files required by page // Load traductions files required by page
$outputlangs->loadLangs(array("main", "propal", "companies", "bills", "orders")); $outputlangs->loadLangs(array("main", "propal", "companies", "bills", "orders"));
@ -687,35 +730,48 @@ class pdf_standard extends ModelePDFProduct
pdf_pagehead($pdf, $outputlangs, $this->page_hauteur); pdf_pagehead($pdf, $outputlangs, $this->page_hauteur);
// Show Draft Watermark // Show Draft Watermark
if ($object->statut == 0 && getDolGlobalString('COMMANDE_DRAFT_WATERMARK')) { if ($object->statut == 0 && getDolGlobalString('PRODUCT_DRAFT_WATERMARK')) {
pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', getDolGlobalString('COMMANDE_DRAFT_WATERMARK')); pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', getDolGlobalString('COMMANDE_DRAFT_WATERMARK'));
} }
$pdf->SetTextColor(0, 0, 60); $pdf->SetTextColor(0, 0, 60);
$pdf->SetFont('', 'B', $default_font_size + 3); $pdf->SetFont('', 'B', $default_font_size + 3);
$w = 100;
$posy = $this->marge_haute; $posy = $this->marge_haute;
$posx = $this->page_largeur - $this->marge_droite - 100; $posx = $this->page_largeur - $this->marge_droite - 100;
$pdf->SetXY($this->marge_gauche, $posy); $pdf->SetXY($this->marge_gauche, $posy);
// Logo // Logo
$logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; if (!getDolGlobalInt('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 (!getDolGlobalInt('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($w, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
$pdf->MultiCell($w, 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($w, 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);
$pdf->SetXY($posx, $posy); $pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60); $pdf->SetTextColor(0, 0, 60);

View File

@ -128,8 +128,7 @@ class mod_task_universal extends ModeleNumRefTask
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
// On defini critere recherche compteur $mask = !empty($conf->global->PROJECT_TASK_UNIVERSAL_MASK) ? $conf->global->PROJECT_TASK_UNIVERSAL_MASK : '';
$mask = $conf->global->PROJECT_TASK_UNIVERSAL_MASK;
if (!$mask) { if (!$mask) {
$this->error = 'NotConfigured'; $this->error = 'NotConfigured';

View File

@ -133,9 +133,15 @@ $(document).ready(function () {
</script> </script>
<?php } ?> <?php } ?>
<div class="login_center center"<?php print empty($conf->global->MAIN_LOGIN_BACKGROUND) ? ' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; background-image: linear-gradient(rgb('.$colorbackhmenu1.',0.3), rgb(240,240,240));"' : '' ?>> <div class="login_center center"<?php
$backstyle = 'background: linear-gradient('.($conf->browser->layout == 'phone' ? '0deg' : '4deg').', rgb(240,240,240) 52%, rgb('.$colorbackhmenu1.') 52.1%);';
// old style: $backstyle = 'background-image: linear-gradient(rgb('.$colorbackhmenu1.',0.3), rgb(240,240,240));';
$backstyle = getDolGlobalString('MAIN_LOGIN_BACKGROUND_STYLE', $backstyle);
print empty($conf->global->MAIN_LOGIN_BACKGROUND) ? ' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; '.$backstyle.'"' : '';
?>>
<div class="login_vertical_align"> <div class="login_vertical_align">
<form id="login" name="login" method="post" action="<?php echo $php_self; ?>"> <form id="login" name="login" method="post" action="<?php echo $php_self; ?>">
<input type="hidden" name="token" value="<?php echo newToken(); ?>" /> <input type="hidden" name="token" value="<?php echo newToken(); ?>" />

View File

@ -82,11 +82,11 @@ class ActionsDatapolicy
/** /**
* Overloading the doActions function : replacing the parent's function with the one below * Overloading the doActions function : replacing the parent's function with the one below
* *
* @param array $parameters Hook metadatas (context, etc...) * @param array $parameters Hook metadatas (context, etc...)
* @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) * @param Societe|CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...)
* @param string $action Current action (if set). Generally create or edit or null * @param string $action Current action (if set). Generally create or edit or null
* @param HookManager $hookmanager Hook manager propagated to allow calling another hook * @param HookManager $hookmanager Hook manager propagated to allow calling another hook
* @return int < 0 on error, 0 on success, 1 to replace standard code * @return int < 0 on error, 0 on success, 1 to replace standard code
*/ */
public function doActions($parameters, &$object, &$action, $hookmanager) public function doActions($parameters, &$object, &$action, $hookmanager)
{ {
@ -103,7 +103,6 @@ class ActionsDatapolicy
// on verifie si l'objet est utilisé // on verifie si l'objet est utilisé
if ($object->isObjectUsed(GETPOST('socid'))) { if ($object->isObjectUsed(GETPOST('socid'))) {
$object->name = $langs->trans('ANONYME'); $object->name = $langs->trans('ANONYME');
$object->name_bis = '';
$object->name_alias = ''; $object->name_alias = '';
$object->address = ''; $object->address = '';
$object->town = ''; $object->town = '';
@ -115,7 +114,7 @@ class ActionsDatapolicy
$object->state = ''; $object->state = '';
$object->country = ''; $object->country = '';
$object->state_id = ''; $object->state_id = '';
$object->skype = ''; $object->socialnetworks = '';
$object->country_id = ''; $object->country_id = '';
$object->note_private = $object->note_private.'<br>'.$langs->trans('ANONYMISER_AT', dol_print_date(time())); $object->note_private = $object->note_private.'<br>'.$langs->trans('ANONYMISER_AT', dol_print_date(time()));
@ -128,76 +127,6 @@ class ActionsDatapolicy
header('Location:'.$_SERVER["PHP_SELF"]."?socid=".$object->id); header('Location:'.$_SERVER["PHP_SELF"]."?socid=".$object->id);
} }
} }
} elseif ($parameters['currentcontext'] == 'thirdpartycard' && $action == 'datapolicy_portabilite') {
header('Content-Type: application/csv');
header('Content-Disposition: attachment; filename=datapolicy_portabilite.csv');
header('Pragma: no-cache');
$object->fetch(GETPOST('socid'));
echo 'Name;Firstname;Civility;Thirdparty;Function;Address;ZipCode;City;Department;Country;Email;Pro Phone;Perso Phone;Mobile Phone;Instant Mail;Birthday;'.PHP_EOL;
echo $object->name.';';
echo ';';
echo ';';
echo ';';
echo ';';
echo $object->address.';';
echo $object->zip.';';
echo $object->town.';';
echo $object->state.';';
echo $object->country.';';
echo $object->email.';';
echo $object->phone.';';
echo ';';
echo ';';
echo $object->skype.';';
echo ';';
exit;
} elseif ($parameters['currentcontext'] == 'membercard' && $action == 'datapolicy_portabilite') {
header('Content-Type: application/csv');
header('Content-Disposition: attachment; filename=datapolicy_portabilite.csv');
header('Pragma: no-cache');
$soc = $object->fetch_thirdparty();
echo 'Name;Firstname;Civility;Thirdparty;Function;Address;ZipCode;City;Department;Country;Email;Pro Phone;Perso Phone;Mobile Phone;Instant Mail;Birthday;'.PHP_EOL;
echo $object->lastname.';';
echo $object->firstname.';';
echo $object->getCivilityLabel().';';
echo ($soc != -1 ? $object->thirdparty->name : '').';';
echo ';';
echo $object->address.';';
echo $object->zip.';';
echo $object->town.';';
echo $object->state.';';
echo $object->country.';';
echo $object->email.';';
echo $object->phone.';';
echo $object->phone_perso.';';
echo $object->phone_mobile.';';
echo $object->skype.';';
echo dol_print_date($object->birth).';';
exit;
} elseif ($parameters['currentcontext'] == 'contactcard' && $action == 'datapolicy_portabilite') {
$object->fetch(GETPOST('id'));
header('Content-Type: application/csv');
header('Content-Disposition: attachment; filename=datapolicy_portabilite.csv');
header('Pragma: no-cache');
$soc = $object->fetch_thirdparty();
echo 'Name;Firstname;Civility;Thirdparty;Function;Address;ZipCode;City;Department;Country;Email;Pro Phone;Perso Phone;Mobile Phone;Instant Mail;Birthday;'.PHP_EOL;
echo $object->lastname.';';
echo $object->firstname.';';
echo $object->getCivilityLabel().';';
echo ($soc != -1 ? $object->thirdparty->name : '').';';
echo $object->poste.';';
echo $object->address.';';
echo $object->zip.';';
echo $object->town.';';
echo $object->state.';';
echo $object->country.';';
echo $object->email.';';
echo $object->phone_pro.';';
echo $object->phone_perso.';';
echo $object->phone_mobile.';';
echo dol_print_date($object->birth).';';
exit;
} elseif ($parameters['currentcontext'] == 'contactcard' && $action == 'send_datapolicy') { } elseif ($parameters['currentcontext'] == 'contactcard' && $action == 'send_datapolicy') {
$object->fetch(GETPOST('id')); $object->fetch(GETPOST('id'));
@ -358,13 +287,7 @@ class ActionsDatapolicy
} ); } );
</script>'; </script>';
echo $dialog; echo $dialog;
if ($parameters['currentcontext'] == 'thirdpartycard' && in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) || $object->typent_id == 8) { // TODO Replace test of hardcoded values
echo '<div class="inline-block divButAction"><a target="_blank" rel="noopener noreferrer" id="rpgpdbtn" class="butAction" href="'.$_SERVER["PHP_SELF"]."?socid=".$object->id.'&action=datapolicy_portabilite" title="'.$langs->trans('DATAPOLICY_PORTABILITE_TITLE').'">'.$langs->trans("DATAPOLICY_PORTABILITE").'</a></div>';
} elseif ($parameters['currentcontext'] == 'membercard') {
echo '<div class="inline-block divButAction"><a target="_blank" rel="noopener noreferrer" id="rpgpdbtn" class="butAction" href="'.$_SERVER["PHP_SELF"]."?rowid=".$object->id.'&action=datapolicy_portabilite" title="'.$langs->trans('DATAPOLICY_PORTABILITE_TITLE').'">'.$langs->trans("DATAPOLICY_PORTABILITE").'</a></div>';
} elseif ($parameters['currentcontext'] == 'contactcard') {
echo '<div class="inline-block divButAction"><a target="_blank" rel="noopener noreferrer" id="rpgpdbtn" class="butAction" href="'.$_SERVER["PHP_SELF"]."?id=".$object->id.'&action=datapolicy_portabilite" title="'.$langs->trans('DATAPOLICY_PORTABILITE_TITLE').'">'.$langs->trans("DATAPOLICY_PORTABILITE").'</a></div>';
}
if (!empty($object->mail) && empty($object->array_options['options_datapolicy_send']) && $parameters['currentcontext'] == 'thirdpartycard' && in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) || $object->typent_id == 8) { if (!empty($object->mail) && empty($object->array_options['options_datapolicy_send']) && $parameters['currentcontext'] == 'thirdpartycard' && in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) || $object->typent_id == 8) {
echo '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"]."?socid=".$object->id.'&action=send_datapolicy" title="'.$langs->trans('DATAPOLICY_SEND').'">'.$langs->trans("DATAPOLICY_SEND").'</a></div>'; echo '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"]."?socid=".$object->id.'&action=send_datapolicy" title="'.$langs->trans('DATAPOLICY_SEND').'">'.$langs->trans("DATAPOLICY_SEND").'</a></div>';
} elseif (!empty($object->mail) && empty($object->array_options['options_datapolicy_send']) && $parameters['currentcontext'] == 'membercard') { } elseif (!empty($object->mail) && empty($object->array_options['options_datapolicy_send']) && $parameters['currentcontext'] == 'membercard') {

View File

@ -92,8 +92,7 @@ $tmpDir = $conf->dav->multidir_output[$entity]; // We need root dir, not a dir t
// Authentication callback function // Authentication callback function
$authBackend = new \Sabre\DAV\Auth\Backend\BasicCallBack(function ($username, $password) { $authBackend = new \Sabre\DAV\Auth\Backend\BasicCallBack(function ($username, $password) {
global $user; global $user, $conf;
global $conf;
global $dolibarr_main_authentication, $dolibarr_auto_user; global $dolibarr_main_authentication, $dolibarr_auto_user;
if (empty($user->login)) { if (empty($user->login)) {
@ -101,7 +100,7 @@ $authBackend = new \Sabre\DAV\Auth\Backend\BasicCallBack(function ($username, $p
return false; return false;
} }
if ($user->socid > 0) { if ($user->socid > 0) {
dol_syslog("Failed to authenticate to DAV, use is an external user", LOG_WARNING); dol_syslog("Failed to authenticate to DAV, user is an external user", LOG_WARNING);
return false; return false;
} }
if ($user->login != $username) { if ($user->login != $username) {
@ -132,6 +131,27 @@ $authBackend = new \Sabre\DAV\Auth\Backend\BasicCallBack(function ($username, $p
return false; return false;
} }
// Check if user status is enabled
if ($user->statut != $user::STATUS_ENABLED) {
// Status is disabled
dol_syslog("The user has been disabled.");
return false;
}
// Check if session was unvalidated by a password change
if (($user->flagdelsessionsbefore && !empty($_SESSION["dol_logindate"]) && $user->flagdelsessionsbefore > $_SESSION["dol_logindate"])) {
// Session is no more valid
dol_syslog("The user has a date for session invalidation = ".$user->flagdelsessionsbefore." and a session date = ".$_SESSION["dol_logindate"].". We must invalidate its sessions.");
return false;
}
// Check date validity
if ($user->isNotIntoValidityDateRange()) {
// User validity dates are no more valid
dol_syslog("The user login has a validity between [".$user->datestartvalidity." and ".$user->dateendvalidity."], curren date is ".dol_now());
return false;
}
return true; return true;
}); });

View File

@ -41,6 +41,11 @@ class DolLogsCollector extends MessagesCollector
*/ */
protected $maxnboflines; protected $maxnboflines;
/**
* @var int number of lines
*/
protected $nboflines;
/** /**
* Constructor * Constructor
* *
@ -54,7 +59,7 @@ class DolLogsCollector extends MessagesCollector
parent::__construct($name); parent::__construct($name);
$this->nboflines = 0; $this->nboflines = 0;
$this->maxnboflines = empty($conf->global->DEBUGBAR_LOGS_LINES_NUMBER) ? 250 : $conf->global->DEBUGBAR_LOGS_LINES_NUMBER; // High number slows seriously output $this->maxnboflines = getDolGlobalInt('DEBUGBAR_LOGS_LINES_NUMBER', 250); // High number slows seriously output
$this->path = $path ?: $this->getLogsFile(); $this->path = $path ?: $this->getLogsFile();
} }

View File

@ -772,7 +772,7 @@ class Don extends CommonObject
*/ */
public function setPaid($id, $modepayment = 0) public function setPaid($id, $modepayment = 0)
{ {
$sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 2"; $sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 2, paid = 1";
if ($modepayment) { if ($modepayment) {
$sql .= ", fk_payment = ".((int) $modepayment); $sql .= ", fk_payment = ".((int) $modepayment);
} }
@ -782,6 +782,7 @@ class Don extends CommonObject
if ($resql) { if ($resql) {
if ($this->db->affected_rows($resql)) { if ($this->db->affected_rows($resql)) {
$this->statut = 2; $this->statut = 2;
$this->paid = 1;
return 1; return 1;
} else { } else {
return 0; return 0;

View File

@ -128,7 +128,7 @@ class EmailCollector extends CommonObject
public $fields = array( public $fields = array(
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>2, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1), 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>2, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1),
'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20), 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20),
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'help'=>'Example: MyCollector1', 'csslist'=>'tdoverflowmax150'), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'help'=>'Example: MyCollector1', 'csslist'=>'tdoverflowmax200'),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1, 'help'=>'Example: My Email collector', 'csslist'=>'tdoverflowmax150'), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1, 'help'=>'Example: My Email collector', 'csslist'=>'tdoverflowmax150'),
'description' => array('type'=>'text', 'label'=>'Description', 'visible'=>-1, 'enabled'=>1, 'position'=>60, 'notnull'=>-1, 'csslist'=>'small'), 'description' => array('type'=>'text', 'label'=>'Description', 'visible'=>-1, 'enabled'=>1, 'position'=>60, 'notnull'=>-1, 'csslist'=>'small'),
'host' => array('type'=>'varchar(255)', 'label'=>'EMailHost', 'visible'=>1, 'enabled'=>1, 'position'=>90, 'notnull'=>1, 'searchall'=>1, 'comment'=>"IMAP server", 'help'=>'Example: imap.gmail.com', 'csslist'=>'tdoverflowmax125'), 'host' => array('type'=>'varchar(255)', 'label'=>'EMailHost', 'visible'=>1, 'enabled'=>1, 'position'=>90, 'notnull'=>1, 'searchall'=>1, 'comment'=>"IMAP server", 'help'=>'Example: imap.gmail.com', 'csslist'=>'tdoverflowmax125'),
@ -145,7 +145,7 @@ class EmailCollector extends CommonObject
'maxemailpercollect' => array('type'=>'integer', 'label'=>'MaxEmailCollectPerCollect', 'visible'=>-1, 'enabled'=>1, 'position'=>111, 'default'=>100), 'maxemailpercollect' => array('type'=>'integer', 'label'=>'MaxEmailCollectPerCollect', 'visible'=>-1, 'enabled'=>1, 'position'=>111, 'default'=>100),
'datelastresult' => array('type'=>'datetime', 'label'=>'DateLastCollectResult', 'visible'=>1, 'enabled'=>'$action != "create" && $action != "edit"', 'position'=>121, 'notnull'=>-1, 'csslist'=>'nowraponall'), 'datelastresult' => array('type'=>'datetime', 'label'=>'DateLastCollectResult', 'visible'=>1, 'enabled'=>'$action != "create" && $action != "edit"', 'position'=>121, 'notnull'=>-1, 'csslist'=>'nowraponall'),
'codelastresult' => array('type'=>'varchar(16)', 'label'=>'CodeLastResult', 'visible'=>1, 'enabled'=>'$action != "create" && $action != "edit"', 'position'=>122, 'notnull'=>-1,), 'codelastresult' => array('type'=>'varchar(16)', 'label'=>'CodeLastResult', 'visible'=>1, 'enabled'=>'$action != "create" && $action != "edit"', 'position'=>122, 'notnull'=>-1,),
'lastresult' => array('type'=>'varchar(255)', 'label'=>'LastResult', 'visible'=>1, 'enabled'=>'$action != "create" && $action != "edit"', 'position'=>123, 'notnull'=>-1, 'csslist'=>'small'), 'lastresult' => array('type'=>'varchar(255)', 'label'=>'LastResult', 'visible'=>1, 'enabled'=>'$action != "create" && $action != "edit"', 'position'=>123, 'notnull'=>-1, 'csslist'=>'small tdoverflowmax200'),
'datelastok' => array('type'=>'datetime', 'label'=>'DateLastcollectResultOk', 'visible'=>1, 'enabled'=>'$action != "create"', 'position'=>125, 'notnull'=>-1, 'csslist'=>'nowraponall'), 'datelastok' => array('type'=>'datetime', 'label'=>'DateLastcollectResultOk', 'visible'=>1, 'enabled'=>'$action != "create"', 'position'=>125, 'notnull'=>-1, 'csslist'=>'nowraponall'),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'visible'=>0, 'enabled'=>1, 'position'=>61, 'notnull'=>-1,), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'visible'=>0, 'enabled'=>1, 'position'=>61, 'notnull'=>-1,),
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'visible'=>0, 'enabled'=>1, 'position'=>62, 'notnull'=>-1,), 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'visible'=>0, 'enabled'=>1, 'position'=>62, 'notnull'=>-1,),
@ -2932,7 +2932,11 @@ class EmailCollector extends CommonObject
// TODO Move mail using PHP-IMAP // TODO Move mail using PHP-IMAP
} }
} else { } else {
dol_syslog("EmailCollector::doCollectOneCollector message ".$imapemail." to ".$connectstringtarget." was set to read", LOG_DEBUG); if (empty($conf->global->MAIN_IMAP_USE_PHPIMAP)) {
dol_syslog("EmailCollector::doCollectOneCollector message ".((string) $imapemail)." to ".$connectstringtarget." was set to read", LOG_DEBUG);
} else {
dol_syslog("EmailCollector::doCollectOneCollector message '".($imapemail->getHeader()->get('subject'))."' using this->host=".$this->host.", this->access_type=".$this->acces_type." was set to read", LOG_DEBUG);
}
} }
} else { } else {
$errorforemail++; $errorforemail++;

View File

@ -24,8 +24,6 @@
// Put here all includes required by your class file // Put here all includes required by your class file
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
/** /**
* Class for EmailCollectorAction * Class for EmailCollectorAction
@ -113,37 +111,6 @@ class EmailCollectorAction extends CommonObject
public $status; public $status;
// END MODULEBUILDER PROPERTIES // END MODULEBUILDER PROPERTIES
// If this object has a subtable with lines
// /**
// * @var string Name of subtable line
// */
//public $table_element_line = 'emailcollectoractiondet';
// /**
// * @var string Field with ID of parent key if this field has a parent
// */
//public $fk_element = 'fk_emailcollectoraction';
// /**
// * @var string Name of subtable class that manage subtable lines
// */
//public $class_element_line = 'EmailcollectorActionline';
// /**
// * @var array List of child tables. To test if we can delete object.
// */
//protected $childtables=array();
// /**
// * @var EmailcollectorActionLine[] Array of subtable lines
// */
//public $lines = array();
/** /**
* Constructor * Constructor
* *
@ -225,16 +192,14 @@ class EmailCollectorAction extends CommonObject
// Clear fields // Clear fields
$object->ref = "copy_of_".$object->ref; $object->ref = "copy_of_".$object->ref;
$object->title = $langs->trans("CopyOf")." ".$object->title; // $object->title = $langs->trans("CopyOf")." ".$object->title;
// ...
// Clear extrafields that are unique // Clear extrafields that are unique
if (is_array($object->array_options) && count($object->array_options) > 0) { if (is_array($object->array_options) && count($object->array_options) > 0) {
$extrafields->fetch_name_optionals_label($this->table_element); $extrafields->fetch_name_optionals_label($this->table_element);
foreach ($object->array_options as $key => $option) { foreach ($object->array_options as $key => $option) {
$shortkey = preg_replace('/options_/', '', $key); $shortkey = preg_replace('/options_/', '', $key);
if (!empty($extrafields->attributes[$this->element]['unique'][$shortkey])) { if (!empty($extrafields->attributes[$this->element]['unique'][$shortkey])) {
//var_dump($key);
//var_dump($clonedObj->array_options[$key]); exit;
unset($object->array_options[$key]); unset($object->array_options[$key]);
} }
} }
@ -271,26 +236,10 @@ class EmailCollectorAction extends CommonObject
public function fetch($id, $ref = null) public function fetch($id, $ref = null)
{ {
$result = $this->fetchCommon($id, $ref); $result = $this->fetchCommon($id, $ref);
// if ($result > 0 && !empty($this->table_element_line)) {
// $this->fetchLinesCommon();
// }
return $result; return $result;
} }
/**
* Load object lines in memory from the database
*
* @return int <0 if KO, 0 if not found, >0 if OK
*/
/*public function fetchLines()
{
$this->lines=array();
// Load lines with object EmailcollectorActionLine
return count($this->lines)?1:0;
}*/
/** /**
* Update object into database * Update object into database
* *
@ -336,7 +285,6 @@ class EmailCollectorAction extends CommonObject
} }
$result = ''; $result = '';
$companylink = '';
$label = '<u>'.$langs->trans("EmailcollectorAction").'</u>'; $label = '<u>'.$langs->trans("EmailcollectorAction").'</u>';
$label .= '<br>'; $label .= '<br>';
@ -487,7 +435,7 @@ class EmailCollectorAction extends CommonObject
$this->user_creation_id = $obj->fk_user_creat; $this->user_creation_id = $obj->fk_user_creat;
$this->user_modification_id = $obj->fk_user_modif; $this->user_modification_id = $obj->fk_user_modif;
$this->date_creation = $this->db->jdate($obj->datec); $this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem); $this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
} }

View File

@ -206,16 +206,14 @@ class EmailCollectorFilter extends CommonObject
// Clear fields // Clear fields
$object->ref = "copy_of_".$object->ref; $object->ref = "copy_of_".$object->ref;
$object->title = $langs->trans("CopyOf")." ".$object->title; // $object->title = $langs->trans("CopyOf")." ".$object->title;
// ...
// Clear extrafields that are unique // Clear extrafields that are unique
if (is_array($object->array_options) && count($object->array_options) > 0) { if (is_array($object->array_options) && count($object->array_options) > 0) {
$extrafields->fetch_name_optionals_label($this->table_element); $extrafields->fetch_name_optionals_label($this->table_element);
foreach ($object->array_options as $key => $option) { foreach ($object->array_options as $key => $option) {
$shortkey = preg_replace('/options_/', '', $key); $shortkey = preg_replace('/options_/', '', $key);
if (!empty($extrafields->attributes[$this->element]['unique'][$shortkey])) { if (!empty($extrafields->attributes[$this->element]['unique'][$shortkey])) {
//var_dump($key);
//var_dump($clonedObj->array_options[$key]); exit;
unset($object->array_options[$key]); unset($object->array_options[$key]);
} }
} }
@ -252,26 +250,10 @@ class EmailCollectorFilter extends CommonObject
public function fetch($id, $ref = null) public function fetch($id, $ref = null)
{ {
$result = $this->fetchCommon($id, $ref); $result = $this->fetchCommon($id, $ref);
if ($result > 0 && !empty($this->table_element_line)) {
$this->fetchLines();
}
return $result; return $result;
} }
/**
* Load object lines in memory from the database
*
* @return int <0 if KO, 0 if not found, >0 if OK
*/
/*public function fetchLines()
{
$this->lines=array();
// Load lines with object EmailcollectorFilterLine
return count($this->lines)?1:0;
}*/
/** /**
* Update object into database * Update object into database
* *
@ -317,7 +299,6 @@ class EmailCollectorFilter extends CommonObject
} }
$result = ''; $result = '';
$companylink = '';
$label = '<u>'.$langs->trans("EmailcollectorFilter").'</u>'; $label = '<u>'.$langs->trans("EmailcollectorFilter").'</u>';
$label .= '<br>'; $label .= '<br>';
@ -468,7 +449,7 @@ class EmailCollectorFilter extends CommonObject
$this->user_creation_id = $obj->fk_user_creat; $this->user_creation_id = $obj->fk_user_creat;
$this->user_modification_id = $obj->fk_user_modif; $this->user_modification_id = $obj->fk_user_modif;
$this->date_creation = $this->db->jdate($obj->datec); $this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem); $this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
} }

View File

@ -106,10 +106,10 @@ class ConferenceOrBooth extends ActionComm
'id' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'id' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
'ref' => array('type'=>'integer', 'label'=>'Ref', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>2, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'csslist'=>'left', 'comment'=>"Id"), 'ref' => array('type'=>'integer', 'label'=>'Ref', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>2, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'csslist'=>'left', 'comment'=>"Id"),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'csslist'=>'tdoverflowmax125', 'help'=>"OrganizationEvenLabelName", 'showoncombobox'=>'1', 'autofocusoncreate'=>1), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'csslist'=>'tdoverflowmax125', 'help'=>"OrganizationEvenLabelName", 'showoncombobox'=>'1', 'autofocusoncreate'=>1),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'csslist'=>'tdoverflowmax150 maxwidth500', 'css'=>'maxwidth500'), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:t.usage_organize_event=1', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'position'=>52, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500', 'csslist'=>'width100'),
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:t.usage_organize_event=1', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500', 'csslist'=>'width100'), 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'csslist'=>'tdoverflowmax125', 'css'=>'maxwidth500'),
'note' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>3), 'note' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>3),
'fk_action' => array('type'=>'sellist:c_actioncomm:libelle:id::module LIKE (\'%@eventorganization\')', 'label'=>'Format', 'enabled'=>'1', 'position'=>60, 'notnull'=>1, 'visible'=>1, 'css'=>'width100'), 'fk_action' => array('type'=>'sellist:c_actioncomm:libelle:id::module LIKE (\'%@eventorganization\')', 'label'=>'Format', 'enabled'=>'1', 'position'=>60, 'notnull'=>1, 'visible'=>1, 'css'=>'width100', 'csslist'=>'tdoverflowmax100'),
'datep' => array('type'=>'datetime', 'label'=>'DateStart', 'enabled'=>'1', 'position'=>70, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'2',), 'datep' => array('type'=>'datetime', 'label'=>'DateStart', 'enabled'=>'1', 'position'=>70, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'2',),
'datep2' => array('type'=>'datetime', 'label'=>'DateEnd', 'enabled'=>'1', 'position'=>71, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'3',), 'datep2' => array('type'=>'datetime', 'label'=>'DateEnd', 'enabled'=>'1', 'position'=>71, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'3',),
'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2, 'csslist'=>'nowraponall'), 'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2, 'csslist'=>'nowraponall'),

View File

@ -44,20 +44,20 @@ global $dolibarr_main_url_root;
$langs->loadLangs(array("eventorganization", "other", "projects", "companies")); $langs->loadLangs(array("eventorganization", "other", "projects", "companies"));
// Get Parameters // Get Parameters
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... $action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'create'/'add', 'edit'/'update', 'view', ...
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ? $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'conferenceorboothlist'; // To manage different context of search $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...) $mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...)
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
$projectid = GETPOST('projectid', 'int'); $projectid = GETPOST('projectid', 'int');
$projectref = GETPOST('ref'); $projectref = GETPOST('ref', 'alpha');
// Load variable for pagination // Load variable for pagination
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
@ -76,7 +76,7 @@ $pagenext = $page + 1;
$object = new ConferenceOrBooth($db); $object = new ConferenceOrBooth($db);
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
$diroutputmassaction = $conf->eventorganization->dir_output.'/temp/massgeneration/'.$user->id; $diroutputmassaction = $conf->eventorganization->dir_output.'/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('conferenceorboothlist')); // Note that conf->hooks_modules contains array $hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array
// 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);
@ -140,8 +140,8 @@ $permissiontoadd = $user->rights->eventorganization->write;
$permissiontodelete = $user->rights->eventorganization->delete; $permissiontodelete = $user->rights->eventorganization->delete;
// Security check // Security check
if (empty($conf->eventorganization->enabled)) { if (!isModEnabled('eventorganization')) {
accessforbidden('Module not enabled'); accessforbidden('Module eventorganization not enabled');
} }
$socid = 0; $socid = 0;
if ($user->socid > 0) { // Protection if external user if ($user->socid > 0) { // Protection if external user
@ -234,7 +234,7 @@ if (empty($reshook)) {
$form = new Form($db); $form = new Form($db);
$now = dol_now(); $now = dol_now();
//$help_url="EN:Module_ConferenceOrBooth|FR:Module_ConferenceOrBooth_FR|ES:Módulo_ConferenceOrBooth"; //$help_url = "EN:Module_ConferenceOrBooth|FR:Module_ConferenceOrBooth_FR|ES:Módulo_ConferenceOrBooth";
$help_url = ''; $help_url = '';
$title = $langs->trans('ListOfConferencesOrBooths'); $title = $langs->trans('ListOfConferencesOrBooths');
$morejs = array(); $morejs = array();
@ -721,7 +721,7 @@ if ($search_all) {
$fieldstosearchall[$key] = $langs->trans($val); $fieldstosearchall[$key] = $langs->trans($val);
$setupstring .= $key."=".$val.";"; $setupstring .= $key."=".$val.";";
} }
print '<!-- Search done like if PRODUCT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n"; print '<!-- Search done like if EVENTORGANIZATION_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n"; print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n";
} }
@ -772,13 +772,13 @@ foreach ($object->fields as $key => $val) {
$cssforfield .= ($cssforfield ? ' ' : '').'center'; $cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif (in_array($val['type'], array('timestamp'))) { } elseif (in_array($val['type'], array('timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $key != 'ref' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
$cssforfield .= ($cssforfield ? ' ' : '').'right'; $cssforfield .= ($cssforfield ? ' ' : '').'right';
} }
if (!empty($arrayfields['t.'.$key]['checked'])) { if (!empty($arrayfields['t.'.$key]['checked'])) {
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').($key == 'status' ? ' parentonrightofpage' : '').'">'; print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status width100 onrightofpage' : ''), 1); print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status onrightofpage' : ''), 1);
} elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) { } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1); print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1);
} elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
@ -831,7 +831,7 @@ foreach ($object->fields as $key => $val) {
$cssforfield .= ($cssforfield ? ' ' : '').'center'; $cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif (in_array($val['type'], array('timestamp'))) { } elseif (in_array($val['type'], array('timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $key != 'ref' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
$cssforfield .= ($cssforfield ? ' ' : '').'right'; $cssforfield .= ($cssforfield ? ' ' : '').'right';
} }
$cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
@ -881,94 +881,110 @@ while ($i < $imaxinloop) {
// Store properties in $object // Store properties in $object
$object->setVarsFromFetchObj($obj); $object->setVarsFromFetchObj($obj);
// Show here line of result if ($mode == 'kanban') {
$j = 0; if ($i == 0) {
print '<tr data-rowid="'.$object->id.'" class="oddeven">'; print '<tr><td colspan="'.$savnbfield.'">';
// Action column print '<div class="box-flex-container">';
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($object->id, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
} }
print '</td>'; // Output Kanban
} print $object->getKanbanView('');
foreach ($object->fields as $key => $val) { if ($i == ($imaxinloop - 1)) {
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); print '</div>';
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { print '</td></tr>';
$cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif ($key == 'status') {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
} }
} else {
if (in_array($val['type'], array('timestamp'))) { // Show here line of result
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; $j = 0;
} elseif ($key == 'ref') { print '<tr data-rowid="'.$object->id.'" class="oddeven">';
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; // Action column
} if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowrap center">';
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) { if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$cssforfield .= ($cssforfield ? ' ' : '').'right'; $selected = 0;
} if (in_array($object->id, $arrayofselected)) {
//if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; $selected = 1;
}
if (!empty($arrayfields['t.'.$key]['checked'])) { print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '');
if (preg_match('/tdoverflow/', $cssforfield)) {
print ' title="'.dol_escape_htmltag($object->$key).'"';
}
print '>';
if ($key == 'status') {
print $object->getLibStatut(5);
} elseif ($key == 'ref') {
print $object->getNomUrl(1, 0, '', (($projectid > 0)?'withproject':''));
} else {
print $object->showOutputField($val, $key, $object->$key, '');
} }
print '</td>'; print '</td>';
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
}
if (!isset($totalarray['val'])) {
$totalarray['val'] = array();
}
if (!isset($totalarray['val']['t.'.$key])) {
$totalarray['val']['t.'.$key] = 0;
}
$totalarray['val']['t.'.$key] += $object->$key;
}
} }
} foreach ($object->fields as $key => $val) {
// Extra fields $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
// Fields from hook $cssforfield .= ($cssforfield ? ' ' : '').'center';
$parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); } elseif ($key == 'status') {
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook $cssforfield .= ($cssforfield ? ' ' : '').'center';
print $hookmanager->resPrint;
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($object->id, $arrayofselected)) {
$selected = 1;
} }
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
}
if (!$i) {
$totalarray['nbfield']++;
}
print '</tr>'."\n"; if (in_array($val['type'], array('timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
} elseif ($key == 'ref') {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
}
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'ref', 'status')) && empty($val['arrayofkeyval'])) {
$cssforfield .= ($cssforfield ? ' ' : '').'right';
}
//if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
if (!empty($arrayfields['t.'.$key]['checked'])) {
print '<td'.($cssforfield ? ' class="'.$cssforfield.(preg_match('/tdoverflow/', $cssforfield) ? ' classfortooltip' : '').'"' : '');
if (preg_match('/tdoverflow/', $cssforfield)) {
print ' title="'.dol_escape_htmltag($object->$key).'"';
}
print '>';
if ($key == 'status') {
print $object->getLibStatut(5);
} elseif ($key == 'ref') {
print $object->getNomUrl(1, 0, '', (($projectid > 0)?'withproject':''));
} else {
print $object->showOutputField($val, $key, $object->$key, '');
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
}
if (!isset($totalarray['val'])) {
$totalarray['val'] = array();
}
if (!isset($totalarray['val']['t.'.$key])) {
$totalarray['val']['t.'.$key] = 0;
}
$totalarray['val']['t.'.$key] += $object->$key;
}
}
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($object->id, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
print '</tr>'."\n";
}
$i++; $i++;
} }

View File

@ -1210,11 +1210,17 @@ if (empty($reshook)) {
unset($date); unset($date);
} else { } else {
$error++;
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
$action = ''; if (!$error) {
header("Location: ".$_SERVER["PHP_SELF"]."?id=".GETPOST('id', 'int'));
exit;
} else {
$action = '';
}
} }
if ($action == 'confirm_delete_line' && GETPOST("confirm", 'alpha') == "yes" && $user->rights->expensereport->creer) { if ($action == 'confirm_delete_line' && GETPOST("confirm", 'alpha') == "yes" && $user->rights->expensereport->creer) {

View File

@ -3071,7 +3071,8 @@ if ($action == 'create') {
} }
if (isset($objectidnext) && $objectidnext > 0) { if (isset($objectidnext) && $objectidnext > 0) {
$facthatreplace = new FactureFournisseur($db); $facthatreplace = new FactureFournisseur($db);
$facthatreplace->fetch($facidnext);
$facthatreplace->fetch($objectidnext);
print ' <span class="opacitymediumbycolor paddingleft">'.str_replace('{s1}', $facthatreplace->getNomUrl(1), $langs->transnoentities("ReplacedByInvoice", '{s1}')).'</span>'; print ' <span class="opacitymediumbycolor paddingleft">'.str_replace('{s1}', $facthatreplace->getNomUrl(1), $langs->transnoentities("ReplacedByInvoice", '{s1}')).'</span>';
} }
if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE || $object->type == FactureFournisseur::TYPE_DEPOSIT) { if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE || $object->type == FactureFournisseur::TYPE_DEPOSIT) {

View File

@ -607,7 +607,7 @@ if ($resql) {
} }
print '<td class="liste_titre maxwidthonsmartphone left">'; print '<td class="liste_titre maxwidthonsmartphone left">';
print $form->select_dolusers($search_employee, "search_employee", 1, "", $disabled, $include, '', 0, 0, 0, $morefilter, 0, '', 'maxwidth150'); print $form->select_dolusers($search_employee, "search_employee", 1, "", $disabled, $include, '', 0, 0, 0, $morefilter, 0, '', 'maxwidth125');
print '</td>'; print '</td>';
} }
@ -617,12 +617,12 @@ if ($resql) {
print '<td class="liste_titre maxwidthonsmartphone left">'; print '<td class="liste_titre maxwidthonsmartphone left">';
$validator = new UserGroup($db); $validator = new UserGroup($db);
$excludefilter = $user->admin ? '' : 'u.rowid <> '.$user->id; $excludefilter = $user->admin ? '' : 'u.rowid <> '.$user->id;
$valideurobjects = $validator->listUsersForGroup($excludefilter); $valideurobjects = $validator->listUsersForGroup($excludefilter, 1);
$valideurarray = array(); $valideurarray = array();
foreach ($valideurobjects as $val) { foreach ($valideurobjects as $val) {
$valideurarray[$val->id] = $val->id; $valideurarray[$val->id] = $val->id;
} }
print $form->select_dolusers($search_valideur, "search_valideur", 1, "", 0, $valideurarray, '', 0, 0, 0, $morefilter, 0, '', 'maxwidth150'); print $form->select_dolusers($search_valideur, "search_valideur", 1, "", 0, $valideurarray, '', 0, 0, 0, $morefilter, 0, '', 'maxwidth125');
print '</td>'; print '</td>';
} else { } else {
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
@ -642,7 +642,7 @@ if ($resql) {
//$labeltoshow .= ($val['delay'] > 0 ? ' ('.$langs->trans("NoticePeriod").': '.$val['delay'].' '.$langs->trans("days").')':''); //$labeltoshow .= ($val['delay'] > 0 ? ' ('.$langs->trans("NoticePeriod").': '.$val['delay'].' '.$langs->trans("days").')':'');
$arraytypeleaves[$val['rowid']] = $labeltoshow; $arraytypeleaves[$val['rowid']] = $labeltoshow;
} }
print $form->selectarray('search_type', $arraytypeleaves, $search_type, 1, 0, 0, '', 0, 0, 0, '', '', 1); print $form->selectarray('search_type', $arraytypeleaves, $search_type, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100', 1);
} }
print '</td>'; print '</td>';
} }

View File

@ -118,16 +118,16 @@ if (empty($reshook)) {
} }
$arrayfields = array( $arrayfields = array(
'cp.ref'=>array('label' => 'Ref', 'checked'=>1), 'cp.ref'=>array('label' => 'Ref', 'checked'=>1, 'position'=>5),
'cp.fk_user'=>array('label' => 'Employee', 'checked'=>1), 'cp.fk_type'=>array('label' => 'Type', 'checked'=>1, 'position'=>10),
'cp.fk_type'=>array('label' => 'Type', 'checked'=>1), 'cp.fk_user'=>array('label' => 'Employee', 'checked'=>1, 'position'=>20),
'cp.date_debut'=>array('label' => 'DateDebCP', 'checked'=>1), 'cp.date_debut'=>array('label' => 'DateDebCP', 'checked'=>1, 'position'=>30),
'cp.date_fin'=>array('label' => 'DateFinCP', 'checked'=>1), 'cp.date_fin'=>array('label' => 'DateFinCP', 'checked'=>1, 'position'=>32),
'used_days'=>array('label' => 'NbUseDaysCPShort', 'checked'=>1), 'used_days'=>array('label' => 'NbUseDaysCPShort', 'checked'=>1, 'position'=>34),
'date_start_month'=>array('label' => 'DateStartInMonth', 'checked'=>1), 'date_start_month'=>array('label' => 'DateStartInMonth', 'checked'=>1, 'position'=>50),
'date_end_month'=>array('label' => 'DateEndInMonth', 'checked'=>1), 'date_end_month'=>array('label' => 'DateEndInMonth', 'checked'=>1, 'position'=>52),
'used_days_month'=>array('label' => 'NbUseDaysCPShortInMonth', 'checked'=>1), 'used_days_month'=>array('label' => 'NbUseDaysCPShortInMonth', 'checked'=>1, 'position'=>54),
'cp.description'=>array('label' => 'DescCP', 'checked'=>1), 'cp.description'=>array('label' => 'DescCP', 'checked'=>-1, 'position'=>800),
); );
@ -149,7 +149,7 @@ $search_month = GETPOST("remonth", 'int') ?GETPOST("remonth", 'int') : date("m",
$search_year = GETPOST("reyear", 'int') ?GETPOST("reyear", 'int') : date("Y", time()); $search_year = GETPOST("reyear", 'int') ?GETPOST("reyear", 'int') : date("Y", time());
$year_month = sprintf("%04d", $search_year).'-'.sprintf("%02d", $search_month); $year_month = sprintf("%04d", $search_year).'-'.sprintf("%02d", $search_month);
$sql = "SELECT cp.rowid, cp.ref, cp.fk_user, cp.date_debut, cp.date_fin, cp.fk_type, cp.description, cp.halfday"; $sql = "SELECT cp.rowid, cp.ref, cp.fk_user, cp.date_debut, cp.date_fin, cp.fk_type, cp.description, cp.halfday, cp.statut as status";
$sql .= " FROM ".MAIN_DB_PREFIX."holiday cp"; $sql .= " FROM ".MAIN_DB_PREFIX."holiday cp";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user u ON cp.fk_user = u.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user u ON cp.fk_user = u.rowid";
$sql .= " WHERE cp.rowid > 0"; $sql .= " WHERE cp.rowid > 0";
@ -250,13 +250,6 @@ if (!empty($arrayfields['cp.ref']['checked'])) {
print '</th>'; print '</th>';
} }
// Filter: Employee
if (!empty($arrayfields['cp.fk_user']['checked'])) {
print '<th class="liste_titre">';
print $form->select_dolusers($search_employee, "search_employee", 1, null, 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth100');
print '</th>';
}
// Filter: Type // Filter: Type
if (!empty($arrayfields['cp.fk_type']['checked'])) { if (!empty($arrayfields['cp.fk_type']['checked'])) {
$typeleaves = $holidaystatic->getTypes(1, -1); $typeleaves = $holidaystatic->getTypes(1, -1);
@ -267,7 +260,14 @@ if (!empty($arrayfields['cp.fk_type']['checked'])) {
} }
print '<th class="liste_titre">'; print '<th class="liste_titre">';
print $form->selectarray('search_type', $arraytypeleaves, $search_type, 1, 0, 0, '', 0, 0, 0, '', '', 1); print $form->selectarray('search_type', $arraytypeleaves, $search_type, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100', 1);
print '</th>';
}
// Filter: Employee
if (!empty($arrayfields['cp.fk_user']['checked'])) {
print '<th class="liste_titre">';
print $form->select_dolusers($search_employee, "search_employee", 1, null, 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth100');
print '</th>'; print '</th>';
} }
@ -313,12 +313,12 @@ if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
if (!empty($arrayfields['cp.ref']['checked'])) { if (!empty($arrayfields['cp.ref']['checked'])) {
print_liste_field_titre($arrayfields['cp.ref']['label'], $_SERVER["PHP_SELF"], 'cp.ref', '', '', '', $sortfield, $sortorder); print_liste_field_titre($arrayfields['cp.ref']['label'], $_SERVER["PHP_SELF"], 'cp.ref', '', '', '', $sortfield, $sortorder);
} }
if (!empty($arrayfields['cp.fk_user']['checked'])) {
print_liste_field_titre($arrayfields['cp.fk_user']['label'], $_SERVER["PHP_SELF"], 'cp.fk_user', '', '', '', $sortfield, $sortorder);
}
if (!empty($arrayfields['cp.fk_type']['checked'])) { if (!empty($arrayfields['cp.fk_type']['checked'])) {
print_liste_field_titre($arrayfields['cp.fk_type']['label'], $_SERVER["PHP_SELF"], 'cp.fk_type', '', '', '', $sortfield, $sortorder); print_liste_field_titre($arrayfields['cp.fk_type']['label'], $_SERVER["PHP_SELF"], 'cp.fk_type', '', '', '', $sortfield, $sortorder);
} }
if (!empty($arrayfields['cp.fk_user']['checked'])) {
print_liste_field_titre($arrayfields['cp.fk_user']['label'], $_SERVER["PHP_SELF"], 'cp.fk_user', '', '', '', $sortfield, $sortorder);
}
if (!empty($arrayfields['ct.label']['checked'])) { if (!empty($arrayfields['ct.label']['checked'])) {
print_liste_field_titre($arrayfields['ct.label']['label'], $_SERVER["PHP_SELF"], 'ct.label', '', '', '', $sortfield, $sortorder); print_liste_field_titre($arrayfields['ct.label']['label'], $_SERVER["PHP_SELF"], 'ct.label', '', '', '', $sortfield, $sortorder);
} }
@ -398,6 +398,15 @@ if ($num == 0) {
// Leave request // Leave request
$holidaystatic->id = $obj->rowid; $holidaystatic->id = $obj->rowid;
$holidaystatic->ref = $obj->ref; $holidaystatic->ref = $obj->ref;
$holidaystatic->statut = $obj->status;
$holidaystatic->status = $obj->status;
$holidaystatic->fk_user = $obj->fk_user;
$holidaystatic->fk_type = $obj->fk_type;
$holidaystatic->description = $obj->description;
$holidaystatic->halfday = $obj->halfday;
$holidaystatic->date_debut = $db->jdate($obj->date_debut);
$holidaystatic->date_fin = $db->jdate($obj->date_fin);
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Action column // Action column
@ -408,12 +417,12 @@ if ($num == 0) {
if (!empty($arrayfields['cp.ref']['checked'])) { if (!empty($arrayfields['cp.ref']['checked'])) {
print '<td class="nowraponall">'.$holidaystatic->getNomUrl(1, 1).'</td>'; print '<td class="nowraponall">'.$holidaystatic->getNomUrl(1, 1).'</td>';
} }
if (!empty($arrayfields['cp.fk_user']['checked'])) {
print '<td>'.$user->getFullName($langs).'</td>';
}
if (!empty($arrayfields['cp.fk_type']['checked'])) { if (!empty($arrayfields['cp.fk_type']['checked'])) {
print '<td>'.$arraytypeleaves[$obj->fk_type].'</td>'; print '<td>'.$arraytypeleaves[$obj->fk_type].'</td>';
} }
if (!empty($arrayfields['cp.fk_user']['checked'])) {
print '<td class="tdoverflowmax150">'.$user->getFullName($langs).'</td>';
}
if (!empty($arrayfields['cp.date_debut']['checked'])) { if (!empty($arrayfields['cp.date_debut']['checked'])) {
print '<td class="center">'.dol_print_date($db->jdate($obj->date_debut), 'day'); print '<td class="center">'.dol_print_date($db->jdate($obj->date_debut), 'day');
@ -447,7 +456,11 @@ if ($num == 0) {
print '<td class="right">'.num_open_day($date_start_inmonth, $date_end_inmonth, 0, 1, $halfdayinmonth).'</td>'; print '<td class="right">'.num_open_day($date_start_inmonth, $date_end_inmonth, 0, 1, $halfdayinmonth).'</td>';
} }
if (!empty($arrayfields['cp.description']['checked'])) { if (!empty($arrayfields['cp.description']['checked'])) {
print '<td class="maxwidth300 small">'.dolGetFirstLineOfText(dol_string_nohtmltag($obj->description, 1)).'</td>'; print '<td class="maxwidth300 small">';
print '<div class="twolinesmax">';
print dolGetFirstLineOfText(dol_string_nohtmltag($obj->description, 1));
print '</div>';
print '</td>';
} }
// Action column // Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {

View File

@ -333,9 +333,8 @@ if (!empty($arrayfields['cpl.date_action']['checked'])) {
if (!empty($arrayfields['cpl.fk_user_action']['checked'])) { if (!empty($arrayfields['cpl.fk_user_action']['checked'])) {
$validator = new UserGroup($db); $validator = new UserGroup($db);
$excludefilter = $user->admin ? '' : 'u.rowid <> '.$user->id; $excludefilter = $user->admin ? '' : 'u.rowid <> '.$user->id;
$valideurobjects = $validator->listUsersForGroup($excludefilter); $valideurobjects = $validator->listUsersForGroup($excludefilter, 1);
$valideurarray = array(); $valideurarray = array();
foreach ($valideurobjects as $val) { foreach ($valideurobjects as $val) {
$valideurarray[$val->id] = $val->id; $valideurarray[$val->id] = $val->id;
} }

View File

@ -1065,20 +1065,21 @@ class Job extends CommonObject
public function getKanbanView($option = '', $arraydata = null) public function getKanbanView($option = '', $arraydata = null)
{ {
global $selected, $langs; global $selected, $langs;
$return = '<div class="box-flex-item box-flex-grow-zero">'; $return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">'; $return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">'; $return .= '<span class="info-box-icon bg-infobox-action">';
$return .= img_picto('', $this->picto); $return .= img_picto('', $this->picto);
$return .= '</span>'; $return .= '</span>';
$return .= '<div class="info-box-content">'; $return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>'; $return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(0) : $this->ref).'</span>';
$return .= '<input style="float:right;" id="cb'.$this->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>'; $return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
if (property_exists($this, 'deplacement')) { /*if (property_exists($this, 'deplacement')) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("Type").'</span>'; $return .= '<br><span class="opacitymedium">'.$langs->trans("Type").'</span>';
$return .= ' : <span class="info-box-label ">'.$this->fields['deplacement']['arrayofkeyval'][$this->deplacement].'</span>'; $return .= ' : <span class="info-box-label ">'.$this->fields['deplacement']['arrayofkeyval'][$this->deplacement].'</span>';
} }*/
if (property_exists($this, 'description') && !(empty($this->description))) { if (property_exists($this, 'description') && !(empty($this->description))) {
$return .= '<br><span class="info-box-label opacitymedium">'.$langs->trans("Description").'</span> : '; //$return .= '<br><span class="info-box-label opacitymedium">'.$langs->trans("Description").'</span> : ';
$return .= '<br><span class="info-box-label ">'.(strlen($this->description) > 30 ? dol_substr($this->description, 0, 25).'...' : $this->description).'</span>'; $return .= '<br><span class="info-box-label ">'.(strlen($this->description) > 30 ? dol_substr($this->description, 0, 25).'...' : $this->description).'</span>';
} }
$return .= '</div>'; $return .= '</div>';

View File

@ -1118,6 +1118,41 @@ class Position extends CommonObject
return $error; return $error;
} }
/**
* Return clicable link of object (with eventually picto)
*
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
* @return string HTML Code for Kanban thumb.
*/
public function getKanbanView($option = '')
{
global $selected, $langs;
$return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">';
$return .= img_picto('', $this->picto);
$return .= '</span>';
$return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
$return .= '<input class="fright" id="cb'.$this->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
if (property_exists($this, 'fk_user') && !(empty($this->fk_user))) {
$return .= '<br><span class="info-box-label opacitymedium">'.$langs->trans("Employee").'</span> : ';
$return .= '<span class="info-box-label ">'.$this->fk_user.'</span>';
}
if (property_exists($this, 'fk_job') && !(empty($this->fk_job))) {
$return .= '<br><span class="info-box-label opacitymedium">'.$langs->trans("Job").'</span> : ';
$return .= '<span class="info-box-label ">'.$this->fk_job.'</span>';
}
if (property_exists($this, 'date_start') && property_exists($this, 'date_end')) {
$return .= '<br><div class ="margintoponly"><span class="info-box-label ">'.dol_print_date($this->db->jdate($this->date_start), 'day').'</span>';
$return .= ' - <span class="info-box-label ">'.dol_print_date($this->db->jdate($this->date_end), 'day').'</span></div>';
}
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';
return $return;
}
} }

View File

@ -116,11 +116,11 @@ $arrayfields = array();
foreach ($object->fields as $key => $val) { foreach ($object->fields as $key => $val) {
// If $val['visible']==0, then we never show the field // If $val['visible']==0, then we never show the field
if (!empty($val['visible'])) { if (!empty($val['visible'])) {
$visible = (int) dol_eval($val['visible'], 1, 1, '1'); $visible = (int) dol_eval($val['visible'], 1);
$arrayfields['t.'.$key] = array( $arrayfields['t.'.$key] = array(
'label'=>$val['label'], 'label'=>$val['label'],
'checked'=>(($visible < 0) ? 0 : 1), 'checked'=>(($visible < 0) ? 0 : 1),
'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')), 'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)),
'position'=>$val['position'], 'position'=>$val['position'],
'help'=> isset($val['help']) ? $val['help'] : '' 'help'=> isset($val['help']) ? $val['help'] : ''
); );
@ -137,18 +137,15 @@ $permissiontoread = $user->rights->hrm->all->read;
$permissiontoadd = $user->rights->hrm->all->write; $permissiontoadd = $user->rights->hrm->all->write;
$permissiontodelete = $user->rights->hrm->all->delete; $permissiontodelete = $user->rights->hrm->all->delete;
// Security check
if (empty($conf->hrm->enabled)) {
accessforbidden('Module not enabled');
}
// 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) accessforbidden(); //if ($user->socid > 0) accessforbidden();
//$socid = 0; if ($user->socid > 0) $socid = $user->socid; //$socid = 0; if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); //$isdraft = (($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->hrm->enabled)) accessforbidden(); if (!isModEnabled('hrm')) {
accessforbidden('Module hrm not enabled');
}
if (!$permissiontoread) accessforbidden(); if (!$permissiontoread) accessforbidden();
@ -257,17 +254,17 @@ foreach ($search as $key => $val) {
$mode_search = 2; $mode_search = 2;
} }
if ($search[$key] != '') { if ($search[$key] != '') {
$sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search)); $sql .= natural_search("t.".$db->escape($key), $search[$key], (($key == 'status') ? 2 : $mode_search));
} }
} else { } else {
if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') { if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
$columnName=preg_replace('/(_dtstart|_dtend)$/', '', $key); $columnName=preg_replace('/(_dtstart|_dtend)$/', '', $key);
if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) { if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
if (preg_match('/_dtstart$/', $key)) { if (preg_match('/_dtstart$/', $key)) {
$sql .= " AND t." . $columnName . " >= '" . $db->idate($search[$key]) . "'"; $sql .= " AND t.".$db->escape($columnName)." >= '".$db->idate($search[$key])."'";
} }
if (preg_match('/_dtend$/', $key)) { if (preg_match('/_dtend$/', $key)) {
$sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'"; $sql .= " AND t.".$db->escape($columnName)." <= '".$db->idate($search[$key])."'";
} }
} }
} }
@ -287,7 +284,7 @@ $sql .= $hookmanager->resPrint;
/* If a group by is required /* If a group by is required
$sql .= " GROUP BY "; $sql .= " GROUP BY ";
foreach($object->fields as $key => $val) { foreach($object->fields as $key => $val) {
$sql .= "t.".$key.", "; $sql .= "t.".$db->escape($key).", ";
} }
// Add fields from extrafields // Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) { if (!empty($extrafields->attributes[$object->table_element]['label'])) {
@ -302,8 +299,6 @@ $sql .= $hookmanager->resPrint;
$sql = preg_replace('/,\s*$/', '', $sql); $sql = preg_replace('/,\s*$/', '', $sql);
*/ */
$sql .= $db->order($sortfield, $sortorder);
// Count total nb of records // Count total nb of records
$nbtotalofrecords = ''; $nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
@ -313,24 +308,24 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$page = 0; $page = 0;
$offset = 0; $offset = 0;
} }
$db->free($resql);
} }
// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
$num = $nbtotalofrecords;
} else {
if ($limit) {
$sql .= $db->plimit($limit + 1, $offset);
}
$resql = $db->query($sql); // Complete request and execute it with limit
if (!$resql) { $sql .= $db->order($sortfield, $sortorder);
dol_print_error($db); if ($limit) {
exit; $sql .= $db->plimit($limit + 1, $offset);
}
$num = $db->num_rows($resql);
} }
$resql = $db->query($sql);
if (!$resql) {
dol_print_error($db);
exit;
}
$num = $db->num_rows($resql);
// Direct jump if only one record found // Direct jump if only one record found
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) { if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
@ -373,11 +368,17 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.urlencode($limit);
} }
foreach ($search as $key => $val) { foreach ($search as $key => $val) {
if (is_array($search[$key]) && count($search[$key])) { if (is_array($search[$key])) {
foreach ($search[$key] as $skey) { foreach ($search[$key] as $skey) {
$param .= '&search_'.$key.'[]='.urlencode($skey); if ($skey != '') {
$param .= '&search_'.$key.'[]='.urlencode($skey);
}
} }
} else { } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) {
$param .= '&search_'.$key.'month='.((int) GETPOST('search_'.$key.'month', 'int'));
$param .= '&search_'.$key.'day='.((int) GETPOST('search_'.$key.'day', 'int'));
$param .= '&search_'.$key.'year='.((int) GETPOST('search_'.$key.'year', 'int'));
} elseif ($search[$key] != '') {
$param .= '&search_'.$key.'='.urlencode($search[$key]); $param .= '&search_'.$key.'='.urlencode($search[$key]);
} }
} }
@ -398,7 +399,7 @@ $arrayofmassactions = array(
//'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
); );
if ($permissiontodelete) { if (!empty($permissiontodelete)) {
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
} }
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) { if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
@ -435,9 +436,12 @@ $trackid = 'xxxx'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($search_all) { if ($search_all) {
$setupstring = '';
foreach ($fieldstosearchall as $key => $val) { foreach ($fieldstosearchall as $key => $val) {
$fieldstosearchall[$key] = $langs->trans($val); $fieldstosearchall[$key] = $langs->trans($val);
$setupstring .= $key."=".$val.";";
} }
print '<!-- Search done like if JOBPOSITION_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'; print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
} }
@ -461,7 +465,7 @@ if (!empty($moreforfilter)) {
} }
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
@ -471,7 +475,15 @@ print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwit
// Fields title search // Fields title search
// -------------------------------------------------------------------- // --------------------------------------------------------------------
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
// Action column
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterButtons('left');
print $searchpicto;
print '</td>';
}
foreach ($object->fields as $key => $val) { foreach ($object->fields as $key => $val) {
$searchkey = empty($search[$key]) ? '' : $search[$key];
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
if ($key == 'status') { if ($key == 'status') {
$cssforfield .= ($cssforfield ? ' ' : '').'center'; $cssforfield .= ($cssforfield ? ' ' : '').'center';
@ -479,7 +491,7 @@ foreach ($object->fields as $key => $val) {
$cssforfield .= ($cssforfield ? ' ' : '').'center'; $cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif (in_array($val['type'], array('timestamp'))) { } elseif (in_array($val['type'], array('timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
$cssforfield .= ($cssforfield ? ' ' : '').'right'; $cssforfield .= ($cssforfield ? ' ' : '').'right';
} }
if (!empty($arrayfields['t.'.$key]['checked'])) { if (!empty($arrayfields['t.'.$key]['checked'])) {
@ -487,9 +499,7 @@ foreach ($object->fields as $key => $val) {
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1); print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
} elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) { } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth125', 1); print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth125', 1);
} elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
} elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
print '<div class="nowrap">'; print '<div class="nowrap">';
print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
@ -497,6 +507,12 @@ foreach ($object->fields as $key => $val) {
print '<div class="nowrap">'; print '<div class="nowrap">';
print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
print '</div>'; print '</div>';
} elseif ($key == 'lang') {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
$formadmin = new FormAdmin($db);
print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth150 maxwidth200', 2);
} else {
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
} }
print '</td>'; print '</td>';
} }
@ -509,16 +525,23 @@ $parameters = array('arrayfields'=>$arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
// Action column // Action column
print '<td class="liste_titre maxwidthsearch">'; if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
$searchpicto = $form->showFilterButtons(); print '<td class="liste_titre maxwidthsearch">';
print $searchpicto; $searchpicto = $form->showFilterButtons();
print '</td>'; print $searchpicto;
print '</td>';
}
print '</tr>'."\n"; print '</tr>'."\n";
$totalarray = array();
$totalarray['nbfield'] = 0;
// Fields title label // Fields title label
// -------------------------------------------------------------------- // --------------------------------------------------------------------
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
}
foreach ($object->fields as $key => $val) { foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
if ($key == 'status') { if ($key == 'status') {
@ -527,21 +550,26 @@ foreach ($object->fields as $key => $val) {
$cssforfield .= ($cssforfield ? ' ' : '').'center'; $cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif (in_array($val['type'], array('timestamp'))) { } elseif (in_array($val['type'], array('timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
$cssforfield .= ($cssforfield ? ' ' : '').'right'; $cssforfield .= ($cssforfield ? ' ' : '').'right';
} }
$cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
if (!empty($arrayfields['t.'.$key]['checked'])) { if (!empty($arrayfields['t.'.$key]['checked'])) {
print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n"; print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
$totalarray['nbfield']++;
} }
} }
// Extra fields // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields // Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
// Action column // Action column
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
}
$totalarray['nbfield']++;
print '</tr>'."\n"; print '</tr>'."\n";
@ -559,9 +587,11 @@ if (isset($extrafields->attributes[$object->table_element]['computed']) && is_ar
// Loop on record // Loop on record
// -------------------------------------------------------------------- // --------------------------------------------------------------------
$i = 0; $i = 0;
$savnbfield = $totalarray['nbfield'];
$totalarray = array(); $totalarray = array();
$totalarray['nbfield'] = 0; $totalarray['nbfield'] = 0;
while ($i < ($limit ? min($num, $limit) : $num)) { $imaxinloop = ($limit ? min($num, $limit) : $num);
while ($i < $imaxinloop) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if (empty($obj)) { if (empty($obj)) {
break; // Should not happen break; // Should not happen
@ -571,29 +601,35 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
$object->setVarsFromFetchObj($obj); $object->setVarsFromFetchObj($obj);
if ($mode == 'kanban') { if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
// Output Kanban
$object->deplacement = $obj->deplacement; $object->deplacement = $obj->deplacement;
$object->description = $obj->description; $object->description = $obj->description;
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined if ($i == 0) {
$selected = 0; print '<tr><td colspan="'.$savnbfield.'">';
if (in_array($object->id, $arrayofselected)) { print '<div class="box-flex-container">';
$selected = 1;
}
print $object->getKanbanView('');
} }
if ($i == (min($num, $limit) - 1)) { // Output Kanban
print $object->getKanbanView('');
if ($i == ($imaxinloop - 1)) {
print '</div>'; print '</div>';
print '</td></tr>'; print '</td></tr>';
} }
} else { } else {
// Show here line of result // Show here line of result
print '<tr class="oddeven">'; $j = 0;
print '<tr data-rowid="'.$object->id.'" class="oddeven">';
// Action column
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($object->id, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
}
foreach ($object->fields as $key => $val) { foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
@ -614,7 +650,11 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
//if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
if (!empty($arrayfields['t.'.$key]['checked'])) { if (!empty($arrayfields['t.'.$key]['checked'])) {
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>'; print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '');
if (preg_match('/tdoverflow/', $cssforfield)) {
print ' title="'.dol_escape_htmltag($object->$key).'"';
}
print '>';
if ($key == 'status') { if ($key == 'status') {
print $object->getLibStatut(5); print $object->getLibStatut(5);
} elseif ($key == 'rowid') { } elseif ($key == 'rowid') {
@ -649,21 +689,24 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
// Action column // Action column
print '<td class="nowrap center">'; if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined print '<td class="nowrap center">';
$selected = 0; if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
if (in_array($object->id, $arrayofselected)) { $selected = 0;
$selected = 1; if (in_array($object->id, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
} }
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>'; print '</td>';
} }
print '</td>';
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
print '</tr>'."\n"; print '</tr>'."\n";
} }
$i++; $i++;
} }
@ -678,14 +721,14 @@ if ($num == 0) {
$colspan++; $colspan++;
} }
} }
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>'; print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
} }
$db->free($resql); $db->free($resql);
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
print '</table>'."\n"; print '</table>'."\n";

View File

@ -73,6 +73,7 @@ $pagenext = $page + 1;
// Initialize technical objects // Initialize technical objects
$object = new Position($db); $object = new Position($db);
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
$userstatic = new User($db);
$diroutputmassaction = $conf->hrm->dir_output.'/temp/massgeneration/'.$user->id; $diroutputmassaction = $conf->hrm->dir_output.'/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('positionlist')); // Note that conf->hooks_modules contains array $hookmanager->initHooks(array('positionlist')); // Note that conf->hooks_modules contains array
@ -218,6 +219,10 @@ $morecss = array();
// -------------------------------------------------------------------- // --------------------------------------------------------------------
$sql = 'SELECT '; $sql = 'SELECT ';
$sql .= $object->getFieldList('t'); $sql .= $object->getFieldList('t');
$sql .= ',';
$sql .= $userstatic->getFieldList('u');
$sql .= ',u.email, u.statut';
$sql .= ',j.rowid, j.label as job_label';
// Add fields from extrafields // Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) { if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
@ -229,7 +234,7 @@ $parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint); $sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql = preg_replace('/,\s*$/', '', $sql); $sql = preg_replace('/,\s*$/', '', $sql);
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t LEFT JOIN ".MAIN_DB_PREFIX.$userstatic->table_element." as u on t.fk_user = u.rowid, ".MAIN_DB_PREFIX."hrm_job as j";
if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
} }
@ -242,6 +247,7 @@ if ($object->ismultientitymanaged == 1) {
} else { } else {
$sql .= " WHERE 1 = 1"; $sql .= " WHERE 1 = 1";
} }
$sql .= " AND t.fk_job = j.rowid";
foreach ($search as $key => $val) { foreach ($search as $key => $val) {
if (array_key_exists($key, $object->fields)) { if (array_key_exists($key, $object->fields)) {
if ($key == 'status' && $search[$key] == -1) { if ($key == 'status' && $search[$key] == -1) {
@ -426,7 +432,10 @@ print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">'; print '<input type="hidden" name="mode" value="'.$mode.'">';
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/hrm/position.php', 1).'?action=create', '', $permissiontoadd); $newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/hrm/position.php', 1).'?action=create', '', $permissiontoadd);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
@ -602,13 +611,33 @@ while ($i < $imaxinloop) {
// Store properties in $object // Store properties in $object
$object->setVarsFromFetchObj($obj); $object->setVarsFromFetchObj($obj);
if ($mode == 'kanban') { if ($mode == 'kanban') {
if ($i == 0) { if ($i == 0) {
print '<tr><td colspan="'.$savnbfield.'">'; print '<tr><td colspan="12">';
print '<div class="box-flex-container">'; print '<div class="box-flex-container">';
} }
// Output Kanban // get info needed
print $object->getKanbanView(''); $object->date_start = $obj->date_start;
$object->date_end = $obj->date_end;
$object->fk_job = $obj->job_label;
$userstatic->id = $obj->fk_user;
$userstatic->ref = $obj->fk_user;
$userstatic->firstname = $obj->firstname;
$userstatic->lastname = $obj->lastname;
$userstatic->email = $obj->email;
$userstatic->statut = $obj->statut;
$object->fk_user = $userstatic->getNomUrl(1);
// output kanban
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($object->id, $arrayofselected)) {
$selected = 1;
}
print $object->getKanbanView('');
}
if ($i == ($imaxinloop - 1)) { if ($i == ($imaxinloop - 1)) {
print '</div>'; print '</div>';
print '</td></tr>'; print '</td></tr>';

View File

@ -1373,7 +1373,7 @@ class tcpdi_parser {
return false; return false;
} else { } else {
$res = $this->_getPageRotation($obj[1][1]['/Parent']); $res = $this->_getPageRotation($obj[1][1]['/Parent']);
if ($res[0] == PDF_TYPE_OBJECT) if ($res && $res[0] == PDF_TYPE_OBJECT)
return $res[1]; return $res[1];
return $res; return $res;
} }

View File

@ -13,10 +13,23 @@ require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit4da13270269c89a28e472e1f7324e6d1::getLoader(); return ComposerAutoloaderInit4da13270269c89a28e472e1f7324e6d1::getLoader();
*/ */
// Add class/method of PHP8 for compatibility with older versions of PHP
require_once(__DIR__.'/symfony/polyfill-php80/bootstrap.php');
spl_autoload_register(function ($class_name) { spl_autoload_register(function ($class_name) {
// Enable this to detect what we need for require_once // Enable this to detect what we need for require_once
//var_dump($class_name); //var_dump($class_name);
$preg_match = preg_match('/^Symfony\\\Polyfill\\\Php80\\\/', $class_name);
if (1 === $preg_match) {
$class_name = preg_replace('/\\\/', '/', $class_name);
$class_name = preg_replace('/^Symfony\\/Polyfill\\/Php80\\//', '', $class_name);
require_once __DIR__ . '/symfony/polyfill-php80/' . $class_name . '.php';
}
$preg_match = preg_match('/^Webklex\\\PHPIMAP\\\/', $class_name); $preg_match = preg_match('/^Webklex\\\PHPIMAP\\\/', $class_name);
if (1 === $preg_match) { if (1 === $preg_match) {
$class_name = preg_replace('/\\\/', '/', $class_name); $class_name = preg_replace('/\\\/', '/', $class_name);

View File

@ -78,6 +78,7 @@
-- Portugal -- Portugal
-- Romania -> for Departmements -- Romania -> for Departmements
-- San Salvador -- San Salvador
-- Slovakia
-- Slovenia -- Slovenia
-- Spain -- Spain
-- Switzerland/Suisse -> for Departmements/Cantons -- Switzerland/Suisse -> for Departmements/Cantons
@ -450,6 +451,13 @@ INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 8
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 86, 8603, NULL, NULL, 'Occidental'); INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 86, 8603, NULL, NULL, 'Occidental');
-- Slovakia Regions (rowid country=201)
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 201, '20101', 'SK01', NULL, 'Bratislava Region');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 201, '20102', 'SK02', NULL, 'Western Slovakia');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 201, '20103', 'SK03', NULL, 'Central Slovakia');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 201, '20104', 'SK04', NULL, 'Eastern Slovakia');
-- Slovenia Regions (rowid country=202) -- Slovenia Regions (rowid country=202)
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 202, '20203', 'SI03', NULL, 'East Slovenia'); INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 202, '20203', 'SI03', NULL, 'East Slovenia');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 202, '20204', 'SI04', NULL, 'West Slovenia'); INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 202, '20204', 'SI04', NULL, 'West Slovenia');

View File

@ -368,13 +368,16 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action)) {
if ($action == "set") { if ($action == "set") {
if ($success) { if ($success) {
if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ($conf->global->MAIN_VERSION_LAST_UPGRADE == DOL_VERSION)) { if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ($conf->global->MAIN_VERSION_LAST_UPGRADE == DOL_VERSION)) {
// Install is finished // Install is finished (database is on same version than files)
print '<br>'.$langs->trans("SystemIsInstalled")."<br>"; print '<br>'.$langs->trans("SystemIsInstalled")."<br>";
// Create install.lock file
// No need for the moment to create it automatically, creation by web assistant means permissions are given
// to the web user, it is better to show a warning to say to create it manually with correct user/permission (not erasable by a web process)
$createlock = 0; $createlock = 0;
if (!empty($force_install_lockinstall) || !empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE)) { if (!empty($force_install_lockinstall) || !empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE)) {
// Install is finished, we create the lock file // Install is finished, we create the "install.lock" file, so install won't be possible anymore.
// TODO Upgrade will be still be possible if a file "upgrade.unlock" is present
$lockfile = DOL_DATA_ROOT.'/install.lock'; $lockfile = DOL_DATA_ROOT.'/install.lock';
$fp = @fopen($lockfile, "w"); $fp = @fopen($lockfile, "w");
if ($fp) { if ($fp) {
@ -413,13 +416,14 @@ if ($action == "set") {
} elseif (empty($action) || preg_match('/upgrade/i', $action)) { } elseif (empty($action) || preg_match('/upgrade/i', $action)) {
// If upgrade // If upgrade
if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ($conf->global->MAIN_VERSION_LAST_UPGRADE == DOL_VERSION)) { if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ($conf->global->MAIN_VERSION_LAST_UPGRADE == DOL_VERSION)) {
// Upgrade is finished // Upgrade is finished (database is on same version than files)
print '<img class="valignmiddle inline-block paddingright" src="../theme/common/octicons/build/svg/checklist.svg" width="20" alt="Configuration"> <span class="valignmiddle">'.$langs->trans("SystemIsUpgraded")."</span><br>"; print '<img class="valignmiddle inline-block paddingright" src="../theme/common/octicons/build/svg/checklist.svg" width="20" alt="Configuration"> <span class="valignmiddle">'.$langs->trans("SystemIsUpgraded")."</span><br>";
// Create install.lock file if it does not exists.
// Note: it should always exists. A better solution to allow upgrade will be to add an upgrade.unlock file
$createlock = 0; $createlock = 0;
if (!empty($force_install_lockinstall) || !empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE)) { if (!empty($force_install_lockinstall) || !empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE)) {
// Upgrade is finished, we create the lock file // Upgrade is finished, we modify the lock file
$lockfile = DOL_DATA_ROOT.'/install.lock'; $lockfile = DOL_DATA_ROOT.'/install.lock';
$fp = @fopen($lockfile, "w"); $fp = @fopen($lockfile, "w");
if ($fp) { if ($fp) {
@ -436,6 +440,10 @@ if ($action == "set") {
print '<br><div class="warning">'.$langs->trans("WarningRemoveInstallDir")."</div>"; print '<br><div class="warning">'.$langs->trans("WarningRemoveInstallDir")."</div>";
} }
// Delete the upgrade.unlock file it it exists
$unlockupgradefile = DOL_DATA_ROOT.'/upgrade.unlock';
dol_delete_file($unlockupgradefile, 0, 0, 0, null, false, 0);
print "<br>"; print "<br>";
$morehtml = '<br><div class="center"><a href="../index.php?mainmenu=home'.(isset($login) ? '&username='.urlencode($login) : '').'">'; $morehtml = '<br><div class="center"><a href="../index.php?mainmenu=home'.(isset($login) ? '&username='.urlencode($login) : '').'">';

View File

@ -469,7 +469,7 @@ if ($search_all) {
$fieldstosearchall[$key] = $langs->trans($val); $fieldstosearchall[$key] = $langs->trans($val);
$setupstring .= $key."=".$val.";"; $setupstring .= $key."=".$val.";";
} }
print '<!-- Search done like if PRODUCT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n"; print '<!-- Search done like if KNOWLEDGEMANAGEMENT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n"; print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n";
} }

Some files were not shown because too many files have changed in this diff Show More