Merge remote-tracking branch 'upstream/develop' into boxindex

This commit is contained in:
Frédéric FRANCE 2021-01-06 21:05:59 +01:00
commit 1e8362575a
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
98 changed files with 1062 additions and 944 deletions

View File

@ -16,7 +16,7 @@ NEW: Accountancy - add options to disable binding on sales, purchases & expense
NEW: Accountancy balance - add a menu entry to show subtotal by group
NEW: Accountancy - change menu disposition
NEW: Accountancy - on transfers, select the periodicity by default
NEW: Accountancy - Add export for Gestinum (v3 & v5)
NEW: Accountancy - Add export for Gestinum (v3 & v5) #15180
NEW: new currency rate editor
NEW: Solve blocking feature. Can increase stock of a Kit without changing subproduct stock.
NEW: add a widget to show the customers with outstanding limits reached
@ -57,7 +57,6 @@ NEW: add option TAKEPOS_CAN_FORCE_BANK_ACCOUNT_DURING_PAYMENT
NEW: add option to define a default warehouse at user level
NEW: add option to include products without alert in replenish
NEW: add order by lastname and firstname by default in get sales representatives
NEW: add param to not show links when output tags
NEW: add PDF document templates for warehouses (list of stock)
NEW: add a prospect status for the contact with managment of custom icon
NEW: add public note on products ; this also partially fix the #14342
@ -68,7 +67,6 @@ NEW: add search param for close date on order list
NEW: add show preview for mail attachement on form mail
NEW: add State/Province origin for products
NEW: add the workflow interaction close intervention on closing ticket
NEW: add third order printer to TakePOS
NEW: add tracking number in list and search_all items
NEW: add vcard for adherent and user
NEW: add week number for month view in agenda
@ -80,7 +78,7 @@ NEW: appearance tab in TakePOS with more visual parameters
NEW: better currency rate editor
NEW: can build vendor invoice from vendor orders
NEW: can change a product in lines of a recurring invoice or contract
NEW: can change size of logo on PDF documents
NEW: can set the size of the logo on PDF documents
NEW: can change VAT rate of all lines of a draft object in one step
NEW: can define date range of validity of a login during creation
NEW: can disable, from edit page, the whole web site
@ -89,16 +87,14 @@ NEW: can edit the list of sending email profiles
NEW: can enable/disable users in bulk actions
NEW: can filter on accounting system ref in export of chart of account
NEW: can filter on container type, language and tags in the list of web pages
NEW: can hide eatby, sellby dates with option PRODUCT_DISABLE_SELLBY and PRODUCT_DISABLE_EATBY
NEW: can hide eatby, sellby dates with option PRODUCT_DISABLE_EATBY and PRODUCT_DISABLE_SELLBY
NEW: can import proposals, sales orders, supplier invoices
NEW: can set a dedicated SMTP config for sending email from public ticket interface
NEW: can set tags/categories to website pages
NEW: can set type of price without tax per default for new sale price creation
NEW: can use desired stock of a given warehouse for replenishment
NEW: change thirdparty with barcode scan in TakePOS
NEW: common behavior for monthly leave list view
NEW: convert all subscription in datetime
NEW: can create a thirdparty customer from TakePOS
NEW: date shipment from order accepts hours
NEW: price level compatibility for variant
NEW: delayed payment in TakePOS
@ -160,10 +156,13 @@ NEW: show tags and status in search list of website pages
NEW: show user on external calender events (when found)
NEW: subject title with company name instead of application title in ticket message
NEW: Support for Samba4 AD
NEW: TakePOS add third order printer
NEW: TakePOS can change thirdparty with barcode scan
NEW: TakePOS can create a thirdparty customer from TakePOS frontend
NEW: TakePOS connector compatibility with RECEIPT PRINTERS module
NEW: TakePOS Gift Receipt
NEW: TakePOS Multicurrency compatibility
NEW: the global header of a website can also have dynamic content
NEW: TakePOS Weighing Scale compatibility with TakePOS connector #14725
NEW: Third-Party Import new fields: mother company,outstanding debt limit,bank account,incoterms
NEW: Thirdparty module : box on customer/supplier tab for invoice outsantding amount late
NEW: ticket classification on create from email collector
@ -173,11 +172,11 @@ NEW: VAT rate for Angola #15606
NEW: VAT and juridical status for Algeria
NEW: VAT report - Invert constant to show by default zero VAT in reports
NEW: website page fields selection
NEW: Weighing Scale compatibility with TakePOS connector
NEW: website - global header of a website can also have dynamic content
NEW: when creating a user from a member linked to a thirdparty, you can choose to create it as external or internal user
NEW: add clone button on miscellaneous payment
NEW: #15065 Add option to put the product label in bold in the PDF templates if configured
NEW: Add option "If the feature to manage kits of module Stock is used, show details of subproducts of a kit on PDF."
NEW: add clone button on miscellaneous payment
NEW: add option to put the product label in bold in the PDF templates if configured #15065
NEW: add option "If the feature to manage kits of module Stock is used, show details of subproducts of a kit on PDF."
For developers:
@ -186,10 +185,10 @@ NEW: add substitution key __MEMBER_TYPE__
NEW: add substitution key __TYPE__
NEW: add function dolButtonToOpenUrlInDialogPopup() to be able to open page into a popup
NEW: show line number on intervention card (via MAIN_VIEW_LINE_NUMBER)
NEW: Add some fields to link website page to an other object
NEW: add some fields to link website page to an other object
NEW: fill ECM src object fields in dol_add_file_process
NEW: conf to allow to show the full tree in warehouse popup
NEW: can use THEME_DARKMODEENABLED=2 for a preview of theme in dark mode
NEW: can use parameter ?THEME_DARKMODEENABLED=2 for a preview of theme in dark mode
NEW: can force the antivirus from conf file or autoprepend ini setup
NEW: can add event to log into blockedlog module with a constant
NEW: add property cssview when declaring fields of an object
@ -202,16 +201,17 @@ NEW: standardizes API thirdparties by email like other object
NEW: Thirdparty REST API: endpoint to set price level
NEW: use new category API for project list view
NEW: Triggers Attributes and Attributes values
NEW: added incoterms data into the substitution array
NEW: add incoterms data into the substitution array
NEW: add send context for ticket
NEW: add a message in error_log after detection of SQL or script injection
NEW: add validation of MX domain for emails
NEW: calculate the virtual stock in transverse mode ( not on getEntity('commande'), ... but on getEntity('stock') )
NEW: Graphics can be horizontal bars
NEW: add param to not show links when output tags
APIs
NEW: API get contacts list of a given order
NEW: API endpoint getContacts and Clean results
NEW: API endpoint getContacts and clean results
NEW: API can update a payment
NEW: API get member by thirdparty
NEW: API get thirdparty by barcode
@ -223,7 +223,7 @@ NEW: get state dictionary by REST API
NEW: improve Product API for product variants
HOOKs
NEW: Hook on propal card
NEW: add hook on propal card
NEW: add hooks on newpayment page to allow external payment modules
NEW: add hooks on stats pages
NEW: add formConfirm hook on product page

View File

@ -3,7 +3,7 @@
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2020 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -39,12 +39,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$langs->loadLangs(array("accountancy", "compta"));
$action = GETPOST('action', 'aZ09');
$search_date_startyear = GETPOST('search_date_startyear', 'int');
$search_date_startmonth = GETPOST('search_date_startmonth', 'int');
$search_date_startday = GETPOST('search_date_startday', 'int');
$search_date_endyear = GETPOST('search_date_endyear', 'int');
$search_date_endmonth = GETPOST('search_date_endmonth', 'int');
$search_date_endday = GETPOST('search_date_endday', 'int');
$search_date_startyear = GETPOST('search_date_startyear', 'int');
$search_date_startmonth = GETPOST('search_date_startmonth', 'int');
$search_date_startday = GETPOST('search_date_startday', 'int');
$search_date_endyear = GETPOST('search_date_endyear', 'int');
$search_date_endmonth = GETPOST('search_date_endmonth', 'int');
$search_date_endday = GETPOST('search_date_endday', 'int');
$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
$search_date_end = dol_mktime(0, 0, 0, $search_date_endmonth, $search_date_endday, $search_date_endyear);
$search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
@ -73,16 +73,22 @@ if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_
}
// 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');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0) { $page = 0; }
if (empty($page) || $page < 0) {
$page = 0;
}
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if ($sortorder == "") $sortorder = "ASC";
if ($sortfield == "") $sortfield = "t.doc_date,t.rowid";
if ($sortorder == "") {
$sortorder = "ASC";
}
if ($sortfield == "") {
$sortfield = "t.doc_date,t.rowid";
}
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$object = new BookKeeping($db);
@ -105,11 +111,12 @@ if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('searc
} else {
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
$year_start = dol_print_date(dol_now(), '%Y');
if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year
if (dol_print_date(dol_now(), '%m') < $month_start) {
$year_start--; // If current month is lower that starting fiscal month, we start last year
}
$year_end = $year_start + 1;
$month_end = $month_start - 1;
if ($month_end < 1)
{
if ($month_end < 1) {
$month_end = 12;
$year_end--;
}
@ -130,7 +137,9 @@ $arrayfields = array(
't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1),
);
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) unset($arrayfields['t.lettering_code']);
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
unset($arrayfields['t.lettering_code']);
}
if ($search_date_start && empty($search_date_startyear)) {
$tmparray = dol_getdate($search_date_start);
@ -149,19 +158,23 @@ if ($search_date_end && empty($search_date_endyear)) {
/*
* Action
*/
if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
if (GETPOST('cancel', 'alpha')) {
$action = 'list'; $massaction = '';
}
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
$massaction = '';
}
$parameters = array('socid'=>$socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook))
{
if (empty($reshook)) {
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
{
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
$search_doc_date = '';
$search_accountancy_code = '';
$search_accountancy_code_start = '';
@ -279,8 +292,7 @@ if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouveme
$deljournal = 0;
}
if (!empty($delmonth) || !empty($delyear) || !empty($deljournal))
{
if (!empty($delmonth) || !empty($delyear) || !empty($deljournal)) {
$result = $object->deleteByYearAndJournal($delyear, $deljournal, '', ($delmonth > 0 ? $delmonth : 0));
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
@ -393,7 +405,9 @@ if ($action == 'delbookkeepingyear') {
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="list">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
}
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
@ -409,8 +423,12 @@ if (empty($reshook)) {
$newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?action=create');
}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
}
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);
@ -418,11 +436,16 @@ print info_admin($langs->trans("WarningRecordWithoutSubledgerAreExcluded"));
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
if ($massactionbutton) $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
if ($massactionbutton) {
$selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
}
// Reverse sort order
if (preg_match('/^asc/i', $sortorder)) $sortorder = "asc";
else $sortorder = "desc";
if (preg_match('/^asc/i', $sortorder)) {
$sortorder = "asc";
} else {
$sortorder = "desc";
}
$moreforfilter = '';
@ -439,8 +462,11 @@ $moreforfilter .= '</div>';
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
else $moreforfilter = $hookmanager->resPrint;
if (empty($reshook)) {
$moreforfilter .= $hookmanager->resPrint;
} else {
$moreforfilter = $hookmanager->resPrint;
}
print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter;
@ -470,8 +496,7 @@ if (!empty($arrayfields['t.doc_date']['checked'])) {
print '</td>';
}
// Movement number
if (!empty($arrayfields['t.piece_num']['checked']))
{
if (!empty($arrayfields['t.piece_num']['checked'])) {
print '<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="'.dol_escape_htmltag($search_mvt_num).'"></td>';
}
// Ref document
@ -491,8 +516,7 @@ if (!empty($arrayfields['t.credit']['checked'])) {
print '<td class="liste_titre right"><input type="text" class="flat" name="search_credit" size="4" value="'.dol_escape_htmltag($search_credit).'"></td>';
}
// Lettering code
if (!empty($arrayfields['t.lettering_code']['checked']))
{
if (!empty($arrayfields['t.lettering_code']['checked'])) {
print '<td class="liste_titre center">';
print '<input type="text" size="3" class="flat" name="search_lettering_code" value="'.$search_lettering_code.'"/>';
print '<br><span class="nowrap"><input type="checkbox" name="search_reconciled_option" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>'.$langs->trans("NotReconciled").'</span>';
@ -512,14 +536,30 @@ print '</td>';
print "</tr>\n";
print '<tr class="liste_titre">';
if (!empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['t.doc_date']['checked'])) print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, '', $sortfield, $sortorder, 'center ');
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);
if (!empty($arrayfields['t.doc_ref']['checked'])) print_liste_field_titre($arrayfields['t.doc_ref']['label'], $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
if (!empty($arrayfields['t.label_operation']['checked'])) print_liste_field_titre($arrayfields['t.label_operation']['label'], $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
if (!empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['t.lettering_code']['checked'])) print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['t.code_journal']['checked'])) {
print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center ');
}
if (!empty($arrayfields['t.doc_date']['checked'])) {
print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, '', $sortfield, $sortorder, 'center ');
}
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);
}
if (!empty($arrayfields['t.doc_ref']['checked'])) {
print_liste_field_titre($arrayfields['t.doc_ref']['label'], $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
}
if (!empty($arrayfields['t.label_operation']['checked'])) {
print_liste_field_titre($arrayfields['t.label_operation']['label'], $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
}
if (!empty($arrayfields['t.debit']['checked'])) {
print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right ');
}
if (!empty($arrayfields['t.credit']['checked'])) {
print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right ');
}
if (!empty($arrayfields['t.lettering_code']['checked'])) {
print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center ');
}
// Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
@ -538,8 +578,7 @@ $displayed_account_number = null; // Start with undefined to be able to distingu
// --------------------------------------------------------------------
$i = 0;
$totalarray = array();
while ($i < min($num, $limit))
{
while ($i < min($num, $limit)) {
$line = $object->lines[$i];
$total_debit += $line->debit;
@ -550,15 +589,15 @@ while ($i < min($num, $limit))
// Is it a break ?
if ($accountg != $displayed_account_number || !isset($displayed_account_number)) {
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) {
$colnumber = 3;
$colnumberend = 7;
} else {
$colnumber = 4;
$colnumberend = 7;
}
$colspan = $totalarray['nbfield'] - $colnumber;
$colspanend = $totalarray['nbfield'] - $colnumberend;
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) {
$colnumber = 3;
$colnumberend = 7;
} else {
$colnumber = 4;
$colnumberend = 7;
}
$colspan = $totalarray['nbfield'] - $colnumber;
$colspanend = $totalarray['nbfield'] - $colnumberend;
// Show a subtotal by accounting account
if (isset($displayed_account_number)) {
print '<tr class="liste_total">';
@ -571,8 +610,7 @@ while ($i < min($num, $limit))
$balance = $sous_total_debit - $sous_total_credit;
print '<tr class="liste_total">';
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("Balance").':</td>';
if ($balance > 0)
{
if ($balance > 0) {
print '<td class="nowraponall right">';
print price($sous_total_debit - $sous_total_credit);
print '</td>';
@ -595,7 +633,9 @@ while ($i < min($num, $limit))
} else {
// Should not happen: subledger account must be null or a non empty value
print '<span class="error">'.$langs->trans("Unknown");
if ($line->subledger_label) print ' ('.$line->subledger_label.')';
if ($line->subledger_label) {
print ' ('.$line->subledger_label.')';
}
$htmltext = 'EmptyStringForSubledgerAccountButSubledgerLabelDefined';
print $form->textwithpicto('', $htmltext);
print '</span>';
@ -614,38 +654,39 @@ while ($i < min($num, $limit))
print '<tr class="oddeven">';
// Journal code
if (!empty($arrayfields['t.code_journal']['checked']))
{
if (!empty($arrayfields['t.code_journal']['checked'])) {
$accountingjournal = new AccountingJournal($db);
$result = $accountingjournal->fetch('', $line->code_journal);
$journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal);
print '<td class="center">'.$journaltoshow.'</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
}
// Document date
if (!empty($arrayfields['t.doc_date']['checked']))
{
if (!empty($arrayfields['t.doc_date']['checked'])) {
print '<td class="center">'.dol_print_date($line->doc_date, 'day').'</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
}
// Piece number
if (!empty($arrayfields['t.piece_num']['checked']))
{
if (!empty($arrayfields['t.piece_num']['checked'])) {
print '<td>';
$object->id = $line->id;
$object->piece_num = $line->piece_num;
print $object->getNomUrl(1, '', 0, '', 1);
print '</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
}
// Document ref
if (!empty($arrayfields['t.doc_ref']['checked']))
{
if ($line->doc_type == 'customer_invoice')
{
if (!empty($arrayfields['t.doc_ref']['checked'])) {
if ($line->doc_type == 'customer_invoice') {
$langs->loadLangs(array('bills'));
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
@ -657,8 +698,7 @@ while ($i < min($num, $limit))
$filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
} elseif ($line->doc_type == 'supplier_invoice')
{
} elseif ($line->doc_type == 'supplier_invoice') {
$langs->loadLangs(array('bills'));
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
@ -670,8 +710,7 @@ while ($i < min($num, $limit))
$filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($line->fk_doc, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref);
$subdir = get_exdir($objectstatic->id, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref);
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $subdir, $filedir);
} elseif ($line->doc_type == 'expense_report')
{
} elseif ($line->doc_type == 'expense_report') {
$langs->loadLangs(array('trips'));
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
@ -683,8 +722,7 @@ while ($i < min($num, $limit))
$filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
} elseif ($line->doc_type == 'bank')
{
} elseif ($line->doc_type == 'bank') {
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$objectstatic = new AccountLine($db);
$objectstatic->fetch($line->fk_doc);
@ -698,8 +736,7 @@ while ($i < min($num, $limit))
// Picto + Ref
print '<td class="nobordernopadding">';
if ($line->doc_type == 'customer_invoice' || $line->doc_type == 'supplier_invoice' || $line->doc_type == 'expense_report')
{
if ($line->doc_type == 'customer_invoice' || $line->doc_type == 'supplier_invoice' || $line->doc_type == 'expense_report') {
print $objectstatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1);
print $documentlink;
} elseif ($line->doc_type == 'bank') {
@ -712,7 +749,9 @@ while ($i < min($num, $limit))
print '</td></tr></table>';
print "</td>\n";
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
}
// Label operation
@ -720,31 +759,41 @@ while ($i < min($num, $limit))
// Affiche un lien vers la facture client/fournisseur
$doc_ref = preg_replace('/\(.*\)/', '', $line->doc_ref);
print strlen(length_accounta($line->subledger_account)) == 0 ? '<td>'.$line->label_operation.'</td>' : '<td>'.$line->label_operation.'<br><span style="font-size:0.8em">('.length_accounta($line->subledger_account).')</span></td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
}
// Amount debit
if (!empty($arrayfields['t.debit']['checked']))
{
if (!empty($arrayfields['t.debit']['checked'])) {
print '<td class="nowrap right">'.($line->debit ? price($line->debit) : '').'</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totaldebit';
if (!$i) {
$totalarray['nbfield']++;
}
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'totaldebit';
}
$totalarray['val']['totaldebit'] += $line->debit;
}
// Amount credit
if (!empty($arrayfields['t.credit']['checked'])) {
print '<td class="nowrap right">'.($line->credit ? price($line->credit) : '').'</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totalcredit';
if (!$i) {
$totalarray['nbfield']++;
}
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'totalcredit';
}
$totalarray['val']['totalcredit'] += $line->credit;
}
// Lettering code
if (!empty($arrayfields['t.lettering_code']['checked']))
{
if (!empty($arrayfields['t.lettering_code']['checked'])) {
print '<td class="center">'.$line->lettering_code.'</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
}
// Fields from hook
@ -763,7 +812,9 @@ while ($i < min($num, $limit))
}
}
print '</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
// Comptabilise le sous-total
$sous_total_debit += $line->debit;
@ -777,11 +828,11 @@ while ($i < min($num, $limit))
if ($num > 0) {
// Show sub-total of last shown account
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) {
$colnumber = 3;
$colnumberend = 7;
$colnumber = 3;
$colnumberend = 7;
} else {
$colnumber = 4;
$colnumberend = 7;
$colnumber = 4;
$colnumberend = 7;
}
$colspan = $totalarray['nbfield'] - $colnumber;
$colspanend = $totalarray['nbfield'] - $colnumberend;
@ -795,8 +846,7 @@ if ($num > 0) {
$balance = $sous_total_debit - $sous_total_credit;
print '<tr class="liste_total">';
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("Balance").':</td>';
if ($balance > 0)
{
if ($balance > 0) {
print '<td class="nowraponall right">';
print price($sous_total_debit - $sous_total_credit);
print '</td>';

View File

@ -4,7 +4,7 @@
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -37,14 +37,17 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("compta", "accountancy"));
$action = GETPOST('action', 'aZ09');
$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array');
$socid = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : GETPOST('id', 'int');
$confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array');
// $socid = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : GETPOST('id', 'int');
// Security check
$socid = GETPOSTINT("socid");
// if ($user->socid) $socid=$user->socid;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOSTISSET('limit') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
@ -54,10 +57,12 @@ if (empty($page) || $page == - 1) {
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if ($sortorder == "")
if ($sortorder == "") {
$sortorder = "ASC";
if ($sortfield == "")
}
if ($sortfield == "") {
$sortfield = "bk.doc_date";
}
/*
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
@ -74,23 +79,18 @@ if (!empty($lettering)) {
/*
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
{
$search_date_start = '';
$search_date_end = '';
$search_date_start = '';
$search_date_end = '';
//$search_doc_type = '';
$search_doc_ref = '';
}
*/
// Security check
$socid = GETPOST("socid", 'int');
// if ($user->socid) $socid=$user->socid;
$lettering = new Lettering($db);
$object = new Societe($db);
$object->id = $socid;
$result = $object->fetch($socid);
if ($result < 0)
{
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
@ -208,30 +208,30 @@ if ($resql) {
print '<table class="liste centpercent">'."\n";
/*
print '<tr class="liste_titre">';
//print '<td><input type="text" name="search_doc_type" value="' . $search_doc_type . '"></td>';
print '<tr class="liste_titre">';
//print '<td><input type="text" name="search_doc_type" value="' . $search_doc_type . '"></td>';
// Date
print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $langs->trans('From') . ' ';
print $form->selectDate($search_date_start, 'date_creation_start', 0, 0, 1);
print '</div>';
print '<div class="nowrap">';
print $langs->trans('to') . ' ';
print $form->selectDate($search_date_end, 'date_creation_end', 0, 0, 1);
print '</div>';
print '</td>';
// Date
print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $langs->trans('From') . ' ';
print $form->selectDate($search_date_start, 'date_creation_start', 0, 0, 1);
print '</div>';
print '<div class="nowrap">';
print $langs->trans('to') . ' ';
print $form->selectDate($search_date_end, 'date_creation_end', 0, 0, 1);
print '</div>';
print '</td>';
// Piece
print '<td><input type="text" name="search_doc_ref" value="' . $search_doc_ref . '"></td>';
// Piece
print '<td><input type="text" name="search_doc_ref" value="' . $search_doc_ref . '"></td>';
print '<td colspan="6">&nbsp;</td>';
print '<td class="right">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
print '</tr>';
print '<td colspan="6">&nbsp;</td>';
print '<td class="right">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
print '</tr>';
*/
print '<tr class="liste_titre">';
@ -251,7 +251,9 @@ if ($resql) {
$tmp = '';
while ($obj = $db->fetch_object($resql)) {
if ($tmp != $obj->lettering_code || empty($tmp)) $tmp = $obj->lettering_code;
if ($tmp != $obj->lettering_code || empty($tmp)) {
$tmp = $obj->lettering_code;
}
/*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit);
print '<tr class="oddeven">';

View File

@ -41,7 +41,11 @@ $massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array');
$socid = GETPOST('socid', 'int') ? ((int) GETPOST('socid', 'int')) : ((int) GETPOST('id', 'int'));
// $socid = GETPOST('socid', 'int') ? ((int) GETPOST('socid', 'int')) : ((int) GETPOST('id', 'int'));
// Security check
$socid = GETPOSTINT("socid");
// if ($user->socid) $socid=$user->socid;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
@ -53,10 +57,12 @@ if (empty($page) || $page == - 1) {
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if ($sortorder == "")
if ($sortorder == "") {
$sortorder = "ASC";
if ($sortfield == "")
}
if ($sortfield == "") {
$sortfield = "bk.doc_date";
}
/*
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
@ -73,24 +79,18 @@ if (!empty($lettering)) {
/*
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
{
$search_date_start = '';
$search_date_end = '';
$search_date_start = '';
$search_date_end = '';
//$search_doc_type='';
$search_doc_ref='';
}
*/
// Security check
$socid = GETPOST("socid", 'int');
// if ($user->socid) $socid=$user->socid;
$lettering = new Lettering($db);
$object = new Societe($db);
$object->id = $socid;
$result = $object->fetch($socid);
if ($result < 0)
{
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
@ -159,8 +159,7 @@ $solde = 0;
// Count total nb of records and calc total sum
$nbtotalofrecords = '';
$resql = $db->query($sql);
if (!$resql)
{
if (!$resql) {
dol_print_error($db);
exit;
}
@ -206,30 +205,30 @@ if ($resql) {
print '<table class="liste centpercent">'."\n";
/*
print '<tr class="liste_titre">';
//print '<td><input type="text" name="search_doc_type" value="' . $search_doc_type . '"></td>';
print '<tr class="liste_titre">';
//print '<td><input type="text" name="search_doc_type" value="' . $search_doc_type . '"></td>';
// Date
print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $langs->trans('From') . ' ';
print $form->selectDate($search_date_start, 'date_creation_start', 0, 0, 1);
print '</div>';
print '<div class="nowrap">';
print $langs->trans('to') . ' ';
print $form->selectDate($search_date_end, 'date_creation_end', 0, 0, 1);
print '</div>';
print '</td>';
// Date
print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $langs->trans('From') . ' ';
print $form->selectDate($search_date_start, 'date_creation_start', 0, 0, 1);
print '</div>';
print '<div class="nowrap">';
print $langs->trans('to') . ' ';
print $form->selectDate($search_date_end, 'date_creation_end', 0, 0, 1);
print '</div>';
print '</td>';
// Piece
print '<td><input type="text" name="search_doc_ref" value="' . $search_doc_ref . '"></td>';
// Piece
print '<td><input type="text" name="search_doc_ref" value="' . $search_doc_ref . '"></td>';
print '<td colspan="6">&nbsp;</td>';
print '<td class="right">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
print '</tr>';
print '<td colspan="6">&nbsp;</td>';
print '<td class="right">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
print '</tr>';
*/
print '<tr class="liste_titre">';
@ -248,7 +247,9 @@ if ($resql) {
$solde = 0;
$tmp = '';
while ($obj = $db->fetch_object($resql)) {
if ($tmp != $obj->lettering_code || empty($tmp)) $tmp = $obj->lettering_code;
if ($tmp != $obj->lettering_code || empty($tmp)) {
$tmp = $obj->lettering_code;
}
/*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit);
print '<tr class="oddeven">';

View File

@ -114,57 +114,57 @@ print '<tr class="liste_titre"><th class="titlefield wordbreak">'.$langs->trans(
// Name
print '<tr class="oddeven"><td><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
print '<input name="nom" id="name" class="minwidth200" value="'.($conf->global->MAIN_INFO_ACCOUNTANT_NAME ? $conf->global->MAIN_INFO_ACCOUNTANT_NAME : GETPOST("nom", 'nohtml')).'"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'></td></tr>'."\n";
print '<input name="nom" id="name" class="minwidth200" value="'.(GETPOSTISSET('nom') ? GETPOST('nom', 'nohtml') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_NAME) ? $conf->global->MAIN_INFO_ACCOUNTANT_NAME : '')).'"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'></td></tr>'."\n";
// Address
print '<tr class="oddeven"><td><label for="address">'.$langs->trans("CompanyAddress").'</label></td><td>';
print '<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_3.'">'.($conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS ? $conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS : GETPOST("address", 'nohtml')).'</textarea></td></tr>'."\n";
print '<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_3.'">'.(GETPOSTISSET('address') ? GETPOST('address', 'nohtml') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS) ? $conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS : '')).'</textarea></td></tr>'."\n";
print '<tr class="oddeven"><td><label for="zipcode">'.$langs->trans("CompanyZip").'</label></td><td>';
print '<input class="minwidth100" name="zipcode" id="zipcode" value="'.($conf->global->MAIN_INFO_ACCOUNTANT_ZIP ? $conf->global->MAIN_INFO_ACCOUNTANT_ZIP : GETPOST("zipcode", 'alpha')).'"></td></tr>'."\n";
print '<input class="minwidth100" name="zipcode" id="zipcode" value="'.(GETPOSTISSET('zipcode') ? GETPOST('zipcode', 'alpha') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_ZIP) ? $conf->global->MAIN_INFO_ACCOUNTANT_ZIP : '')).'"></td></tr>'."\n";
print '<tr class="oddeven"><td><label for="town">'.$langs->trans("CompanyTown").'</label></td><td>';
print '<input name="town" class="minwidth100" id="town" value="'.($conf->global->MAIN_INFO_ACCOUNTANT_TOWN ? $conf->global->MAIN_INFO_ACCOUNTANT_TOWN : GETPOST("town", 'nohtml')).'"></td></tr>'."\n";
print '<input name="town" class="minwidth100" id="town" value="'.(GETPOSTISSET('town') ? GETPOST('town', 'nohtml') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_TOWN) ? $conf->global->MAIN_INFO_ACCOUNTANT_TOWN : '')).'"></td></tr>'."\n";
// Country
print '<tr class="oddeven"><td><label for="selectcountry_id">'.$langs->trans("Country").'</label></td><td class="maxwidthonsmartphone">';
print img_picto('', 'globe-americas', 'class="paddingrightonly"');
print $form->select_country($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 'country_id');
print $form->select_country((GETPOSTISSET('country_id') ? GETPOST('country_id', 'int') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY) ? $conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY : '')), 'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '</td></tr>'."\n";
print '<tr class="oddeven"><td><label for="state_id">'.$langs->trans("State").'</label></td><td class="maxwidthonsmartphone">';
$formcompany->select_departement($conf->global->MAIN_INFO_ACCOUNTANT_STATE, $conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 'state_id');
$formcompany->select_departement((GETPOSTISSET('state_id') ? GETPOST('state_id', 'alpha') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_STATE) ? $conf->global->MAIN_INFO_ACCOUNTANT_STATE : '')), (GETPOSTISSET('country_id') ? GETPOST('country_id', 'int') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY) ? $conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY : '')), 'state_id');
print '</td></tr>'."\n";
print '<tr class="oddeven"><td><label for="phone">'.$langs->trans("Phone").'</label></td><td>';
print img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright');
print '<input name="tel" id="phone" value="'.$conf->global->MAIN_INFO_ACCOUNTANT_PHONE.'"></td></tr>';
print '<input name="tel" id="phone" value="'.(GETPOSTISSET('tel') ? GETPOST('tel', 'alpha') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_PHONE) ? $conf->global->MAIN_INFO_ACCOUNTANT_PHONE : '')).'"></td></tr>';
print '</td></tr>'."\n";
print '<tr class="oddeven"><td><label for="fax">'.$langs->trans("Fax").'</label></td><td>';
print img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright');
print '<input name="fax" id="fax" value="'.$conf->global->MAIN_INFO_ACCOUNTANT_FAX.'"></td></tr>';
print '<input name="fax" id="fax" value="'.(GETPOSTISSET('fax') ? GETPOST('fax', 'alpha') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_FAX) ? $conf->global->MAIN_INFO_ACCOUNTANT_FAX : '')).'"></td></tr>';
print '</td></tr>'."\n";
print '<tr class="oddeven"><td><label for="email">'.$langs->trans("EMail").'</label></td><td>';
print img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright');
print '<input name="mail" id="email" class="minwidth200" value="'.$conf->global->MAIN_INFO_ACCOUNTANT_MAIL.'"></td></tr>';
print '<input name="mail" id="email" class="minwidth200" value="'.(GETPOSTISSET('mail') ? GETPOST('mail', 'alpha') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_MAIL) ? $conf->global->MAIN_INFO_ACCOUNTANT_MAIL : '')).'"></td></tr>';
print '</td></tr>'."\n";
// Web
print '<tr class="oddeven"><td><label for="web">'.$langs->trans("Web").'</label></td><td>';
print img_picto('', 'globe', '', false, 0, 0, '', 'paddingright');
print '<input name="web" id="web" class="minwidth300" value="'.$conf->global->MAIN_INFO_ACCOUNTANT_WEB.'"></td></tr>';
print '<input name="web" id="web" class="minwidth300" value="'.(GETPOSTISSET('web') ? GETPOST('web', 'alpha') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_WEB) ? $conf->global->MAIN_INFO_ACCOUNTANT_WEB : '')).'"></td></tr>';
print '</td></tr>'."\n";
// Code
print '<tr class="oddeven"><td><label for="code">'.$langs->trans("AccountantFileNumber").'</label></td><td>';
print '<input name="code" id="code" class="minwidth100" value="'.($conf->global->MAIN_INFO_ACCOUNTANT_CODE ? $conf->global->MAIN_INFO_ACCOUNTANT_CODE : GETPOST("code", 'nohtml')).'"></td></tr>'."\n";
print '<input name="code" id="code" class="minwidth100" value="'.(GETPOSTISSET('code') ? GETPOST('code', 'nohtml') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_CODE) ? $conf->global->MAIN_INFO_ACCOUNTANT_CODE : '')).'"></td></tr>'."\n";
// Note
print '<tr class="oddeven"><td class="tdtop"><label for="note">'.$langs->trans("Note").'</label></td><td>';
print '<textarea class="flat quatrevingtpercent" name="note" id="note" rows="'.ROWS_5.'">'.(GETPOSTISSET('note') ? GETPOST('note', 'restricthtml') : $conf->global->MAIN_INFO_ACCOUNTANT_NOTE).'</textarea></td></tr>';
print '<textarea class="flat quatrevingtpercent" name="note" id="note" rows="'.ROWS_5.'">'.(GETPOSTISSET('note') ? GETPOST('note', 'restricthtml') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_NOTE) ? $conf->global->MAIN_INFO_ACCOUNTANT_NOTE : '')).'</textarea></td></tr>';
print '</td></tr>';
print '</table>';

View File

@ -446,14 +446,14 @@ print '<td>';
print $langs->trans("MaxNbOfLinesForBoxes");
print '</td>'."\n";
print '<td>';
print '<input type="text" class="flat" size="6" name="MAIN_BOXES_MAXLINES" value="'.$conf->global->MAIN_BOXES_MAXLINES.'">';
print '<input type="text" class="flat" size="6" name="MAIN_BOXES_MAXLINES" value="'.(!empty($conf->global->MAIN_BOXES_MAXLINES) ? $conf->global->MAIN_BOXES_MAXLINES : '').'">';
print '</td>';
print '</tr>';
// Activate FileCache - Developement
if ($conf->global->MAIN_FEATURES_LEVEL == 2 || !empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
print '<tr class="oddeven"><td width="35%">'.$langs->trans("EnableFileCache").'</td><td>';
print $form->selectyesno('MAIN_ACTIVATE_FILECACHE', $conf->global->MAIN_ACTIVATE_FILECACHE, 1);
print $form->selectyesno('MAIN_ACTIVATE_FILECACHE', (!empty($conf->global->MAIN_ACTIVATE_FILECACHE) ? $conf->global->MAIN_ACTIVATE_FILECACHE : 0), 1);
print '</td>';
print '</tr>';
}

View File

@ -393,18 +393,18 @@ print '<tr class="liste_titre"><th class="titlefield wordbreak">'.$langs->trans(
// Name
print '<tr class="oddeven"><td class="fieldrequired wordbreak"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
print '<input name="nom" id="name" class="minwidth200" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_NOM ? $conf->global->MAIN_INFO_SOCIETE_NOM : GETPOST("nom", 'nohtml')).'"'.(empty($conf->global->MAIN_INFO_SOCIETE_NOM) ? ' autofocus="autofocus"' : '').'></td></tr>'."\n";
print '<input name="nom" id="name" class="minwidth200" value="'.dol_escape_htmltag((GETPOSTISSET('nom') ? GETPOST('nom', 'nohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_NOM) ? $conf->global->MAIN_INFO_SOCIETE_NOM : '')).'"'.(empty($conf->global->MAIN_INFO_SOCIETE_NOM) ? ' autofocus="autofocus"' : '')).'></td></tr>'."\n";
// Address
print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_ADDRESS">'.$langs->trans("CompanyAddress").'</label></td><td>';
print '<textarea name="MAIN_INFO_SOCIETE_ADDRESS" id="MAIN_INFO_SOCIETE_ADDRESS" class="quatrevingtpercent" rows="'.ROWS_3.'">'.($conf->global->MAIN_INFO_SOCIETE_ADDRESS ? $conf->global->MAIN_INFO_SOCIETE_ADDRESS : GETPOST("MAIN_INFO_SOCIETE_ADDRESS", 'nohtml')).'</textarea></td></tr>'."\n";
print '<textarea name="MAIN_INFO_SOCIETE_ADDRESS" id="MAIN_INFO_SOCIETE_ADDRESS" class="quatrevingtpercent" rows="'.ROWS_3.'">'.(GETPOSTISSET('MAIN_INFO_SOCIETE_ADDRESS') ? GETPOST('MAIN_INFO_SOCIETE_ADDRESS', 'nohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_ADDRESS) ? $conf->global->MAIN_INFO_SOCIETE_ADDRESS : '')).'</textarea></td></tr>'."\n";
// Zip
print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_ZIP">'.$langs->trans("CompanyZip").'</label></td><td>';
print '<input class="width100" name="MAIN_INFO_SOCIETE_ZIP" id="MAIN_INFO_SOCIETE_ZIP" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_ZIP ? $conf->global->MAIN_INFO_SOCIETE_ZIP : GETPOST("MAIN_INFO_SOCIETE_ZIP", 'alpha')).'"></td></tr>'."\n";
print '<input class="width100" name="MAIN_INFO_SOCIETE_ZIP" id="MAIN_INFO_SOCIETE_ZIP" value="'.dol_escape_htmltag((GETPOSTISSET('MAIN_INFO_SOCIETE_ZIP') ? GETPOST('MAIN_INFO_SOCIETE_ZIP', 'alpha') : (!empty($conf->global->MAIN_INFO_SOCIETE_ZIP) ? $conf->global->MAIN_INFO_SOCIETE_ZIP : ''))).'"></td></tr>'."\n";
print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_TOWN">'.$langs->trans("CompanyTown").'</label></td><td>';
print '<input name="MAIN_INFO_SOCIETE_TOWN" class="minwidth200" id="MAIN_INFO_SOCIETE_TOWN" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_TOWN ? $conf->global->MAIN_INFO_SOCIETE_TOWN : GETPOST("MAIN_INFO_SOCIETE_TOWN", 'nohtml')).'"></td></tr>'."\n";
print '<input name="MAIN_INFO_SOCIETE_TOWN" class="minwidth200" id="MAIN_INFO_SOCIETE_TOWN" value="'.dol_escape_htmltag((GETPOSTISSET('MAIN_INFO_SOCIETE_TOWN') ? GETPOST('MAIN_INFO_SOCIETE_TOWN', 'nohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_TOWN) ? $conf->global->MAIN_INFO_SOCIETE_TOWN : ''))).'"></td></tr>'."\n";
// Country
print '<tr class="oddeven"><td class="fieldrequired"><label for="selectcountry_id">'.$langs->trans("Country").'</label></td><td class="maxwidthonsmartphone">';
@ -431,25 +431,25 @@ print '</td></tr>'."\n";
// Phone
print '<tr class="oddeven"><td><label for="phone">'.$langs->trans("Phone").'</label></td><td>';
print img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright');
print '<input name="tel" id="phone" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_TEL).'"></td></tr>';
print '<input name="tel" id="phone" value="'.dol_escape_htmltag((GETPOSTISSET('tel') ? GETPOST('tel', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_TEL) ? $conf->global->MAIN_INFO_SOCIETE_TEL : ''))).'"></td></tr>';
print '</td></tr>'."\n";
// Fax
print '<tr class="oddeven"><td><label for="fax">'.$langs->trans("Fax").'</label></td><td>';
print img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright');
print '<input name="fax" id="fax" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_FAX).'"></td></tr>';
print '<input name="fax" id="fax" value="'.dol_escape_htmltag((GETPOSTISSET('fax') ? GETPOST('fax', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_FAX) ? $conf->global->MAIN_INFO_SOCIETE_FAX : ''))).'"></td></tr>';
print '</td></tr>'."\n";
// Email
print '<tr class="oddeven"><td><label for="email">'.$langs->trans("EMail").'</label></td><td>';
print img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright');
print '<input name="mail" id="email" class="minwidth200" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_MAIL).'"></td></tr>';
print '<input name="mail" id="email" class="minwidth200" value="'.dol_escape_htmltag((GETPOSTISSET('mail') ? GETPOST('mail', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_MAIL) ? $conf->global->MAIN_INFO_SOCIETE_MAIL : ''))).'"></td></tr>';
print '</td></tr>'."\n";
// Web
print '<tr class="oddeven"><td><label for="web">'.$langs->trans("Web").'</label></td><td>';
print img_picto('', 'globe', '', false, 0, 0, '', 'paddingright');
print '<input name="web" id="web" class="minwidth300" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_WEB).'"></td></tr>';
print '<input name="web" id="web" class="minwidth300" value="'.dol_escape_htmltag((GETPOSTISSET('web') ? GETPOST('web', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_WEB) ? $conf->global->MAIN_INFO_SOCIETE_WEB : ''))).'"></td></tr>';
print '</td></tr>'."\n";
// Barcode
@ -457,7 +457,7 @@ if (!empty($conf->barcode->enabled)) {
print '<tr class="oddeven"><td>';
print '<label for="barcode">'.$langs->trans("Gencod").'</label></td><td>';
print '<span class="fa paddingright fa-barcode"></span>';
print '<input name="barcode" id="barcode" class="minwidth150" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_GENCOD).'"></td></tr>';
print '<input name="barcode" id="barcode" class="minwidth150" value="'.dol_escape_htmltag((GETPOSTISSET('barcode') ? GETPOST('barcode', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_GENCODE) ? $conf->global->MAIN_INFO_SOCIETE_GENCODE : ''))).'"></td></tr>';
print '</td></tr>';
}
@ -534,7 +534,7 @@ print '</td></tr>';
// Note
print '<tr class="oddeven"><td class="tdtop"><label for="note">'.$langs->trans("Note").'</label></td><td>';
print '<textarea class="flat quatrevingtpercent" name="note" id="note" rows="'.ROWS_5.'">'.(GETPOSTISSET('note') ? GETPOST('note', 'restricthtml') : $conf->global->MAIN_INFO_SOCIETE_NOTE).'</textarea></td></tr>';
print '<textarea class="flat quatrevingtpercent" name="note" id="note" rows="'.ROWS_5.'">'.(GETPOSTISSET('note') ? GETPOST('note', 'restricthtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_NOTE) ? $conf->global->MAIN_INFO_SOCIETE_NOTE : '')).'</textarea></td></tr>';
print '</td></tr>';
print '</table>';
@ -549,17 +549,17 @@ $langs->load("companies");
// Managing Director(s)
print '<tr class="oddeven"><td><label for="director">'.$langs->trans("ManagingDirectors").'</label></td><td>';
print '<input name="MAIN_INFO_SOCIETE_MANAGERS" id="directors" class="minwidth200" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_MANAGERS).'"></td></tr>';
print '<input name="MAIN_INFO_SOCIETE_MANAGERS" id="directors" class="minwidth200" value="'.dol_escape_htmltag((GETPOSTISSET('MAIN_INFO_SOCIETE_MANAGERS') ? GETPOST('MAIN_INFO_SOCIETE_MANAGERS', 'nohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_MANAGERS) ? $conf->global->MAIN_INFO_SOCIETE_MANAGERS : ''))).'"></td></tr>';
// GDPR contact
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("GDPRContact"), $langs->trans("GDPRContactDesc"));
print '</td><td>';
print '<input name="MAIN_INFO_GDPR" id="infodirector" class="minwidth500" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_GDPR).'"></td></tr>';
print '<input name="MAIN_INFO_GDPR" id="infodirector" class="minwidth500" value="'.dol_escape_htmltag((GETPOSTISSET("MAIN_INFO_GDPR") ? GETPOST("MAIN_INFO_GDPR", 'nohtml') : (!empty($conf->global->MAIN_INFO_GDPR) ? $conf->global->MAIN_INFO_GDPR : ''))).'"></td></tr>';
// Capital
print '<tr class="oddeven"><td><label for="capital">'.$langs->trans("Capital").'</label></td><td>';
print '<input name="capital" id="capital" class="maxwidth100" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_CAPITAL).'"></td></tr>';
print '<input name="capital" id="capital" class="maxwidth100" value="'.dol_escape_htmltag((GETPOSTISSET('capital') ? GETPOST('capital', 'nohtml') : (!empty($conf->global->MAIN_INFO_CAPITAL) ? $conf->global->MAIN_INFO_CAPITAL : ''))).'"></td></tr>';
// Juridical Status
print '<tr class="oddeven"><td><label for="forme_juridique_code">'.$langs->trans("JuridicalStatus").'</label></td><td>';

View File

@ -117,11 +117,11 @@ foreach ($listofnetworks as $key => $value) {
$networkconstname = 'MAIN_INFO_SOCIETE_'.strtoupper($key).'_URL';
$networkconstid = 'MAIN_INFO_SOCIETE_'.strtoupper($key);
print '<td><span class="fa paddingright '.($value['icon'] ? $value['icon'] : 'fa-link').'"></span>';
print '<input name="'.$key.'url" id="'.$key.'url" class="minwidth300" value="'.dol_escape_htmltag($conf->global->$networkconstname).'">';
print '<input name="'.$key.'url" id="'.$key.'url" class="minwidth300" value="'.(!empty($conf->global->$networkconstname) ? dol_escape_htmltag($conf->global->$networkconstname) : '').'">';
print '</td><td>';
print '<input name="'.$key.'" id="'.$key.'" class="minwidth300" value="'.dol_escape_htmltag($conf->global->$networkconstid).'">';
print '<input name="'.$key.'" id="'.$key.'" class="minwidth300" value="'.(!empty($conf->global->$networkconstid) ? dol_escape_htmltag($conf->global->$networkconstid) : '').'">';
print '</td>';
print '<td>'.dol_print_socialnetworks($conf->global->$networkconstid, 0, 0, $key, $listofnetworks).'</td>';
print '<td>'.dol_print_socialnetworks((!empty($conf->global->$networkconstid) ? dol_escape_htmltag($conf->global->$networkconstid) : ''), 0, 0, $key, $listofnetworks).'</td>';
print '</tr>'."\n";
}
}

View File

@ -72,9 +72,9 @@ $hookmanager->initHooks(array('admindefaultvalues', 'globaladmin'));
*/
if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
if (!GETPOST('confirmmassaction', 'alpha') && !empty($massaction) && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
$parameters = array('socid'=>$socid);
$parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@ -186,7 +186,7 @@ llxHeader('', $langs->trans("Setup"), $wikihelp);
$param = '&mode='.$mode;
$enabledisablehtml .= $langs->trans("EnableDefaultValues").' ';
$enabledisablehtml = $langs->trans("EnableDefaultValues").' ';
if (empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES))
{
// Button off, click to enable
@ -213,7 +213,7 @@ if ($defaultkey) $param .= '&defaultkey='.urlencode($defaultkey);
if ($defaultvalue) $param .= '&defaultvalue='.urlencode($defaultvalue);
print '<form action="'.$_SERVER["PHP_SELF"].((empty($user->entity) && $debug) ? '?debug=1' : '').'" method="POST">';
print '<form action="'.$_SERVER["PHP_SELF"].((empty($user->entity) && !empty($debug)) ? '?debug=1' : '').'" method="POST">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';

View File

@ -35,127 +35,127 @@ if (!$user->admin) accessforbidden();
$action = GETPOST('action', 'aZ09');
$modules = array(
'agenda' => array(
array(
'code' => 'MAIN_DELAY_ACTIONS_TODO',
'img' => 'action'
)
),
'projet' => array(
array(
'code' => 'MAIN_DELAY_PROJECT_TO_CLOSE',
'img' => 'project'
),
array(
'code' => 'MAIN_DELAY_TASKS_TODO',
'img' => 'projecttask'
)
),
'propal' => array(
array(
'code' => 'MAIN_DELAY_PROPALS_TO_CLOSE',
'img' => 'propal'
),
array(
'code' => 'MAIN_DELAY_PROPALS_TO_BILL',
'img' => 'propal'
)
),
'commande' => array(
array(
'code' => 'MAIN_DELAY_ORDERS_TO_PROCESS',
'img' => 'order'
)
),
'facture' => array(
array(
'code' => 'MAIN_DELAY_CUSTOMER_BILLS_UNPAYED',
'img' => 'bill'
)
),
'fournisseur' => array(
array(
'code' => 'MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS',
'img' => 'order'
),
array(
'code' => 'MAIN_DELAY_SUPPLIER_BILLS_TO_PAY',
'img' => 'bill'
)
),
'service' => array(
array(
'code' => 'MAIN_DELAY_NOT_ACTIVATED_SERVICES',
'img' => 'service'
),
array(
'code' => 'MAIN_DELAY_RUNNING_SERVICES',
'img' => 'service'
)
),
'banque' => array(
array(
'code' => 'MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE',
'img' => 'account'
),
array(
'code' => 'MAIN_DELAY_CHEQUES_TO_DEPOSIT',
'img' => 'account'
)
),
'adherent' => array(
array(
'code' => 'MAIN_DELAY_MEMBERS',
'img' => 'user'
)
),
'expensereport' => array(
array(
'code' => 'MAIN_DELAY_EXPENSEREPORTS',
'img' => 'trip'
),
/* TODO Enable this
array(
'code' => 'MAIN_DELAY_EXPENSEREPORTS_TO_PAY',
'img' => 'trip'
)*/
),
'holiday' => array(
array(
'code' => 'MAIN_DELAY_HOLIDAYS',
'img' => 'holiday'
),
),
'agenda' => array(
array(
'code' => 'MAIN_DELAY_ACTIONS_TODO',
'img' => 'action'
)
),
'projet' => array(
array(
'code' => 'MAIN_DELAY_PROJECT_TO_CLOSE',
'img' => 'project'
),
array(
'code' => 'MAIN_DELAY_TASKS_TODO',
'img' => 'projecttask'
)
),
'propal' => array(
array(
'code' => 'MAIN_DELAY_PROPALS_TO_CLOSE',
'img' => 'propal'
),
array(
'code' => 'MAIN_DELAY_PROPALS_TO_BILL',
'img' => 'propal'
)
),
'commande' => array(
array(
'code' => 'MAIN_DELAY_ORDERS_TO_PROCESS',
'img' => 'order'
)
),
'facture' => array(
array(
'code' => 'MAIN_DELAY_CUSTOMER_BILLS_UNPAYED',
'img' => 'bill'
)
),
'fournisseur' => array(
array(
'code' => 'MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS',
'img' => 'order'
),
array(
'code' => 'MAIN_DELAY_SUPPLIER_BILLS_TO_PAY',
'img' => 'bill'
)
),
'service' => array(
array(
'code' => 'MAIN_DELAY_NOT_ACTIVATED_SERVICES',
'img' => 'service'
),
array(
'code' => 'MAIN_DELAY_RUNNING_SERVICES',
'img' => 'service'
)
),
'banque' => array(
array(
'code' => 'MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE',
'img' => 'account'
),
array(
'code' => 'MAIN_DELAY_CHEQUES_TO_DEPOSIT',
'img' => 'account'
)
),
'adherent' => array(
array(
'code' => 'MAIN_DELAY_MEMBERS',
'img' => 'user'
)
),
'expensereport' => array(
array(
'code' => 'MAIN_DELAY_EXPENSEREPORTS',
'img' => 'trip'
),
/* TODO Enable this
array(
'code' => 'MAIN_DELAY_EXPENSEREPORTS_TO_PAY',
'img' => 'trip'
)*/
),
'holiday' => array(
array(
'code' => 'MAIN_DELAY_HOLIDAYS',
'img' => 'holiday'
),
),
);
$labelmeteo = array(0=>$langs->trans("No"), 1=>$langs->trans("Yes"), 2=>$langs->trans("OnMobileOnly"));
if (!isset($conf->global->MAIN_DELAY_PROJECT_TO_CLOSE)) {
$conf->global->MAIN_DELAY_PROJECT_TO_CLOSE = 7; // Must be same value than into conf.class.php
$conf->global->MAIN_DELAY_PROJECT_TO_CLOSE = 7; // Must be same value than into conf.class.php
}
if (!isset($conf->global->MAIN_DELAY_TASKS_TODO)) {
$conf->global->MAIN_DELAY_TASKS_TODO = 7; // Must be same value than into conf.class.php
$conf->global->MAIN_DELAY_TASKS_TODO = 7; // Must be same value than into conf.class.php
}
if (!isset($conf->global->MAIN_DELAY_MEMBERS)) {
$conf->global->MAIN_DELAY_MEMBERS = 0; // Must be same value than into conf.class.php
$conf->global->MAIN_DELAY_MEMBERS = 0; // Must be same value than into conf.class.php
}
if (!isset($conf->global->MAIN_DELAY_ACTIONS_TODO)) {
$conf->global->MAIN_DELAY_ACTIONS_TODO = 7; // Must be same value than into conf.class.php
$conf->global->MAIN_DELAY_ACTIONS_TODO = 7; // Must be same value than into conf.class.php
}
if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) {
$conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2;
$conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2;
}
if (!isset($conf->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS)) {
$conf->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS = 7;
$conf->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS = 7;
}
if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) {
$conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2;
$conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2;
}
if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) {
$conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2;
$conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2;
}
if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) {
$conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2;
$conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2;
}
@ -166,30 +166,30 @@ if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) {
if ($action == 'update')
{
foreach ($modules as $module => $delays)
{
if (!empty($conf->$module->enabled))
{
foreach ($delays as $delay)
{
if (GETPOST($delay['code']) != '')
{
dolibarr_set_const($db, $delay['code'], GETPOST($delay['code']), 'chaine', 0, '', $conf->entity);
}
}
}
}
foreach ($modules as $module => $delays)
{
if (!empty($conf->$module->enabled))
{
foreach ($delays as $delay)
{
if (GETPOST($delay['code']) != '')
{
dolibarr_set_const($db, $delay['code'], GETPOST($delay['code']), 'chaine', 0, '', $conf->entity);
}
}
}
}
dolibarr_set_const($db, "MAIN_DISABLE_METEO", $_POST["MAIN_DISABLE_METEO"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_USE_METEO_WITH_PERCENTAGE", GETPOST("MAIN_USE_METEO_WITH_PERCENTAGE"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_DISABLE_METEO", $_POST["MAIN_DISABLE_METEO"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_USE_METEO_WITH_PERCENTAGE", GETPOST("MAIN_USE_METEO_WITH_PERCENTAGE"), 'chaine', 0, '', $conf->entity);
// For update value with percentage
$plus = '';
if (!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $plus = '_PERCENTAGE';
// Update values
for ($i = 0; $i < 4; $i++) {
if (GETPOSTISSET('MAIN_METEO'.$plus.'_LEVEL'.$i)) dolibarr_set_const($db, 'MAIN_METEO'.$plus.'_LEVEL'.$i, GETPOST('MAIN_METEO'.$plus.'_LEVEL'.$i, 'int'), 'chaine', 0, '', $conf->entity);
}
// For update value with percentage
$plus = '';
if (!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $plus = '_PERCENTAGE';
// Update values
for ($i = 0; $i < 4; $i++) {
if (GETPOSTISSET('MAIN_METEO'.$plus.'_LEVEL'.$i)) dolibarr_set_const($db, 'MAIN_METEO'.$plus.'_LEVEL'.$i, GETPOST('MAIN_METEO'.$plus.'_LEVEL'.$i, 'int'), 'chaine', 0, '', $conf->entity);
}
}
@ -209,156 +209,156 @@ print "<br>\n";
if ($action == 'edit')
{
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" name="form_index">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">';
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" name="form_index">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>';
foreach ($modules as $module => $delays)
{
if (!empty($conf->$module->enabled))
{
foreach ($delays as $delay)
{
$value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']}:0);
print '<tr class="oddeven">';
print '<td width="20px">'.img_object('', $delay['img']).'</td>';
print '<td>'.$langs->trans('Delays_'.$delay['code']).'</td><td class="nowraponall">';
print '<input class="right maxwidth75" type="number" name="'.$delay['code'].'" value="'.$value.'"> '.$langs->trans("days").'</td></tr>';
}
}
}
foreach ($modules as $module => $delays)
{
if (!empty($conf->$module->enabled))
{
foreach ($delays as $delay)
{
$value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']}:0);
print '<tr class="oddeven">';
print '<td width="20px">'.img_object('', $delay['img']).'</td>';
print '<td>'.$langs->trans('Delays_'.$delay['code']).'</td><td class="nowraponall">';
print '<input class="right maxwidth75" type="number" name="'.$delay['code'].'" value="'.$value.'"> '.$langs->trans("days").'</td></tr>';
}
}
}
print '</table>';
print '</table>';
print '<br>';
print '<br>';
// Show if meteo is enabled
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>';
// Show if meteo is enabled
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td class="center">';
print $form->selectarray('MAIN_DISABLE_METEO', $labelmeteo, (empty($conf->global->MAIN_DISABLE_METEO) ? 0 : $conf->global->MAIN_DISABLE_METEO));
print '</td></tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td class="center">';
print $form->selectarray('MAIN_DISABLE_METEO', $labelmeteo, (empty($conf->global->MAIN_DISABLE_METEO) ? 0 : $conf->global->MAIN_DISABLE_METEO));
print '</td></tr>';
print '</table>';
print '</table>';
} else {
/*
/*
* Show parameters
*/
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>';
foreach ($modules as $module => $delays)
{
if (!empty($conf->$module->enabled))
{
foreach ($delays as $delay)
{
$value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']}:0);
print '<tr class="oddeven">';
print '<td width="20px">'.img_object('', $delay['img']).'</td>';
print '<td>'.$langs->trans('Delays_'.$delay['code']).'</td>';
print '<td class="right">'.$value.' '.$langs->trans("days").'</td></tr>';
}
}
}
foreach ($modules as $module => $delays)
{
if (!empty($conf->$module->enabled))
{
foreach ($delays as $delay)
{
$value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']}:0);
print '<tr class="oddeven">';
print '<td width="20px">'.img_object('', $delay['img']).'</td>';
print '<td>'.$langs->trans('Delays_'.$delay['code']).'</td>';
print '<td class="right">'.$value.' '.$langs->trans("days").'</td></tr>';
}
}
}
print '</table>';
print '</table>';
print '<br>';
print '<br>';
// Show if meteo is enabled
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>';
// Show if meteo is enabled
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td class="center">';
print $labelmeteo[$conf->global->MAIN_DISABLE_METEO];
print '</td></tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td class="center">';
print $labelmeteo[$conf->global->MAIN_DISABLE_METEO];
print '</td></tr>';
print '</table>';
print '</table>';
}
print '<br>';
if ($conf->global->MAIN_DISABLE_METEO != 1) {
// Show logo for weather
print '<span class="opacitymedium">'.$langs->trans("DescWeather").'</span> ';
// Show logo for weather
print '<span class="opacitymedium">'.$langs->trans("DescWeather").'</span> ';
if ($action == 'edit') {
$str_mode_std = $langs->trans('MeteoStdModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->transnoentitiesnoconv('MeteoPercentageMod'));
$str_mode_percentage = $langs->trans('MeteoPercentageModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->transnoentitiesnoconv('MeteoStdMod'));
if (empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $str_mode_enabled = $str_mode_std;
else $str_mode_enabled = $str_mode_percentage;
print '<a href="#" onclick="return false;" id="change_mode">'.$str_mode_enabled.'</a>';
print '<input type="hidden" id="MAIN_USE_METEO_WITH_PERCENTAGE" name="MAIN_USE_METEO_WITH_PERCENTAGE" value="'.$conf->global->MAIN_USE_METEO_WITH_PERCENTAGE.'" />';
if ($action == 'edit') {
$str_mode_std = $langs->trans('MeteoStdModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->transnoentitiesnoconv('MeteoPercentageMod'));
$str_mode_percentage = $langs->trans('MeteoPercentageModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->transnoentitiesnoconv('MeteoStdMod'));
if (empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $str_mode_enabled = $str_mode_std;
else $str_mode_enabled = $str_mode_percentage;
print '<a href="#" onclick="return false;" id="change_mode">'.$str_mode_enabled.'</a>';
print '<input type="hidden" id="MAIN_USE_METEO_WITH_PERCENTAGE" name="MAIN_USE_METEO_WITH_PERCENTAGE" value="'.$conf->global->MAIN_USE_METEO_WITH_PERCENTAGE.'" />';
print '<br><br>';
} else {
if (empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) print $langs->trans('MeteoStdModEnabled');
else print $langs->trans('MeteoPercentageModEnabled');
print '<br><br>';
}
print '<br><br>';
} else {
if (empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) print $langs->trans('MeteoStdModEnabled');
else print $langs->trans('MeteoPercentageModEnabled');
print '<br><br>';
}
$offset = 0;
$cursor = 10; // By default
//if (! empty($conf->global->MAIN_METEO_OFFSET)) $offset=$conf->global->MAIN_METEO_OFFSET;
//if (! empty($conf->global->MAIN_METEO_GAP)) $cursor=$conf->global->MAIN_METEO_GAP;
$level0 = $offset; if (!empty($conf->global->MAIN_METEO_LEVEL0)) $level0 = $conf->global->MAIN_METEO_LEVEL0;
$level1 = $offset + 1 * $cursor; if (!empty($conf->global->MAIN_METEO_LEVEL1)) $level1 = $conf->global->MAIN_METEO_LEVEL1;
$level2 = $offset + 2 * $cursor; if (!empty($conf->global->MAIN_METEO_LEVEL2)) $level2 = $conf->global->MAIN_METEO_LEVEL2;
$level3 = $offset + 3 * $cursor; if (!empty($conf->global->MAIN_METEO_LEVEL3)) $level3 = $conf->global->MAIN_METEO_LEVEL3;
$text = ''; $options = 'class="valignmiddle" height="60px"';
$offset = 0;
$cursor = 10; // By default
//if (! empty($conf->global->MAIN_METEO_OFFSET)) $offset=$conf->global->MAIN_METEO_OFFSET;
//if (! empty($conf->global->MAIN_METEO_GAP)) $cursor=$conf->global->MAIN_METEO_GAP;
$level0 = $offset; if (!empty($conf->global->MAIN_METEO_LEVEL0)) $level0 = $conf->global->MAIN_METEO_LEVEL0;
$level1 = $offset + 1 * $cursor; if (!empty($conf->global->MAIN_METEO_LEVEL1)) $level1 = $conf->global->MAIN_METEO_LEVEL1;
$level2 = $offset + 2 * $cursor; if (!empty($conf->global->MAIN_METEO_LEVEL2)) $level2 = $conf->global->MAIN_METEO_LEVEL2;
$level3 = $offset + 3 * $cursor; if (!empty($conf->global->MAIN_METEO_LEVEL3)) $level3 = $conf->global->MAIN_METEO_LEVEL3;
$text = ''; $options = 'class="valignmiddle" height="60px"';
if ($action == 'edit') {
print '<div id="standard" '.(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '' : 'style="display:none;"').'>';
if ($action == 'edit') {
print '<div id="standard" '.(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '' : 'style="display:none;"').'>';
print '<div>';
print '<div class="inline-block" style="padding-right: 20px">';
print img_weather($text, 0, $options);
print ' &lt;= <input type="text" size="2" name="MAIN_METEO_LEVEL0" value="'.$level0.'"/></td>';
print '</div><div class="inline-block" style="padding-right: 20px">';
print img_weather($text, 1, $options);
print ' &lt;= <input type="text" size="2" name="MAIN_METEO_LEVEL1" value="'.$level1.'"/></td>';
print '</div><div class="inline-block" style="padding-right: 20px">';
print img_weather($text, 2, $options);
print ' &lt;= <input type="text" size="2" name="MAIN_METEO_LEVEL2" value="'.$level2.'"/></td>';
print '</div><div class="inline-block" style="padding-right: 20px">';
print img_weather($text, 3, $options);
print ' &lt;= <input type="text" size="2" name="MAIN_METEO_LEVEL3" value="'.$level3.'"/></td>';
print '</div>';
print '</div>';
print '<div>';
print '<div class="inline-block" style="padding-right: 20px">';
print img_weather($text, 0, $options);
print ' &lt;= <input type="text" size="2" name="MAIN_METEO_LEVEL0" value="'.$level0.'"/></td>';
print '</div><div class="inline-block" style="padding-right: 20px">';
print img_weather($text, 1, $options);
print ' &lt;= <input type="text" size="2" name="MAIN_METEO_LEVEL1" value="'.$level1.'"/></td>';
print '</div><div class="inline-block" style="padding-right: 20px">';
print img_weather($text, 2, $options);
print ' &lt;= <input type="text" size="2" name="MAIN_METEO_LEVEL2" value="'.$level2.'"/></td>';
print '</div><div class="inline-block" style="padding-right: 20px">';
print img_weather($text, 3, $options);
print ' &lt;= <input type="text" size="2" name="MAIN_METEO_LEVEL3" value="'.$level3.'"/></td>';
print '</div>';
print '</div>';
print '</div>';
print '</div>';
print '<div id="percentage" '.(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? 'style="display:none;"' : '').'>';
print '<div id="percentage" '.(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? 'style="display:none;"' : '').'>';
print '<div>';
print '<div class="inline-block" style="padding-right: 20px">';
print img_weather($text, 0, $options);
print ' &lt;= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL0" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL0.'"/>&nbsp;%</td>';
print '</div><div class="inline-block" style="padding-right: 20px">';
print img_weather($text, 1, $options);
print ' &lt;= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL1" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL1.'"/>&nbsp;%</td>';
print '</div><div class="inline-block" style="padding-right: 20px">';
print img_weather($text, 2, $options);
print ' &lt;= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL2" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL2.'"/>&nbsp;%</td>';
print '</div><div class="inline-block" style="padding-right: 20px">';
print img_weather($text, 3, $options);
print ' &lt;= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL3" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL3.'"/>&nbsp;%</td>';
print '</div>';
print '</div>';
print '<div>';
print '<div class="inline-block" style="padding-right: 20px">';
print img_weather($text, 0, $options);
print ' &lt;= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL0" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL0.'"/>&nbsp;%</td>';
print '</div><div class="inline-block" style="padding-right: 20px">';
print img_weather($text, 1, $options);
print ' &lt;= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL1" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL1.'"/>&nbsp;%</td>';
print '</div><div class="inline-block" style="padding-right: 20px">';
print img_weather($text, 2, $options);
print ' &lt;= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL2" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL2.'"/>&nbsp;%</td>';
print '</div><div class="inline-block" style="padding-right: 20px">';
print img_weather($text, 3, $options);
print ' &lt;= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL3" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL3.'"/>&nbsp;%</td>';
print '</div>';
print '</div>';
print '</div>';
print '</div>';
?>
?>
<script type="text/javascript">

View File

@ -621,6 +621,7 @@ if ($id == 11)
// 'contract' => $langs->trans('Contract'),
'project' => $langs->trans('Project'),
'project_task' => $langs->trans('Task'),
'ticket' => $langs->trans('Ticket'),
'agenda' => $langs->trans('Agenda'),
'dolresource' => $langs->trans('Resource'),
// old deprecated
@ -692,7 +693,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
if ($value == 'sortorder') continue; // For a column name 'sortorder', we use the field name 'position'
if ((!GETPOSTISSET($value) || GETPOST($value) == '')
&& (!in_array($listfield[$f], array('decalage', 'module', 'accountancy_code', 'accountancy_code_sell', 'accountancy_code_buy', 'tracking', 'picto')) // Fields that are not mandatory
&& (!($id == 10 && $listfield[$f] == 'code')) // Code is mandatory fir table 10
&& ($id != 10 || ($listfield[$f] != 'code' && $listfield[$f] != 'note')) // Field code and note is not mandatory for dictionary table 10
)
) {
$ok = 0;
@ -757,9 +758,9 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
if ($_POST["accountancy_code"] <= 0) $_POST["accountancy_code"] = ''; // If empty, we force to null
if ($_POST["accountancy_code_sell"] <= 0) $_POST["accountancy_code_sell"] = ''; // If empty, we force to null
if ($_POST["accountancy_code_buy"] <= 0) $_POST["accountancy_code_buy"] = ''; // If empty, we force to null
if ($id == 10 && GETPOSTISSET("code")) // Spaces are not allowed into code
if ($id == 10 && GETPOSTISSET("code")) // Spaces are not allowed into code for tax dictionary
{
$_POST["code"] = preg_replace('/\s/', '', $_POST["code"]);
$_POST["code"] = preg_replace('/[^a-zA-Z0-9\-\+]/', '', $_POST["code"]);
}
// If check ok and action add, add the line
@ -826,8 +827,13 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$result = $db->query($sql);
if ($result) // Add is ok
{
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
$_POST = array('id'=>$id); // Clean $_POST array, we keep only
setEventMessages($langs->transnoentities("RecordCreatedSuccessfully"), null, 'mesgs');
// Clean $_POST array, we keep only id of dictionary
if ($id == 10 && GETPOST('country', 'int') > 0) {
$search_country_id = GETPOST('country', 'int');
}
$_POST = array('id'=>$id);
} else {
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors');
@ -1487,11 +1493,9 @@ if ($id)
continue;
}
if ($value == 'element')
{
if ($value == 'element') {
$valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow;
} elseif ($value == 'source')
{
} elseif ($value == 'source') {
$valuetoshow = isset($sourceList[$valuetoshow]) ? $sourceList[$valuetoshow] : $valuetoshow;
} elseif ($valuetoshow == 'all') {
$valuetoshow = $langs->trans('All');

View File

@ -163,7 +163,7 @@ if ($action == 'edit')
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"), $langs->trans("ParameterActiveForNextInputOnly"));
print '</td><td><input class="flat" name="'.$mainroundingruletot.'" size="3" value="'.(isset($conf->global->$mainroundingruletot) ? $conf->global->$mainroundingruletot : $conf->global->MAIN_ROUNDING_RULE_TOT).'"></td></tr>';
print '</td><td><input class="flat" name="'.$mainroundingruletot.'" size="3" value="'.(isset($conf->global->$mainroundingruletot) ? $conf->global->$mainroundingruletot : (!empty($conf->global->MAIN_ROUNDING_RULE_TOT) ? $conf->global->MAIN_ROUNDING_RULE_TOT : '')).'"></td></tr>';
print '</table>';
@ -193,7 +193,7 @@ if ($action == 'edit')
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"), $langs->trans("ParameterActiveForNextInputOnly"));
print '</td><td align="right">'.(isset($conf->global->$mainroundingruletot) ? $conf->global->$mainroundingruletot : $conf->global->MAIN_ROUNDING_RULE_TOT).'</td></tr>';
print '</td><td align="right">'.(isset($conf->global->$mainroundingruletot) ? $conf->global->$mainroundingruletot : (!empty($conf->global->MAIN_ROUNDING_RULE_TOT) ? $conf->global->MAIN_ROUNDING_RULE_TOT : '')).'</td></tr>';
print '</table>';
print '</div>';

View File

@ -290,6 +290,11 @@ if ($action == 'create') {
// Id
$parent_rowid = GETPOST('menuId', 'int');
$parent_mainmenu = '';
$parent_leftmenu = '';
$parent_langs = '';
$parent_level = '';
if (GETPOST('menuId', 'int')) {
$sql = "SELECT m.rowid, m.mainmenu, m.leftmenu, m.level, m.langs FROM ".MAIN_DB_PREFIX."menu as m WHERE m.rowid = ".GETPOST('menuId', 'int');
$res = $db->query($sql);
@ -328,8 +333,8 @@ if ($action == 'create') {
} else {
print '<select name="type" class="flat" id="topleft">';
print '<option value="">&nbsp;</option>';
print '<option value="top"'.($_POST["type"] && $_POST["type"] == 'top' ? ' selected' : '').'>'.$langs->trans('Top').'</option>';
print '<option value="left"'.($_POST["type"] && $_POST["type"] == 'left' ? ' selected' : '').'>'.$langs->trans('Left').'</option>';
print '<option value="top"'.(!empty($_POST["type"]) && $_POST["type"] == 'top' ? ' selected' : '').'>'.$langs->trans('Top').'</option>';
print '<option value="left"'.(!empty($_POST["type"]) && $_POST["type"] == 'left' ? ' selected' : '').'>'.$langs->trans('Left').'</option>';
print '</select>';
}
print '</td><td>'.$langs->trans('DetailType').'</td></tr>';
@ -370,8 +375,8 @@ if ($action == 'create') {
// Target
print '<tr><td>'.$langs->trans('Target').'</td><td><select class="flat" name="target">';
print '<option value=""'.($menu->target == "" ? ' selected' : '').'>&nbsp;</option>';
print '<option value="_blank"'.($menu->target == "_blank" ? ' selected' : '').'>'.$langs->trans('_blank').'</option>';
print '<option value=""'.(isset($menu->target) && $menu->target == "" ? ' selected' : '').'>&nbsp;</option>';
print '<option value="_blank"'.(isset($menu->target) && $menu->target == "_blank" ? ' selected' : '').'>'.$langs->trans('_blank').'</option>';
print '</select></td></td><td>'.$langs->trans('DetailTarget').'</td></tr>';
// Enabled

View File

@ -367,7 +367,7 @@ if ($conf->use_javascript_ajax)
$remainingdata = array();
foreach ($data as $datar)
{
if (empty($datar['rowid']) || $tree_recur_alreadyadded[$datar['rowid']]) continue;
if (empty($datar['rowid']) || !empty($tree_recur_alreadyadded[$datar['rowid']])) continue;
$remainingdata[] = $datar;
}

View File

@ -495,13 +495,19 @@ if ($mode == 'common' || $mode == 'commonkanban') {
dol_set_focus('#search_keyword');
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') {
print '<input type="hidden" name="token" value="'.newToken().'">';
if (isset($optioncss) && $optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
}
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
if (isset($sortfield) && $sortfield != '') {
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
}
if (isset($sortorder) && $sortorder != '') {
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
}
if (isset($page) && $page != '') {
print '<input type="hidden" name="page" value="'.$page.'">';
}
print '<input type="hidden" name="mode" value="'.$mode.'">';
print dol_get_fiche_head($head, 'modules', '', -1);
@ -999,7 +1005,7 @@ if ($mode == 'marketplace') {
<div id="listing-content">
<table summary="list_of_modules" id="list_of_modules" class="productlist centpercent">
<tbody id="listOfModules">
<?php echo $dolistore->get_products($categorie); ?>
<?php echo $dolistore->get_products(!empty($categorie) ? $categorie: ''); ?>
</tbody>
</table>
</div>
@ -1080,28 +1086,36 @@ if ($mode == 'deploy') {
$max = $conf->global->MAIN_UPLOAD_DOC; // In Kb
$maxphp = @ini_get('upload_max_filesize'); // In unknown
if (preg_match('/k$/i', $maxphp)) {
$maxphp = preg_replace('/k$/i', '', $maxphp);
$maxphp = $maxphp * 1;
}
if (preg_match('/m$/i', $maxphp)) {
$maxphp = preg_replace('/m$/i', '', $maxphp);
$maxphp = $maxphp * 1024;
}
if (preg_match('/g$/i', $maxphp)) {
$maxphp = preg_replace('/g$/i', '', $maxphp);
$maxphp = $maxphp * 1024 * 1024;
}
if (preg_match('/t$/i', $maxphp)) {
$maxphp = preg_replace('/t$/i', '', $maxphp);
$maxphp = $maxphp * 1024 * 1024 * 1024;
}
$maxphp2 = @ini_get('post_max_size'); // In unknown
if (preg_match('/k$/i', $maxphp2)) {
$maxphp2 = preg_replace('/k$/i', '', $maxphp2);
$maxphp2 = $maxphp2 * 1;
}
if (preg_match('/m$/i', $maxphp2)) {
$maxphp2 = preg_replace('/m$/i', '', $maxphp2);
$maxphp2 = $maxphp2 * 1024;
}
if (preg_match('/g$/i', $maxphp2)) {
$maxphp2 = preg_replace('/g$/i', '', $maxphp2);
$maxphp2 = $maxphp2 * 1024 * 1024;
}
if (preg_match('/t$/i', $maxphp2)) {
$maxphp2 = preg_replace('/t$/i', '', $maxphp2);
$maxphp2 = $maxphp2 * 1024 * 1024 * 1024;
}
// Now $max and $maxphp and $maxphp2 are in Kb

View File

@ -95,37 +95,37 @@ if (empty($action) || $action == 'edit' || $action == 'updateedit')
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("Monday"), $langs->trans("OpeningHoursFormatDesc"));
print '</td><td>';
print '<input name="monday" id="monday" class="minwidth100" value="'.($conf->global->MAIN_INFO_OPENINGHOURS_MONDAY ? $conf->global->MAIN_INFO_OPENINGHOURS_MONDAY : GETPOST("monday", 'alpha')).'"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'></td></tr>'."\n";
print '<input name="monday" id="monday" class="minwidth100" value="'.(!empty($conf->global->MAIN_INFO_OPENINGHOURS_MONDAY) ? $conf->global->MAIN_INFO_OPENINGHOURS_MONDAY : GETPOST("monday", 'alpha')).'"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'></td></tr>'."\n";
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("Tuesday"), $langs->trans("OpeningHoursFormatDesc"));
print '</td><td>';
print '<input name="tuesday" id="tuesday" class="minwidth100" value="'.($conf->global->MAIN_INFO_OPENINGHOURS_TUESDAY ? $conf->global->MAIN_INFO_OPENINGHOURS_TUESDAY : GETPOST("tuesday", 'alpha')).'"></td></tr>'."\n";
print '<input name="tuesday" id="tuesday" class="minwidth100" value="'.(!empty($conf->global->MAIN_INFO_OPENINGHOURS_TUESDAY) ? $conf->global->MAIN_INFO_OPENINGHOURS_TUESDAY : GETPOST("tuesday", 'alpha')).'"></td></tr>'."\n";
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("Wednesday"), $langs->trans("OpeningHoursFormatDesc"));
print '</td><td>';
print '<input name="wednesday" id="wednesday" class="minwidth100" value="'.($conf->global->MAIN_INFO_OPENINGHOURS_WEDNESDAY ? $conf->global->MAIN_INFO_OPENINGHOURS_WEDNESDAY : GETPOST("wednesday", 'alpha')).'"></td></tr>'."\n";
print '<input name="wednesday" id="wednesday" class="minwidth100" value="'.(!empty($conf->global->MAIN_INFO_OPENINGHOURS_WEDNESDAY) ? $conf->global->MAIN_INFO_OPENINGHOURS_WEDNESDAY : GETPOST("wednesday", 'alpha')).'"></td></tr>'."\n";
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("Thursday"), $langs->trans("OpeningHoursFormatDesc"));
print '</td><td>';
print '<input name="thursday" id="thursday" class="minwidth100" value="'.($conf->global->MAIN_INFO_OPENINGHOURS_THURSDAY ? $conf->global->MAIN_INFO_OPENINGHOURS_THURSDAY : GETPOST("thursday", 'alpha')).'"></td></tr>'."\n";
print '<input name="thursday" id="thursday" class="minwidth100" value="'.(!empty($conf->global->MAIN_INFO_OPENINGHOURS_THURSDAY) ? $conf->global->MAIN_INFO_OPENINGHOURS_THURSDAY : GETPOST("thursday", 'alpha')).'"></td></tr>'."\n";
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("Friday"), $langs->trans("OpeningHoursFormatDesc"));
print '</td><td>';
print '<input name="friday" id="friday" class="minwidth100" value="'.($conf->global->MAIN_INFO_OPENINGHOURS_FRIDAY ? $conf->global->MAIN_INFO_OPENINGHOURS_FRIDAY : GETPOST("friday", 'alpha')).'"></td></tr>'."\n";
print '<input name="friday" id="friday" class="minwidth100" value="'.(!empty($conf->global->MAIN_INFO_OPENINGHOURS_FRIDAY) ? $conf->global->MAIN_INFO_OPENINGHOURS_FRIDAY : GETPOST("friday", 'alpha')).'"></td></tr>'."\n";
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("Saturday"), $langs->trans("OpeningHoursFormatDesc"));
print '</td><td>';
print '<input name="saturday" id="saturday" class="minwidth100" value="'.($conf->global->MAIN_INFO_OPENINGHOURS_SATURDAY ? $conf->global->MAIN_INFO_OPENINGHOURS_SATURDAY : GETPOST("saturday", 'alpha')).'"></td></tr>'."\n";
print '<input name="saturday" id="saturday" class="minwidth100" value="'.(!empty($conf->global->MAIN_INFO_OPENINGHOURS_SATURDAY) ? $conf->global->MAIN_INFO_OPENINGHOURS_SATURDAY : GETPOST("saturday", 'alpha')).'"></td></tr>'."\n";
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("Sunday"), $langs->trans("OpeningHoursFormatDesc"));
print '</td><td>';
print '<input name="sunday" id="sunday" class="minwidth100" value="'.($conf->global->MAIN_INFO_OPENINGHOURS_SUNDAY ? $conf->global->MAIN_INFO_OPENINGHOURS_SUNDAY : GETPOST("sunday", 'alpha')).'"></td></tr>'."\n";
print '<input name="sunday" id="sunday" class="minwidth100" value="'.(!empty($conf->global->MAIN_INFO_OPENINGHOURS_SUNDAY) ? $conf->global->MAIN_INFO_OPENINGHOURS_SUNDAY : GETPOST("sunday", 'alpha')).'"></td></tr>'."\n";
print '</table>';

View File

@ -161,7 +161,7 @@ print '<div class="div-table-responsive-no-min">';
print '<table summary="more" class="noborder centpercent">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
$selected = $conf->global->MAIN_PDF_FORMAT;
$selected = (isset($conf->global->MAIN_PDF_FORMAT) ? $conf->global->MAIN_PDF_FORMAT : '');
if (empty($selected)) $selected = dol_getDefaultFormat();
// Show pdf format
@ -320,13 +320,13 @@ print '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("ShowDetailsInPDFPageFoot").'</td><td>';
print $form->selectarray('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', $arraydetailsforpdffoot, $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS);
print $form->selectarray('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', $arraydetailsforpdffoot, (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS : 0));
print '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("PDF_USE_ALSO_LANGUAGE_CODE").'</td><td>';
//if (! empty($conf->global->MAIN_MULTILANGS))
//{
print $formadmin->select_language(GETPOSTISSET('PDF_USE_ALSO_LANGUAGE_CODE') ? GETPOST('PDF_USE_ALSO_LANGUAGE_CODE') : $conf->global->PDF_USE_ALSO_LANGUAGE_CODE, 'PDF_USE_ALSO_LANGUAGE_CODE', 0, null, 1);
print $formadmin->select_language(GETPOSTISSET('PDF_USE_ALSO_LANGUAGE_CODE') ? GETPOST('PDF_USE_ALSO_LANGUAGE_CODE') : (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) ? $conf->global->PDF_USE_ALSO_LANGUAGE_CODE : 0), 'PDF_USE_ALSO_LANGUAGE_CODE', 0, null, 1);
//} else {
// print '<span class="opacitymedium">'.$langs->trans("MultiLangNotEnabled").'</span>';
//}

View File

@ -166,7 +166,7 @@ if ($result)
if (is_object($modules[$obj->module]) && ($modules[$obj->module]->module_position > 0))
{
// TODO Define familyposition
$family = $modules[$obj->module]->family_position;
$family = (!empty($modules[$obj->module]->family_position) ? $modules[$obj->module]->family_position : '');
$familyposition = 0;
$sqlupdate = 'UPDATE '.MAIN_DB_PREFIX."rights_def SET module_position = ".$modules[$obj->module]->module_position.",";
$sqlupdate .= " family_position = ".$familyposition;
@ -214,7 +214,7 @@ if ($result)
print '</tr>'."\n";
}
$perm_libelle = ($conf->global->MAIN_USE_ADVANCED_PERMS && ($langs->trans("PermissionAdvanced".$obj->id) != ("PermissionAdvanced".$obj->id)) ? $langs->trans("PermissionAdvanced".$obj->id) : (($langs->trans("Permission".$obj->id) != ("Permission".$obj->id)) ? $langs->trans("Permission".$obj->id) : $obj->label));
$perm_libelle = (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ($langs->trans("PermissionAdvanced".$obj->id) != ("PermissionAdvanced".$obj->id)) ? $langs->trans("PermissionAdvanced".$obj->id) : (($langs->trans("Permission".$obj->id) != ("Permission".$obj->id)) ? $langs->trans("Permission".$obj->id) : $obj->label));
print '<tr class="oddeven">';

View File

@ -155,7 +155,7 @@ print '<tr class="oddeven">';
print '<td>'.$langs->trans("MAIN_PROXY_USE").'</td><td class="right">';
print '</td>';
print '<td class="nowrap">';
print $form->selectyesno('MAIN_PROXY_USE', $conf->global->MAIN_PROXY_USE, 1);
print $form->selectyesno('MAIN_PROXY_USE', (!empty($conf->global->MAIN_PROXY_USE) ? $conf->global->MAIN_PROXY_USE : 0), 1);
print '</td>';
print '</tr>';
@ -164,7 +164,7 @@ print '<tr class="oddeven">';
print '<td>'.$langs->trans("MAIN_PROXY_HOST").'</td><td class="right">';
print '</td>';
print '<td class="nowrap">';
print '<input class="flat" name="MAIN_PROXY_HOST" type="text" size="16" value="'.$conf->global->MAIN_PROXY_HOST.'">';
print '<input class="flat" name="MAIN_PROXY_HOST" type="text" size="16" value="'.(!empty($conf->global->MAIN_PROXY_HOST) ? $conf->global->MAIN_PROXY_HOST : '').'">';
print '</td>';
print '</tr>';
@ -173,7 +173,7 @@ print '<tr class="oddeven">';
print '<td>'.$langs->trans("MAIN_PROXY_PORT").'</td><td class="right">';
print '</td>';
print '<td class="nowrap">';
print '<input class="flat" name="MAIN_PROXY_PORT" type="text" size="4" value="'.$conf->global->MAIN_PROXY_PORT.'">';
print '<input class="flat" name="MAIN_PROXY_PORT" type="text" size="4" value="'.(!empty($conf->global->MAIN_PROXY_PORT) ? $conf->global->MAIN_PROXY_PORT : '').'">';
print '</td>';
print '</tr>';
@ -182,7 +182,7 @@ print '<tr class="oddeven">';
print '<td>'.$langs->trans("MAIN_PROXY_USER").'</td><td class="right">';
print '</td>';
print '<td class="nowrap">';
print '<input class="flat" name="MAIN_PROXY_USER" type="text" size="16" value="'.$conf->global->MAIN_PROXY_USER.'">';
print '<input class="flat" name="MAIN_PROXY_USER" type="text" size="16" value="'.(!empty($conf->global->MAIN_PROXY_USER) ? $conf->global->MAIN_PROXY_USER : '').'">';
print '</td>';
print '</tr>';
@ -191,7 +191,7 @@ print '<tr class="oddeven">';
print '<td>'.$langs->trans("MAIN_PROXY_PASS").'</td><td class="right">';
print '</td>';
print '<td class="nowrap">';
print '<input class="flat" name="MAIN_PROXY_PASS" type="text" size="16" value="'.$conf->global->MAIN_PROXY_PASS.'">';
print '<input class="flat" name="MAIN_PROXY_PASS" type="text" size="16" value="'.(!empty($conf->global->MAIN_PROXY_PASS) ? $conf->global->MAIN_PROXY_PASS : '').'">';
print '</td>';
print '</tr>';

View File

@ -241,8 +241,8 @@ print '</tr>';
foreach ($arrayhandler as $key => $module)
{
// Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
if (!empty($module->version) && $module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if (!empty($module->version) && $module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
if ($module->isEnabled())
{

View File

@ -116,7 +116,7 @@ print '</tr>';
print '<tr class="oddeven">';
print '<td colspan="2">'.$langs->trans("MaxSizeForUploadedFiles").'.';
$max = @ini_get('upload_max_filesize');
if ($max) print ' '.$langs->trans("MustBeLowerThanPHPLimit", $max * 1024, $langs->trans("Kb")).'.';
if (isset($max)) print ' '.$langs->trans("MustBeLowerThanPHPLimit", ((int) $max) * 1024, $langs->trans("Kb")).'.';
else print ' '.$langs->trans("NoMaxSizeByPHPLimit").'.';
print '</td>';
print '<td class="nowrap">';

View File

@ -51,15 +51,39 @@ if (isset($title))
// Check PHP setup is OK
$maxphp = @ini_get('upload_max_filesize'); // In unknown
if (preg_match('/k$/i', $maxphp)) $maxphp = $maxphp * 1;
if (preg_match('/m$/i', $maxphp)) $maxphp = $maxphp * 1024;
if (preg_match('/g$/i', $maxphp)) $maxphp = $maxphp * 1024 * 1024;
if (preg_match('/t$/i', $maxphp)) $maxphp = $maxphp * 1024 * 1024 * 1024;
if (preg_match('/k$/i', $maxphp)) {
$maxphp = preg_replace('/k$/i', '', $maxphp);
$maxphp = $maxphp * 1;
}
if (preg_match('/m$/i', $maxphp)) {
$maxphp = preg_replace('/m$/i', '', $maxphp);
$maxphp = $maxphp * 1024;
}
if (preg_match('/g$/i', $maxphp)) {
$maxphp = preg_replace('/g$/i', '', $maxphp);
$maxphp = $maxphp * 1024 * 1024;
}
if (preg_match('/t$/i', $maxphp)) {
$maxphp = preg_replace('/t$/i', '', $maxphp);
$maxphp = $maxphp * 1024 * 1024 * 1024;
}
$maxphp2 = @ini_get('post_max_size'); // In unknown
if (preg_match('/k$/i', $maxphp2)) $maxphp2 = $maxphp2 * 1;
if (preg_match('/m$/i', $maxphp2)) $maxphp2 = $maxphp2 * 1024;
if (preg_match('/g$/i', $maxphp2)) $maxphp2 = $maxphp2 * 1024 * 1024;
if (preg_match('/t$/i', $maxphp2)) $maxphp2 = $maxphp2 * 1024 * 1024 * 1024;
if (preg_match('/k$/i', $maxphp2)) {
$maxphp2 = preg_replace('/k$/i', '', $maxphp2);
$maxphp2 = $maxphp2 * 1;
}
if (preg_match('/m$/i', $maxphp2)) {
$maxphp2 = preg_replace('/m$/i', '', $maxphp2);
$maxphp2 = $maxphp2 * 1024;
}
if (preg_match('/g$/i', $maxphp2)) {
$maxphp2 = preg_replace('/g$/i', '', $maxphp2);
$maxphp2 = $maxphp2 * 1024 * 1024;
}
if (preg_match('/t$/i', $maxphp2)) {
$maxphp2 = preg_replace('/t$/i', '', $maxphp2);
$maxphp2 = $maxphp2 * 1024 * 1024 * 1024;
}
if ($maxphp > 0 && $maxphp2 > 0 && $maxphp > $maxphp2)
{
$langs->load("errors");

View File

@ -40,9 +40,9 @@ $transkey = GETPOST('transkey', 'alphanohtml');
$transvalue = GETPOST('transvalue', 'restricthtml');
$mode = GETPOST('mode', 'aZ09') ?GETPOST('mode', 'aZ09') : 'searchkey';
$mode = GETPOST('mode', 'aZ09') ? GETPOST('mode', 'aZ09') : 'searchkey';
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
@ -62,9 +62,9 @@ $hookmanager->initHooks(array('admintranslation', 'globaladmin'));
*/
if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
if (!GETPOST('confirmmassaction', 'alpha') && !empty($massaction) && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
$parameters = array('socid'=>$socid);
$parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@ -217,14 +217,14 @@ print '<br>';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
if (isset($optioncss) && $optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
if ($langcode) $param .= '&langcode='.urlencode($langcode);
if ($transkey) $param .= '&transkey='.urlencode($transkey);
if ($transvalue) $param .= '&transvalue='.urlencode($transvalue);
print '<form action="'.$_SERVER["PHP_SELF"].((empty($user->entity) && $debug) ? '?debug=1' : '').'" method="POST">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<form action="'.$_SERVER["PHP_SELF"].((empty($user->entity) && !empty($debug)) ? '?debug=1' : '').'" method="POST">';
if (isset($optioncss) && $optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
@ -472,7 +472,7 @@ if ($mode == 'searchkey')
print '</td>';
// Action column
print '<td class="nowrap right">';
$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
$searchpicto = $form->showFilterAndCheckAddButtons(!empty($massactionbutton) ? 1 : 0, 'checkforselect', 1);
print $searchpicto;
print '</td>';
print '</tr>';

View File

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

View File

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

View File

@ -214,6 +214,7 @@ llxHeader('', $langs->trans("Agenda"), $help_url);
$form = new Form($db);
$companystatic = new Societe($db);
$contactstatic = new Contact($db);
$userstatic = new User($db);
$now = dol_now();
$nowarray = dol_getdate($now);
@ -1071,7 +1072,6 @@ if (count($listofextcals))
{
$event->id = $icalevent['UID'];
$event->ref = $event->id;
$userId = $userstatic->findUserIdByEmail($namecal);
if (!empty($userId) && $userId > 0)
{

View File

@ -87,7 +87,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
$hookmanager->initHooks(array('thirdpartycomm', 'globalcard'));
// Security check
$result = restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', 0);
$result = restrictedArea($user, 'societe', $id, '&societe', '', 'fk_soc', 'rowid', 0);
if ($object->id > 0) {
if (!($object->client > 0) || empty($user->rights->societe->lire)) {

View File

@ -46,7 +46,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
// Load translation files required by the page
$langs->loadLangs(array("orders", 'sendings', 'deliveries', 'companies', 'compta', 'bills', 'stocks'));
$langs->loadLangs(array("orders", 'sendings', 'deliveries', 'companies', 'compta', 'bills', 'stocks', 'products'));
$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');

View File

@ -549,16 +549,17 @@ if (!empty($conf->multicompany->enabled) && is_object($mc))
print '<br>';
$listofchoices = array(
'selectinvoices'=>array('label'=>'Invoices', 'lang'=>'bills'),
'selectsupplierinvoices'=>array('label'=>'BillsSuppliers', 'lang'=>'bills'),
'selectexpensereports'=>array('label'=>'ExpenseReports', 'lang'=>'trips'),
'selectdonations'=>array('label'=>'Donations', 'lang'=>'donation'),
'selectpaymentsofsalaries'=>array('label'=>'SalariesPayments', 'lang'=>'salaries'),
'selectsocialcontributions'=>array('label'=>'SocialContributions'),
'selectvariouspayment'=>array('label'=>'VariousPayment'),
'selectloanspayment'=>array('label'=>'PaymentLoan'),
'selectinvoices'=>array('label'=>'Invoices', 'lang'=>'bills', 'enabled' => !empty($conf->facture->enabled)),
'selectsupplierinvoices'=>array('label'=>'BillsSuppliers', 'lang'=>'bills', 'enabled' => !empty($conf->supplier_invoice->enabled)),
'selectexpensereports'=>array('label'=>'ExpenseReports', 'lang'=>'trips', 'enabled' => !empty($conf->expensereport->enabled)),
'selectdonations'=>array('label'=>'Donations', 'lang'=>'donation', 'enabled' => !empty($conf->don->enabled)),
'selectsocialcontributions'=>array('label'=>'SocialContributions', 'enabled' => !empty($conf->tax->enabled)),
'selectpaymentsofsalaries'=>array('label'=>'SalariesPayments', 'lang'=>'salaries', 'enabled' => !empty($conf->salaries->enabled)),
'selectvariouspayment'=>array('label'=>'VariousPayment', 'enabled' => !empty($conf->banque->enabled)),
'selectloanspayment'=>array('label'=>'PaymentLoan', 'enabled' => !empty($conf->loan->enabled)),
);
foreach ($listofchoices as $choice => $val) {
if (empty($val['enabled'])) continue; // list not qualified
$checked = (((!GETPOSTISSET('search') && $action != 'searchfiles') || GETPOST($choice)) ? ' checked="checked"' : '');
print '<div class="paddingleft inline-block marginrightonly"><input type="checkbox" id="'.$choice.'" name="'.$choice.'" value="1"'.$checked.'> <label for="'.$choice.'">'.$langs->trans($val['label']).'</label></div>';
}

View File

@ -493,9 +493,10 @@ class Account extends CommonObject
* @param string $banque Bank of cheque writer
* @param string $accountancycode When we record a free bank entry, we must provide accounting account if accountancy module is on.
* @param int $datev Date value
* @param string $num_releve Label of bank receipt for reconciliation
* @return int Rowid of added entry, <0 if KO
*/
public function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur = '', $banque = '', $accountancycode = '', $datev = null)
public function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur = '', $banque = '', $accountancycode = '', $datev = null, $num_releve = '')
{
// Deprecation warning
if (is_numeric($oper)) {
@ -555,6 +556,7 @@ class Account extends CommonObject
$accline->fk_account = $this->rowid;
$accline->fk_type = $oper;
$accline->numero_compte = $accountancycode;
$accline->num_releve = $num_releve;
if ($num_chq) {
$accline->num_chq = $num_chq;
@ -1886,6 +1888,7 @@ class AccountLine extends CommonObject
$sql .= ", emetteur,banque";
$sql .= ", rappro";
$sql .= ", numero_compte";
$sql .= ", num_releve";
$sql .= ") VALUES (";
$sql .= "'".$this->db->idate($this->datec)."'";
$sql .= ", '".$this->db->idate($this->dateo)."'";
@ -1900,6 +1903,7 @@ class AccountLine extends CommonObject
$sql .= ", ".($this->bank_chq ? "'".$this->db->escape($this->bank_chq)."'" : "null");
$sql .= ", ".(int) $this->rappro;
$sql .= ", ".($this->numero_compte ? "'".$this->db->escape($this->numero_compte)."'" : "''");
$sql .= ", ".($this->num_releve ? "'".$this->db->escape($this->num_releve)."'" : "null");
$sql .= ")";
dol_syslog(get_class($this)."::insert", LOG_DEBUG);

View File

@ -81,10 +81,8 @@ class BankAccounts extends DolibarrApi
$sql .= " AND c.fk_categorie = ".$this->db->escape($category)." AND c.fk_account = t.rowid ";
}
// Add sql filters
if ($sqlfilters)
{
if (!DolibarrApi::_checkFilters($sqlfilters))
{
if ($sqlfilters) {
if (!DolibarrApi::_checkFilters($sqlfilters)) {
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
@ -93,8 +91,7 @@ class BankAccounts extends DolibarrApi
$sql .= $this->db->order($sortfield, $sortorder);
if ($limit) {
if ($page < 0)
{
if ($page < 0) {
$page = 0;
}
$offset = $limit * $page;
@ -222,12 +219,10 @@ class BankAccounts extends DolibarrApi
throw new RestException(404, 'The BankAccount for bankaccount_to_id provided does not exist.');
}
if ($accountto->currency_code == $accountfrom->currency_code)
{
if ($accountto->currency_code == $accountfrom->currency_code) {
$amount_to = $amount;
} else {
if (!$amount_to || empty($amount_to))
{
if (!$amount_to || empty($amount_to)) {
throw new RestException(422, 'You must provide amount_to value since bankaccount_from and bankaccount_to does not share the same currency.');
}
}
@ -244,8 +239,7 @@ class BankAccounts extends DolibarrApi
$typefrom = 'PRE';
$typeto = 'VIR';
if ($accountto->courant == Account::TYPE_CASH || $accountfrom->courant == Account::TYPE_CASH)
{
if ($accountto->courant == Account::TYPE_CASH || $accountfrom->courant == Account::TYPE_CASH) {
// This is transfer of change
$typefrom = 'LIQ';
$typeto = 'LIQ';
@ -291,8 +285,7 @@ class BankAccounts extends DolibarrApi
$error++;
}
if (!$error)
{
if (!$error) {
$this->db->commit();
return array(
@ -327,12 +320,13 @@ class BankAccounts extends DolibarrApi
}
foreach ($request_data as $field => $value) {
if ($field == 'id') continue;
if ($field == 'id') {
continue;
}
$account->$field = $value;
}
if ($account->update(DolibarrApiAccess::$user) > 0)
{
if ($account->update(DolibarrApiAccess::$user) > 0) {
return $this->get($id);
} else {
throw new RestException(500, $account->error);
@ -380,8 +374,9 @@ class BankAccounts extends DolibarrApi
{
$account = array();
foreach (BankAccounts::$FIELDS as $field) {
if (!isset($data[$field]))
if (!isset($data[$field])) {
throw new RestException(400, "$field field missing");
}
$account[$field] = $data[$field];
}
return $account;
@ -433,10 +428,8 @@ class BankAccounts extends DolibarrApi
$sql .= " WHERE fk_account = ".$id;
// Add sql filters
if ($sqlfilters)
{
if (!DolibarrApi::_checkFilters($sqlfilters))
{
if ($sqlfilters) {
if (!DolibarrApi::_checkFilters($sqlfilters)) {
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
@ -457,7 +450,7 @@ class BankAccounts extends DolibarrApi
}
}
} else {
throw new RestException(503, 'Error when retrieving list of account lines: '.$accountLine->error);
throw new RestException(503, 'Error when retrieving list of account lines: '.$this->db->lasterror());
}
return $list;
@ -466,20 +459,23 @@ class BankAccounts extends DolibarrApi
/**
* Add a line to an account
*
* @param int $id ID of account
* @param int $date Payment date (timestamp) {@from body} {@type timestamp}
* @param string $type Payment mode (TYP,VIR,PRE,LIQ,VAD,CB,CHQ...) {@from body}
* @param string $label Label {@from body}
* @param float $amount Amount (may be 0) {@from body}
* @param int $category Category
* @param string $cheque_number Cheque numberl {@from body}
* @param string $cheque_writer Name of cheque writer {@from body}
* @param string $cheque_bank Bank of cheque writer {@from body}
* @param int $id ID of account
* @param int $date Payment date (timestamp) {@from body} {@type timestamp}
* @param string $type Payment mode (TYP,VIR,PRE,LIQ,VAD,CB,CHQ...) {@from body}
* @param string $label Label {@from body}
* @param float $amount Amount (may be 0) {@from body}
* @param int $category Category
* @param string $cheque_number Cheque numero {@from body}
* @param string $cheque_writer Name of cheque writer {@from body}
* @param string $cheque_bank Bank of cheque writer {@from body}
* @param string $accountancycode Accountancy code {@from body}
* @param int $datev Payment date value (timestamp) {@from body} {@type timestamp}
* @param string $num_releve Bank statement numero {@from body}
* @return int ID of line
*
* @url POST {id}/lines
*/
public function addLine($id, $date, $type, $label, $amount, $category = 0, $cheque_number = '', $cheque_writer = '', $cheque_bank = '')
public function addLine($id, $date, $type, $label, $amount, $category = 0, $cheque_number = '', $cheque_writer = '', $cheque_bank = '', $accountancycode = '', $datev = null, $num_releve = '')
{
if (!DolibarrApiAccess::$user->rights->banque->modifier) {
throw new RestException(401);
@ -499,7 +495,11 @@ class BankAccounts extends DolibarrApi
$cheque_number,
$category,
DolibarrApiAccess::$user,
$cheque_writer, $cheque_bank
$cheque_writer,
$cheque_bank,
$accountancycode,
$datev,
$num_releve
);
if ($result < 0) {
throw new RestException(503, 'Error when adding line to account: '.$account->error);

View File

@ -58,11 +58,15 @@ if ($user->socid) $socid = $user->socid;
$result = restrictedArea($user, 'banque', $fieldvalue, 'bank_account', '', '', $fieldtype);
if (!$user->rights->banque->lire && !$user->rights->banque->consolidate) accessforbidden();
$hookmanager->initHooks(array('bankline'));
/*
* Actions
*/
$parameters = array('socid' => $socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if ($cancel)
{
if ($backtopage)

View File

@ -40,11 +40,14 @@ if (!$user->rights->banque->transfer)
$action = GETPOST('action', 'aZ09');
$error = 0;
$hookmanager->initHooks(array('banktransfer'));
/*
* Actions
*/
$parameters = array('socid' => $socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if ($action == 'add')
{
$langs->load("errors");

View File

@ -710,10 +710,10 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
// Price
print '<td class="right">'.price($sign * $objp->total_ttc).'</td>';
// Received or paid back
// Received + already paid
print '<td class="right">'.price($sign * $paiement);
if ($creditnotes) print '+'.price($creditnotes);
if ($deposits) print '+'.price($deposits);
if ($creditnotes) print '<span class="opacitymedium">+'.price($creditnotes).'</span>';
if ($deposits) print '<span class="opacitymedium">+'.price($deposits).'</span>';
print '</td>';
// Remain to take or to pay back

View File

@ -1382,7 +1382,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
if (!empty($object->socid)) {
print '<tr><td class="titlefield">'.$langs->trans("ContactByDefaultFor").'</td>';
print '<td colspan="3">';
print $formcompany->showRoles("roles", $object, 'view');
print $formcompany->showRoles("roles", $object, 'view', $object->roles);
print '</td></tr>';
}

View File

@ -374,8 +374,7 @@ if (empty($reshook))
$action = 'create';
}
}
} elseif ($action == 'classin' && $user->rights->contrat->creer)
{
} elseif ($action == 'classin' && $user->rights->contrat->creer) {
$object->setProject(GETPOST('projectid'));
}

View File

@ -83,7 +83,7 @@ class box_commandes extends ModeleBoxes
$societestatic = new Societe($this->db);
$userstatic = new User($this->db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE ? "" : "Modified")."CustomerOrders", $max));
$this->info_box_head = array('text' => $langs->trans("BoxTitleLast".(!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) ? "" : "Modified")."CustomerOrders", $max));
if ($user->rights->commande->lire)
{
@ -108,7 +108,7 @@ class box_commandes extends ModeleBoxes
if (!empty($conf->global->ORDER_BOX_LAST_ORDERS_VALIDATED_ONLY)) $sql .= " AND c.fk_statut = 1";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY c.date_commande DESC, c.ref DESC ";
if (!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE)) $sql .= " ORDER BY c.date_commande DESC, c.ref DESC ";
else $sql .= " ORDER BY c.tms DESC, c.ref DESC ";
$sql .= $this->db->plimit($max, 0);

View File

@ -92,7 +92,7 @@ class box_contracts extends ModeleBoxes
$sql .= " AND c.entity = ".$conf->entity;
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY c.date_contrat DESC, c.ref DESC ";
if (! empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE)) $sql .= " ORDER BY c.date_contrat DESC, c.ref DESC ";
else $sql .= " ORDER BY c.tms DESC, c.ref DESC ";
$sql .= $this->db->plimit($max, 0);

View File

@ -81,7 +81,7 @@ class box_factures extends ModeleBoxes
$langs->load("bills");
$text = $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE ? "" : "Modified")."CustomerBills", $max);
$text = $langs->trans("BoxTitleLast".(!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) ? "" : "Modified")."CustomerBills", $max);
$this->info_box_head = array(
'text' => $text,
'limit'=> dol_strlen($text)
@ -106,7 +106,7 @@ class box_factures extends ModeleBoxes
$sql .= " AND f.entity IN (".getEntity('invoice').")";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY f.datef DESC, f.ref DESC ";
if (!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE)) $sql .= " ORDER BY f.datef DESC, f.ref DESC ";
else $sql .= " ORDER BY f.tms DESC, f.ref DESC ";
$sql .= $this->db->plimit($max, 0);

View File

@ -81,7 +81,7 @@ class box_factures_fourn extends ModeleBoxes
$thirdpartystatic = new Fournisseur($this->db);
$this->info_box_head = array(
'text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE ? "" : "Modified")."SupplierBills", $max)
'text' => $langs->trans("BoxTitleLast".(!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) ? "" : "Modified")."SupplierBills", $max)
);
if ($user->rights->fournisseur->facture->lire)
@ -104,7 +104,7 @@ class box_factures_fourn extends ModeleBoxes
$sql .= " AND f.entity = ".$conf->entity;
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY f.datef DESC, f.ref DESC ";
if (!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE)) $sql .= " ORDER BY f.datef DESC, f.ref DESC ";
else $sql .= " ORDER BY f.tms DESC, f.ref DESC ";
$sql .= $this->db->plimit($max, 0);

View File

@ -137,10 +137,13 @@ class box_fournisseurs extends ModeleBoxes
$line++;
}
if ($num == 0) $this->info_box_contents[$line][0] = array(
'td' => 'class="center opacitymedium"',
'text'=>$langs->trans("NoRecordedSuppliers"),
);
if ($num == 0) {
$langs->load("suppliers");
$this->info_box_contents[$line][0] = array(
'td' => 'class="center opacitymedium"',
'text'=>$langs->trans("NoRecordedSuppliers"),
);
}
$this->db->free($result);
} else {

View File

@ -112,10 +112,10 @@ class box_graph_invoices_permonth extends ModeleBoxes
$shownb = GETPOST($param_shownb, 'alpha');
$showtot = GETPOST($param_showtot, 'alpha');
} else {
$tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true);
$endyear = $tmparray['year'];
$shownb = $tmparray['shownb'];
$showtot = $tmparray['showtot'];
$tmparray = (!empty($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode]) ? json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true) : array());
$endyear = (!empty($tmparray['year']) ? $tmparray['year'] : '');
$shownb = (!empty($tmparray['shownb']) ? $tmparray['shownb'] : '');
$showtot = (!empty($tmparray['showtot']) ? $tmparray['showtot'] : '');
}
if (empty($shownb) && empty($showtot)) { $shownb = 1; $showtot = 1; }
$nowarray = dol_getdate(dol_now(), true);

View File

@ -109,13 +109,14 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
$shownb = GETPOST($param_shownb, 'alpha');
$showtot = GETPOST($param_showtot, 'alpha');
} else {
$tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true);
$endyear = $tmparray['year'];
$shownb = $tmparray['shownb'];
$showtot = $tmparray['showtot'];
$tmparray = (!empty($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode]) ? json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true) : array());
$endyear = (!empty($tmparray['year']) ? $tmparray['year'] : '');
$shownb = (!empty($tmparray['shownb']) ? $tmparray['shownb'] : '');
$showtot = (!empty($tmparray['showtot']) ? $tmparray['showtot'] : '');
}
if (empty($shownb) && empty($showtot)) { $shownb = 1; $showtot = 1; }
$nowarray = dol_getdate(dol_now(), true);
if (empty($year)) $year = $nowarray['year'];
if (empty($endyear)) $endyear = $nowarray['year'];
$startyear = $endyear - 1;
$mode = 'supplier';

View File

@ -112,10 +112,10 @@ class box_graph_orders_permonth extends ModeleBoxes
$shownb = GETPOST($param_shownb, 'alpha');
$showtot = GETPOST($param_showtot, 'alpha');
} else {
$tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true);
$endyear = $tmparray['year'];
$shownb = $tmparray['shownb'];
$showtot = $tmparray['showtot'];
$tmparray = (!empty($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode]) ? json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true) : array());
$endyear = (!empty($tmparray['year']) ? $tmparray['year'] : '');
$shownb = (!empty($tmparray['shownb']) ? $tmparray['shownb'] : '');
$showtot = (!empty($tmparray['showtot']) ? $tmparray['showtot'] : '');
}
if (empty($shownb) && empty($showtot)) { $shownb = 1; $showtot = 1; }
$nowarray = dol_getdate(dol_now(), true);

View File

@ -111,10 +111,10 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
$shownb = GETPOST($param_shownb, 'alpha');
$showtot = GETPOST($param_showtot, 'alpha');
} else {
$tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true);
$endyear = $tmparray['year'];
$shownb = $tmparray['shownb'];
$showtot = $tmparray['showtot'];
$tmparray = (!empty($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode]) ? json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true) : array());
$endyear = (!empty($tmparray['year']) ? $tmparray['year'] : '');
$shownb = (!empty($tmparray['shownb']) ? $tmparray['shownb'] : '');
$showtot = (!empty($tmparray['showtot']) ? $tmparray['showtot'] : '');
}
if (empty($shownb) && empty($showtot)) { $shownb = 1; $showtot = 1; }
$nowarray = dol_getdate(dol_now(), true);

View File

@ -95,11 +95,11 @@ class box_graph_product_distribution extends ModeleBoxes
$showpropalnb = GETPOST($param_showpropalnb, 'alpha');
$showordernb = GETPOST($param_showordernb, 'alpha');
} else {
$tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true);
$year = $tmparray['year'];
$showinvoicenb = $tmparray['showinvoicenb'];
$showpropalnb = $tmparray['showpropalnb'];
$showordernb = $tmparray['showordernb'];
$tmparray = (!empty($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode]) ? json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true) : array());
$year = (!empty($tmparray['year']) ? $tmparray['year'] : '');
$showinvoicenb = (!empty($tmparray['showinvoicenb']) ? $tmparray['showinvoicenb'] : '');
$showpropalnb = (!empty($tmparray['showpropalnb']) ? $tmparray['showpropalnb'] : '');
$showordernb = (!empty($tmparray['showordernb']) ? $tmparray['showordernb'] : '');
}
if (empty($showinvoicenb) && empty($showpropalnb) && empty($showordernb)) { $showpropalnb = 1; $showinvoicenb = 1; $showordernb = 1; }
if (empty($conf->facture->enabled) || empty($user->rights->facture->lire)) $showinvoicenb = 0;

View File

@ -112,10 +112,10 @@ class box_graph_propales_permonth extends ModeleBoxes
$shownb = GETPOST($param_shownb, 'alpha');
$showtot = GETPOST($param_showtot, 'alpha');
} else {
$tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true);
$endyear = $tmparray['year'];
$shownb = $tmparray['shownb'];
$showtot = $tmparray['showtot'];
$tmparray = (!empty($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode]) ? json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true) : array());
$endyear = (!empty($tmparray['year']) ? $tmparray['year'] : '');
$shownb = (!empty($tmparray['shownb']) ? $tmparray['shownb'] : '');
$showtot = (!empty($tmparray['showtot']) ? $tmparray['showtot'] : '');
}
if (empty($shownb) && empty($showtot)) { $shownb = 1; $showtot = 1; }
$nowarray = dol_getdate(dol_now(), true);
@ -176,8 +176,10 @@ class box_graph_propales_permonth extends ModeleBoxes
//$datatype2 = array('lines','bars');
$filenamenb = $dir."/".$prefix."propalsamountinyear-".$endyear.".png";
if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&amp;file=propalsamountinyear-'.$endyear.'.png';
if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstatssupplier&amp;file=propalsamountinyear-'.$endyear.'.png';
if (!empty($mode)) {
if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&amp;file=propalsamountinyear-'.$endyear.'.png';
if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstatssupplier&amp;file=propalsamountinyear-'.$endyear.'.png';
}
$px2 = new DolGraph();
$mesg = $px2->isGraphKo();

View File

@ -64,7 +64,7 @@ class box_produits_alerte_stock extends ModeleBoxes
$this->db = $db;
$listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
$tmpentry = array('enabled'=>((!empty($conf->product->enabled) || !empty($conf->service->enabled)) && !empty($conf->stock->enabled)), 'perms'=>($user->rights->stock->lire), 'module'=>'product|service|stock');
$tmpentry = array('enabled'=>((!empty($conf->product->enabled) || !empty($conf->service->enabled)) && !empty($conf->stock->enabled)), 'perms'=>!empty($user->rights->stock->lire), 'module'=>'product|service|stock');
$showmode = isVisibleToUserType(($user->socid > 0 ? 1 : 0), $tmpentry, $listofmodulesforexternal);
$this->hidden = ($showmode != 1);
}

View File

@ -81,7 +81,7 @@ class box_propales extends ModeleBoxes
$propalstatic = new Propal($this->db);
$societestatic = new Societe($this->db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE ? "" : "Modified")."Propals", $max));
$this->info_box_head = array('text' => $langs->trans("BoxTitleLast".(!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) ? "" : "Modified")."Propals", $max));
if ($user->rights->propale->lire)
{
@ -96,7 +96,7 @@ class box_propales extends ModeleBoxes
$sql .= " AND p.entity IN (".getEntity('propal').")";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY p.datep DESC, p.ref DESC ";
if (!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE)) $sql .= " ORDER BY p.datep DESC, p.ref DESC ";
else $sql .= " ORDER BY p.tms DESC, p.ref DESC ";
$sql .= $this->db->plimit($max, 0);

View File

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

View File

@ -79,7 +79,7 @@ class box_supplier_orders extends ModeleBoxes
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
$thirdpartystatic = new Fournisseur($this->db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleLatest".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE ? "" : "Modified")."SupplierOrders", $max));
$this->info_box_head = array('text' => $langs->trans("BoxTitleLatest".(!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) ? "" : "Modified")."SupplierOrders", $max));
if ($user->rights->fournisseur->commande->lire)
{
@ -98,7 +98,7 @@ class box_supplier_orders extends ModeleBoxes
$sql .= " AND c.entity IN (".getEntity('supplier_order').")";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY c.date_commande DESC, c.ref DESC ";
if (!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE)) $sql .= " ORDER BY c.date_commande DESC, c.ref DESC ";
else $sql .= " ORDER BY c.tms DESC, c.ref DESC ";
$sql .= $this->db->plimit($max, 0);

View File

@ -99,7 +99,7 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes
$sql .= " AND c.fk_statut IN (".CommandeFournisseur::STATUS_ORDERSENT.", ".CommandeFournisseur::STATUS_RECEIVED_PARTIALLY.")";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY c.date_commande DESC, c.ref DESC";
if (!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE)) $sql .= " ORDER BY c.date_commande DESC, c.ref DESC";
else $sql .= " ORDER BY c.date_livraison ASC, c.fk_statut ASC";
$sql .= $this->db->plimit($max, 0);

View File

@ -6,7 +6,7 @@
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-2020 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -950,15 +950,14 @@ class CMailFile
* Read a file on disk and return encoded content for emails (mode = 'mail')
*
* @param string $sourcefile Path to file to encode
* @return int <0 if KO, encoded string if OK
* @return int|string <0 if KO, encoded string if OK
*/
private function _encode_file($sourcefile)
{
// phpcs:enable
$newsourcefile = dol_osencode($sourcefile);
if (is_readable($newsourcefile))
{
if (is_readable($newsourcefile)) {
$contents = file_get_contents($newsourcefile); // Need PHP 4.3
$encoded = chunk_split(base64_encode($contents), 76, $this->eol); // 76 max is defined into http://tools.ietf.org/html/rfc2047
return $encoded;
@ -983,27 +982,24 @@ class CMailFile
// phpcs:enable
global $conf, $dolibarr_main_data_root;
if (@is_writeable($dolibarr_main_data_root)) // Avoid fatal error on fopen with open_basedir
{
if (@is_writeable($dolibarr_main_data_root)) { // Avoid fatal error on fopen with open_basedir
$outputfile = $dolibarr_main_data_root."/dolibarr_mail.log";
$fp = fopen($outputfile, "w");
if ($this->sendmode == 'mail')
{
if ($this->sendmode == 'mail') {
fputs($fp, $this->headers);
fputs($fp, $this->eol); // This eol is added by the mail function, so we add it in log
fputs($fp, $this->message);
} elseif ($this->sendmode == 'smtps')
{
} elseif ($this->sendmode == 'smtps') {
fputs($fp, $this->smtps->log); // this->smtps->log is filled only if MAIN_MAIL_DEBUG was set to on
} elseif ($this->sendmode == 'swiftmailer')
{
} elseif ($this->sendmode == 'swiftmailer') {
fputs($fp, $this->logger->dump()); // this->logger is filled only if MAIN_MAIL_DEBUG was set to on
}
fclose($fp);
if (!empty($conf->global->MAIN_UMASK))
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($outputfile, octdec($conf->global->MAIN_UMASK));
}
}
}
@ -1016,8 +1012,7 @@ class CMailFile
*/
public function checkIfHTML($msg)
{
if (!preg_match('/^[\s\t]*<html/i', $msg))
{
if (!preg_match('/^[\s\t]*<html/i', $msg)) {
$out = "<html><head><title></title>";
if (!empty($this->styleCSS)) $out .= $this->styleCSS;
$out .= "</head><body";
@ -1039,19 +1034,16 @@ class CMailFile
*/
public function buildCSS()
{
if (!empty($this->css))
{
if (!empty($this->css)) {
// Style CSS
$this->styleCSS = '<style type="text/css">';
$this->styleCSS .= 'body {';
if ($this->css['bgcolor'])
{
if ($this->css['bgcolor']) {
$this->styleCSS .= ' background-color: '.$this->css['bgcolor'].';';
$this->bodyCSS .= ' bgcolor="'.$this->css['bgcolor'].'"';
}
if ($this->css['bgimage'])
{
if ($this->css['bgimage']) {
// TODO recuperer cid
$this->styleCSS .= ' background-image: url("cid:'.$this->css['bgimage_cid'].'");';
}

View File

@ -601,7 +601,7 @@ abstract class CommonObject
if (empty($lastname)) $lastname = (isset($this->lastname) ? $this->lastname : (isset($this->name) ? $this->name : (isset($this->nom) ? $this->nom : (isset($this->societe) ? $this->societe : (isset($this->company) ? $this->company : '')))));
$ret = '';
if ($option && $this->civility_code)
if (!empty($option) && !empty($this->civility_code))
{
if ($langs->transnoentitiesnoconv("Civility".$this->civility_code) != "Civility".$this->civility_code) $ret .= $langs->transnoentitiesnoconv("Civility".$this->civility_code).' ';
else $ret .= $this->civility_code.' ';
@ -720,7 +720,7 @@ abstract class CommonObject
$out = '';
$outdone = 0;
$coords = $this->getFullAddress(1, ', ', $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT);
$coords = $this->getFullAddress(1, ', ', (!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) ? $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT : 0));
if ($coords)
{
if (!empty($conf->use_javascript_ajax))
@ -1407,7 +1407,7 @@ abstract class CommonObject
} elseif (strpos($obj->element, 'supplier') !== false && $obj->element != 'supplier_proposal') {
$modulename = 'fournisseur';
}
if ($conf->{$modulename}->enabled) {
if (!empty($conf->{$modulename}->enabled)) {
$libelle_element = $langs->trans('ContactDefault_'.$obj->element);
$transkey = "TypeContact_".$obj->element."_".$source."_".$obj->code;
$libelle_type = ($langs->trans($transkey) != $transkey ? $langs->trans($transkey) : $obj->libelle);
@ -6846,12 +6846,13 @@ abstract class CommonObject
$value = $getposttemp;
}
} else {
$value = $this->array_options["options_".$key]; // No GET, no POST, no default value, so we take value of object.
$value = (!empty($this->array_options["options_".$key]) ? $this->array_options["options_".$key] : ''); // No GET, no POST, no default value, so we take value of object.
}
//var_dump($keyprefix.' - '.$key.' - '.$keysuffix.' - '.$keyprefix.'options_'.$key.$keysuffix.' - '.$this->array_options["options_".$key.$keysuffix].' - '.$getposttemp.' - '.$value);
break;
}
// Output value of the current field
if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate')
{
$extrafields_collapse_num = '';

View File

@ -964,7 +964,7 @@ class DolGraph
$array_of_ykeys = array_keys($valarray);
$alabelexists = 1;
$tmpykey = explode('_', ($array_of_ykeys[$i + ($alabelexists ? 1 : 0)]), 3);
if (!empty($tmpykey[2]) || $tmpykey[2] == '0') { // This is a 'Group by' array
if (isset($tmpykey[2]) && (!empty($tmpykey[2]) || $tmpykey[2] == '0')) { // This is a 'Group by' array
$tmpvalue = (array_key_exists('y_' . $tmpykey[1] . '_' . $tmpykey[2], $valarray) ? $valarray['y_' . $tmpykey[1] . '_' . $tmpykey[2]] : $valarray[$i + 1]);
$values[$x] = (is_numeric($tmpvalue) ? $tmpvalue : null);
$arrayofgroupslegend[$i] = array(
@ -1203,7 +1203,7 @@ class DolGraph
$foundnegativecolor = 0;
$usecolorvariantforgroupby = 0;
// We used a 'group by' and we have too many colors so we generated color variants per
if (is_array($arrayofgroupslegend[$i]) && count($arrayofgroupslegend[$i]) > 0) { // If we used a group by.
if (!empty($arrayofgroupslegend) && is_array($arrayofgroupslegend[$i]) && count($arrayofgroupslegend[$i]) > 0) { // If we used a group by.
$nbofcolorneeds = count($arrayofgroupslegend);
$nbofcolorsavailable = count($theme_datacolor);
if ($nbofcolorneeds > $nbofcolorsavailable) {
@ -1278,7 +1278,7 @@ class DolGraph
$this->stringtoshow .= '{';
$this->stringtoshow .= 'dolibarrinfo: \'y_' . $i . '\', ';
$this->stringtoshow .= 'label: \'' . dol_escape_js(dol_string_nohtmltag($textoflegend)) . '\', ';
$this->stringtoshow .= 'pointStyle: \'' . ($this->type[$i] == 'linesnopoint' ? 'line' : 'circle') . '\', ';
$this->stringtoshow .= 'pointStyle: \'' . ((!empty($this->type[$i]) && $this->type[$i] == 'linesnopoint') ? 'line' : 'circle') . '\', ';
$this->stringtoshow .= 'fill: ' . ($type == 'bar' ? 'true' : 'false') . ', ';
if ($isfunnel) {
$this->stringtoshow .= 'borderWidth: \'2\', ';
@ -1287,7 +1287,7 @@ class DolGraph
}
$this->stringtoshow .= 'borderColor: \'' . $bordercolor . '\', ';
$this->stringtoshow .= 'backgroundColor: \'' . $color . '\', ';
if ($arrayofgroupslegend[$i]) $this->stringtoshow .= 'stack: \'' . $arrayofgroupslegend[$i]['stacknum'] . '\', ';
if (!empty($arrayofgroupslegend) && !empty($arrayofgroupslegend[$i])) $this->stringtoshow .= 'stack: \'' . $arrayofgroupslegend[$i]['stacknum'] . '\', ';
$this->stringtoshow .='data: [';
if ($isfunnel) {
$this->stringtoshow .= '['.-$serie[$i].','.$serie[$i].']';

View File

@ -1097,7 +1097,12 @@ class ExtraFields
foreach ($param['options'] as $key => $val)
{
if ((string) $key == '') continue;
list($val, $parent) = explode('|', $val);
$valarray = explode('|', $val);
$val = $valarray[0];
$parent = '';
if (!empty($valarray[1])) {
$parent = $valarray[1];
}
$out .= '<option value="'.$key.'"';
$out .= (((string) $value == (string) $key) ? ' selected' : '');
$out .= (!empty($parent) ? ' parent="'.$parent.'"' : '');
@ -2063,7 +2068,7 @@ class ExtraFields
{
global $_POST;
if (is_string($extrafieldsobjectkey) && is_array($this->attributes[$extrafieldsobjectkey]['label']))
if (is_string($extrafieldsobjectkey) && !empty($this->attributes[$extrafieldsobjectkey]['label']) && is_array($this->attributes[$extrafieldsobjectkey]['label']))
{
$extralabels = $this->attributes[$extrafieldsobjectkey]['label'];
} else {

View File

@ -202,7 +202,8 @@ class FormActions
$newcardbutton = '';
if (!empty($conf->agenda->enabled) && !empty($user->rights->agenda->myactions->create))
{
$newcardbutton .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&amp;datep='.urlencode(dol_print_date(dol_now(), 'dayhourlog')).'&amp;origin='.urlencode($typeelement).'&amp;originid='.$object->id.($object->socid > 0 ? '&amp;socid='.$object->socid : ($socid > 0 ? '&amp;socid='.$socid : '')).($projectid > 0 ? '&amp;projectid='.$projectid : '').'&amp;backtopage='.urlencode($urlbacktopage));
$url = DOL_URL_ROOT.'/comm/action/card.php?action=create&amp;datep='.urlencode(dol_print_date(dol_now(), 'dayhourlog')).'&amp;origin='.urlencode($typeelement).'&amp;originid='.$object->id.((!empty($object->socid) && $object->socid > 0) ? '&amp;socid='.$object->socid : ((!empty($socid) && $socid > 0) ? '&amp;socid='.$socid : '')).($projectid > 0 ? '&amp;projectid='.$projectid : '').'&amp;backtopage='.urlencode($urlbacktopage);
$newcardbutton .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', $url);
}
@ -244,7 +245,7 @@ class FormActions
print '<td class="nowraponall tdoverflowmax125">';
if (!empty($actioncomm->userownerid))
{
if (is_object($cacheusers[$actioncomm->userownerid]))
if (isset($cacheusers[$actioncomm->userownerid]) && is_object($cacheusers[$actioncomm->userownerid]))
{
$tmpuser = $cacheusers[$actioncomm->userownerid];
} else {

View File

@ -135,15 +135,39 @@ class FormFile
$max = $conf->global->MAIN_UPLOAD_DOC; // In Kb
$maxphp = @ini_get('upload_max_filesize'); // In unknown
if (preg_match('/k$/i', $maxphp)) $maxphp = $maxphp * 1;
if (preg_match('/m$/i', $maxphp)) $maxphp = $maxphp * 1024;
if (preg_match('/g$/i', $maxphp)) $maxphp = $maxphp * 1024 * 1024;
if (preg_match('/t$/i', $maxphp)) $maxphp = $maxphp * 1024 * 1024 * 1024;
if (preg_match('/k$/i', $maxphp)) {
$maxphp = preg_replace('/k$/i', '', $maxphp);
$maxphp = $maxphp * 1;
}
if (preg_match('/m$/i', $maxphp)) {
$maxphp = preg_replace('/m$/i', '', $maxphp);
$maxphp = $maxphp * 1024;
}
if (preg_match('/g$/i', $maxphp)) {
$maxphp = preg_replace('/g$/i', '', $maxphp);
$maxphp = $maxphp * 1024 * 1024;
}
if (preg_match('/t$/i', $maxphp)) {
$maxphp = preg_replace('/t$/i', '', $maxphp);
$maxphp = $maxphp * 1024 * 1024 * 1024;
}
$maxphp2 = @ini_get('post_max_size'); // In unknown
if (preg_match('/k$/i', $maxphp2)) $maxphp2 = $maxphp2 * 1;
if (preg_match('/m$/i', $maxphp2)) $maxphp2 = $maxphp2 * 1024;
if (preg_match('/g$/i', $maxphp2)) $maxphp2 = $maxphp2 * 1024 * 1024;
if (preg_match('/t$/i', $maxphp2)) $maxphp2 = $maxphp2 * 1024 * 1024 * 1024;
if (preg_match('/k$/i', $maxphp2)) {
$maxphp2 = preg_replace('/k$/i', '', $maxphp2);
$maxphp2 = $maxphp2 * 1;
}
if (preg_match('/m$/i', $maxphp2)) {
$maxphp2 = preg_replace('/m$/i', '', $maxphp2);
$maxphp2 = $maxphp2 * 1024;
}
if (preg_match('/g$/i', $maxphp2)) {
$maxphp2 = preg_replace('/g$/i', '', $maxphp2);
$maxphp2 = $maxphp2 * 1024 * 1024;
}
if (preg_match('/t$/i', $maxphp2)) {
$maxphp2 = preg_replace('/t$/i', '', $maxphp2);
$maxphp2 = $maxphp2 * 1024 * 1024 * 1024;
}
// Now $max and $maxphp and $maxphp2 are in Kb
$maxmin = $max;
$maxphptoshow = $maxphptoshowparam = '';
@ -1049,8 +1073,8 @@ class FormFile
if (empty($relativepath))
{
$relativepath = (!empty($object->ref) ?dol_sanitizeFileName($object->ref) : '').'/';
if ($object->element == 'invoice_supplier') $relativepath = get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier').$relativepath; // TODO Call using a defined value for $relativepath
if ($object->element == 'project_task') $relativepath = 'Call_not_supported_._Call_function_using_a_defined_relative_path_.';
if (!empty($object->element) && $object->element == 'invoice_supplier') $relativepath = get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier').$relativepath; // TODO Call using a defined value for $relativepath
if (!empty($object->element) && $object->element == 'project_task') $relativepath = 'Call_not_supported_._Call_function_using_a_defined_relative_path_.';
}
// For backward compatiblity, we detect file stored into an old path
if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO) && $filearray[0]['level1name'] == 'photos')

View File

@ -116,7 +116,12 @@ class FormMail extends Form
*/
public $withto; // Show recipient emails
public $withtofree; // Show free text for recipient emails
/**
* @var int|string 0 = Do not Show free text for recipient emails
* 1 = Show free text for recipient emails
* or a free email
*/
public $withtofree;
public $withtocc;
public $withtoccc;
public $withtopic;
@ -354,14 +359,15 @@ class FormMail extends Form
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
$formfile = new Formfile($this->db);
if (!is_object($form)) $form = new Form($this->db);
if (!is_object($form)) {
$form = new Form($this->db);
}
// Load translation files required by the page
$langs->loadLangs(array('other', 'mails'));
// Clear temp files. Must be done at beginning, before call of triggers
if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1'))
{
if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1')) {
$this->clear_attached_files();
}
@ -375,8 +381,7 @@ class FormMail extends Form
);
$reshook = $hookmanager->executeHooks('getFormMail', $parameters, $this);
if (!empty($reshook))
{
if (!empty($reshook)) {
return $hookmanager->resPrint;
} else {
$out = '';
@ -387,8 +392,7 @@ class FormMail extends Form
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $this->param['langsmodels'];
if (!empty($newlang))
{
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
$outputlangs->load('other');
@ -396,11 +400,9 @@ class FormMail extends Form
// Get message template for $this->param["models"] into c_email_templates
$arraydefaultmessage = -1;
if ($this->param['models'] != 'none')
{
if ($this->param['models'] != 'none') {
$model_id = 0;
if (array_key_exists('models_id', $this->param))
{
if (array_key_exists('models_id', $this->param)) {
$model_id = $this->param["models_id"];
}
@ -413,25 +415,27 @@ class FormMail extends Form
$listofmimes = array();
$keytoavoidconflict = empty($this->trackid) ? '' : '-'.$this->trackid; // this->trackid must be defined
if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1'))
{
if (!empty($arraydefaultmessage->joinfiles) && is_array($this->param['fileinit']))
{
foreach ($this->param['fileinit'] as $file)
{
if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1')) {
if (!empty($arraydefaultmessage->joinfiles) && is_array($this->param['fileinit'])) {
foreach ($this->param['fileinit'] as $file) {
$this->add_attached_files($file, basename($file), dol_mimetype($file));
}
}
}
if (!empty($_SESSION["listofpaths".$keytoavoidconflict])) $listofpaths = explode(';', $_SESSION["listofpaths".$keytoavoidconflict]);
if (!empty($_SESSION["listofnames".$keytoavoidconflict])) $listofnames = explode(';', $_SESSION["listofnames".$keytoavoidconflict]);
if (!empty($_SESSION["listofmimes".$keytoavoidconflict])) $listofmimes = explode(';', $_SESSION["listofmimes".$keytoavoidconflict]);
if (!empty($_SESSION["listofpaths".$keytoavoidconflict])) {
$listofpaths = explode(';', $_SESSION["listofpaths".$keytoavoidconflict]);
}
if (!empty($_SESSION["listofnames".$keytoavoidconflict])) {
$listofnames = explode(';', $_SESSION["listofnames".$keytoavoidconflict]);
}
if (!empty($_SESSION["listofmimes".$keytoavoidconflict])) {
$listofmimes = explode(';', $_SESSION["listofmimes".$keytoavoidconflict]);
}
$out .= "\n".'<!-- Begin form mail type='.$this->param["models"].' --><div id="mailformdiv"></div>'."\n";
if ($this->withform == 1)
{
if ($this->withform == 1) {
$out .= '<form method="POST" name="mailform" id="mailform" enctype="multipart/form-data" action="'.$this->param["returnurl"].'#formmail">'."\n";
$out .= '<a id="formmail" name="formmail"></a>';
@ -439,16 +443,13 @@ class FormMail extends Form
$out .= '<input type="hidden" name="token" value="'.newToken().'" />';
$out .= '<input type="hidden" name="trackid" value="'.$this->trackid.'" />';
}
if (!empty($this->withfrom))
{
if (!empty($this->withfromreadonly))
{
if (!empty($this->withfrom)) {
if (!empty($this->withfromreadonly)) {
$out .= '<input type="hidden" id="fromname" name="fromname" value="'.$this->fromname.'" />';
$out .= '<input type="hidden" id="frommail" name="frommail" value="'.$this->frommail.'" />';
}
}
foreach ($this->param as $key=>$value)
{
foreach ($this->param as $key=>$value) {
if (is_array($value)) {
$out .= "<!-- param key=".$key." is array, we do not output input filed for it -->\n";
} else {
@ -457,17 +458,14 @@ class FormMail extends Form
}
$modelmail_array = array();
if ($this->param['models'] != 'none')
{
if ($this->param['models'] != 'none') {
$result = $this->fetchAllEMailTemplate($this->param["models"], $user, $outputlangs);
if ($result < 0)
{
if ($result < 0) {
setEventMessages($this->error, $this->errors, 'errors');
}
$langs->trans("members");
foreach ($this->lines_model as $line)
{
foreach ($this->lines_model as $line) {
$reg = array();
if (preg_match('/\((.*)\)/', $line->label, $reg)) {
$labeltouse = $langs->trans($reg[1]); // langs->trans when label is __(xxx)__
@ -483,8 +481,7 @@ class FormMail extends Form
}
// Zone to select email template
if (count($modelmail_array) > 0)
{
if (count($modelmail_array) > 0) {
// If list of template is filled
$out .= '<div class="center" style="padding: 0px 0 12px 0">'."\n";
$out .= '<span class="opacitymedium">'.$langs->trans('SelectMailModel').':</span> ';
@ -498,8 +495,7 @@ class FormMail extends Form
'propal_send', 'order_send', 'facture_send',
'shipping_send', 'fichinter_send', 'supplier_proposal_send', 'order_supplier_send',
'invoice_supplier_send', 'thirdparty', 'contract', 'user', 'recruitmentcandidature_send', 'all'
)))
{
))) {
// If list of template is empty
$out .= '<div class="center" style="padding: 0px 0 12px 0">'."\n";
$out .= $langs->trans('SelectMailModel').': <select name="modelmailselected" disabled="disabled"><option value="none">'.$langs->trans("NoTemplateDefined").'</option></select>'; // Do not put 'disabled' on 'option' tag, it is already on 'select' and it makes chrome crazy.
@ -518,12 +514,10 @@ class FormMail extends Form
// Substitution array/string
$helpforsubstitution = '';
if (is_array($this->substit) && count($this->substit)) $helpforsubstitution .= $langs->trans('AvailableVariables').' :<br>'."\n";
foreach ($this->substit as $key => $val)
{
foreach ($this->substit as $key => $val) {
$helpforsubstitution .= $key.' -> '.$langs->trans(dol_string_nohtmltag(dolGetFirstLineOfText($val))).'<br>';
}
if (!empty($this->withsubstit)) // Unset or set ->withsubstit=0 to disable this.
{
if (!empty($this->withsubstit)) { // Unset or set ->withsubstit=0 to disable this.
$out .= '<tr><td colspan="2" class="right">';
//$out.='<div class="floatright">';
if (is_numeric($this->withsubstit)) $out .= $form->textwithpicto($langs->trans("EMailTestSubstitutionReplacedByGenericValues"), $helpforsubstitution, 1, 'help', '', 0, 2, 'substittooltip'); // Old usage
@ -538,10 +532,8 @@ class FormMail extends Form
var_dump($this->fromname);*/
// From
if (!empty($this->withfrom))
{
if (!empty($this->withfromreadonly))
{
if (!empty($this->withfrom)) {
if (!empty($this->withfromreadonly)) {
$out .= '<tr><td class="fieldrequired minwidth200">'.$langs->trans("MailFrom").'</td><td>';
// $this->fromtype is the default value to use to select sender
@ -551,16 +543,13 @@ class FormMail extends Form
&& !preg_match('/user_aliases/', $this->fromtype)
&& !preg_match('/global_aliases/', $this->fromtype)
&& !preg_match('/senderprofile/', $this->fromtype)
)
{
) {
// Use this->fromname and this->frommail or error if not defined
$out .= $this->fromname;
if ($this->frommail)
{
if ($this->frommail) {
$out .= ' &lt;'.$this->frommail.'&gt;';
} else {
if ($this->fromtype)
{
if ($this->fromtype) {
$langs->load('errors');
$out .= '<span class="warning"> &lt;'.$langs->trans('ErrorNoMailDefinedForThisUser').'&gt; </span>';
}
@ -569,8 +558,7 @@ class FormMail extends Form
$liste = array();
// Add user email
if (empty($user->email))
{
if (empty($user->email)) {
$langs->load('errors');
$liste['user'] = $user->getFullName($langs).' &lt;'.$langs->trans('ErrorNoMailDefinedForThisUser').'&gt;';
} else {
@ -584,13 +572,10 @@ class FormMail extends Form
$listaliases = array('user_aliases'=>$user->email_aliases, 'global_aliases'=>$conf->global->MAIN_INFO_SOCIETE_MAIL_ALIASES);
// Also add robot email
if (!empty($this->fromalsorobot))
{
if (!empty($conf->global->MAIN_MAIL_EMAIL_FROM) && $conf->global->MAIN_MAIL_EMAIL_FROM != $conf->global->MAIN_INFO_SOCIETE_MAIL)
{
if (!empty($this->fromalsorobot)) {
if (!empty($conf->global->MAIN_MAIL_EMAIL_FROM) && $conf->global->MAIN_MAIL_EMAIL_FROM != $conf->global->MAIN_INFO_SOCIETE_MAIL) {
$liste['robot'] = $conf->global->MAIN_MAIL_EMAIL_FROM;
if ($this->frommail)
{
if ($this->frommail) {
$liste['robot'] .= ' &lt;'.$conf->global->MAIN_MAIL_EMAIL_FROM.'&gt;';
}
}
@ -601,31 +586,27 @@ class FormMail extends Form
$sql .= ' WHERE active = 1 AND (private = 0 OR private = '.$user->id.')';
$sql .= ' ORDER BY position';
$resql = $this->db->query($sql);
if ($resql)
{
if ($resql) {
$num = $this->db->num_rows($resql);
$i = 0;
while ($i < $num)
{
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
if ($obj)
{
if ($obj) {
$listaliases['senderprofile_'.$obj->rowid] = $obj->label.' <'.$obj->email.'>';
}
$i++;
}
} else dol_print_error($this->db);
} else {
dol_print_error($this->db);
}
foreach ($listaliases as $typealias => $listalias)
{
foreach ($listaliases as $typealias => $listalias) {
$posalias = 0;
$listaliasarray = explode(',', $listalias);
foreach ($listaliasarray as $listaliasval)
{
foreach ($listaliasarray as $listaliasval) {
$posalias++;
$listaliasval = trim($listaliasval);
if ($listaliasval)
{
if ($listaliasval) {
$listaliasval = preg_replace('/</', '&lt;', $listaliasval);
$listaliasval = preg_replace('/>/', '&gt;', $listaliasval);
if (!preg_match('/&lt;/', $listaliasval)) $listaliasval = '&lt;'.$listaliasval.'&gt;';
@ -637,8 +618,7 @@ class FormMail extends Form
// Set the default "From"
$defaultfrom = '';
$reshook = $hookmanager->executeHooks('getDefaultFromEmail', $parameters, $this);
if (empty($reshook))
{
if (empty($reshook)) {
$defaultfrom = $this->fromtype;
}
if (!empty($hookmanager->resArray['defaultfrom'])) $defaultfrom = $hookmanager->resArray['defaultfrom'];
@ -665,19 +645,15 @@ class FormMail extends Form
if ($this->withtofree) $out .= $form->textwithpicto($langs->trans("MailTo"), $langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"));
else $out .= $langs->trans("MailTo");
$out .= '</td><td>';
if ($this->withtoreadonly)
{
if (!empty($this->toname) && !empty($this->tomail))
{
if ($this->withtoreadonly) {
if (!empty($this->toname) && !empty($this->tomail)) {
$out .= '<input type="hidden" id="toname" name="toname" value="'.$this->toname.'" />';
$out .= '<input type="hidden" id="tomail" name="tomail" value="'.$this->tomail.'" />';
if ($this->totype == 'thirdparty')
{
if ($this->totype == 'thirdparty') {
$soc = new Societe($this->db);
$soc->fetch($this->toid);
$out .= $soc->getNomUrl(1);
} elseif ($this->totype == 'contact')
{
} elseif ($this->totype == 'contact') {
$contact = new Contact($this->db);
$contact->fetch($this->toid);
$out .= $contact->getNomUrl(1);
@ -685,8 +661,7 @@ class FormMail extends Form
$out .= $this->toname;
}
$out .= ' &lt;'.$this->tomail.'&gt;';
if ($this->withtofree)
{
if ($this->withtofree) {
$out .= '<br>'.$langs->trans("and").' <input class="minwidth200" id="sendto" name="sendto" value="'.(!is_array($this->withto) && !is_numeric($this->withto) ? (GETPOSTISSET("sendto") ? GETPOST("sendto") : $this->withto) : "").'" />';
}
} else {
@ -695,25 +670,21 @@ class FormMail extends Form
}
} else {
// The free input of email
if (!empty($this->withtofree))
{
if (!empty($this->withtofree)) {
$out .= '<input class="minwidth200" id="sendto" name="sendto" value="'.(($this->withtofree && !is_numeric($this->withtofree)) ? $this->withtofree : (!is_array($this->withto) && !is_numeric($this->withto) ? (GETPOSTISSET("sendto") ? GETPOST("sendto") : $this->withto) : "")).'" />';
}
// The select combo
if (!empty($this->withto) && is_array($this->withto))
{
if (!empty($this->withto) && is_array($this->withto)) {
if (!empty($this->withtofree)) $out .= " ".$langs->trans("and")."/".$langs->trans("or")." ";
// multiselect array convert html entities into options tags, even if we dont want this, so we encode them a second time
$tmparray = $this->withto;
foreach ($tmparray as $key => $val)
{
foreach ($tmparray as $key => $val) {
$tmparray[$key] = dol_htmlentities($tmparray[$key], null, 'UTF-8', true);
}
$withtoselected = GETPOST("receiver", 'array'); // Array of selected value
if (empty($withtoselected) && count($tmparray) == 1 && GETPOST('action', 'aZ09') == 'presend')
{
if (empty($withtoselected) && count($tmparray) == 1 && GETPOST('action', 'aZ09') == 'presend') {
$withtoselected = array_keys($tmparray);
}
$out .= $form->multiselectarray("receiver", $tmparray, $withtoselected, null, null, 'inline-block minwidth500', null, "");
@ -723,21 +694,18 @@ class FormMail extends Form
}
// To User
if (!empty($this->withtouser) && is_array($this->withtouser) && !empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT))
{
if (!empty($this->withtouser) && is_array($this->withtouser) && !empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT)) {
$out .= '<tr><td>';
$out .= $langs->trans("MailToUsers");
$out .= '</td><td>';
// multiselect array convert html entities into options tags, even if we dont want this, so we encode them a second time
$tmparray = $this->withtouser;
foreach ($tmparray as $key => $val)
{
foreach ($tmparray as $key => $val) {
$tmparray[$key] = dol_htmlentities($tmparray[$key], null, 'UTF-8', true);
}
$withtoselected = GETPOST("receiveruser", 'array'); // Array of selected value
if (empty($withtoselected) && count($tmparray) == 1 && GETPOST('action', 'aZ09') == 'presend')
{
if (empty($withtoselected) && count($tmparray) == 1 && GETPOST('action', 'aZ09') == 'presend') {
$withtoselected = array_keys($tmparray);
}
$out .= $form->multiselectarray("receiveruser", $tmparray, $withtoselected, null, null, 'inline-block minwidth500', null, "");
@ -745,8 +713,7 @@ class FormMail extends Form
}
// With option one email per recipient
if (!empty($this->withoptiononeemailperrecipient))
{
if (!empty($this->withoptiononeemailperrecipient)) {
$out .= '<tr><td class="minwidth200">';
$out .= $langs->trans("GroupEmails");
$out .= '</td><td>';
@ -760,23 +727,19 @@ class FormMail extends Form
}
// CC
if (!empty($this->withtocc) || is_array($this->withtocc))
{
if (!empty($this->withtocc) || is_array($this->withtocc)) {
$out .= '<tr><td>';
$out .= $form->textwithpicto($langs->trans("MailCC"), $langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"));
$out .= '</td><td>';
if ($this->withtoccreadonly)
{
if ($this->withtoccreadonly) {
$out .= (!is_array($this->withtocc) && !is_numeric($this->withtocc)) ? $this->withtocc : "";
} else {
$out .= '<input class="minwidth200" id="sendtocc" name="sendtocc" value="'.(GETPOST("sendtocc", "alpha") ? GETPOST("sendtocc", "alpha") : ((!is_array($this->withtocc) && !is_numeric($this->withtocc)) ? $this->withtocc : '')).'" />';
if (!empty($this->withtocc) && is_array($this->withtocc))
{
if (!empty($this->withtocc) && is_array($this->withtocc)) {
$out .= " ".$langs->trans("and")."/".$langs->trans("or")." ";
// multiselect array convert html entities into options tags, even if we dont want this, so we encode them a second time
$tmparray = $this->withtocc;
foreach ($tmparray as $key => $val)
{
foreach ($tmparray as $key => $val) {
$tmparray[$key] = dol_htmlentities($tmparray[$key], null, 'UTF-8', true);
}
$withtoccselected = GETPOST("receivercc", 'array'); // Array of selected value
@ -787,21 +750,18 @@ class FormMail extends Form
}
// To User cc
if (!empty($this->withtoccuser) && is_array($this->withtoccuser) && !empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT))
{
if (!empty($this->withtoccuser) && is_array($this->withtoccuser) && !empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT)) {
$out .= '<tr><td>';
$out .= $langs->trans("MailToCCUsers");
$out .= '</td><td>';
// multiselect array convert html entities into options tags, even if we dont want this, so we encode them a second time
$tmparray = $this->withtoccuser;
foreach ($tmparray as $key => $val)
{
foreach ($tmparray as $key => $val) {
$tmparray[$key] = dol_htmlentities($tmparray[$key], null, 'UTF-8', true);
}
$withtoselected = GETPOST("receiverccuser", 'array'); // Array of selected value
if (empty($withtoselected) && count($tmparray) == 1 && GETPOST('action', 'aZ09') == 'presend')
{
if (empty($withtoselected) && count($tmparray) == 1 && GETPOST('action', 'aZ09') == 'presend') {
$withtoselected = array_keys($tmparray);
}
$out .= $form->multiselectarray("receiverccuser", $tmparray, $withtoselected, null, null, 'inline-block minwidth500', null, "");
@ -814,10 +774,8 @@ class FormMail extends Form
}
// Replyto
if (!empty($this->withreplyto))
{
if ($this->withreplytoreadonly)
{
if (!empty($this->withreplyto)) {
if ($this->withreplytoreadonly) {
$out .= '<input type="hidden" id="replyname" name="replyname" value="'.$this->replytoname.'" />';
$out .= '<input type="hidden" id="replymail" name="replymail" value="'.$this->replytomail.'" />';
$out .= "<tr><td>".$langs->trans("MailReply")."</td><td>".$this->replytoname.($this->replytomail ? (" &lt;".$this->replytomail."&gt;") : "");
@ -841,41 +799,32 @@ class FormMail extends Form
}
// Attached files
if (!empty($this->withfile))
{
if (!empty($this->withfile)) {
$out .= '<tr>';
$out .= '<td>'.$langs->trans("MailFile").'</td>';
$out .= '<td>';
if ($this->withmaindocfile) // withmaindocfile is set to 1 or -1 to show the checkbox (-1 = checked or 1 = not checked)
{
if (GETPOSTISSET('sendmail'))
{
if ($this->withmaindocfile) { // withmaindocfile is set to 1 or -1 to show the checkbox (-1 = checked or 1 = not checked)
if (GETPOSTISSET('sendmail')) {
$this->withmaindocfile = (GETPOST('addmaindocfile', 'alpha') ? -1 : 1);
}
// If a template was selected, we use setup of template to define if join file checkbox is selected or not.
elseif (is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0)
{
} elseif (is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
// If a template was selected, we use setup of template to define if join file checkbox is selected or not.
$this->withmaindocfile = ($arraydefaultmessage->joinfiles ? -1 : 1);
}
}
if (!empty($this->withmaindocfile))
{
if ($this->withmaindocfile == 1)
{
if (!empty($this->withmaindocfile)) {
if ($this->withmaindocfile == 1) {
$out .= '<input type="checkbox" name="addmaindocfile" value="1" />';
}
if ($this->withmaindocfile == -1)
{
if ($this->withmaindocfile == -1) {
$out .= '<input type="checkbox" name="addmaindocfile" value="1" checked="checked" />';
}
$out .= ' '.$langs->trans("JoinMainDoc").'.<br>';
}
if (is_numeric($this->withfile))
{
if (is_numeric($this->withfile)) {
// TODO Trick to have param removedfile containing nb of file to delete. But this does not works without javascript
$out .= '<input type="hidden" class="removedfilehidden" name="removedfile" value="">'."\n";
$out .= '<script type="text/javascript" language="javascript">';
@ -885,28 +834,23 @@ class FormMail extends Form
$out .= ' });';
$out .= '})';
$out .= '</script>'."\n";
if (count($listofpaths))
{
foreach ($listofpaths as $key => $val)
{
if (count($listofpaths)) {
foreach ($listofpaths as $key => $val) {
$out .= '<div id="attachfile_'.$key.'">';
// Preview of attachment
preg_match('#^(/)(\w+)(/)(.+)$#', substr($val, (strlen(DOL_DATA_ROOT) - strlen($val))), $formfile_params);
$out .= img_mime($listofnames[$key]).' '.$listofnames[$key];
$out .= $formfile->showPreview(array(), $formfile_params[2], $formfile_params[4]);
if (!$this->withfilereadonly)
{
if (!$this->withfilereadonly) {
$out .= ' <input type="image" style="border: 0px;" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/delete.png" value="'.($key + 1).'" class="removedfile" id="removedfile_'.$key.'" name="removedfile_'.$key.'" />';
//$out.= ' <a href="'.$_SERVER["PHP_SELF"].'?removedfile='.($key+1).' id="removedfile_'.$key.'">'.img_delete($langs->trans("Delete").'</a>';
}
$out .= '<br></div>';
}
} elseif (empty($this->withmaindocfile)) // Do not show message if we asked to show the checkbox
{
} elseif (empty($this->withmaindocfile)) { // Do not show message if we asked to show the checkbox
$out .= $langs->trans("NoAttachedFiles").'<br>';
}
if ($this->withfile == 2) // Can add other files
{
if ($this->withfile == 2) { // Can add other files
if (!empty($conf->global->FROM_MAIL_USE_INPUT_FILE_MULTIPLE)) $out .= '<input type="file" class="flat" id="addedfile" name="addedfile[]" value="'.$langs->trans("Upload").'" multiple />';
else $out .= '<input type="file" class="flat" id="addedfile" name="addedfile" value="'.$langs->trans("Upload").'" />';
$out .= ' ';
@ -920,11 +864,9 @@ class FormMail extends Form
}
// Message
if (!empty($this->withbody))
{
if (!empty($this->withbody)) {
$defaultmessage = GETPOST('message', 'restricthtml');
if (!GETPOST('modelselected', 'alpha') || GETPOST('modelmailselected') != '-1')
{
if (!GETPOST('modelselected', 'alpha') || GETPOST('modelmailselected') != '-1') {
if ($arraydefaultmessage && $arraydefaultmessage->content) {
$defaultmessage = $arraydefaultmessage->content;
} elseif (!is_numeric($this->withbody)) {
@ -934,25 +876,29 @@ class FormMail extends Form
// Complete substitution array with the url to make online payment
$paymenturl = ''; $validpaymentmethod = array();
if (empty($this->substit['__REF__']))
{
if (empty($this->substit['__REF__'])) {
$paymenturl = '';
} else {
// Set the online payment url link into __ONLINE_PAYMENT_URL__ key
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
$langs->loadLangs(array('paypal', 'other'));
$typeforonlinepayment = 'free';
if ($this->param["models"] == 'order' || $this->param["models"] == 'order_send') $typeforonlinepayment = 'order'; // TODO use detection on something else than template
if ($this->param["models"] == 'invoice' || $this->param["models"] == 'facture_send') $typeforonlinepayment = 'invoice'; // TODO use detection on something else than template
if ($this->param["models"] == 'member') $typeforonlinepayment = 'member'; // TODO use detection on something else than template
if ($this->param["models"] == 'order' || $this->param["models"] == 'order_send') {
$typeforonlinepayment = 'order'; // TODO use detection on something else than template
}
if ($this->param["models"] == 'invoice' || $this->param["models"] == 'facture_send') {
$typeforonlinepayment = 'invoice'; // TODO use detection on something else than template
}
if ($this->param["models"] == 'member') {
$typeforonlinepayment = 'member'; // TODO use detection on something else than template
}
$url = getOnlinePaymentUrl(0, $typeforonlinepayment, $this->substit['__REF__']);
$paymenturl = $url;
$validpaymentmethod = getValidOnlinePaymentMethods('');
}
if (count($validpaymentmethod) > 0 && $paymenturl)
{
if (count($validpaymentmethod) > 0 && $paymenturl) {
$langs->load('other');
$this->substit['__ONLINE_PAYMENT_TEXT_AND_URL__'] = str_replace('\n', "\n", $langs->transnoentities("PredefinedMailContentLink", $paymenturl));
$this->substit['__ONLINE_PAYMENT_URL__'] = $paymenturl;
@ -966,10 +912,8 @@ class FormMail extends Form
// Add lines substitution key from each line
$lines = '';
$defaultlines = $arraydefaultmessage->content_lines;
if (isset($defaultlines))
{
foreach ($this->substit_lines as $substit_line)
{
if (isset($defaultlines)) {
foreach ($this->substit_lines as $substit_line) {
$lines .= make_substitutions($defaultlines, $substit_line)."\n";
}
}
@ -1003,8 +947,9 @@ class FormMail extends Form
}
}
if (GETPOSTISSET("message") && !$_POST['modelselected']) $defaultmessage = $_POST["message"];
else {
if (GETPOSTISSET("message") && !$_POST['modelselected']) {
$defaultmessage = $_POST["message"];
} else {
$defaultmessage = make_substitutions($defaultmessage, $this->substit);
// Clean first \n and br (to avoid empty line when CONTACTCIVNAME is empty)
$defaultmessage = preg_replace("/^(<br>)+/", "", $defaultmessage);
@ -1016,17 +961,17 @@ class FormMail extends Form
$out .= $form->textwithpicto($langs->trans('MailText'), $helpforsubstitution, 1, 'help', '', 0, 2, 'substittooltipfrombody');
$out .= '</td>';
$out .= '<td>';
if ($this->withbodyreadonly)
{
if ($this->withbodyreadonly) {
$out .= nl2br($defaultmessage);
$out .= '<input type="hidden" id="message" name="message" value="'.$defaultmessage.'" />';
} else {
if (!isset($this->ckeditortoolbar)) $this->ckeditortoolbar = 'dolibarr_notes';
if (!isset($this->ckeditortoolbar)) {
$this->ckeditortoolbar = 'dolibarr_notes';
}
// Editor wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
if ($this->withfckeditor == -1)
{
if ($this->withfckeditor == -1) {
if (!empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $this->withfckeditor = 1;
else $this->withfckeditor = 0;
}
@ -1039,29 +984,27 @@ class FormMail extends Form
$out .= '</table>'."\n";
if ($this->withform == 1 || $this->withform == -1)
{
if ($this->withform == 1 || $this->withform == -1) {
$out .= '<br><div class="center">';
$out .= '<input class="button" type="submit" id="sendmail" name="sendmail" value="'.$langs->trans("SendMail").'"';
// Add a javascript test to avoid to forget to submit file before sending email
if ($this->withfile == 2 && $conf->use_javascript_ajax)
{
if ($this->withfile == 2 && $conf->use_javascript_ajax) {
$out .= ' onClick="if (document.mailform.addedfile.value != \'\') { alert(\''.dol_escape_js($langs->trans("FileWasNotUploaded")).'\'); return false; } else { return true; }"';
}
$out .= ' />';
if ($this->withcancel)
{
if ($this->withcancel) {
$out .= ' &nbsp; &nbsp; ';
$out .= '<input class="button button-cancel" type="submit" id="cancel" name="cancel" value="'.$langs->trans("Cancel").'" />';
}
$out .= '</div>'."\n";
}
if ($this->withform == 1) $out .= '</form>'."\n";
if ($this->withform == 1) {
$out .= '</form>'."\n";
}
// Disable enter key if option MAIN_MAILFORM_DISABLE_ENTERKEY is set
if (!empty($conf->global->MAIN_MAILFORM_DISABLE_ENTERKEY))
{
if (!empty($conf->global->MAIN_MAILFORM_DISABLE_ENTERKEY)) {
$out .= '<script type="text/javascript" language="javascript">';
$out .= 'jQuery(document).ready(function () {';
$out .= ' $(document).on("keypress", \'#mailform\', function (e) { /* Note this is called at every key pressed ! */

View File

@ -111,7 +111,8 @@ class InfoBox
$sql .= " AND b.fk_user = 0";
}
$sql .= " ORDER BY b.box_order";
} else // available
}
else // available
{
$sql = "SELECT d.rowid as box_id, d.file, d.note, d.tms";
$sql .= " FROM ".MAIN_DB_PREFIX."boxes_def as d";
@ -150,7 +151,7 @@ class InfoBox
// box properties
$box->rowid = (empty($obj->rowid) ? '' : $obj->rowid);
$box->id = (empty($obj->box_id) ? '' : $obj->box_id);
$box->position = ($obj->position == '' ? '' : $obj->position); // '0' must stay '0'
$box->position = ((isset($obj->position) && $obj->position == '') ? '' : (isset($obj->position) ? $obj->position : '')); // '0' must stay '0'
$box->box_order = (empty($obj->box_order) ? '' : $obj->box_order);
$box->fk_user = (empty($obj->fk_user) ? 0 : $obj->fk_user);
$box->sourcefile = $relsourcefile;

View File

@ -731,7 +731,7 @@ class Translate
*/
public function transcountry($str, $countrycode)
{
if ($this->tab_translate["$str$countrycode"]) return $this->trans("$str$countrycode");
if (!empty($this->tab_translate["$str$countrycode"])) return $this->trans("$str$countrycode");
else return $this->trans($str);
}

View File

@ -302,7 +302,7 @@ function societe_prepare_head(Societe $object)
}
$head[$h][0] = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id;
$head[$h][1] .= $langs->trans("Events");
$head[$h][1] = $langs->trans("Events");
if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
$head[$h][1] .= '/';
$head[$h][1] .= $langs->trans("Agenda");
@ -862,7 +862,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
// Definition of fields for list
$arrayfields = array(
't.rowid'=>array('label'=>"TechnicalID", 'checked'=>($conf->global->MAIN_SHOW_TECHNICAL_ID ? 1 : 0), 'enabled'=>($conf->global->MAIN_SHOW_TECHNICAL_ID ? 1 : 0), 'position'=>1),
't.rowid'=>array('label'=>"TechnicalID", 'checked'=>(!empty($conf->global->MAIN_SHOW_TECHNICAL_ID) ? 1 : 0), 'enabled'=>(!empty($conf->global->MAIN_SHOW_TECHNICAL_ID) ? 1 : 0), 'position'=>1),
't.name'=>array('label'=>"Name", 'checked'=>1, 'position'=>10),
't.poste'=>array('label'=>"PostOrFunction", 'checked'=>1, 'position'=>20),
't.address'=>array('label'=>(empty($conf->dol_optimize_smallscreen) ? $langs->trans("Address").' / '.$langs->trans("Phone").' / '.$langs->trans("Email") : $langs->trans("Address")), 'checked'=>1, 'position'=>30),
@ -870,7 +870,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
't.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>50, 'class'=>'center'),
);
// Extra fields
if (is_array($extrafields->attributes[$contactstatic->table_element]['label']) && count($extrafields->attributes[$contactstatic->table_element]['label'])) {
if (!empty($extrafields->attributes[$contactstatic->table_element]['label']) && is_array($extrafields->attributes[$contactstatic->table_element]['label']) && count($extrafields->attributes[$contactstatic->table_element]['label'])) {
foreach ($extrafields->attributes[$contactstatic->table_element]['label'] as $key => $val) {
if (!empty($extrafields->attributes[$contactstatic->table_element]['list'][$key])) {
$arrayfields["ef.".$key] = array(
@ -989,7 +989,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
} elseif (in_array($key, array('role'))) {
print $formcompany->showRoles("search_roles", $contactstatic, 'edit', $search_roles);
} else {
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.(!empty($search[$key]) ? dol_escape_htmltag($search[$key]) : '').'">';
}
print '</td>';
}
@ -1204,14 +1204,17 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
{
global $user, $conf;
global $form;
global $param, $massactionbutton;
$start_year = GETPOST('dateevent_startyear');
$start_month = GETPOST('dateevent_startmonth');
$start_day = GETPOST('dateevent_startday');
$end_year = GETPOST('dateevent_endyear');
$end_month = GETPOST('dateevent_endmonth');
$end_day = GETPOST('dateevent_endday');
$tms_start = '';
$tms_end = '';
if (!empty($start_year) && !empty($start_month) && !empty($start_day)) {
$search_start = $start_year.'-'.$start_month.'-'.$start_day;
$tms_start = strtotime($search_start);
@ -1391,7 +1394,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
//if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))";
//elseif ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
$tododone = '';
if (($obj->percent >= 0 and $obj->percent < 100) || ($obj->percent == -1 && $obj->datep > $now)) $tododone = 'todo';
if (($obj->percent >= 0 and $obj->percent < 100) || ($obj->percent == -1 && (!empty($obj->datep) && $obj->datep > $now))) $tododone = 'todo';
$histo[$numaction] = array(
'type'=>$obj->type,

View File

@ -680,7 +680,8 @@ function checkVal($out = '', $check = 'alphanohtml', $filter = null, $options =
if (!is_array($out)) {
// '"' is dangerous because param in url can close the href= or src= and add javascript functions.
// '../' is dangerous because it allows dir transversals
$out = str_replace(array('&quot;', '"', '../'), '', trim($out));
$out = str_replace(array('&quot;', '"'), "''", trim($out));
$out = str_replace(array('../'), '', $out);
// keep lines feed
$out = dol_string_nohtmltag($out, 0);
}
@ -4615,7 +4616,7 @@ function print_fleche_navigation($page, $file, $options = '', $nextpage = 0, $be
}
if ((int) $limit > 0 && empty($hideselectlimit))
{
$pagesizechoices = '10:10,15:15,20:20,30:30,40:40,50:50,100:100,250:250,500:500,1000:1000,5000:5000';
$pagesizechoices = '10:10,15:15,20:20,30:30,40:40,50:50,100:100,250:250,500:500,1000:1000,5000:5000,25000:25000';
//$pagesizechoices.=',0:'.$langs->trans("All"); // Not yet supported
//$pagesizechoices.=',2:2';
if (!empty($conf->global->MAIN_PAGESIZE_CHOICES)) $pagesizechoices = $conf->global->MAIN_PAGESIZE_CHOICES;

View File

@ -2526,13 +2526,15 @@ function getTaskProgressBadge($task, $label = '', $tooltip = '')
if (doubleval($progressCalculated) > doubleval($task->progress * $warningRatio)) {
$badgeClass .= 'badge-danger';
if (empty($tooltip)) $tooltip = $task->progress.'% < '.$langs->trans("Expected").' '.$progressCalculated.'%';
if (empty($tooltip)) {
$tooltip = $task->progress.'% < '.$langs->trans("TimeConsumed").' '.$progressCalculated.'%';
}
} elseif (doubleval($progressCalculated) > doubleval($task->progress)) { // warning if close at 10%
$badgeClass .= 'badge-warning';
if (empty($tooltip)) $tooltip = $task->progress.'% < '.$langs->trans("Expected").' '.$progressCalculated.'%';
if (empty($tooltip)) $tooltip = $task->progress.'% < '.$langs->trans("TimeConsumed").' '.$progressCalculated.'%';
} else {
$badgeClass .= 'badge-success';
if (empty($tooltip)) $tooltip = $task->progress.'% >= '.$langs->trans("Expected").' '.$progressCalculated.'%';
if (empty($tooltip)) $tooltip = $task->progress.'% >= '.$langs->trans("TimeConsumed").' '.$progressCalculated.'%';
}
}
}

View File

@ -81,7 +81,7 @@ function shipping_prepare_head($object)
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
$upload_dir = $conf->commande->dir_output."/".dol_sanitizeFileName($object->ref);
$upload_dir = $conf->expedition->dir_output."/sending/".dol_sanitizeFileName($object->ref);
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
$nbLinks = Link::count($db, $object->element, $object->id);
$head[$h][0] = DOL_URL_ROOT.'/expedition/document.php?id='.$object->id;

View File

@ -163,7 +163,7 @@ function tree_recur($tab, $pere, $rang, $iddivjstree = 'iddivjstree', $donoreset
print '<ul'.(empty($pere['rowid']) ? ' id="treeData"' : '').'>'; $ulprinted++;
}
print "\n".'<li '.($tab[$x]['statut'] ? ' class="liuseractive"' : 'class="liuserdisabled"').'>';
print "\n".'<li '.(!empty($tab[$x]['statut']) ? ' class="liuseractive"' : 'class="liuserdisabled"').'>';
if ($showfk)
{
print '<table class="nobordernopadding centpercent"><tr><td>';
@ -194,7 +194,7 @@ function tree_recur($tab, $pere, $rang, $iddivjstree = 'iddivjstree', $donoreset
print '<ul'.(empty($pere['rowid']) ? ' id="treeData"' : '').'>'; $ulprinted++;
}
print "\n".'<li '.($tab[$x]['statut'] ? ' class="liuseractive"' : 'class="liuserdisabled"').'>';
print "\n".'<li '.(!empty($tab[$x]['statut']) ? ' class="liuseractive"' : 'class="liuserdisabled"').'>';
if ($showfk)
{
print '<table class="nobordernopadding centpercent"><tr><td>';

View File

@ -498,7 +498,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td colspan="'.($colspan - 1).'">';
//var_dump($conf->global->THEME_ELDY_BACKBODY);
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY, array()), ''), 'THEME_ELDY_BACKBODY', '', 1, '', '', 'colorbackbody').' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_BACKBODY) ? $conf->global->THEME_ELDY_BACKBODY : ''), array()), ''), 'THEME_ELDY_BACKBODY', '', 1, '', '', 'colorbackbody').' ';
} else {
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY, array()), '');
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
@ -539,7 +539,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1, array()), ''), 'THEME_ELDY_TOPMENU_BACK1', '', 1, '', '', 'colorbackhmenu1').' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_TOPMENU_BACK1) ? $conf->global->THEME_ELDY_TOPMENU_BACK1 : ''), array()), ''), 'THEME_ELDY_TOPMENU_BACK1', '', 1, '', '', 'colorbackhmenu1').' ';
} else {
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1, array()), '');
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
@ -580,7 +580,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td>'.$langs->trans("LeftMenuBackgroundColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1, array()), ''), 'THEME_ELDY_VERMENU_BACK1', '', 1, '', '', 'colorbackvmenu1').' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_VERMENU_BACK1) ? $conf->global->THEME_ELDY_VERMENU_BACK1 : ''), array()), ''), 'THEME_ELDY_VERMENU_BACK1', '', 1, '', '', 'colorbackvmenu1').' ';
} else {
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1, array()), '');
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
@ -601,7 +601,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td>'.$langs->trans("TextTitleColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLENOTAB, array()), ''), 'THEME_ELDY_TEXTTITLENOTAB', '', 1, '', '', 'colortexttitlenotab').' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_TEXTTITLENOTAB) ? $conf->global->THEME_ELDY_TEXTTITLENOTAB : ''), array()), ''), 'THEME_ELDY_TEXTTITLENOTAB', '', 1, '', '', 'colortexttitlenotab').' ';
} else {
print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLENOTAB, $langs->trans("Default"));
}
@ -621,7 +621,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td>'.$langs->trans("BackgroundTableTitleColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKTITLE1, array()), ''), 'THEME_ELDY_BACKTITLE1', '', 1, '', '', 'colorbacktitle1').' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_BACKTITLE1) ? $conf->global->THEME_ELDY_BACKTITLE1 : ''), array()), ''), 'THEME_ELDY_BACKTITLE1', '', 1, '', '', 'colorbacktitle1').' ';
} else {
print $formother->showColor($conf->global->THEME_ELDY_BACKTITLE1, $langs->trans("Default"));
}
@ -641,7 +641,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td>'.$langs->trans("BackgroundTableTitleTextColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLE, array()), ''), 'THEME_ELDY_TEXTTITLE', '', 1, '', '', 'colortexttitle').' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_TEXTTITLE) ? $conf->global->THEME_ELDY_TEXTTITLE : ''), array()), ''), 'THEME_ELDY_TEXTTITLE', '', 1, '', '', 'colortexttitle').' ';
} else {
print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLE, $langs->trans("Default"));
}
@ -661,7 +661,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td>'.$langs->trans("BackgroundTableTitleTextlinkColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLELINK, array()), ''), 'THEME_ELDY_TEXTTITLELINK', '', 1, '', '', 'colortexttitlelink').' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_TEXTTITLELINK) ? $conf->global->THEME_ELDY_TEXTTITLELINK : ''), array()), ''), 'THEME_ELDY_TEXTTITLELINK', '', 1, '', '', 'colortexttitlelink').' ';
} else {
print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLELINK, $langs->trans("Default"));
}
@ -682,7 +682,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td>'.$langs->trans("BackgroundTableLineOddColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1, array()), ''), 'THEME_ELDY_LINEIMPAIR1', '', 1, '', '', 'colorbacklinepair2').' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_LINEIMPAIR1) ? $conf->global->THEME_ELDY_LINEIMPAIR1 : ''), array()), ''), 'THEME_ELDY_LINEIMPAIR1', '', 1, '', '', 'colorbacklinepair2').' ';
} else {
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1, array()), '');
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
@ -703,7 +703,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td>'.$langs->trans("BackgroundTableLineEvenColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1, array()), ''), 'THEME_ELDY_LINEPAIR1', '', 1, '', '', 'colorbacklineimpair2').' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_LINEPAIR1) ? $conf->global->THEME_ELDY_LINEPAIR1 : ''), array()), ''), 'THEME_ELDY_LINEPAIR1', '', 1, '', '', 'colorbacklineimpair2').' ';
} else {
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1, array()), '');
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
@ -744,7 +744,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td>'.$langs->trans("LinkColor").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK, array()), ''), 'THEME_ELDY_TEXTLINK', '', 1, '', '', 'colortextlink').' ';
print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_TEXTLINK) ? $conf->global->THEME_ELDY_TEXTLINK : ''), array()), ''), 'THEME_ELDY_TEXTLINK', '', 1, '', '', 'colortextlink').' ';
} else {
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK, array()), '');
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
@ -781,12 +781,12 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
//print '<input name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
//print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
if ($edit) {
if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color = colorArrayToHex(colorStringToArray($colorbacklinepairhover));
else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER, array()), '');
if (!empty($conf->global->THEME_ELDY_USE_HOVER) && $conf->global->THEME_ELDY_USE_HOVER == '1') $color = colorArrayToHex(colorStringToArray($colorbacklinepairhover));
else $color = colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_USE_HOVER) ? $conf->global->THEME_ELDY_USE_HOVER : ''), array()), '');
print $formother->selectColor($color, 'THEME_ELDY_USE_HOVER', '', 1, '', '', 'colorbacklinepairhover').' ';
} else {
if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color = colorArrayToHex(colorStringToArray($colorbacklinepairhover));
else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER, array()), '');
else $color = colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_USE_HOVER) ? $conf->global->THEME_ELDY_USE_HOVER : ''), array()), '');
if ($color) {
if ($color != colorArrayToHex(colorStringToArray($colorbacklinepairhover))) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
else print $langs->trans("Default");
@ -818,12 +818,12 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
//print '<input name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
//print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
if ($edit) {
if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color = 'e6edf0';
else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED, array()), '');
if (!empty($conf->global->THEME_ELDY_USE_CHECKED) && $conf->global->THEME_ELDY_USE_CHECKED == '1') $color = 'e6edf0';
else $color = colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_USE_CHECKED) ? $conf->global->THEME_ELDY_USE_CHECKED : ''), array()), '');
print $formother->selectColor($color, 'THEME_ELDY_USE_CHECKED', '', 1, '', '', 'colorbacklinepairchecked').' ';
} else {
if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color = 'e6edf0';
else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED, array()), '');
else $color = colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_USE_CHECKED) ? $conf->global->THEME_ELDY_USE_CHECKED : ''), array()), '');
if ($color) {
if ($color != 'e6edf0') print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
else print $langs->trans("Default");

View File

@ -206,9 +206,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
$menu_arr[] = array(
'name' => 'Projet',
'link' => '/projet/index.php?mainmenu=project&amp;leftmenu=',
'title' => (empty($conf->global->PROJECT_USE_OPPORTUNITIES) || $conf->global->PROJECT_USE_OPPORTUNITIES == 2)
? (($conf->global->PROJECT_USE_OPPORTUNITIES == 2) ? "Leads" : "Projects")
: "Projects",
'title' => (! empty($conf->global->PROJECT_USE_OPPORTUNITIES) && $conf->global->PROJECT_USE_OPPORTUNITIES == 2 ? "Leads" : "Projects"),
'level' => 0,
'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal),
'target' => $atarget,
@ -743,11 +741,11 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
$newmenu->add("/admin/pdf.php?mainmenu=home", $langs->trans("PDF"), 1);
$warnpicto = '';
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) {
if (!empty($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) {
$langs->load("errors");
$warnpicto = img_warning($langs->trans("WarningPHPMailD"));
}
if (in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmail')) && empty($conf->global->MAIN_MAIL_SMTP_SERVER)) {
if (!empty($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmail')) && empty($conf->global->MAIN_MAIL_SMTP_SERVER)) {
$langs->load("errors");
$warnpicto = img_warning($langs->trans("ErrorSetupOfEmailsNotComplete"));
}
@ -805,8 +803,8 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
$newmenu->add("/categories/index.php?leftmenu=users&type=7", $langs->trans("UsersCategoriesShort"), 2, $user->rights->categorie->lire, '', $mainmenu, 'cat');
}
$newmenu->add("", $langs->trans("Groups"), 1, ($user->rights->user->user->lire || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE));
$newmenu->add("/user/group/card.php?leftmenu=users&action=create", $langs->trans("NewGroup"), 2, (($conf->global->MAIN_USE_ADVANCED_PERMS ? $user->rights->user->group_advance->write : $user->rights->user->user->creer) || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE));
$newmenu->add("/user/group/list.php?leftmenu=users", $langs->trans("ListOfGroups"), 2, (($conf->global->MAIN_USE_ADVANCED_PERMS ? $user->rights->user->group_advance->read : $user->rights->user->user->lire) || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE));
$newmenu->add("/user/group/card.php?leftmenu=users&action=create", $langs->trans("NewGroup"), 2, ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) ? $user->rights->user->group_advance->write : $user->rights->user->user->creer) || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE));
$newmenu->add("/user/group/list.php?leftmenu=users", $langs->trans("ListOfGroups"), 2, ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) ? $user->rights->user->group_advance->read : $user->rights->user->user->lire) || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE));
}
}
}

View File

@ -622,6 +622,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
$content='';
$pathoffile = $this->getDescLongReadmeFound();
if ($pathoffile) // Mostly for external modules

View File

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

View File

@ -254,7 +254,7 @@ class modStock extends DolibarrModules
$this->export_sql_end[$r] .= ' AND e.entity IN ('.getEntity('stock').')';
// Export stock including batch number
if ($conf->productbatch->enabled)
if (!empty($conf->productbatch->enabled))
{
$langs->load("productbatch");
@ -327,7 +327,7 @@ class modStock extends DolibarrModules
'p.rowid'=>"product", 'p.ref'=>"product", 'p.fk_product_type'=>"product", 'p.label'=>"product", 'p.description'=>"product", 'p.note'=>"product",
'p.price'=>"product", 'p.tva_tx'=>'product', 'p.tosell'=>"product", 'p.tobuy'=>"product", 'p.duration'=>"product", 'p.datec'=>'product', 'p.tms'=>'product'
); // We define here only fields that use another icon that the one defined into export_icon
if ($conf->productbatch->enabled)
if (!empty($conf->productbatch->enabled))
{
$this->export_fields_array[$r]['sm.batch'] = 'Batch';
$this->export_TypeFields_array[$r]['sm.batch'] = 'Text';

View File

@ -14,7 +14,7 @@ if (empty($extrafieldsobjectkey) && is_object($object)) $extrafieldsobjectkey =
// Loop to show all columns of extrafields for the search title line
if (!empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ...
{
if (is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label']))
if (!empty($extrafields->attributes[$extrafieldsobjectkey]['label']) && is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label']))
{
if (empty($extrafieldsobjectprefix)) $extrafieldsobjectprefix = 'ef.';
if (empty($search_options_pattern)) $search_options_pattern = 'search_options_';

View File

@ -13,7 +13,7 @@ if (!isset($disablesortlink)) $disablesortlink = 0;
// Loop to show all columns of extrafields for the title line
if (!empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ...
{
if (is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label']))
if (!empty($extrafields->attributes[$extrafieldsobjectkey]['label']) && is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label']))
{
if (empty($extrafieldsobjectprefix)) $extrafieldsobjectprefix = 'ef.';

View File

@ -87,7 +87,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]
{
$value = (GETPOSTISSET("options_".$tmpkeyextra) ? GETPOST("options_".$tmpkeyextra) : $object->array_options["options_".$tmpkeyextra]);
} else {
$value = $object->array_options["options_".$tmpkeyextra];
$value = (!empty($object->array_options["options_".$tmpkeyextra]) ? $object->array_options["options_".$tmpkeyextra] : '');
//var_dump($tmpkeyextra.' - '.$value);
}
@ -165,7 +165,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]
$html_id = !empty($object->id) ? $object->element.'_extras_'.$tmpkeyextra.'_'.$object->id : '';
print '<td id="'.$html_id.'" class="'.$object->element.'_extras_'.$tmpkeyextra.' wordbreak"'.($cols ? ' colspan="'.$cols.'"' : '').'>';
print '<td id="'.$html_id.'" class="'.$object->element.'_extras_'.$tmpkeyextra.' wordbreak"'.(!empty($cols) ? ' colspan="'.$cols.'"' : '').'>';
// Convert date into timestamp format
if (in_array($extrafields->attributes[$object->table_element]['type'][$tmpkeyextra], array('date', 'datetime')))

View File

@ -62,7 +62,11 @@ if ($absolute_discount > 0) {
$text .= ' ('.$addabsolutediscount.')';
}
print '<div class="inline-block clearboth">'.$text.'</div>';
if ($isNewObject) {
print '<br>'.$text;
} else {
print '<div class="inline-block clearboth">'.$text.'</div>';
}
} else {
// Discount available of type fixed amount (not credit note)
$more = '('.$addabsolutediscount.')';
@ -85,7 +89,11 @@ if ($absolute_creditnote > 0) {
$text .= '('.$addabsolutediscount.')';
}
print '<div class="inline-block clearboth">'.$text.'</div>';
if ($isNewObject) {
print '<br>'.$text;
} else {
print '<div class="inline-block clearboth">'.$text.'</div>';
}
} else { // We can add a credit note on a down payment or standard invoice or situation invoice
// There is credit notes discounts available
$more = $isInvoice && !$isNewObject ? ' ('.$viewabsolutediscount.')' : '';

View File

@ -81,9 +81,9 @@ $(document).ready(function () {
<!-- Title with version -->
<div class="login_table_title center" title="<?php echo dol_escape_htmltag($title); ?>">
<?php
if ($disablenofollow) echo '<a class="login_table_title" href="https://www.dolibarr.org" target="_blank">';
if (!empty($disablenofollow)) echo '<a class="login_table_title" href="https://www.dolibarr.org" target="_blank">';
echo dol_escape_htmltag($title);
if ($disablenofollow) echo '</a>';
if (!empty($disablenofollow)) echo '</a>';
?>
</div>
@ -113,7 +113,7 @@ if ($disablenofollow) echo '</a>';
</div>
<?php
if ($captcha) {
if (!empty($captcha)) {
// Add a variable param to force not using cache (jmobile)
$php_self = preg_replace('/[&\?]time=(\d+)/', '', $php_self); // Remove param time
if (preg_match('/\?/', $php_self)) $php_self .= '&time='.dol_print_date(dol_now(), 'dayhourlog');
@ -200,7 +200,7 @@ if (!empty($morelogincontent)) {
<br>
<?php if ($message) { ?>
<?php if (!empty($message)) { ?>
<div class="center login_main_message">
<?php echo dol_htmloutput_mesg($message, '', '', 1); ?>
</div>

View File

@ -80,7 +80,9 @@ if ($action == 'addcontact' && $user->rights->expedition->creer)
{
if ($result > 0 && $id > 0)
{
$result = $objectsrc->add_contact(GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'), $_POST["type"], $_POST["source"]);
$contactid = (GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int'));
$typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type'));
$result = $objectsrc->add_contact($contactid, $typeid, GETPOST("source", 'aZ09'));
}
if ($result >= 0)

View File

@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("sendings", "deliveries", 'companies', 'bills'));
$langs->loadLangs(array("sendings", "deliveries", 'companies', 'bills', 'products'));
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'shipmentlist'; // To manage different context of search
@ -340,7 +340,7 @@ if ($resql)
if ($search_product_category != '') $param .= '&search_product_category='.urlencode($search_product_category);
if ($search_categ_cus > 0) $param .= '&search_categ_cus='.urlencode($search_categ_cus);
if ($search_status != '') $param .= '&viewstatut='.urlencode($search_status);
if ($search_status != '') $param .= '&search_status='.urlencode($search_status);
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';

View File

@ -43,7 +43,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
$langs->loadLangs(array("orders", "sendings", 'deliveries', 'companies', 'compta', 'bills', 'projects', 'suppliers'));
$langs->loadLangs(array("orders", "sendings", 'deliveries', 'companies', 'compta', 'bills', 'projects', 'suppliers', 'products'));
$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');

View File

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

View File

@ -1182,7 +1182,7 @@ class Parsedown
'src' => $Link['element']['attributes']['href'],
'alt' => $Link['element']['text'],
// @CHANGE LDR
'class' => $Link['element']['attributes']['class']
'class' => (!empty($Link['element']['attributes']['class']) ? $Link['element']['attributes']['class'] : '')
),
),
);

View File

@ -310,7 +310,7 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) {
$boxstatItem .= '<a href="'.$links[$val].'" class="boxstatsindicator thumbstat nobold nounderline">';
$boxstatItem .= '<div class="boxstats">';
$boxstatItem .= '<span class="boxstatstext" title="'.dol_escape_htmltag($text).'">'.$text.'</span><br>';
$boxstatItem .= '<span class="boxstatsindicator">'.img_object("", $board->picto, 'class="inline-block"').' '.($board->nb[$val] ? $board->nb[$val] : 0).'</span>';
$boxstatItem .= '<span class="boxstatsindicator">'.img_object("", $board->picto, 'class="inline-block"').' '.(!empty($board->nb[$val]) ? $board->nb[$val] : 0).'</span>';
$boxstatItem .= '</div>';
$boxstatItem .= '</a>';
@ -678,7 +678,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
// get key index of stats used in $includes, $classes, $keys, $icons, $titres, $links
$keyIndex = array_search($globalStatsKey, $keys);
$classe = $classes[$keyIndex];
$classe = (!empty($classes[$keyIndex]) ? $classes[$keyIndex] : '');
if (isset($boardloaded[$classe]) && is_object($boardloaded[$classe])) {
$groupElement['globalStats']['total'] = $boardloaded[$classe]->nb[$globalStatsKey] ? $boardloaded[$classe]->nb[$globalStatsKey] : 0;
$nbTotal = doubleval($groupElement['globalStats']['total']);
@ -766,7 +766,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
}
if ($showweather && !empty($isIntopOpenedDashBoard)) {
$appendClass = $conf->global->MAIN_DISABLE_METEO == 2 ? ' hideonsmartphone' : '';
$appendClass = (!empty($conf->global->MAIN_DISABLE_METEO) && $conf->global->MAIN_DISABLE_METEO == 2 ? ' hideonsmartphone' : '');
$weather = getWeatherStatus($totallate);
$text = '';
@ -906,7 +906,7 @@ print '<div class="fichecenter fichecenterbis">';
* Show widgets (boxes)
*/
$boxlist .= '<div class="twocolumns">';
$boxlist = '<div class="twocolumns">';
$boxlist .= '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
if (!empty($nbworkboardcount)) {
@ -929,7 +929,7 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) {
}
if (!empty($boxstatFromHook) || !empty($boxstatItems)) {
$boxstat .= '<!-- Database statistics -->'."\n";
$boxstat = '<!-- Database statistics -->'."\n";
$boxstat .= '<div class="box">';
$boxstat .= '<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="noborder boxtable boxtablenobottom nohover widgetstats" width="100%">';
$boxstat .= '<tr class="liste_titre box_titre">';

View File

@ -77,7 +77,7 @@ if (!empty($useragent))
// Check PHP version
$arrayphpminversionerror = array(5, 5, 0);
$arrayphpminversionwarning = array(5, 5, 0);
$arrayphpminversionwarning = array(5, 6, 0);
if (versioncompare(versionphparray(), $arrayphpminversionerror) < 0) // Minimum to use (error if lower)
{
print '<img src="../theme/eldy/img/error.png" alt="Error"> '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionerror));
@ -105,7 +105,7 @@ if (!isset($_GET["testget"]) && !isset($_POST["testpost"])) // We must keep $_GE
}
// Check if sessions enabled
// Check if session_id is enabled
if (!function_exists("session_id"))
{
print '<img src="../theme/eldy/img/error.png" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportSessions")."<br>\n";
@ -115,7 +115,7 @@ if (!function_exists("session_id"))
}
// Check if GD supported (we need GD for image conversion)
// Check if GD is supported (we need GD for image conversion)
if (!function_exists("imagecreate"))
{
$langs->load("errors");
@ -126,7 +126,7 @@ if (!function_exists("imagecreate"))
}
// Check if Curl supported
// Check if Curl is supported
if (!function_exists("curl_init"))
{
$langs->load("errors");
@ -145,7 +145,7 @@ if (!function_exists("easter_date"))
}
// Check if UTF8 supported
// Check if UTF8 is supported
if (!function_exists("utf8_encode"))
{
$langs->load("errors");
@ -201,7 +201,7 @@ if ($memmaxorig != '')
}
// If config file present and filled
// If that config file is present and filled
clearstatcache();
if (is_readable($conffile) && filesize($conffile) > 8)
{

View File

@ -18,7 +18,7 @@ FormatHourShortJQuery=HH:MI
FormatHourShort=%H:%M
FormatHourShortDuration=%H:%M
FormatDateTextShort=%d %b %Y
FormatDateText=%d %B %Y
FormatDateText=%d. %B %Y
FormatDateHourShort=%d.%m.%Y %H:%M
FormatDateHourSecShort=%d.%m.%Y %H:%M:%S
FormatDateHourTextShort=%d %b %Y %H:%M

View File

@ -85,6 +85,7 @@ ProgressCalculated=Progress on consumption
WhichIamLinkedTo=which I'm linked to
WhichIamLinkedToProject=which I'm linked to project
Time=Time
TimeConsumed=Consumed
ListOfTasks=List of tasks
GoToListOfTimeConsumed=Go to list of time consumed
GanttView=Gantt View

View File

@ -475,7 +475,7 @@ class PaymentLoan extends CommonObject
// Insert payment into llx_bank
$bank_line_id = $acc->addline(
$this->datep,
$this->fk_typepayment, // Payment mode ID or code ("CHQ or VIR for example")
$this->paymenttype, // Payment mode ID or code ("CHQ or VIR for example")
$label,
$total,
$this->num_payment,

View File

@ -152,7 +152,7 @@ if ($action == 'add_payment')
// Create a line of payments
$payment = new PaymentLoan($db);
$payment->chid = $chid;
$payment->chid = $chid;
$payment->datep = $datepaid;
$payment->label = $loan->label;
$payment->amount_capital = $pay_amount_capital;
@ -176,7 +176,7 @@ if ($action == 'add_payment')
if (!$error)
{
$result = $payment->addPaymentToBank($user, $chid, 'payment_loan', '(LoanPayment)', GETPOST('accountid', 'int'), '', '');
$result = $payment->addPaymentToBank($user, $chid, 'payment_loan', '(LoanPayment)', $payment->fk_bank, '', '');
if (!$result > 0)
{
setEventMessages($payment->error, $payment->errors, 'errors');

View File

@ -5428,7 +5428,6 @@ class Product extends CommonObject
$langs->load('products');
$label_type = 'label';
if ($type == 'short') {
$label_type = 'short_label';
}

View File

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

View File

@ -67,11 +67,6 @@ if ($id > 0 || !empty($ref))
$objectsrc = new CommandeFournisseur($db);
$objectsrc->fetch($object->$typeobject->id);
}
if ($typeobject == 'propal' && $object->$typeobject->id && !empty($conf->propal->enabled))
{
$objectsrc = new Propal($db);
$objectsrc->fetch($object->$typeobject->id);
}
}
@ -83,7 +78,9 @@ if ($action == 'addcontact' && $user->rights->reception->creer)
{
if ($result > 0 && $id > 0)
{
$result = $objectsrc->add_contact(GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'), $_POST["type"], $_POST["source"]);
$contactid = (GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int'));
$typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type'));
$result = $objectsrc->add_contact($contactid, $typeid, GETPOST("source", 'aZ09'));
}
if ($result >= 0)

View File

@ -505,7 +505,7 @@ if ($resql)
if ($search_town) $param .= "&amp;search_town=".urlencode($search_town);
if ($search_zip) $param .= "&amp;search_zip=".urlencode($search_zip);
if ($search_state) $param .= "&amp;search_state=".urlencode($search_state);
if ($search_status) $param .= "&amp;search_status=".urlencode($search_status);
if ($search_status != '') $param .= "&amp;search_status=".urlencode($search_status);
if ($search_country) $param .= "&amp;search_country=".urlencode($search_country);
if ($search_type_thirdparty) $param .= "&amp;search_type_thirdparty=".urlencode($search_type_thirdparty);
if ($search_ref_supplier) $param .= "&amp;search_ref_supplier=".urlencode($search_ref_supplier);

View File

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

View File

@ -148,7 +148,7 @@ if ($object->client)
if ($conf->contrat->enabled && $user->rights->contrat->lire) $elementTypeArray['contract'] = $langs->transnoentitiesnoconv('Contracts');
}
if ($conf->ficheinter->enabled && $user->rights->ficheinter->lire) $elementTypeArray['fichinter'] = $langs->transnoentitiesnoconv('Interventions');
if (!empty($conf->ficheinter->enabled) && !empty($user->rights->ficheinter->lire)) $elementTypeArray['fichinter'] = $langs->transnoentitiesnoconv('Interventions');
if ($object->fournisseur)
{
@ -606,9 +606,10 @@ if ($sql_select)
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num);
}
$db->free($resql);
} elseif (empty($type_element) || $type_element == -1)
}
elseif (empty($type_element) || $type_element == -1)
{
print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, '', '');
print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', (!empty($num) ? $num : 0), '', '');
print '<table class="liste centpercent">'."\n";
// Titles with sort buttons

View File

@ -99,7 +99,7 @@ if ($cancel)
$action = '';
}
$parameters = array('id'=>$socid, 'objcanvas'=>$objcanvas);
$parameters = array('id'=>$socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@ -937,7 +937,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
{
try {
$customerstripe = $stripe->customerStripe($object, $stripeacc, $servicestatus);
if ($customerstripe->id) {
if (!empty($customerstripe->id)) {
// When using the Charge API architecture
if (empty($conf->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION))
{

View File

@ -25,7 +25,7 @@ if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
.info-box.info-box-sm {
min-height: 80px;
margin-bottom: 10px;
/* background: #fff; */
/* background: #fff; */
}
.opened-dash-board-wrap .info-box.info-box-sm {
border-radius: 0 0 0 20px;

View File

@ -345,7 +345,7 @@ if ($catid > 0) $sql .= " AND cu.fk_categorie = ".((int) $catid);
if ($catid == -2) $sql .= " AND cu.fk_categorie IS NULL";
if ($search_categ > 0) $sql .= " AND cu.fk_categorie = ".$db->escape($search_categ);
if ($search_categ == -2) $sql .= " AND cu.fk_categorie IS NULL";
if ($mode == 'employee' && empty($user->rights->salaries->readall)) $sql .= " AND s.fk_user IN (".join(',', $childids).")";
if ($mode == 'employee' && empty($user->rights->salaries->readall)) $sql .= " AND u.fk_user IN (".join(',', $childids).")";
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
// Add where from hooks

View File

@ -153,7 +153,7 @@ if ($resql) {
if ($targettype == 'contacts') {
$oldcid = $obj->cid;
}
$oldlang = $obj->lang;
$oldlang = $obj->default_lang;
$oldtarget = (empty($obj->cfirstname) && empty($obj->clastname)) ? $obj->name : ($obj->clastname." ".$obj->cfirstname);
$message = '';
$total = 0;

View File

@ -294,20 +294,20 @@ class SecurityTest extends PHPUnit\Framework\TestCase
$result=GETPOST("param1", 'int');
print __METHOD__." result=".$result."\n";
$this->assertEquals($result, 222);
$this->assertEquals($result, 222, 'Test on param1 with no 3rd param');
$result=GETPOST("param1", 'int', 2);
print __METHOD__." result=".$result."\n";
$this->assertEquals($result, 333);
$this->assertEquals($result, 333, 'Test on param1 with 3rd param = 2');
// Test alpha
$result=GETPOST("param2", 'alpha');
print __METHOD__." result=".$result."\n";
$this->assertEquals($result, $_GET["param2"]);
$this->assertEquals($result, $_GET["param2"], 'Test on param2');
$result=GETPOST("param3", 'alpha'); // Must return string sanitized from char "
print __METHOD__." result=".$result."\n";
$this->assertEquals($result, 'na/b#e(pr)qq-rr\cc');
$this->assertEquals($result, '\'\'na/b#e(pr)qq-rr\cc', 'Test on param3');
$result=GETPOST("param4", 'alpha'); // Must return string sanitized from ../
print __METHOD__." result=".$result."\n";
@ -346,7 +346,7 @@ class SecurityTest extends PHPUnit\Framework\TestCase
// With alphanohtml, we must convert the html entities like &#110;
$result=GETPOST("param8", 'alphanohtml');
print __METHOD__." result=".$result."\n";
$this->assertEquals("Hacker<svg onload='console.log(123)'", $result);
$this->assertEquals("Hacker<svg onload='console.log(''123'')'", $result);
$result=GETPOST("param9", 'alphanohtml');
print __METHOD__." result=".$result."\n";