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

This commit is contained in:
Florian Mortgat 2021-07-09 09:11:11 +02:00
commit 407f314498
524 changed files with 4238 additions and 3062 deletions

View File

@ -259,7 +259,7 @@ llxHeader('', $title);
$linkback = '';
//$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php?restore_lastsearch_values=1">' . $langs->trans("BackToModuleList") . '</a>';
print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'accountancy');
print load_fiche_titre($title, $linkback, 'accountancy');
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">';

View File

@ -59,6 +59,8 @@ class AccountancyExport
public static $EXPORT_TYPE_LDCOMPTA10 = 120;
public static $EXPORT_TYPE_GESTIMUMV3 = 130;
public static $EXPORT_TYPE_GESTIMUMV5 = 135;
public static $EXPORT_TYPE_ISUITEEXPERT = 200;
// Generic FEC after that
public static $EXPORT_TYPE_FEC = 1000;
public static $EXPORT_TYPE_FEC2 = 1010;
@ -123,6 +125,7 @@ class AccountancyExport
self::$EXPORT_TYPE_GESTIMUMV5 => $langs->trans('Modelcsv_Gestinum_v5'),
self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'),
self::$EXPORT_TYPE_FEC2 => $langs->trans('Modelcsv_FEC2'),
self::$EXPORT_TYPE_ISUITEEXPERT => 'Export iSuite Expert',
);
ksort($listofexporttypes, SORT_NUMERIC);
@ -158,6 +161,7 @@ class AccountancyExport
self::$EXPORT_TYPE_GESTIMUMV5 => 'gestimumv5',
self::$EXPORT_TYPE_FEC => 'fec',
self::$EXPORT_TYPE_FEC2 => 'fec2',
self::$EXPORT_TYPE_ISUITEEXPERT => 'isuiteexpert',
);
return $formatcode[$type];
@ -243,6 +247,10 @@ class AccountancyExport
'label' => $langs->trans('Modelcsv_FEC2'),
'ACCOUNTING_EXPORT_FORMAT' => 'txt',
),
self::$EXPORT_TYPE_ISUITEEXPERT => array(
'label' => 'iSuite Expert',
'ACCOUNTING_EXPORT_FORMAT' => 'csv',
),
),
'cr'=> array(
'1' => $langs->trans("Unix"),
@ -334,6 +342,9 @@ class AccountancyExport
case self::$EXPORT_TYPE_FEC2:
$this->exportFEC2($TData);
break;
case self::$EXPORT_TYPE_ISUITEEXPERT :
$this->exportiSuiteExpert($TData);
break;
default:
$this->errors[] = $langs->trans('accountancy_error_modelnotfound');
break;
@ -1752,6 +1763,62 @@ class AccountancyExport
}
}
/**
* Export format : iSuite Expert
*
* by OpenSolus [https://opensolus.fr]
*
* @param array $objectLines data
*
* @return void
*/
public function exportiSuiteExpert($objectLines)
{
$this->separator = ';';
$this->end_line = "\r\n";
foreach ($objectLines as $line) {
$tab = array();
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
$tab[] = $line->piece_num;
$tab[] = $date;
$tab[] = substr($date, 6, 4);
$tab[] = substr($date, 3, 2);
$tab[] = substr($date, 0, 2);
$tab[] = $line->doc_ref;
//Conversion de chaine UTF8 en Latin9
$tab[] = mb_convert_encoding(str_replace(' - Compte auxiliaire', '', $line->label_operation), "Windows-1252", 'UTF-8');
//Calcul de la longueur des numéros de comptes
$taille_numero = strlen(length_accountg($line->numero_compte));
//Création du numéro de client générique
$numero_cpt_client = '411';
for ($i = 1; $i <= ($taille_numero - 3); $i++) {
$numero_cpt_client .= '0';
}
//Création des comptes auxiliaire des clients
if (length_accountg($line->numero_compte) == $numero_cpt_client) {
$tab[] = rtrim(length_accounta($line->subledger_account), "0");
} else {
$tab[] = length_accountg($line->numero_compte);
}
$nom_client = explode(" - ", $line->label_operation);
$tab[] = mb_convert_encoding($nom_client[0], "Windows-1252", 'UTF-8');
$tab[] = price($line->debit);
$tab[] = price($line->credit);
$tab[] = price($line->montant);
$tab[] = $line->code_journal;
$separator = $this->separator;
print implode($separator, $tab) . $this->end_line;
}
}
/**
* trunc
*

View File

@ -158,6 +158,9 @@ if ($action == 'validatehistory') {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON " . $alias_societe_perentity . ".accountancy_code_sell = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
$sql .= " AND l.product_type <= 2";
if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
$sql .= " AND f.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
}
dol_syslog('htdocs/accountancy/customer/index.php');
$result = $db->query($sql);
@ -201,11 +204,13 @@ if ($action == 'validatehistory') {
}
}
// Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
if (!empty($objp->company_code_sell)) {
$objp->code_sell_t = $objp->company_code_sell;
$objp->aarowid_suggest = $objp->aarowid_thirdparty;
$suggestedaccountingaccountfor = '';
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
// Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
if (!empty($objp->company_code_sell)) {
$objp->code_sell_t = $objp->company_code_sell;
$objp->aarowid_suggest = $objp->aarowid_thirdparty;
$suggestedaccountingaccountfor = '';
}
}
if ($objp->aarowid_suggest > 0) {

View File

@ -166,6 +166,9 @@ if ($action == 'validatehistory') {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON " . $alias_product_perentity . ".accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
$sql .= " AND l.product_type <= 2";
if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
$sql .= " AND f.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
}
dol_syslog('htdocs/accountancy/supplier/index.php');
@ -202,11 +205,13 @@ if ($action == 'validatehistory') {
}
}
// Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
if (!empty($objp->company_code_buy)) {
$objp->code_buy_t = $objp->company_code_buy;
$objp->aarowid_suggest = $objp->aarowid_thirdparty;
$suggestedaccountingaccountfor = '';
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
// Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
if (!empty($objp->company_code_buy)) {
$objp->code_buy_t = $objp->company_code_buy;
$objp->aarowid_suggest = $objp->aarowid_thirdparty;
$suggestedaccountingaccountfor = '';
}
}
if ($objp->aarowid_suggest > 0) {

View File

@ -263,6 +263,7 @@ if ($conf->facture->enabled) {
print '<tr class="oddeven"><td>'.$langs->trans("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS").'</td>';
print '<td>';
$selected = (empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) ? '' : $conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS);
print img_picto('', 'product', 'class="pictofixedwidth"');
$form->select_produits($selected, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', '', 0);
print '</td>';
}

View File

@ -31,8 +31,6 @@ print load_fiche_titre($this->control->tpl['title']);
dol_htmloutput_errors((is_numeric($object->error) ? '' : $object->error), $object->errors);
dol_htmloutput_errors((is_numeric($GLOBALS['error']) ? '' : $GLOBALS['error']), $GLOBALS['errors']);
dol_htmloutput_errors($this->control->tpl['error'], $this->control->tpl['errors']);
echo $this->control->tpl['ajax_selectcountry']; ?>

View File

@ -1054,6 +1054,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Country
$object->country_id = $object->country_id ? $object->country_id : $mysoc->country_id;
print '<tr><td width="25%">'.$langs->trans('Country').'</td><td>';
print img_picto('', 'country', 'class="pictofixedwidth"');
print $form->select_country(GETPOSTISSET('country_id') ? GETPOST('country_id', 'alpha') : $object->country_id, 'country_id');
if ($user->admin) {
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
@ -1064,6 +1065,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if (empty($conf->global->MEMBER_DISABLE_STATE)) {
print '<tr><td>'.$langs->trans('State').'</td><td>';
if ($object->country_id) {
print img_picto('', 'state', 'class="pictofixedwidth"');
print $formcompany->select_state(GETPOSTISSET('state_id') ? GETPOST('state_id', 'int') : $object->state_id, $object->country_code);
} else {
print $countrynotdefined;
@ -1303,6 +1305,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Country
//$object->country_id=$object->country_id?$object->country_id:$mysoc->country_id; // In edit mode we don't force to company country if not defined
print '<tr><td>'.$langs->trans('Country').'</td><td>';
print img_picto('', 'country', 'class="pictofixedwidth"');
print $form->select_country(GETPOSTISSET("country_id") ? GETPOST("country_id", "alpha") : $object->country_id, 'country_id');
if ($user->admin) {
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
@ -1312,21 +1315,22 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// State
if (empty($conf->global->MEMBER_DISABLE_STATE)) {
print '<tr><td>'.$langs->trans('State').'</td><td>';
print img_picto('', 'state', 'class="pictofixedwidth"');
print $formcompany->select_state($object->state_id, GETPOSTISSET("country_id") ? GETPOST("country_id", "alpha") : $object->country_id);
print '</td></tr>';
}
// Pro phone
print '<tr><td>'.$langs->trans("PhonePro").'</td>';
print '<td>'.img_picto('', 'object_phoning').' <input type="text" name="phone" value="'.(GETPOSTISSET("phone") ? GETPOST("phone") : $object->phone).'"></td></tr>';
print '<td>'.img_picto('', 'object_phoning', 'class="pictofixedwidth"').' <input type="text" name="phone" value="'.(GETPOSTISSET("phone") ? GETPOST("phone") : $object->phone).'"></td></tr>';
// Personal phone
print '<tr><td>'.$langs->trans("PhonePerso").'</td>';
print '<td>'.img_picto('', 'object_phoning').' <input type="text" name="phone_perso" value="'.(GETPOSTISSET("phone_perso") ? GETPOST("phone_perso") : $object->phone_perso).'"></td></tr>';
print '<td>'.img_picto('', 'object_phoning', 'class="pictofixedwidth"').' <input type="text" name="phone_perso" value="'.(GETPOSTISSET("phone_perso") ? GETPOST("phone_perso") : $object->phone_perso).'"></td></tr>';
// Mobile phone
print '<tr><td>'.$langs->trans("PhoneMobile").'</td>';
print '<td>'.img_picto('', 'object_phoning_mobile').' <input type="text" name="phone_mobile" value="'.(GETPOSTISSET("phone_mobile") ? GETPOST("phone_mobile") : $object->phone_mobile).'"></td></tr>';
print '<td>'.img_picto('', 'object_phoning_mobile', 'class="pictofixedwidth"').' <input type="text" name="phone_mobile" value="'.(GETPOSTISSET("phone_mobile") ? GETPOST("phone_mobile") : $object->phone_mobile).'"></td></tr>';
if (!empty($conf->socialnetworks->enabled)) {
foreach ($socialnetworks as $key => $value) {

View File

@ -65,6 +65,7 @@ $search_filter = GETPOST("search_filter", 'alpha');
$search_status = GETPOST("search_status", 'intcomma');
$catid = GETPOST("catid", 'int');
$optioncss = GETPOST('optioncss', 'alpha');
$socid = GETPOST('socid', 'int');
$filter = GETPOST("filter", 'alpha');
if ($filter) {

View File

@ -131,7 +131,7 @@ print '<input name="town" class="minwidth100" id="town" value="'.(GETPOSTISSET('
// 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 img_picto('', 'globe-americas', 'class="pictofixedwidth"');
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);
@ -139,27 +139,28 @@ if ($user->admin) {
print '</td></tr>'."\n";
print '<tr class="oddeven"><td><label for="state_id">'.$langs->trans("State").'</label></td><td class="maxwidthonsmartphone">';
$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 img_picto('', 'state', 'class="pictofixedwidth"');
print $formcompany->select_state((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 img_picto('', 'object_phoning', '', false, 0, 0, '', 'pictofixedwidth');
print '<input name="tel" id="phone" class="maxwidth150 widthcentpercentminusx" 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 img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'pictofixedwidth');
print '<input name="fax" id="fax" class="maxwidth150 widthcentpercentminusx" 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 img_picto('', 'object_email', '', false, 0, 0, '', 'pictofixedwidth');
print '<input name="mail" id="email" class="maxwidth150 widthcentpercentminusx" 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 img_picto('', 'globe', '', false, 0, 0, '', 'pictofixedwidth');
print '<input name="web" id="web" class="maxwidth300 widthcentpercentminusx" 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";

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
/* Copyright (C) 2018-2021 Alexandre Spangaro <aspangaro@open-dsi.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
@ -18,7 +18,7 @@
/**
* \file htdocs/admin/accounting.php
* \ingroup accounting
* \brief Setup page to configure accountanting module
* \brief Setup page to configure accounting module
*/
require '../main.inc.php';
@ -32,7 +32,7 @@ $action = GETPOST('action', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'adminaccoutant'; // To manage different context of search
// Load translation files required by the page
$langs->loadLangs(array('admin', 'companies'));
$langs->loadLangs(array('admin', 'companies', 'accountancy'));
if (!$user->admin) {
accessforbidden();
@ -52,12 +52,13 @@ $error = 0;
* View
*/
$title = $langs->trans("ConfigAccountingExpert");
$help_url = '';
llxHeader('', $langs->trans("ConfigAccountingExpert"), $help_url);
llxHeader('', $title, $help_url);
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("ConfigAccountingExpert"), $linkback, 'title_setup');
print load_fiche_titre($title, $linkback, 'title_setup');
print "<br>\n";
print '<span class="opacitymedium">'.$langs->trans("AccountancySetupDoneFromAccountancyMenu", $langs->transnoentitiesnoconv("Accounting").' - '.$langs->transnoentitiesnoconv("Setup"))."</span><br>\n";

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2020 Laurent Destailleur <eldy@users.sourceforge.org>
* Copyright (C) 2005-2021 Laurent Destailleur <eldy@users.sourceforge.org>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
@ -20,7 +20,7 @@
/**
* \file htdocs/admin/clicktodial.php
* \ingroup clicktodial
* \brief Page to setup module clicktodial
* \brief Page to setup module ClickToDial
*/
require '../main.inc.php';
@ -99,7 +99,12 @@ print '<input class="quatrevingtpercent" type="text" id="CLICKTODIAL_URL" name="
print ajax_autoselect('CLICKTODIAL_URL');
print '<br>';
print $langs->trans("ClickToDialUrlDesc").'<br>';
print $langs->trans("Example").':<br>http://myphoneserver/mypage?login=__LOGIN__&password=__PASS__&caller=__PHONEFROM__&called=__PHONETO__';
print '<br>';
print '<span class="opacitymedium">';
print $langs->trans("Example").':<br>';
print 'http://myphoneserver/mypage?login=__LOGIN__&password=__PASS__&caller=__PHONEFROM__&called=__PHONETO__<br>';
print 'sip:__PHONETO__@my.sip.server';
print '</span>';
//if (! empty($user->clicktodial_url))
//{

View File

@ -417,7 +417,7 @@ print '<input name="MAIN_INFO_SOCIETE_TOWN" class="minwidth200" id="MAIN_INFO_SO
// Country
print '<tr class="oddeven"><td class="fieldrequired"><label for="selectcountry_id">'.$langs->trans("Country").'</label></td><td class="maxwidthonsmartphone">';
print img_picto('', 'globe-americas', 'class="paddingrightonly"');
print img_picto('', 'globe-americas', 'class="pictofixedwidth"');
print $form->select_country($mysoc->country_id, 'country_id', '', 0);
if ($user->admin) {
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
@ -430,35 +430,37 @@ if (!empty($conf->global->MAIN_INFO_SOCIETE_STATE)) {
$tmp = explode(':', $conf->global->MAIN_INFO_SOCIETE_STATE);
$state_id = $tmp[0];
}
$formcompany->select_departement($state_id, $mysoc->country_code, 'state_id');
print img_picto('', 'state', 'class="pictofixedwidth"');
print $formcompany->select_state($state_id, $mysoc->country_code, 'state_id');
print '</td></tr>'."\n";
// Currency
print '<tr class="oddeven"><td><label for="currency">'.$langs->trans("CompanyCurrency").'</label></td><td>';
print img_picto('', 'multicurrency', 'class="pictofixedwidth"');
print $form->selectCurrency($conf->currency, "currency");
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 img_picto('', 'object_phoning', '', false, 0, 0, '', 'pictofixedwidth');
print '<input class="maxwidth150 widthcentpercentminusx" 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 img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'pictofixedwidth');
print '<input class="maxwidth150" 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 img_picto('', 'object_email', '', false, 0, 0, '', 'pictofixedwidth');
print '<input class="maxwidth150" name="mail" id="email" 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 img_picto('', 'globe', '', false, 0, 0, '', 'pictofixedwidth');
print '<input class="maxwidth300 widthcentpercentminusx" name="web" id="web" 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";
@ -466,7 +468,7 @@ print '</td></tr>'."\n";
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 '<span class="fa fa-barcode pictofixedwidth"></span>';
print '<input name="barcode" id="barcode" class="minwidth150 widthcentpercentminusx maxwidth300" 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>';
}

View File

@ -74,6 +74,8 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))) {
}
}
}
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}

View File

@ -241,7 +241,7 @@ if ($defaultvalue) {
}
print '<form action="'.$_SERVER["PHP_SELF"].((empty($user->entity) && !empty($debug)) ? '?debug=1' : '').'" method="POST">';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
}
@ -393,8 +393,8 @@ if (!is_array($result) && $result<0) {
// Actions
print '<td class="center">';
if ($action != 'edit' || GETPOST('rowid') != $defaultvalue->id) {
print '<a class="editfielda marginleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$defaultvalue->id.'&entity='.$defaultvalue->entity.'&mode='.$mode.'&action=edit&token='.newToken().((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_edit().'</a>';
print '<a class="marginleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$defaultvalue->id.'&entity='.$defaultvalue->entity.'&mode='.$mode.'&action=delete&token='.newToken().((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_delete().'</a>';
print '<a class="editfielda marginleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$defaultvalue->id.'&entity='.$defaultvalue->entity.'&mode='.$mode.'&action=edit&token='.newToken().'">'.img_edit().'</a>';
print '<a class="marginleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$defaultvalue->id.'&entity='.$defaultvalue->entity.'&mode='.$mode.'&action=delete&token='.newToken().'">'.img_delete().'</a>';
} else {
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="rowid" value="'.$id.'">';

View File

@ -100,7 +100,7 @@ $hookmanager->initHooks(array('admin'));
// Put here declaration of dictionaries properties
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
$taborder = array(9, 0, 4, 3, 2, 0, 1, 8, 19, 16, 39, 27, 40, 38, 0, 5, 11, 0, 6, 0, 29, 0, 33, 34, 32, 24, 28, 17, 35, 36, 0, 10, 23, 12, 13, 7, 0, 14, 0, 22, 20, 18, 21, 41, 0, 15, 30, 0, 37, 42, 0, 43, 0, 25, 0);
$taborder = array(9, 15, 30, 0, 4, 3, 2, 0, 1, 8, 19, 16, 39, 27, 40, 38, 0, 5, 11, 0, 6, 24, 0, 29, 0, 33, 34, 32, 28, 17, 35, 36, 0, 10, 23, 12, 13, 7, 0, 14, 0, 22, 20, 18, 21, 41, 0, 37, 42, 0, 43, 0, 25, 0);
// Name of SQL tables of dictionaries
$tabname = array();
@ -223,7 +223,7 @@ $tabsql[24] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFI
$tabsql[25] = "SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity IN (".getEntity('c_type_container').")";
//$tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units";
$tabsql[27] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcomm";
$tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
$tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newByMonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
$tabsql[29] = "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status";
$tabsql[30] = "SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM ".MAIN_DB_PREFIX."c_format_cards";
//$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s";
@ -315,7 +315,7 @@ $tabfield[24] = "code,label";
$tabfield[25] = "code,label";
//$tabfield[26]= "code,label,short_label";
$tabfield[27] = "code,libelle,picto";
$tabfield[28] = "code,label,affect,delay,newbymonth,country_id,country";
$tabfield[28] = "code,label,affect,delay,newByMonth,country_id,country";
$tabfield[29] = "code,label,percent,position";
$tabfield[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
//$tabfield[31]= "pcg_version,label";
@ -361,7 +361,7 @@ $tabfieldvalue[24] = "code,label";
$tabfieldvalue[25] = "code,label";
//$tabfieldvalue[26]= "code,label,short_label";
$tabfieldvalue[27] = "code,libelle,picto";
$tabfieldvalue[28] = "code,label,affect,delay,newbymonth,country";
$tabfieldvalue[28] = "code,label,affect,delay,newByMonth,country";
$tabfieldvalue[29] = "code,label,percent,position";
$tabfieldvalue[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
//$tabfieldvalue[31]= "pcg_version,label";
@ -407,7 +407,7 @@ $tabfieldinsert[24] = "code,label";
$tabfieldinsert[25] = "code,label";
//$tabfieldinsert[26]= "code,label,short_label";
$tabfieldinsert[27] = "code,libelle,picto";
$tabfieldinsert[28] = "code,label,affect,delay,newbymonth,fk_country";
$tabfieldinsert[28] = "code,label,affect,delay,newByMonth,fk_country";
$tabfieldinsert[29] = "code,label,percent,position";
$tabfieldinsert[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
//$tabfieldinsert[31]= "pcg_version,label";
@ -548,7 +548,7 @@ $tabhelp[24] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[25] = array('code'=>$langs->trans('EnterAnyCode'));
//$tabhelp[26] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[27] = array('code'=>$langs->trans("EnterAnyCode"), 'picto'=>$langs->trans("PictoHelp"));
$tabhelp[28] = array('affect'=>$langs->trans("FollowedByACounter"), 'delay'=>$langs->trans("MinimumNoticePeriod"), 'newbymonth'=>$langs->trans("NbAddedAutomatically"));
$tabhelp[28] = array('affect'=>$langs->trans("FollowedByACounter"), 'delay'=>$langs->trans("MinimumNoticePeriod"), 'newByMonth'=>$langs->trans("NbAddedAutomatically"));
$tabhelp[29] = array('code'=>$langs->trans("EnterAnyCode"), 'percent'=>$langs->trans("OpportunityPercent"), 'position'=>$langs->trans("PositionIntoComboList"));
$tabhelp[30] = array('code'=>$langs->trans("EnterAnyCode"), 'name'=>$langs->trans("LabelName"), 'paper_size'=>$langs->trans("LabelPaperSize"));
//$tabhelp[31] = array('pcg_version'=>$langs->trans("EnterAnyCode"));
@ -568,8 +568,8 @@ $tabhelp[43] = array('code'=>$langs->trans("EnterAnyCode"));
// Table to store complete informations (will replace all other table). Key is table name.
$tabcomplete = array(
'c_forme_juridique'=>array('picto'=>'company'),
'c_departements'=>array('picto'=>'country'),
'c_regions'=>array('picto'=>'country'),
'c_departements'=>array('picto'=>'state'),
'c_regions'=>array('picto'=>'region'),
'c_country'=>array('picto'=>'country'),
'c_civility'=>array('picto'=>'contact'),
'c_actioncomm'=>array('picto'=>'action'),
@ -695,7 +695,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) {
$listfieldmodify = explode(',', $tabfieldinsert[$id]);
$listfieldvalue = explode(',', $tabfieldvalue[$id]);
// Check that all fields are filled
// Check that all mandatory fields are filled
$ok = 1;
foreach ($listfield as $f => $value) {
// Discard check of mandatory fields for country for some tables
@ -882,12 +882,12 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) {
}
if ($keycode == 'sortorder') { // For column name 'sortorder', we use the field name 'position'
$sql .= "'".(int) GETPOST('position', 'int')."'";
$sql .= (int) GETPOST('position', 'int');
} elseif ($_POST[$keycode] == '' && !($keycode == 'code' && $id == 10)) {
$sql .= "null"; // For vat, we want/accept code = ''
} elseif ($keycode == 'content') {
$sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'";
} elseif (in_array($keycode, array('joinfile', 'private', 'position', 'scale'))) {
} elseif (in_array($keycode, array('joinfile', 'private', 'pos', 'position', 'scale', 'use_default'))) {
$sql .= (int) GETPOST($keycode, 'int');
} else {
$sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'";
@ -898,8 +898,8 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) {
$sql .= ",1)";
dol_syslog("actionadd", LOG_DEBUG);
$result = $db->query($sql);
if ($result) { // Add is ok
$resql = $db->query($sql);
if ($resql) { // Add is ok
setEventMessages($langs->transnoentities("RecordCreatedSuccessfully"), null, 'mesgs');
// Clean $_POST array, we keep only id of dictionary
@ -956,7 +956,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) {
$sql .= "null"; // For vat, we want/accept code = ''
} elseif ($keycode == 'content') {
$sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'";
} elseif (in_array($keycode, array('private', 'position', 'scale'))) {
} elseif (in_array($keycode, array('joinfile', 'private', 'pos', 'position', 'scale', 'use_default'))) {
$sql .= (int) GETPOST($keycode, 'int');
} else {
$sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'";
@ -1234,7 +1234,7 @@ if ($id) {
$class = '';
if ($value == 'pos') {
$valuetoshow = $langs->trans("Position"); $class = 'maxwidth100';
$valuetoshow = $langs->trans("Position"); $class = 'right';
}
if ($value == 'source') {
$valuetoshow = $langs->trans("Contact");
@ -1341,6 +1341,9 @@ if ($id) {
if ($value == 'short_label') {
$valuetoshow = $langs->trans("ShortLabel");
}
if ($value == 'fk_parent') {
$valuetoshow = $langs->trans("ParentID"); $class = 'center';
}
if ($value == 'range_account') {
$valuetoshow = $langs->trans("Range");
}
@ -1389,7 +1392,7 @@ if ($id) {
if ($value == 'delay') {
$valuetoshow = $langs->trans("NoticePeriod");
}
if ($value == 'newbymonth') {
if ($value == 'newByMonth') {
$valuetoshow = $langs->trans("NewByMonth");
}
if ($value == 'fk_tva') {
@ -1623,11 +1626,8 @@ if ($id) {
if ($value == 'code') {
$valuetoshow = $langs->trans("Code");
}
if ($value == 'pos') {
$cssprefix = 'right '; $valuetoshow = $langs->trans("Position");
}
if ($value == 'position') {
$cssprefix = 'right '; $valuetoshow = $langs->trans("Position");
if (in_array($value, array('pos', 'position'))) {
$valuetoshow = $langs->trans("Position"); $cssprefix = 'right ';
}
if ($value == 'libelle' || $value == 'label') {
$valuetoshow = $langs->trans("Label");
@ -1686,6 +1686,9 @@ if ($id) {
if ($value == 'short_label') {
$valuetoshow = $langs->trans("ShortLabel");
}
if ($value == 'fk_parent') {
$valuetoshow = $langs->trans("ParentID"); $cssprefix = 'center ';
}
if ($value == 'range_account') {
$valuetoshow = $langs->trans("Range");
}
@ -1734,7 +1737,7 @@ if ($id) {
if ($value == 'delay') {
$valuetoshow = $langs->trans("NoticePeriod");
}
if ($value == 'newbymonth') {
if ($value == 'newByMonth') {
$valuetoshow = $langs->trans("NewByMonth");
}
if ($value == 'fk_tva') {
@ -1992,19 +1995,13 @@ if ($id) {
if ($value == 'tracking') {
$class .= ' tdoverflowauto';
}
if ($value == 'position') {
if (in_array($value, array('pos', 'position'))) {
$class .= ' right';
}
if ($value == 'localtax1_type') {
if (in_array($value, array('localtax1_type', 'localtax2_type'))) {
$class .= ' nowrap';
}
if ($value == 'localtax2_type') {
$class .= ' nowrap';
}
if ($value == 'pos') {
$class .= ' right';
}
if ($value == 'use_default') {
if (in_array($value, array('use_default', 'fk_parent'))) {
$class .= ' center';
}
if ($value == 'public') {
@ -2271,7 +2268,13 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
print '<td>';
print $form->selectarray('source', $sourceList, (!empty($obj->{$value}) ? $obj->{$value}:''));
print '</td>';
} elseif (in_array($value, array('public', 'use_default'))) {
// Fields 0/1 with a combo select Yes/No
print '<td class="center">';
print $form->selectyesno($value, (!empty($obj->{$value}) ? $obj->{$value}:''), 1);
print '</td>';
} elseif ($value == 'private') {
// Fields 'no'/'yes' with a combo select Yes/No
print '<td>';
print $form->selectyesno("private", (!empty($obj->{$value}) ? $obj->{$value}:''));
print '</td>';
@ -2367,7 +2370,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
print $form->selectExpenseRanges($obj->fk_range);
print '</td>';
} else {
$fieldValue = isset($obj->{$value}) ? $obj->{$value}:'';
$fieldValue = isset($obj->{$value}) ? $obj->{$value}: '';
if ($value == 'sortorder') {
$fieldlist[$field] = 'position';
@ -2377,15 +2380,24 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
if ($fieldlist[$field] == 'code') {
$class = 'maxwidth100';
}
if (in_array($fieldlist[$field], array('dayrule', 'day', 'month', 'year', 'pos', 'use_default', 'affect', 'delay', 'position', 'public', 'sortorder', 'sens', 'category_type'))) {
if (in_array($fieldlist[$field], array('pos', 'position'))) {
$classtd = 'right'; $class = 'maxwidth50 right';
}
if (in_array($fieldlist[$field], array('dayrule', 'day', 'month', 'year', 'use_default', 'affect', 'delay', 'public', 'sortorder', 'sens', 'category_type', 'fk_parent'))) {
$class = 'maxwidth50 center';
}
if (in_array($fieldlist[$field], array('use_default', 'public'))) {
if (in_array($fieldlist[$field], array('use_default', 'public', 'fk_parent'))) {
$classtd = 'center';
}
if (in_array($fieldlist[$field], array('libelle', 'label', 'tracking'))) {
$class = 'quatrevingtpercent';
}
// Fields that must be suggested as '0' instead of ''
if ($fieldlist[$field] == 'fk_parent') {
if (empty($fieldValue)) {
$fieldValue = '0';
}
}
print '<td class="'.$classtd.'">';
$transfound = 0;
$transkey = '';

View File

@ -54,12 +54,12 @@ $arrayofparameters = array(
'EVENTORGANIZATION_CATEG_THIRDPARTY_BOOTH'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1),
//'EVENTORGANIZATION_FILTERATTENDEES_CAT'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1),
//'EVENTORGANIZATION_FILTERATTENDEES_TYPE'=>array('type'=>'thirdparty_type:', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_CONF'=>array('type'=>'emailtemplate:eventorganization_send', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH'=>array('type'=>'emailtemplate:eventorganization_send', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH'=>array('type'=>'emailtemplate:eventorganization_send', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT'=>array('type'=>'emailtemplate:eventorganization_send', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_SPEAKER'=>array('type'=>'emailtemplate:eventorganization_send', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_ATTENDES'=>array('type'=>'emailtemplate:eventorganization_send', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_CONF'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_SPEAKER'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_ATTENDES'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1),
'EVENTORGANIZATION_SECUREKEY'=>array('type'=>'securekey', 'enabled'=>1),
'SERVICE_BOOTH_LOCATION'=>array('type'=>'product', 'enabled'=>1),
'SERVICE_CONFERENCE_ATTENDEE_SUBSCRIPTION'=>array('type'=>'product', 'enabled'=>1),

View File

@ -117,7 +117,7 @@ if (GETPOST('save', 'alpha')) {
$error++;
}
$fckeditor_test = GETPOST('formtestfield');
$fckeditor_test = GETPOST('formtestfield', 'restricthtml');
if (!empty($fckeditor_test)) {
if (!dolibarr_set_const($db, 'FCKEDITOR_TEST', $fckeditor_test, 'chaine', 0, '', $conf->entity)) {
$error++;

View File

@ -51,6 +51,7 @@ if (!empty($conf->global->MAIN_MOTD_SETUPPAGE)) {
$conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i', '<br>', $conf->global->MAIN_MOTD_SETUPPAGE);
if (!empty($conf->global->MAIN_MOTD_SETUPPAGE)) {
$i = 0;
$reg = array();
while (preg_match('/__\(([a-zA-Z|@]+)\)__/i', $conf->global->MAIN_MOTD_SETUPPAGE, $reg) && $i < 100) {
$tmp = explode('|', $reg[1]);
if (!empty($tmp[1])) {

View File

@ -499,7 +499,7 @@ foreach ($object->fields as $key => $val) {
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], empty($search[$key]) ? '' : $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
} elseif (strpos($val['type'], 'integer:') === 0) {
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
print $object->showInputField($val, $key, empty($search[$key]) ? '' : $search[$key], '', '', 'search_', 'maxwidth150', 1);
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) {
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(empty($search[$key]) ? '' : $search[$key]).'">';
}

View File

@ -919,7 +919,6 @@ if ($mode == 'common' || $mode == 'commonkanban') {
if ($objMod->needUpdate) {
$versionTitle = $langs->trans('ModuleUpdateAvailable').' : '.$objMod->lastVersion;
print '<span class="badge badge-warning classfortooltip" title="'.dol_escape_htmltag($versionTitle).'">'.$versiontrans.'</span>';
$foundoneexternalmodulewithupdate++;
} else {
print $versiontrans;
}
@ -937,6 +936,9 @@ if ($mode == 'common' || $mode == 'commonkanban') {
print "</tr>\n";
}
if ($objMod->needUpdate) {
$foundoneexternalmodulewithupdate++;
}
}
if ($action == 'checklastversion') {

View File

@ -371,17 +371,7 @@ print $formadmin->select_language($selected, 'PDF_USE_ALSO_LANGUAGE_CODE', 0, nu
//}
print '</td></tr>';
//Desc
print '<tr class="oddeven"><td>'.$langs->trans("HideDescOnPDF").'</td><td>';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_HIDE_DESC');
} else {
print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DESC', (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC)) ? $conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC : 0, 1);
}
print '</td></tr>';
//Ref
// Ref
print '<tr class="oddeven"><td>'.$langs->trans("HideRefOnPDF").'</td><td>';
if ($conf->use_javascript_ajax) {
@ -391,7 +381,17 @@ if ($conf->use_javascript_ajax) {
}
print '</td></tr>';
//Details
// Desc
print '<tr class="oddeven"><td>'.$langs->trans("HideDescOnPDF").'</td><td>';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_HIDE_DESC');
} else {
print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DESC', (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC)) ? $conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC : 0, 1);
}
print '</td></tr>';
// Details
print '<tr class="oddeven"><td>'.$langs->trans("HideDetailsOnPDF").'</td><td>';
if ($conf->use_javascript_ajax) {

View File

@ -78,7 +78,8 @@ $head = pdf_admin_prepare_head();
print dol_get_fiche_head($head, 'other', $langs->trans("other"), -1, 'pdf');
print '<span class="opacitymedium">'.$form->textwithpicto($langs->trans("PDFOtherDesc"), $s)."</span><br>\n";
$tooltiptext = '';
print '<span class="opacitymedium">'.$form->textwithpicto($langs->trans("PDFOtherDesc"), $tooltiptext)."</span><br>\n";
print "<br>\n";
print load_fiche_titre($langs->trans("Proposal"), '', '');
@ -116,10 +117,11 @@ print '</td></tr>';
print '</table>';
print '</div>';
/*
print '<br><div class="center">';
print '<input class="button button-save" type="submit" name="save" value="'.$langs->trans("Save").'">';
print '</div>';
*/
print '</form>';

View File

@ -251,7 +251,7 @@ foreach ($arrayhandler as $key => $module) {
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
} else {
print $tmp;
print '<span class="opacitymedium">'.$tmp.'</span>';
}
print '</td>'."\n";

View File

@ -309,57 +309,58 @@ print '<br>';
// Parameters in conf.php file (when a parameter start with ?, it is shown only if defined)
$configfileparameters = array(
'dolibarr_main_url_root' => $langs->trans("URLRoot"),
'?dolibarr_main_url_root_alt' => $langs->trans("URLRoot").' (alt)',
'dolibarr_main_document_root'=> $langs->trans("DocumentRootServer"),
'?dolibarr_main_document_root_alt' => $langs->trans("DocumentRootServer").' (alt)',
'dolibarr_main_data_root' => $langs->trans("DataRootServer"),
'dolibarr_main_instance_unique_id' => $langs->trans("InstanceUniqueID"),
'separator1' => '',
'dolibarr_main_db_host' => $langs->trans("DatabaseServer"),
'dolibarr_main_db_port' => $langs->trans("DatabasePort"),
'dolibarr_main_db_name' => $langs->trans("DatabaseName"),
'dolibarr_main_db_type' => $langs->trans("DriverType"),
'dolibarr_main_db_user' => $langs->trans("DatabaseUser"),
'dolibarr_main_db_pass' => $langs->trans("DatabasePassword"),
'dolibarr_main_db_character_set' => $langs->trans("DBStoringCharset"),
'dolibarr_main_db_collation' => $langs->trans("DBSortingCollation"),
'?dolibarr_main_db_prefix' => $langs->trans("Prefix"),
'separator2' => '',
'dolibarr_main_authentication' => $langs->trans("AuthenticationMode"),
'?multicompany_transverse_mode'=> $langs->trans("MultiCompanyMode"),
'separator'=> '',
'?dolibarr_main_auth_ldap_login_attribute' => 'dolibarr_main_auth_ldap_login_attribute',
'?dolibarr_main_auth_ldap_host' => 'dolibarr_main_auth_ldap_host',
'?dolibarr_main_auth_ldap_port' => 'dolibarr_main_auth_ldap_port',
'?dolibarr_main_auth_ldap_version' => 'dolibarr_main_auth_ldap_version',
'?dolibarr_main_auth_ldap_dn' => 'dolibarr_main_auth_ldap_dn',
'?dolibarr_main_auth_ldap_admin_login' => 'dolibarr_main_auth_ldap_admin_login',
'?dolibarr_main_auth_ldap_admin_pass' => 'dolibarr_main_auth_ldap_admin_pass',
'?dolibarr_main_auth_ldap_debug' => 'dolibarr_main_auth_ldap_debug',
'separator3' => '',
'?dolibarr_lib_ADODB_PATH' => 'dolibarr_lib_ADODB_PATH',
'?dolibarr_lib_FPDF_PATH' => 'dolibarr_lib_FPDF_PATH',
'?dolibarr_lib_TCPDF_PATH' => 'dolibarr_lib_TCPDF_PATH',
'?dolibarr_lib_FPDI_PATH' => 'dolibarr_lib_FPDI_PATH',
'?dolibarr_lib_TCPDI_PATH' => 'dolibarr_lib_TCPDI_PATH',
'?dolibarr_lib_NUSOAP_PATH' => 'dolibarr_lib_NUSOAP_PATH',
'?dolibarr_lib_GEOIP_PATH' => 'dolibarr_lib_GEOIP_PATH',
'?dolibarr_lib_ODTPHP_PATH' => 'dolibarr_lib_ODTPHP_PATH',
'?dolibarr_lib_ODTPHP_PATHTOPCLZIP' => 'dolibarr_lib_ODTPHP_PATHTOPCLZIP',
'?dolibarr_js_CKEDITOR' => 'dolibarr_js_CKEDITOR',
'?dolibarr_js_JQUERY' => 'dolibarr_js_JQUERY',
'?dolibarr_js_JQUERY_UI' => 'dolibarr_js_JQUERY_UI',
'?dolibarr_font_DOL_DEFAULT_TTF' => 'dolibarr_font_DOL_DEFAULT_TTF',
'?dolibarr_font_DOL_DEFAULT_TTF_BOLD' => 'dolibarr_font_DOL_DEFAULT_TTF_BOLD',
'separator4' => '',
'dolibarr_main_prod' => 'Production mode (Hide all error messages)',
'dolibarr_main_restrict_os_commands' => 'Restrict CLI commands for backups',
'dolibarr_main_restrict_ip' => 'Restrict access to some IPs only',
'?dolibarr_mailing_limit_sendbyweb' => 'Limit nb of email sent by page',
'?dolibarr_mailing_limit_sendbycli' => 'Limit nb of email sent by cli',
'?dolibarr_strict_mode' => 'Strict mode is on/off',
'?dolibarr_nocsrfcheck' => 'Disable CSRF security checks'
'dolibarr_main_prod' => 'Production mode (Hide all error messages)',
'dolibarr_main_instance_unique_id' => $langs->trans("InstanceUniqueID"),
'separator0' => '',
'dolibarr_main_url_root' => $langs->trans("URLRoot"),
'?dolibarr_main_url_root_alt' => $langs->trans("URLRoot").' (alt)',
'dolibarr_main_document_root'=> $langs->trans("DocumentRootServer"),
'?dolibarr_main_document_root_alt' => $langs->trans("DocumentRootServer").' (alt)',
'dolibarr_main_data_root' => $langs->trans("DataRootServer"),
'separator1' => '',
'dolibarr_main_db_host' => $langs->trans("DatabaseServer"),
'dolibarr_main_db_port' => $langs->trans("DatabasePort"),
'dolibarr_main_db_name' => $langs->trans("DatabaseName"),
'dolibarr_main_db_type' => $langs->trans("DriverType"),
'dolibarr_main_db_user' => $langs->trans("DatabaseUser"),
'dolibarr_main_db_pass' => $langs->trans("DatabasePassword"),
'dolibarr_main_db_character_set' => $langs->trans("DBStoringCharset"),
'dolibarr_main_db_collation' => $langs->trans("DBSortingCollation"),
'?dolibarr_main_db_prefix' => $langs->trans("DatabasePrefix"),
'separator2' => '',
'dolibarr_main_authentication' => $langs->trans("AuthenticationMode"),
'?multicompany_transverse_mode'=> $langs->trans("MultiCompanyMode"),
'separator'=> '',
'?dolibarr_main_auth_ldap_login_attribute' => 'dolibarr_main_auth_ldap_login_attribute',
'?dolibarr_main_auth_ldap_host' => 'dolibarr_main_auth_ldap_host',
'?dolibarr_main_auth_ldap_port' => 'dolibarr_main_auth_ldap_port',
'?dolibarr_main_auth_ldap_version' => 'dolibarr_main_auth_ldap_version',
'?dolibarr_main_auth_ldap_dn' => 'dolibarr_main_auth_ldap_dn',
'?dolibarr_main_auth_ldap_admin_login' => 'dolibarr_main_auth_ldap_admin_login',
'?dolibarr_main_auth_ldap_admin_pass' => 'dolibarr_main_auth_ldap_admin_pass',
'?dolibarr_main_auth_ldap_debug' => 'dolibarr_main_auth_ldap_debug',
'separator3' => '',
'?dolibarr_lib_ADODB_PATH' => 'dolibarr_lib_ADODB_PATH',
'?dolibarr_lib_FPDF_PATH' => 'dolibarr_lib_FPDF_PATH',
'?dolibarr_lib_TCPDF_PATH' => 'dolibarr_lib_TCPDF_PATH',
'?dolibarr_lib_FPDI_PATH' => 'dolibarr_lib_FPDI_PATH',
'?dolibarr_lib_TCPDI_PATH' => 'dolibarr_lib_TCPDI_PATH',
'?dolibarr_lib_NUSOAP_PATH' => 'dolibarr_lib_NUSOAP_PATH',
'?dolibarr_lib_GEOIP_PATH' => 'dolibarr_lib_GEOIP_PATH',
'?dolibarr_lib_ODTPHP_PATH' => 'dolibarr_lib_ODTPHP_PATH',
'?dolibarr_lib_ODTPHP_PATHTOPCLZIP' => 'dolibarr_lib_ODTPHP_PATHTOPCLZIP',
'?dolibarr_js_CKEDITOR' => 'dolibarr_js_CKEDITOR',
'?dolibarr_js_JQUERY' => 'dolibarr_js_JQUERY',
'?dolibarr_js_JQUERY_UI' => 'dolibarr_js_JQUERY_UI',
'?dolibarr_font_DOL_DEFAULT_TTF' => 'dolibarr_font_DOL_DEFAULT_TTF',
'?dolibarr_font_DOL_DEFAULT_TTF_BOLD' => 'dolibarr_font_DOL_DEFAULT_TTF_BOLD',
'separator4' => '',
'dolibarr_main_restrict_os_commands' => 'Restrict CLI commands for backups',
'dolibarr_main_restrict_ip' => 'Restrict access to some IPs only',
'?dolibarr_mailing_limit_sendbyweb' => 'Limit nb of email sent by page',
'?dolibarr_mailing_limit_sendbycli' => 'Limit nb of email sent by cli',
'?dolibarr_strict_mode' => 'Strict mode is on/off',
'?dolibarr_nocsrfcheck' => 'Disable CSRF security checks'
);
print '<div class="div-table-responsive-no-min">';
@ -400,8 +401,10 @@ foreach ($configfileparameters as $key => $value) {
if (in_array($newkey, array('dolibarr_main_db_pass', 'dolibarr_main_auth_ldap_admin_pass'))) {
if (empty($dolibarr_main_prod)) {
print '<!-- '.${$newkey}.' -->';
print showValueWithClipboardCPButton(${$newkey}, 0, '********');
} else {
print '**********';
}
print '**********';
} elseif ($newkey == 'dolibarr_main_url_root' && preg_match('/__auto__/', ${$newkey})) {
print ${$newkey}.' => '.constant('DOL_MAIN_URL_ROOT');
} elseif ($newkey == 'dolibarr_main_document_root_alt') {
@ -420,9 +423,14 @@ foreach ($configfileparameters as $key => $value) {
}
} elseif ($newkey == 'dolibarr_main_instance_unique_id') {
//print $conf->file->instance_unique_id;
global $dolibarr_main_cookie_cryptkey;
$valuetoshow = ${$newkey} ? ${$newkey} : $dolibarr_main_cookie_cryptkey; // Use $dolibarr_main_instance_unique_id first then $dolibarr_main_cookie_cryptkey
print $valuetoshow;
global $dolibarr_main_cookie_cryptkey, $dolibarr_main_instance_unique_id;
$valuetoshow = $dolibarr_main_instance_unique_id ? $dolibarr_main_instance_unique_id : $dolibarr_main_cookie_cryptkey; // Use $dolibarr_main_instance_unique_id first then $dolibarr_main_cookie_cryptkey
if (empty($dolibarr_main_prod)) {
print '<!-- '.${$newkey}.' -->';
print showValueWithClipboardCPButton($valuetoshow, 0, '********');
} else {
print '**********';
}
if (empty($valuetoshow)) {
print img_warning("EditConfigFileToAddEntry", 'dolibarr_main_instance_unique_id');
}

View File

@ -251,7 +251,7 @@ print '<br>';
if (empty($conf->global->SECURITY_DISABLE_TEST_ON_OBFUSCATED_CONF)) {
print '<strong>$dolibarr_main_db_pass</strong>: ';
if (!empty($dolibarr_main_db_pass) && empty($dolibarr_main_db_encrypted_pass)) {
print img_picto('', 'warning').' '.$langs->trans("DatabasePasswordNotObfuscated").' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommanded").': '.$langs->trans("SetOptionTo", $langs->transnoentitiesnoconv("MainDbPasswordFileConfEncrypted"), yn(1)).')</span>';
print img_picto('', 'warning').' '.$langs->trans("DatabasePasswordNotObfuscated").' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': '.$langs->trans("SetOptionTo", $langs->transnoentitiesnoconv("MainDbPasswordFileConfEncrypted"), yn(1)).')</span>';
//print ' <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("IPsOfUsers")).')</span>';
} else {
print img_picto('', 'tick').' '.$langs->trans("DatabasePasswordObfuscated");
@ -267,49 +267,14 @@ if (empty($conf->global->SECURITY_DISABLE_TEST_ON_OBFUSCATED_CONF)) {
print '<br>';
print '<br>';
print '<br>';
print load_fiche_titre($langs->trans("Menu").' '.$langs->trans("SecuritySetup").' + '.$langs->trans("OtherSetup"), '', 'folder');
//print '<strong>'.$langs->trans("PasswordEncryption").'</strong>: ';
print '<strong>MAIN_SECURITY_HASH_ALGO</strong> = '.(empty($conf->global->MAIN_SECURITY_HASH_ALGO) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>' : $conf->global->MAIN_SECURITY_HASH_ALGO)." &nbsp; ";
if (empty($conf->global->MAIN_SECURITY_HASH_ALGO)) {
print '<span class="opacitymedium"> &nbsp; &nbsp; If unset: \'md5\'</span>';
}
if ($conf->global->MAIN_SECURITY_HASH_ALGO != 'password_hash') {
print '<br><strong>MAIN_SECURITY_SALT</strong> = '.(empty($conf->global->MAIN_SECURITY_SALT) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>' : $conf->global->MAIN_SECURITY_SALT).'<br>';
} else {
print '<span class="opacitymedium">('.$langs->trans("Recommanded").': password_hash)</span>';
print '<br>';
}
if ($conf->global->MAIN_SECURITY_HASH_ALGO != 'password_hash') {
print '<div class="info">The recommanded value for MAIN_SECURITY_HASH_ALGO is now \'password_hash\' but setting it now will make ALL existing passwords of all users not valid, so update is not possible.<br>';
print 'If you really want to switch, you must:<br>';
print '- Go on home - setup - other and add constant MAIN_SECURITY_HASH_ALGO to value \'password_hash\'<br>';
print '- In same session, WITHOUT LOGGING OUT, go into your admin user record and set a new password<br>';
print '- You can now logout and login with this new password. You must now reset password of all other users.<br>';
print '</div><br>';
}
print load_fiche_titre($langs->trans("Menu").' '.$langs->trans("SecuritySetup"), '', 'folder');
print '<strong>'.$langs->trans("UseCaptchaCode").'</strong>: ';
print empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA) ? '' : img_picto('', 'tick').' ';
print yn(empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA) ? 0 : 1);
print '<br>';
print '<strong>MAIN_SECURITY_ANTI_SSRF_SERVER_IP</strong> = '.(empty($conf->global->MAIN_SECURITY_ANTI_SSRF_SERVER_IP) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span> &nbsp; <span class="opacitymedium">('.$langs->trans("Example").': static-ips-of-server - '.$langs->trans("Note").': common loopback ip like 127.*.*.*, [::1] are already added)</span>' : $conf->global->MAIN_SECURITY_ANTI_SSRF_SERVER_IP)."<br>";
print '<br>';
print '<strong>MAIN_ALLOW_SVG_FILES_AS_IMAGES</strong> = '.(empty($conf->global->MAIN_ALLOW_SVG_FILES_AS_IMAGES) ? '0 &nbsp; <span class="opacitymedium">('.$langs->trans("Recommanded").': 0)</span>' : $conf->global->MAIN_ALLOW_SVG_FILES_AS_IMAGES)."<br>";
print '<br>';
print '<strong>MAIN_EXEC_USE_POPEN</strong> = ';
if (empty($conf->global->MAIN_EXEC_USE_POPEN)) {
print '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>';
} else {
print $conf->global->MAIN_EXEC_USE_POPEN;
}
if ($execmethod == 1) {
print ' &nbsp; <span class="opacitymedium">("exec" PHP method will be used for shell commands)</span>';
}
if ($execmethod == 2) {
print ' &nbsp; <span class="opacitymedium">("popen" PHP method will be used for shell commands)</span>';
}
print "<br>";
print '<br>';
@ -354,6 +319,62 @@ if (empty($out)) {
}
print '<br>';
print '<br>';
print '<br>';
print '<br>';
print load_fiche_titre($langs->trans("OtherSetup").' ('.$langs->trans("Experimental").')', '', 'folder');
//print '<strong>'.$langs->trans("PasswordEncryption").'</strong>: ';
print '<strong>MAIN_SECURITY_HASH_ALGO</strong> = '.(empty($conf->global->MAIN_SECURITY_HASH_ALGO) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>' : $conf->global->MAIN_SECURITY_HASH_ALGO)." &nbsp; ";
if (empty($conf->global->MAIN_SECURITY_HASH_ALGO)) {
print '<span class="opacitymedium"> &nbsp; &nbsp; If unset: \'md5\'</span>';
}
if ($conf->global->MAIN_SECURITY_HASH_ALGO != 'password_hash') {
print '<br><strong>MAIN_SECURITY_SALT</strong> = '.(empty($conf->global->MAIN_SECURITY_SALT) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>' : $conf->global->MAIN_SECURITY_SALT).'<br>';
} else {
print '<span class="opacitymedium">('.$langs->trans("Recommanded").': password_hash)</span>';
print '<br>';
}
if ($conf->global->MAIN_SECURITY_HASH_ALGO != 'password_hash') {
print '<div class="info">The recommanded value for MAIN_SECURITY_HASH_ALGO is now \'password_hash\' but setting it now will make ALL existing passwords of all users not valid, so update is not possible.<br>';
print 'If you really want to switch, you must:<br>';
print '- Go on home - setup - other and add constant MAIN_SECURITY_HASH_ALGO to value \'password_hash\'<br>';
print '- In same session, WITHOUT LOGGING OUT, go into your admin user record and set a new password<br>';
print '- You can now logout and login with this new password. You must now reset password of all other users.<br>';
print '</div><br>';
}
print '<br>';
print '<strong>MAIN_SECURITY_ANTI_SSRF_SERVER_IP</strong> = '.(empty($conf->global->MAIN_SECURITY_ANTI_SSRF_SERVER_IP) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span> &nbsp; <span class="opacitymedium">('.$langs->trans("Example").': static-ips-of-server - '.$langs->trans("Note").': common loopback ip like 127.*.*.*, [::1] are already added)</span>' : $conf->global->MAIN_SECURITY_ANTI_SSRF_SERVER_IP)."<br>";
print '<br>';
print '<strong>MAIN_ALLOW_SVG_FILES_AS_IMAGES</strong> = '.(empty($conf->global->MAIN_ALLOW_SVG_FILES_AS_IMAGES) ? '0 &nbsp; <span class="opacitymedium">('.$langs->trans("Recommanded").': 0)</span>' : $conf->global->MAIN_ALLOW_SVG_FILES_AS_IMAGES)."<br>";
print '<br>';
print '<strong>MAIN_RESTRICTHTML_ONLY_VALID_HTML</strong> = '.(empty($conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML) ? '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Recommanded").': 1)</span>' : $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML)."<br>";
print '<br>';
print '<strong>MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES</strong> = '.(empty($conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES) ? '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Recommanded").': 1)</span>' : $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES)."<br>";
print '<br>';
print '<strong>MAIN_EXEC_USE_POPEN</strong> = ';
if (empty($conf->global->MAIN_EXEC_USE_POPEN)) {
print '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>';
} else {
print $conf->global->MAIN_EXEC_USE_POPEN;
}
if ($execmethod == 1) {
print ' &nbsp; <span class="opacitymedium">("exec" PHP method will be used for shell commands)</span>';
}
if ($execmethod == 2) {
print ' &nbsp; <span class="opacitymedium">("popen" PHP method will be used for shell commands)</span>';
}
print "<br>";
print '<br>';
// Modules/Applications
@ -405,7 +426,7 @@ if (empty($conf->api->enabled) && empty($conf->webservices->enabled)) {
print '<br>';
}
if (!empty($conf->api->enabled)) {
print '<strong>API_ENDPOINT_RULES</strong> = '.(empty($conf->global->API_ENDPOINT_RULES) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>' : $conf->global->API_ENDPOINT_RULES)."<br>\n";
print '<strong>API_ENDPOINT_RULES</strong> = '.(empty($conf->global->API_ENDPOINT_RULES) ? '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Example").': endpoint1:1,endpoint2:1,...)</span>' : $conf->global->API_ENDPOINT_RULES)."<br>\n";
print '<br>';
}
}

View File

@ -1013,7 +1013,7 @@ class Setup extends DolibarrApi
$list[$tab->elementtype][$tab->name]['computed'] = $tab->fieldcomputed;
$list[$tab->elementtype][$tab->name]['unique'] = $tab->fieldunique;
$list[$tab->elementtype][$tab->name]['required'] = $tab->fieldrequired;
$list[$tab->elementtype][$tab->name]['param'] = ($tab->param ? unserialize($tab->param) : '');
$list[$tab->elementtype][$tab->name]['param'] = ($tab->param ? jsonOrUnserialize($tab->param) : ''); // This may be a string encoded with serialise() or json_encode()
$list[$tab->elementtype][$tab->name]['pos'] = $tab->pos;
$list[$tab->elementtype][$tab->name]['alwayseditable'] = $tab->alwayseditable;
$list[$tab->elementtype][$tab->name]['perms'] = $tab->perms;

View File

@ -777,10 +777,8 @@ class BlockedLog
public function dolDecodeBlockedData($data, $mode = 0)
{
try {
//include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
//include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$aaa = unserialize($data);
//$aaa = unserialize($data);
} catch (Exception $e) {
//print $e->getErrs);
}

View File

@ -532,10 +532,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
*/
if (!empty($object->table_element_line)) {
print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '#addline' : '').'" method="POST">
print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '' : '').'" method="POST">
<input type="hidden" name="token" value="' . newToken().'">
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'">
<input type="hidden" name="mode" value="">
<input type="hidden" name="page_y" value="">
<input type="hidden" name="id" value="' . $object->id.'">
';

View File

@ -83,6 +83,10 @@ foreach ($object->fields as $key => $val) {
if (GETPOST('search_'.$key, 'alpha') !== '') {
$search[$key] = GETPOST('search_'.$key, 'alpha');
}
if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
$search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int'));
$search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int'));
}
}
// List of fields to search into when doing a "search in all"
@ -104,7 +108,7 @@ foreach ($object->fields as $key => $val) {
'checked'=>(($visible < 0) ? 0 : 1),
'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)),
'position'=>$val['position'],
'help'=>$val['help']
'help'=> isset($val['help']) ? $val['help'] : ''
);
}
}
@ -131,7 +135,8 @@ $result = restrictedArea($user, 'bom');
*/
if (GETPOST('cancel', 'alpha')) {
$action = 'list'; $massaction = '';
$action = 'list';
$massaction = '';
}
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
$massaction = '';
@ -151,6 +156,10 @@ if (empty($reshook)) {
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
foreach ($object->fields as $key => $val) {
$search[$key] = '';
if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
$search[$key.'_dtstart'] = '';
$search[$key.'_dtend'] = '';
}
}
$toselect = array();
$search_array_options = array();
@ -277,18 +286,18 @@ $now = dol_now();
$help_url = 'EN:Module_BOM';
$title = $langs->trans('ListOfBOMs');
$morejs = array();
$morecss = array();
// Build and execute select
// --------------------------------------------------------------------
$sql = 'SELECT ';
foreach ($object->fields as $key => $val) {
$sql .= 't.'.$key.', ';
}
$sql .= $object->getFieldList('t');
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : '');
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key.', ' : '');
}
}
// Add fields from hooks
@ -297,33 +306,52 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $obje
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql = preg_replace('/,\s*$/', '', $sql);
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
}
// Add table from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
if ($object->ismultientitymanaged == 1) {
$sql .= " WHERE t.entity IN (".getEntity($object->element).")";
} else {
$sql .= " WHERE 1 = 1";
}
foreach ($search as $key => $val) {
if ($key == 'status' && $search[$key] == -1) {
continue;
}
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
if (strpos($object->fields[$key]['type'], 'integer:') === 0) {
if ($search[$key] == '-1') {
$search[$key] = '';
if (array_key_exists($key, $object->fields)) {
if ($key == 'status' && $search[$key] == -1) {
continue;
}
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) {
if ($search[$key] == '-1' || $search[$key] === '0') {
$search[$key] = '';
}
$mode_search = 2;
}
if ($search[$key] != '') {
$sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
}
} else {
if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
$columnName=preg_replace('/(_dtstart|_dtend)$/', '', $key);
if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
if (preg_match('/_dtstart$/', $key)) {
$sql .= " AND t." . $columnName . " >= '" . $db->idate($search[$key]) . "'";
}
if (preg_match('/_dtend$/', $key)) {
$sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'";
}
}
}
$mode_search = 2;
}
if ($search[$key] != '') {
$sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
}
}
if ($search_all) {
$sql .= natural_search(array_keys($fieldstosearchall), $search_all);
}
//$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
// Add where from hooks
@ -332,7 +360,7 @@ $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $objec
$sql .= $hookmanager->resPrint;
/* If a group by is required
$sql.= " GROUP BY "
$sql.= " GROUP BY ";
foreach($object->fields as $key => $val)
{
$sql.='t.'.$key.', ';
@ -345,7 +373,7 @@ if (! empty($extrafields->attributes[$object->table_element]['label'])) {
}
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
$reshook=$hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql=preg_replace('/,\s*$/','', $sql);
*/
@ -391,7 +419,7 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
// Output page
// --------------------------------------------------------------------
llxHeader('', $title, $help_url);
llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', '');
$arrayofselected = is_array($toselect) ? $toselect : array();
@ -416,6 +444,10 @@ if ($optioncss != '') {
}
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
// Add $param from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
$param .= $hookmanager->resPrint;
// List of mass actions available
$arrayofmassactions = array(
@ -431,7 +463,7 @@ if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'pr
}
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
}
@ -440,11 +472,12 @@ print '<input type="hidden" name="formfilteraction" id="formfilteraction" value=
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bom/bom_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $user->rights->bom->write);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bom', 0, $newcardbutton, '', $limit, 0, 0, 1);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
// Add code for pre mass action (confirmation or email presend form)
$topicmail = "SendBillOfMaterialsRef";
@ -504,11 +537,18 @@ foreach ($object->fields as $key => $val) {
if (!empty($arrayfields['t.'.$key]['checked'])) {
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
} elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth125', 1);
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) {
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth125', 1);
} elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
} elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
print '<div class="nowrap">';
print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
print '</div>';
print '<div class="nowrap">';
print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
print '</div>';
}
print '</td>';
}
@ -559,7 +599,7 @@ print '</tr>'."\n";
// Detect if we need a fetch on each output line
$needToFetchEachLine = 0;
if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
if (preg_match('/\$object/', $val)) {
$needToFetchEachLine++; // There is at least one compute field that use $object
@ -572,6 +612,7 @@ if (is_array($extrafields->attributes[$object->table_element]['computed']) && co
// --------------------------------------------------------------------
$i = 0;
$totalarray = array();
$totalarray['nbfield'] = 0;
while ($i < ($limit ? min($num, $limit) : $num)) {
$obj = $db->fetch_object($resql);
if (empty($obj)) {
@ -597,17 +638,16 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
}
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status' && empty($val['arrayofkeyval'])) {
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) {
$cssforfield .= ($cssforfield ? ' ' : '').'right';
}
if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) {
$cssforfield = 'tdoverflowmax100';
}
if (!empty($arrayfields['t.'.$key]['checked'])) {
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
if ($key == 'status') {
print $object->getLibStatut(5);
} elseif ($key == 'rowid') {
print $object->showOutputField($val, $key, $object->id, '');
} else {
print $object->showOutputField($val, $key, $object->$key, '');
}

View File

@ -97,23 +97,23 @@ class BOM extends CommonObject
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",),
'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>5),
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'noteditable'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'2', 'autofocusoncreate'=>1),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'2', 'autofocusoncreate'=>1, 'css'=>'maxwidth300', 'csslist'=>'tdoverflowmax200'),
'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassemble'), 'css'=>'minwidth150', 'csslist'=>'minwidth150 center'),
//'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'position'=>32, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing')),
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1:(finished IS NULL or finished <> 0)', 'label'=>'Product', 'picto'=>'product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp', 'css'=>'maxwidth500'),
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1:(finished IS NULL or finished <> 0)', 'label'=>'Product', 'picto'=>'product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax100'),
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,),
'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1', 'css'=>'maxwidth75imp'),
//'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>-1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLossForProductProduced'),
'duration' => array('type'=>'duration', 'label'=>'EstimatedDuration', 'enabled'=>1, 'visible'=>-1, 'position'=>101, 'notnull'=>-1, 'css'=>'maxwidth50imp', 'help'=>'EstimatedDurationDesc'),
'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:0', 'label'=>'WarehouseForProduction', 'picto'=>'stock', 'enabled'=>1, 'visible'=>-1, 'position'=>102, 'css'=>'maxwidth500'),
'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:0', 'label'=>'WarehouseForProduction', 'picto'=>'stock', 'enabled'=>1, 'visible'=>-1, 'position'=>102, 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax100'),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>-2, 'position'=>161, 'notnull'=>-1,),
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>-2, 'position'=>162, 'notnull'=>-1,),
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>300, 'notnull'=>1,),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>1,),
'date_valid' => array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>502, 'notnull'=>0,),
'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserCreation', 'picto'=>'user', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'user.rowid',),
'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'picto'=>'user', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1,),
'fk_user_valid' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'picto'=>'user', 'enabled'=>1, 'visible'=>-2, 'position'=>512, 'notnull'=>0,),
'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserCreation', 'picto'=>'user', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'user.rowid', 'csslist'=>'tdoverflowmax100'),
'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'picto'=>'user', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1, 'csslist'=>'tdoverflowmax100'),
'fk_user_valid' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'picto'=>'user', 'enabled'=>1, 'visible'=>-2, 'position'=>512, 'notnull'=>0, 'csslist'=>'tdoverflowmax100'),
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,),
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>1010),
'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>2, 'position'=>1000, 'notnull'=>1, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Enabled', 9=>'Disabled')),
@ -786,6 +786,9 @@ class BOM extends CommonObject
}
$label .= '<br>';
$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
if (isset($this->label)) {
$label .= '<br><b>'.$langs->trans('Label').':</b> '.$this->label;
}
$url = DOL_URL_ROOT.'/bom/bom_card.php?id='.$this->id;

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
* Copyright (C) 2006-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006-2021 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
@ -257,6 +257,7 @@ if ($user->rights->categorie->creer) {
// Parent category
print '<tr><td>'.$langs->trans("AddIn").'</td><td>';
print img_picto($langs->trans("ParentCategory"), 'category', 'class="pictofixedwidth"');
print $form->select_all_categories($type, $catorigin, 'parent');
print ajax_combobox('parent');
print '</td></tr>';

View File

@ -138,16 +138,18 @@ if (empty($action) && !GETPOSTISSET('action')) {
if ($action == 'default') { // When action is default, we want a calendar view and not the list
$action = (($defaultview != 'show_list') ? $defaultview : 'show_month');
}
if (GETPOST('viewcal', 'restricthtml') && GETPOST('action', 'alpha') != 'show_day' && GETPOST('action', 'alpha') != 'show_week') {
if (GETPOST('viewcal', 'int') && GETPOST('action', 'alpha') != 'show_day' && GETPOST('action', 'alpha') != 'show_week') {
$action = 'show_month'; $day = '';
} // View by month
if (GETPOST('viewweek', 'restricthtml') || GETPOST('action', 'alpha') == 'show_week') {
if (GETPOST('viewweek', 'int') || GETPOST('action', 'alpha') == 'show_week') {
$action = 'show_week'; $week = ($week ? $week : date("W")); $day = ($day ? $day : date("d"));
} // View by week
if (GETPOST('viewday', 'restricthtml') || GETPOST('action', 'alpha') == 'show_day') {
if (GETPOST('viewday', 'int') || GETPOST('action', 'alpha') == 'show_day') {
$action = 'show_day'; $day = ($day ? $day : date("d"));
} // View by day
$object = new ActionComm($db);
// Load translation files required by the page
$langs->loadLangs(array('agenda', 'other', 'commercial'));
@ -197,6 +199,7 @@ if (GETPOST("viewperuser", 'alpha') || $action == 'show_peruser') {
exit;
}
/*
if ($action == 'delete_action') {
$event = new ActionComm($db);
$event->fetch($actionid);
@ -206,6 +209,7 @@ if ($action == 'delete_action') {
$result = $event->delete();
}
*/
/*
@ -484,25 +488,25 @@ $viewmode .= img_picto($langs->trans("List"), 'object_list', 'class="pictoaction
//$viewmode .= '</span>';
$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewList").'</span></a>';
$viewmode .= '<a class="btnTitle'.($action == 'show_month' ? ' btnTitleSelected' : '').' reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">';
$viewmode .= '<a class="btnTitle'.($action == 'show_month' ? ' btnTitleSelected' : '').' reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.(isset($object->datep) ? dol_print_date($object->datep, '%Y') : $year).'&month='.(isset($object->datep) ? dol_print_date($object->datep, '%m') : $month).'&day='.(isset($object->datep) ? dol_print_date($object->datep, '%d') : $day).$paramnoactionodate.'">';
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
$viewmode .= img_picto($langs->trans("ViewCal"), 'object_calendarmonth', 'class="pictoactionview block"');
//$viewmode .= '</span>';
$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewCal").'</span></a>';
$viewmode .= '<a class="btnTitle'.($action == 'show_week' ? ' btnTitleSelected' : '').' reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_week&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">';
$viewmode .= '<a class="btnTitle'.($action == 'show_week' ? ' btnTitleSelected' : '').' reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_week&year='.(isset($object->datep) ? dol_print_date($object->datep, '%Y') : $year).'&month='.(isset($object->datep) ? dol_print_date($object->datep, '%m') : $month).'&day='.(isset($object->datep) ? dol_print_date($object->datep, '%d') : $day).$paramnoactionodate.'">';
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
$viewmode .= img_picto($langs->trans("ViewWeek"), 'object_calendarweek', 'class="pictoactionview block"');
//$viewmode .= '</span>';
$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewWeek").'</span></a>';
$viewmode .= '<a class="btnTitle'.($action == 'show_day' ? ' btnTitleSelected' : '').' reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">';
$viewmode .= '<a class="btnTitle'.($action == 'show_day' ? ' btnTitleSelected' : '').' reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.(isset($object->datep) ? dol_print_date($object->datep, '%Y') : $year).'&month='.(isset($object->datep) ? dol_print_date($object->datep, '%m') : $month).'&day='.(isset($object->datep) ? dol_print_date($object->datep, '%d') : $day).$paramnoactionodate.'">';
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
$viewmode .= img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="pictoactionview block"');
//$viewmode .= '</span>';
$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewDay").'</span></a>';
$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/peruser.php?action=show_peruser&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">';
$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/peruser.php?action=show_peruser&year='.(isset($object->datep) ? dol_print_date($object->datep, '%Y') : $year).'&month='.(isset($object->datep) ? dol_print_date($object->datep, '%m') : $month).'&day='.(isset($object->datep) ? dol_print_date($object->datep, '%d') : $day).$paramnoactionodate.'">';
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
$viewmode .= img_picto($langs->trans("ViewPerUser"), 'object_calendarperuser', 'class="pictoactionview block"');
//$viewmode .= '</span>';
@ -939,6 +943,7 @@ if ($showbirthday) {
}
}
// LEAVE CALENDAR
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.statut, x.rowid, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.statut as status";
$sql .= " FROM ".MAIN_DB_PREFIX."holiday as x, ".MAIN_DB_PREFIX."user as u";
$sql .= " WHERE u.rowid = x.fk_user";
@ -1877,7 +1882,8 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
$cacheusers[$tmpid] = $newuser;
}
$listofusertoshow .= '<br>'.$cacheusers[$tmpid]->getNomUrl(-3, '', 0, 0, 0, 0, '', 'paddingright valigntextbottom');
$listofusertoshow = '';
$listofusertoshow .= '<br>'.$cacheusers[$tmpid]->getNomUrl(-1, '', 0, 0, 0, 0, '', 'paddingright valigntextbottom');
print $listofusertoshow;
} else { // Other calendar
// Picto

View File

@ -577,7 +577,6 @@ if (empty($reshook)) {
if (!$isupload) {
$mesgs = array();
$object->sujet = (string) GETPOST("sujet");
$object->body = (string) GETPOST("bodyemail", 'restricthtml');
$object->bgcolor = (string) GETPOST("bgcolor");
@ -744,7 +743,7 @@ if ($action == 'create') {
print '<div style="padding-top: 10px">';
// wysiwyg editor
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('bodyemail', GETPOST('bodyemail', 'restricthtml'), '', 600, 'dolibarr_mailings', '', true, true, $conf->global->FCKEDITOR_ENABLE_MAILING, 20, '90%');
$doleditor = new DolEditor('bodyemail', GETPOST('bodyemail', 'restricthtmlallowunvalid'), '', 600, 'dolibarr_mailings', '', true, true, $conf->global->FCKEDITOR_ENABLE_MAILING, 20, '90%');
$doleditor->Create();
print '</div>';

View File

@ -208,6 +208,12 @@ class Mailing extends CommonObject
{
global $conf, $langs;
// Check properties
if ($this->body === 'InvalidHTMLString') {
$this->error = 'InvalidHTMLString';
return -1;
}
$this->db->begin();
$this->title = trim($this->title);
@ -257,6 +263,12 @@ class Mailing extends CommonObject
*/
public function update($user)
{
// Check properties
if ($this->body === 'InvalidHTMLString') {
$this->error = 'InvalidHTMLString';
return -1;
}
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing ";
$sql .= " SET titre = '".$this->db->escape($this->title)."'";
$sql .= ", sujet = '".$this->db->escape($this->sujet)."'";

View File

@ -843,16 +843,16 @@ if (empty($reshook)) {
}
}
if ($prod_entry_mode == 'free' && empty($idprod) && GETPOST('type') < 0) {
if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && GETPOST('type') < 0) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
$error++;
}
if ($prod_entry_mode == 'free' && empty($idprod) && $price_ht === '' && $price_ht_devise === '') { // Unit price can be 0 but not ''. Also price can be negative for proposal.
if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && $price_ht === '' && $price_ht_devise === '') { // Unit price can be 0 but not ''. Also price can be negative for proposal.
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
$error++;
}
if ($prod_entry_mode == 'free' && empty($idprod) && empty($product_desc)) {
if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && empty($product_desc)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description")), null, 'errors');
$error++;
}
@ -871,7 +871,7 @@ if (empty($reshook)) {
}
}
if (!$error && ($qty >= 0) && (!empty($product_desc) || !empty($idprod))) {
if (!$error && ($qty >= 0) && (!empty($product_desc) || (!empty($idprod) && $idprod > 0))) {
$pu_ht = 0;
$pu_ttc = 0;
$price_min = 0;
@ -885,7 +885,7 @@ if (empty($reshook)) {
// Ecrase $desc par celui du produit
// Ecrase $tva_tx par celui du produit
// Replaces $fk_unit with the product unit
if (!empty($idprod)) {
if (!empty($idprod) && $idprod > 0) {
$prod = new Product($db);
$prod->fetch($idprod);
@ -2450,10 +2450,11 @@ if ($action == 'create') {
// Show object lines
$result = $object->getLinesArray();
print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '#addline' : '#line_'.GETPOST('lineid', 'int')).'" method="POST">
print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '' : '#line_'.GETPOST('lineid', 'int')).'" method="POST">
<input type="hidden" name="token" value="' . newToken().'">
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'">
<input type="hidden" name="mode" value="">
<input type="hidden" name="page_y" value="">
<input type="hidden" name="id" value="' . $object->id.'">
';
@ -2594,9 +2595,14 @@ if ($action == 'create') {
}
// Close as accepted/refused
if ($object->statut == Propal::STATUS_VALIDATED && $usercanclose) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=closeas'.(empty($conf->global->MAIN_JUMP_TAG) ? '' : '#close').'"';
print '>'.$langs->trans('SetAcceptedRefused').'</a>';
if ($object->statut == Propal::STATUS_VALIDATED) {
if ($usercanclose) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=closeas'.(empty($conf->global->MAIN_JUMP_TAG) ? '' : '#close').'"';
print '>'.$langs->trans('SetAcceptedRefused').'</a>';
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotEnoughPermissions").'"';
print '>'.$langs->trans('SetAcceptedRefused').'</a>';
}
}
// Clone

View File

@ -605,7 +605,7 @@ class Propal extends CommonObject
$this->db->begin();
$product_type = $type;
if (!empty($fk_product)) {
if (!empty($fk_product) && $fk_product > 0) {
$product = new Product($this->db);
$result = $product->fetch($fk_product);
$product_type = $product->type;

View File

@ -220,17 +220,16 @@ $permissiontoread = $user->rights->propal->lire;
$permissiontoadd = $user->rights->propal->creer;
$permissiontodelete = $user->rights->propal->supprimer;
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
$permissiontovalidate = $user->rights->propale->propal_advance->validate;
$permissiontoclose = $user->rights->propale->propal_advance->close;
$permissiontosendbymail = $user->rights->propale->propal_advance->send;
$permissiontovalidate = $user->rights->propal->propal_advance->validate;
$permissiontoclose = $user->rights->propal->propal_advance->close;
$permissiontosendbymail = $user->rights->propal->propal_advance->send;
} else {
$permissiontovalidate = $user->rights->propal->creer;
$permissiontoclose = $user->rights->propal->creer;
$permissiontosendbymail = $user->rights->propal->lire;
}
/*
* Actions
*/

View File

@ -645,15 +645,15 @@ if (empty($reshook)) {
}
}
if (empty($idprod) && ($price_ht < 0) && ($qty < 0)) {
if ((empty($idprod) || $idprod < 0) && ($price_ht < 0) && ($qty < 0)) {
setEventMessages($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), null, 'errors');
$error++;
}
if ($prod_entry_mode == 'free' && empty($idprod) && GETPOST('type') < 0) {
if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && GETPOST('type') < 0) {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
$error++;
}
if ($prod_entry_mode == 'free' && empty($idprod) && $price_ht == '' && $price_ht_devise == '') { // Unit price can be 0 but not ''. Also price can be negative for order.
if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && $price_ht == '' && $price_ht_devise == '') { // Unit price can be 0 but not ''. Also price can be negative for order.
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
$error++;
}
@ -661,7 +661,7 @@ if (empty($reshook)) {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors');
$error++;
}
if ($prod_entry_mode == 'free' && empty($idprod) && empty($product_desc)) {
if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && empty($product_desc)) {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), null, 'errors');
$error++;
}
@ -680,7 +680,7 @@ if (empty($reshook)) {
}
}
if (!$error && ($qty >= 0) && (!empty($product_desc) || !empty($idprod))) {
if (!$error && ($qty >= 0) && (!empty($product_desc) || (!empty($idprod) && $idprod > 0))) {
// Clean parameters
$date_start = dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year'));
$date_end = dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year'));
@ -690,7 +690,7 @@ if (empty($reshook)) {
// Ecrase $desc par celui du produit
// Ecrase $tva_tx par celui du produit
// Ecrase $base_price_type par celui du produit
if (!empty($idprod)) {
if (!empty($idprod) && $idprod > 0) {
$prod = new Product($db);
$prod->fetch($idprod);
@ -2417,10 +2417,11 @@ if ($action == 'create' && $usercancreate) {
*/
$result = $object->getLinesArray();
print '<form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '#addline' : '#line_'.GETPOST('lineid', 'int')).'" method="POST">
print '<form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '' : '#line_'.GETPOST('lineid', 'int')).'" method="POST">
<input type="hidden" name="token" value="' . newToken().'">
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'">
<input type="hidden" name="mode" value="">
<input type="hidden" name="page_y" value="">
<input type="hidden" name="id" value="' . $object->id.'">';
if (!empty($conf->use_javascript_ajax) && $object->statut == Commande::STATUS_DRAFT) {

View File

@ -1518,7 +1518,7 @@ class Commande extends CommonOrder
$this->db->begin();
$product_type = $type;
if (!empty($fk_product)) {
if (!empty($fk_product) && $fk_product > 0) {
$product = new Product($this->db);
$result = $product->fetch($fk_product);
$product_type = $product->type;
@ -4389,7 +4389,7 @@ class OrderLine extends CommonOrderLine
$sql .= " '".price2num($this->localtax2_tx)."',";
$sql .= " '".$this->db->escape($this->localtax1_type)."',";
$sql .= " '".$this->db->escape($this->localtax2_type)."',";
$sql .= ' '.(!empty($this->fk_product) ? $this->fk_product : "null").',';
$sql .= ' '.((!empty($this->fk_product) && $this->fk_product > 0) ? $this->fk_product : "null").',';
$sql .= " '".$this->db->escape($this->product_type)."',";
$sql .= " '".price2num($this->remise_percent)."',";
$sql .= " ".(price2num($this->subprice) !== '' ?price2num($this->subprice) : "null").",";

View File

@ -494,7 +494,7 @@ if ($search_billed != '' && $search_billed >= 0) {
$sql .= ' AND c.facture = '.((int) $search_billed);
}
if ($search_status <> '') {
if ($search_status < 4 && $search_status > -3) {
if ($search_status < 4 && $search_status > -4) {
if ($search_status == 1 && empty($conf->expedition->enabled)) {
$sql .= ' AND c.fk_statut IN (1,2)'; // If module expedition disabled, we include order with status 'sending in process' into 'validated'
} else {
@ -513,6 +513,11 @@ if ($search_status <> '') {
//$sql.= ' AND c.facture = 0'; // invoice not created
$sql .= ' AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))'; // validated, in process or closed but not billed
}
if ($search_status == -4) { // "validate and in progress"
$sql .= ' AND (c.fk_statut IN (1,2))'; // validated, in process
}
}
if ($search_datecloture_start) {
@ -675,6 +680,9 @@ if ($resql) {
if ($search_status == -3) {
$title .= ' - '.$langs->trans('StatusOrderValidated').', '.(empty($conf->expedition->enabled) ? '' : $langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill');
}
if ($search_status == -4) {
$title .= ' - '.$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort");
}
$num = $db->num_rows($resql);
@ -1236,6 +1244,7 @@ if ($resql) {
Commande::STATUS_SHIPMENTONPROCESS=>$langs->trans("StatusOrderSentShort"),
Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"),
-3=>$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort").'+'.$langs->trans("StatusOrderDelivered"),
-4=>$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort"),
Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceledShort")
);
print $form->selectarray('search_status', $liststatus, $search_status, -4, 0, 0, '', 0, 0, 0, '', 'maxwidth100', 1);

View File

@ -399,7 +399,8 @@ if ($action == 'create') {
// State
print '<tr><td>'.$langs->trans('State').'</td><td>';
if ($selectedcode) {
$formcompany->select_departement(GETPOSTISSET("account_state_id") ? GETPOST("account_state_id") : '', $selectedcode, 'account_state_id');
print img_picto('', 'state', 'class="pictofixedwidth"');
print $formcompany->select_state(GETPOSTISSET("account_state_id") ? GETPOST("account_state_id") : '', $selectedcode, 'account_state_id');
} else {
print $countrynotdefined;
}
@ -407,7 +408,10 @@ if ($action == 'create') {
// Web
print '<tr><td>'.$langs->trans("Web").'</td>';
print '<td><input class="minwidth300" type="text" class="flat" name="url" value="'.GETPOST("url").'"></td></tr>';
print '<td>';
print img_picto('', 'globe', 'class="pictofixedwidth"');
print '<input class="minwidth300" type="text" class="flat" name="url" value="'.GETPOST("url").'">';
print '</td></tr>';
// Tags-Categories
if ($conf->categorie->enabled) {
@ -865,6 +869,7 @@ if ($action == 'create') {
if (!$selectedcode) {
$selectedcode = $conf->currency;
}
print img_picto('', 'multicurrency', 'class="pictofixedwidth"');
print $form->selectCurrency((GETPOSTISSET("account_currency_code") ? GETPOST("account_currency_code") : $selectedcode), 'account_currency_code');
//print $langs->trans("Currency".$conf->currency);
//print '<input type="hidden" name="account_currency_code" value="'.$conf->currency.'">';
@ -897,6 +902,7 @@ if ($action == 'create') {
// State
print '<tr><td>'.$langs->trans('State').'</td><td class="maxwidth200onsmartphone">';
if ($selectedcode) {
print img_picto('', 'state', 'class="pictofixedwidth"');
print $formcompany->select_state(GETPOSTISSET("account_state_id") ? GETPOST("account_state_id") : $object->state_id, $selectedcode, 'account_state_id');
} else {
print $countrynotdefined;
@ -925,7 +931,9 @@ if ($action == 'create') {
// Web
print '<tr><td>'.$langs->trans("Web").'</td>';
print '<td><input class="maxwidth200onsmartphone" type="text" class="flat" name="url" value="'.(GETPOSTISSET("url") ? GETPOST("url") : $object->url).'">';
print '<td>';
print img_picto('', 'globe', 'class="pictofixedwidth"');
print '<input class="maxwidth200onsmartphone" type="text" class="flat" name="url" value="'.(GETPOSTISSET("url") ? GETPOST("url") : $object->url).'">';
print '</td></tr>';
// Tags-Categories

View File

@ -829,8 +829,8 @@ class Account extends CommonObject
$sql .= ",min_desired = ".($this->min_desired != '' ? price2num($this->min_desired) : "null");
$sql .= ",comment = '".$this->db->escape($this->comment)."'";
$sql .= ",state_id = ".($this->state_id > 0 ? $this->state_id : "null");
$sql .= ",fk_pays = ".($this->country_id > 0 ? $this->country_id : "null");
$sql .= ",state_id = ".($this->state_id > 0 ? ((int) $this->state_id) : "null");
$sql .= ",fk_pays = ".($this->country_id > 0 ? ((int) $this->country_id) : "null");
$sql .= ",ics = '".$this->db->escape($this->ics)."'";
$sql .= ",ics_transfer = '".$this->db->escape($this->ics_transfer)."'";

View File

@ -564,7 +564,7 @@ foreach ($accounts as $key => $type) {
// Account number
if (!empty($arrayfields['b.account_number']['checked'])) {
print '<td class="tdoverflowmax300">';
print '<td class="tdoverflowmax250">';
if (!empty($conf->accounting->enabled) && !empty($objecttmp->account_number)) {
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch('', $objecttmp->account_number, 1);

View File

@ -163,8 +163,8 @@ if (GETPOST("account") || GETPOST("ref")) {
$sqls[] = $sql;
// Social contributions
$sql = " SELECT 'social_contribution' as family, cs.rowid as objid, cs.libelle as ref, (-1*cs.amount) as total_ttc, ccs.libelle as type, cs.date_ech as dlr";
$sql .= ", cs.fk_account";
$sql = " SELECT 'social_contribution' as family, cs.rowid as objid, cs.libelle as ref, (-1*cs.amount) as total_ttc, ccs.libelle as type, cs.date_ech as dlr,";
$sql .= " 0 as socid, 'noname' as name, 0 as fournisseur";
$sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as cs";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as ccs ON cs.fk_type = ccs.id";
$sql .= " WHERE cs.entity = ".$conf->entity;
@ -188,7 +188,18 @@ if (GETPOST("account") || GETPOST("ref")) {
$resql = $db->query($sql);
if ($resql) {
while ($sqlobj = $db->fetch_object($resql)) {
$tab_sqlobj[] = $sqlobj;
$tmpobj = new stdClass();
$tmpobj->family = $sqlobj->family;
$tmpobj->objid = $sqlobj->objid;
$tmpobj->ref = $sqlobj->ref;
$tmpobj->total_ttc = $sqlobj->total_ttc;
$tmpobj->type = $sqlobj->type;
$tmpobj->dlt = $sqlobj->dlr;
$tmpobj->socid = $sqlobj->socid;
$tmpobj->name = $sqlobj->name;
$tmpobj->fournisseur = $sqlobj->fournisseur;
$tab_sqlobj[] = $tmpobj;
$tab_sqlobjOrder[] = $db->jdate($sqlobj->dlr);
}
$db->free($resql);
@ -201,15 +212,6 @@ if (GETPOST("account") || GETPOST("ref")) {
if (!$error) {
array_multisort($tab_sqlobjOrder, $tab_sqlobj);
// Apply distinct filter
foreach ($tab_sqlobj as $key => $value) {
$tab_sqlobj[$key] = "'".serialize($value)."'";
}
$tab_sqlobj = array_unique($tab_sqlobj);
foreach ($tab_sqlobj as $key => $value) {
$tab_sqlobj[$key] = unserialize(trim($value, "'"));
}
$num = count($tab_sqlobj);
$i = 0;

View File

@ -131,7 +131,7 @@ foreach ($object->fields as $key => $val) {
'checked'=>(($visible < 0) ? 0 : 1),
'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)),
'position'=>$val['position'],
'help'=>$val['help']
'help'=> isset($val['help']) ? $val['help'] : ''
);
}
}

View File

@ -447,15 +447,15 @@ if (empty($reshook)) {
}
}
if (empty($idprod) && ($price_ht < 0) && ($qty < 0)) {
if ((empty($idprod) || $idprod < 0) && ($price_ht < 0) && ($qty < 0)) {
setEventMessages($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), null, 'errors');
$error++;
}
if ($prod_entry_mode == 'free' && empty($idprod) && GETPOST('type') < 0) {
if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && GETPOST('type') < 0) {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
$error++;
}
if ($prod_entry_mode == 'free' && empty($idprod) && (!($price_ht >= 0) || $price_ht == '')) { // Unit price can be 0 but not ''
if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && (!($price_ht >= 0) || $price_ht == '')) { // Unit price can be 0 but not ''
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
$error++;
}
@ -463,7 +463,7 @@ if (empty($reshook)) {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors');
$error++;
}
if ($prod_entry_mode == 'free' && empty($idprod) && empty($product_desc)) {
if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && empty($product_desc)) {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), null, 'errors');
$error++;
}
@ -473,7 +473,7 @@ if (empty($reshook)) {
$error++;
}
if (!$error && ($qty >= 0) && (!empty($product_desc) || !empty($idprod))) {
if (!$error && ($qty >= 0) && (!empty($product_desc) || (!empty($idprod) && $idprod > 0))) {
$ret = $object->fetch($id);
if ($ret < 0) {
dol_print_error($db, $object->error);
@ -495,7 +495,7 @@ if (empty($reshook)) {
// Ecrase $tva_tx par celui du produit
// Ecrase $base_price_type par celui du produit
// Replaces $fk_unit with the product's
if (!empty($idprod)) {
if (!empty($idprod) && $idprod > 0) {
$prod = new Product($db);
$prod->fetch($idprod);

View File

@ -2000,7 +2000,7 @@ if (empty($reshook)) {
}
}
if (empty($idprod) && ($price_ht < 0) && ($qty < 0)) {
if ((empty($idprod) || $idprod < 0) && ($price_ht < 0) && ($qty < 0)) {
setEventMessages($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), null, 'errors');
$error++;
}
@ -2010,11 +2010,11 @@ if (empty($reshook)) {
$error++;
}
}
if ($prod_entry_mode == 'free' && empty($idprod) && GETPOST('type') < 0) {
if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && GETPOST('type') < 0) {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
$error++;
}
if (($prod_entry_mode == 'free' && empty($idprod) && (($price_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) || $price_ht == '') && $price_ht_devise == '') && $object->type != Facture::TYPE_CREDIT_NOTE) { // Unit price can be 0 but not ''
if (($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && (($price_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) || $price_ht == '') && $price_ht_devise == '') && $object->type != Facture::TYPE_CREDIT_NOTE) { // Unit price can be 0 but not ''
if ($price_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) {
$langs->load("errors");
if ($object->type == $object::TYPE_DEPOSIT) {
@ -2057,7 +2057,7 @@ if (empty($reshook)) {
}
}
if (!$error && ($qty >= 0) && (!empty($product_desc) || !empty($idprod))) {
if (!$error && ($qty >= 0) && (!empty($product_desc) || (!empty($idprod) && $idprod > 0))) {
$ret = $object->fetch($id);
if ($ret < 0) {
dol_print_error($db, $object->error);
@ -2079,7 +2079,7 @@ if (empty($reshook)) {
// Ecrase $tva_tx par celui du produit
// Ecrase $base_price_type par celui du produit
// Replaces $fk_unit with the product's
if (!empty($idprod)) {
if (!empty($idprod) && $idprod > 0) {
$prod = new Product($db);
$prod->fetch($idprod);
@ -3296,11 +3296,11 @@ if ($action == 'create') {
if (is_array($facids)) {
foreach ($facids as $facparam) {
$options .= '<option value="'.$facparam ['id'].'"';
if ($facparam ['id'] == $_POST['fac_replacement']) {
if ($facparam['id'] == GETPOST('fac_replacement', 'int')) {
$options .= ' selected';
}
$options .= '>'.$facparam ['ref'];
$options .= ' ('.$facturestatic->LibStatut(0, $facparam ['status']).')';
$options .= '>'.$facparam['ref'];
$options .= ' ('.$facturestatic->LibStatut($facparam['paid'], $facparam['status'], 0, $facparam['alreadypaid']).')';
$options .= '</option>';
}
}
@ -5195,10 +5195,11 @@ if ($action == 'create') {
}
}
print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '#addline' : '#line_'.GETPOST('lineid', 'int')).'" method="POST">
print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '' : '#line_'.GETPOST('lineid', 'int')).'" method="POST">
<input type="hidden" name="token" value="' . newToken().'">
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'">
<input type="hidden" name="mode" value="">
<input type="hidden" name="page_y" value="">
<input type="hidden" name="id" value="' . $object->id.'">
';
@ -5393,7 +5394,7 @@ if ($action == 'create') {
}
// Create a credit note
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut > 0 && $usercancreate) {
if (($object->type == Facture::TYPE_STANDARD || ($object->type == Facture::TYPE_DEPOSIT && empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) || $object->type == Facture::TYPE_PROFORMA) && $object->statut > 0 && $usercancreate) {
if (!$objectidnext) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?socid='.$object->socid.'&amp;fac_avoir='.$object->id.'&amp;action=create&amp;type=2'.($object->fk_project > 0 ? '&amp;projectid='.$object->fk_project : '').($object->entity > 0 ? '&amp;originentity='.$object->entity : '').'">'.$langs->trans("CreateCreditNote").'</a>';
}

View File

@ -3213,7 +3213,7 @@ class Facture extends CommonInvoice
$this->db->begin();
$product_type = $type;
if (!empty($fk_product)) {
if (!empty($fk_product) && $fk_product > 0) {
$product = new Product($this->db);
$result = $product->fetch($fk_product);
$product_type = $product->type;
@ -4090,8 +4090,8 @@ class Facture extends CommonInvoice
* Invoices matching the following rules are returned:
* (Status validated or abandonned for a reason 'other') + not payed + no payment at all + not already replaced
*
* @param int $socid Id thirdparty
* @return array|int Array of invoices ('id'=>id, 'ref'=>ref, 'status'=>status, 'paymentornot'=>0/1)
* @param int $socid Id thirdparty
* @return array|int Array of invoices ('id'=>id, 'ref'=>ref, 'status'=>status, 'paymentornot'=>0/1)
*/
public function list_replacable_invoices($socid = 0)
{
@ -4100,28 +4100,34 @@ class Facture extends CommonInvoice
$return = array();
$sql = "SELECT f.rowid as rowid, f.ref, f.fk_statut,";
$sql = "SELECT f.rowid as rowid, f.ref, f.fk_statut as status, f.paye as paid,";
$sql .= " ff.rowid as rowidnext";
//$sql .= ", SUM(pf.amount) as alreadypaid";
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid = pf.fk_facture";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as ff ON f.rowid = ff.fk_facture_source";
$sql .= " WHERE (f.fk_statut = ".self::STATUS_VALIDATED." OR (f.fk_statut = ".self::STATUS_ABANDONED." AND f.close_code = '".self::CLOSECODE_ABANDONED."'))";
$sql .= " AND f.entity IN (".getEntity('invoice').")";
$sql .= " AND f.paye = 0"; // Pas classee payee completement
$sql .= " AND pf.fk_paiement IS NULL"; // Aucun paiement deja fait
$sql .= " AND ff.fk_statut IS NULL"; // Renvoi vrai si pas facture de remplacement
$sql .= " AND f.paye = 0"; // Not paid completely
$sql .= " AND pf.fk_paiement IS NULL"; // No payment already done
$sql .= " AND ff.fk_statut IS NULL"; // Return true if it is not a replacement invoice
if ($socid > 0) {
$sql .= " AND f.fk_soc = ".((int) $socid);
}
//$sql .= " GROUP BY f.rowid, f.ref, f.fk_statut, f.paye, ff.rowid";
$sql .= " ORDER BY f.ref";
dol_syslog(get_class($this)."::list_replacable_invoices", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
while ($obj = $this->db->fetch_object($resql)) {
$return[$obj->rowid] = array('id' => $obj->rowid,
'ref' => $obj->ref,
'status' => $obj->fk_statut);
$return[$obj->rowid] = array(
'id' => $obj->rowid,
'ref' => $obj->ref,
'status' => $obj->status,
'paid' => $obj->paid,
'alreadypaid' => 0
);
}
//print_r($return);
return $return;
@ -5336,7 +5342,7 @@ class FactureLigne extends CommonInvoiceLine
$this->error = 'ErrorProductTypeMustBe0orMore';
return -1;
}
if (!empty($this->fk_product)) {
if (!empty($this->fk_product) && $this->fk_product > 0) {
// Check product exists
$result = Product::isExistingObject('product', $this->fk_product);
if ($result <= 0) {
@ -5371,7 +5377,7 @@ class FactureLigne extends CommonInvoiceLine
$sql .= " ".price2num($this->localtax2_tx).",";
$sql .= " '".$this->db->escape($this->localtax1_type)."',";
$sql .= " '".$this->db->escape($this->localtax2_type)."',";
$sql .= ' '.(!empty($this->fk_product) ? $this->fk_product : "null").',';
$sql .= ' '.((!empty($this->fk_product) && $this->fk_product > 0) ? $this->fk_product : "null").',';
$sql .= " ".((int) $this->product_type).",";
$sql .= " ".price2num($this->remise_percent).",";
$sql .= " ".price2num($this->subprice).",";

View File

@ -260,13 +260,13 @@ class Cchargesociales
// Update request
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET';
$sql .= ' libelle = '.(isset($this->libelle) ? "'".$this->db->escape($this->libelle)."'" : "null").',';
$sql .= ' deductible = '.(isset($this->deductible) ? $this->deductible : "null").',';
$sql .= ' active = '.(isset($this->active) ? $this->active : "null").',';
$sql .= ' deductible = '.(isset($this->deductible) ? ((int) $this->deductible) : "null").',';
$sql .= ' active = '.(isset($this->active) ? ((int) $this->active) : "null").',';
$sql .= ' code = '.(isset($this->code) ? "'".$this->db->escape($this->code)."'" : "null").',';
$sql .= ' fk_pays = '.(isset($this->fk_pays) ? $this->fk_pays : "null").',';
$sql .= ' fk_pays = '.((isset($this->fk_pays) && $this->fk_pays > 0) ? ((int) $this->fk_pays) : "null").',';
$sql .= ' module = '.(isset($this->module) ? "'".$this->db->escape($this->module)."'" : "null").',';
$sql .= ' accountancy_code = '.(isset($this->accountancy_code) ? "'".$this->db->escape($this->accountancy_code)."'" : "null");
$sql .= ' WHERE id='.$this->id;
$sql .= ' WHERE id='.((int) $this->id);
$this->db->begin();

View File

@ -30,8 +30,6 @@ print load_fiche_titre($this->control->tpl['title']);
dol_htmloutput_errors((is_numeric($object->error) ? '' : $object->error), $object->errors);
dol_htmloutput_errors((is_numeric($GLOBALS['error']) ? '' : $GLOBALS['error']), $GLOBALS['errors']);
dol_htmloutput_errors($this->control->tpl['error'], $this->control->tpl['errors']);
echo $this->control->tpl['ajax_selectcountry']; ?>

View File

@ -726,6 +726,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
if ($object->country_id) {
print img_picto('', 'state', 'class="pictofixedwidth"');
print $formcompany->select_state(GETPOST("state_id", 'alpha') ? GETPOST("state_id", 'alpha') : $object->state_id, $object->country_code, 'state_id');
} else {
print $countrynotdefined;
@ -1019,6 +1020,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<tr><td><label for="state_id">'.$langs->trans('State').'</label></td><td colspan="3" class="maxwidthonsmartphone">';
}
print img_picto('', 'state', 'class="pictofixedwidth"');
print $formcompany->select_state(GETPOSTISSET('state_id') ? GETPOST('state_id', 'alpha') : $object->state_id, $object->country_code, 'state_id');
print '</td></tr>';
}

View File

@ -100,15 +100,15 @@ class Contact extends CommonObject
'firstname' =>array('type'=>'varchar(50)', 'label'=>'Firstname', 'enabled'=>1, 'visible'=>1, 'position'=>50, 'showoncombobox'=>1, 'searchall'=>1),
'address' =>array('type'=>'varchar(255)', 'label'=>'Address', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
'zip' =>array('type'=>'varchar(25)', 'label'=>'Zip', 'enabled'=>1, 'visible'=>1, 'position'=>60),
'town' =>array('type'=>'text', 'label'=>'Town', 'enabled'=>1, 'visible'=>1, 'position'=>65),
'town' =>array('type'=>'text', 'label'=>'Town', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
'fk_departement' =>array('type'=>'integer', 'label'=>'Fk departement', 'enabled'=>1, 'visible'=>3, 'position'=>70),
'fk_pays' =>array('type'=>'integer', 'label'=>'Fk pays', 'enabled'=>1, 'visible'=>3, 'position'=>75),
'birthday' =>array('type'=>'date', 'label'=>'Birthday', 'enabled'=>1, 'visible'=>3, 'position'=>80),
'poste' =>array('type'=>'varchar(80)', 'label'=>'PostOrFunction', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
'phone' =>array('type'=>'varchar(30)', 'label'=>'Phone', 'enabled'=>1, 'visible'=>1, 'position'=>90, 'searchall'=>1),
'phone_perso' =>array('type'=>'varchar(30)', 'label'=>'PhonePerso', 'enabled'=>1, 'visible'=>1, 'position'=>95, 'searchall'=>1),
'phone_perso' =>array('type'=>'varchar(30)', 'label'=>'PhonePerso', 'enabled'=>1, 'visible'=>-1, 'position'=>95, 'searchall'=>1),
'phone_mobile' =>array('type'=>'varchar(30)', 'label'=>'PhoneMobile', 'enabled'=>1, 'visible'=>1, 'position'=>100, 'searchall'=>1),
'fax' =>array('type'=>'varchar(30)', 'label'=>'Fax', 'enabled'=>1, 'visible'=>1, 'position'=>105, 'searchall'=>1),
'fax' =>array('type'=>'varchar(30)', 'label'=>'Fax', 'enabled'=>1, 'visible'=>-1, 'position'=>105, 'searchall'=>1),
'email' =>array('type'=>'varchar(255)', 'label'=>'Email', 'enabled'=>1, 'visible'=>1, 'position'=>110, 'searchall'=>1),
'socialnetworks' =>array('type'=>'text', 'label'=>'SocialNetworks', 'enabled'=>1, 'visible'=>3, 'position'=>115),
'photo' =>array('type'=>'varchar(255)', 'label'=>'Photo', 'enabled'=>1, 'visible'=>3, 'position'=>170),

View File

@ -1097,28 +1097,28 @@ while ($i < min($num, $limit)) {
}
// Phone
if (!empty($arrayfields['p.phone']['checked'])) {
print '<td class="nowraponall">'.dol_print_phone($obj->phone_pro, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'phone').'</td>';
print '<td class="nowraponall tdoverflowmax150">'.dol_print_phone($obj->phone_pro, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'phone').'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Phone perso
if (!empty($arrayfields['p.phone_perso']['checked'])) {
print '<td class="nowraponall">'.dol_print_phone($obj->phone_perso, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'phone').'</td>';
print '<td class="nowraponall tdoverflowmax150">'.dol_print_phone($obj->phone_perso, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'phone').'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Phone mobile
if (!empty($arrayfields['p.phone_mobile']['checked'])) {
print '<td class="nowraponall">'.dol_print_phone($obj->phone_mobile, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'mobile').'</td>';
print '<td class="nowraponall tdoverflowmax150">'.dol_print_phone($obj->phone_mobile, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'mobile').'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Fax
if (!empty($arrayfields['p.fax']['checked'])) {
print '<td class="nowraponall">'.dol_print_phone($obj->fax, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'fax').'</td>';
print '<td class="nowraponall tdoverflowmax150">'.dol_print_phone($obj->fax, $obj->country_code, $obj->rowid, $obj->socid, 'AC_TEL', ' ', 'fax').'</td>';
if (!$i) {
$totalarray['nbfield']++;
}

View File

@ -386,7 +386,7 @@ if (empty($reshook)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Qty")), null, 'errors');
$error++;
}
if (GETPOST('prod_entry_mode', 'alpha') == 'free' && empty($idprod) && empty($product_desc)) {
if (GETPOST('prod_entry_mode', 'alpha') == 'free' && (empty($idprod) || $idprod < 0) && empty($product_desc)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description")), null, 'errors');
$error++;
}

View File

@ -69,20 +69,11 @@ class box_graph_nb_tickets_type extends ModeleBoxes
global $theme_datacolor, $badgeStatus8;
require_once DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php";
require_once DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/theme_vars.inc.php";
$badgeStatus0 = '#cbd3d3'; // draft
$badgeStatus1 = '#bc9526'; // validated
$badgeStatus1b = '#bc9526'; // validated
$badgeStatus2 = '#9c9c26'; // approved
$badgeStatus3 = '#bca52b';
$badgeStatus4 = '#25a580'; // Color ok
$badgeStatus4b = '#25a580'; // Color ok
$badgeStatus5 = '#cad2d2';
$badgeStatus6 = '#cad2d2';
$badgeStatus7 = '#baa32b';
$badgeStatus8 = '#993013';
$badgeStatus9 = '#e7f0f0';
$text = $langs->trans("BoxTicketType");
$this->info_box_head = array(
'text' => $text,

View File

@ -85,7 +85,7 @@ class box_scheduled_jobs extends ModeleBoxes
$resultarray = array();
$result = 0;
$sql = "SELECT t.rowid, t.datelastrun, t.datenextrun,";
$sql = "SELECT t.rowid, t.datelastrun, t.datenextrun, t.datestart,";
$sql .= " t.label, t.status, t.test, t.lastresult";
$sql .= " FROM " . MAIN_DB_PREFIX . "cronjob as t";
$sql .= " WHERE status <> ".$cronstatic::STATUS_DISABLED;

View File

@ -6254,10 +6254,12 @@ abstract class CommonObject
$this->array_options["options_".$key] = price2num($this->array_options["options_".$key]);
break;
case 'date':
$this->array_options["options_".$key] = $this->db->idate($this->array_options["options_".$key]);
break;
case 'datetime':
$this->array_options["options_".$key] = $this->db->idate($this->array_options["options_".$key]);
if (empty($this->array_options["options_".$key])) {
$this->array_options["options_".$key] = null;
} else {
$this->array_options["options_".$key] = $this->db->idate($this->array_options["options_".$key]);
}
break;
/*
case 'link':
@ -6305,7 +6307,11 @@ abstract class CommonObject
}
if ($linealreadyfound) {
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element."_extrafields SET ".$key." = '".$this->db->escape($this->array_options["options_".$key])."'";
if ($this->array_options["options_".$key] === null) {
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element."_extrafields SET ".$key." = null";
} else {
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element."_extrafields SET ".$key." = '".$this->db->escape($this->array_options["options_".$key])."'";
}
$sql .= " WHERE fk_object = ".$this->id;
} else {
$result = $this->insertExtraFields('', $user);
@ -7486,6 +7492,9 @@ abstract class CommonObject
if ($display_type == 'card') {
$out .= '<tr '.($html_id ? 'id="'.$html_id.'" ' : '').$csstyle.' class="valuefieldcreate '.$class.$this->element.'_extras_'.$key.' trextrafields_collapse'.$extrafields_collapse_num.(!empty($this->id)?'_'.$this->id:'').'" '.$domData.' >';
if ( ! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ) {
$out .= '<td></td>';
}
$out .= '<td class="wordbreak';
} elseif ($display_type == 'line') {
$out .= '<div '.($html_id ? 'id="'.$html_id.'" ' : '').$csstyle.' class="valuefieldlinecreate '.$class.$this->element.'_extras_'.$key.' trextrafields_collapse'.$extrafields_collapse_num.(!empty($this->id)?'_'.$this->id:'').'" '.$domData.' >';
@ -7711,7 +7720,7 @@ abstract class CommonObject
$buyPrice = $unitPrice * (1 - $discountPercent / 100);
} else {
// Get cost price for margin calculation
if (!empty($fk_product)) {
if (!empty($fk_product) && $fk_product > 0) {
if (isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == 'costprice') {
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
$product = new Product($this->db);
@ -8167,15 +8176,6 @@ abstract class CommonObject
} else {
$queryarray[$field] = $this->db->idate($this->{$field});
}
} elseif ($this->isArray($info)) {
if (!empty($this->{$field})) {
if (!is_array($this->{$field})) {
$this->{$field} = array($this->{$field});
}
$queryarray[$field] = serialize($this->{$field});
} else {
$queryarray[$field] = null;
}
} elseif ($this->isDuration($info)) {
// $this->{$field} may be null, '', 0, '0', 123, '123'
if ((isset($this->{$field}) && $this->{$field} != '') || !empty($info['notnull'])) {
@ -8236,16 +8236,6 @@ abstract class CommonObject
} else {
$this->{$field} = $db->jdate($obj->{$field});
}
} elseif ($this->isArray($info)) {
if (!empty($obj->{$field})) {
$this->{$field} = @unserialize($obj->{$field});
// Hack for data not in UTF8
if ($this->{$field } === false) {
@unserialize(utf8_decode($obj->{$field}));
}
} else {
$this->{$field} = array();
}
} elseif ($this->isInt($info)) {
if ($field == 'rowid') {
$this->id = (int) $obj->{$field};

View File

@ -596,7 +596,7 @@ class DolGraph
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Get max value
* Get max value among all values of all series
*
* @return int Max value
*/
@ -607,25 +607,26 @@ class DolGraph
return 0;
}
$k = 0;
$vals = array();
$max = null;
$nblines = count($this->data);
$nbvalues = (empty($this->data[0]) ? 0 : count($this->data[0]) - 1);
$nbseries = (empty($this->data[0]) ? 0 : count($this->data[0]) - 1);
for ($j = 0; $j < $nblines; $j++) {
for ($i = 0; $i < $nbvalues; $i++) {
$vals[$k] = $this->data[$j][$i + 1];
$k++;
foreach ($this->data as $x) { // Loop on each x
for ($i = 0; $i < $nbseries; $i++) { // Loop on each serie
if (is_null($max)) {
$max = $x[$i + 1]; // $i+1 because the index 0 is the legend
} elseif ($max < $x[$i + 1]) {
$max = $x[$i + 1];
}
}
}
rsort($vals);
return $vals[0];
return $max;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return min value of all data
* Return min value of all values of all series
*
* @return int Min value of all data
*/
@ -636,20 +637,21 @@ class DolGraph
return 0;
}
$k = 0;
$vals = array();
$min = null;
$nblines = count($this->data);
$nbvalues = (empty($this->data[0]) ? 0 : count($this->data[0]) - 1);
$nbseries = (empty($this->data[0]) ? 0 : count($this->data[0]) - 1);
for ($j = 0; $j < $nblines; $j++) {
for ($i = 0; $i < $nbvalues; $i++) {
$vals[$k] = $this->data[$j][$i + 1];
$k++;
foreach ($this->data as $x) { // Loop on each x
for ($i = 0; $i < $nbseries; $i++) { // Loop on each serie
if (is_null($min)) {
$min = $x[$i + 1]; // $i+1 because the index 0 is the legend
} elseif ($min > $x[$i + 1]) {
$min = $x[$i + 1];
}
}
}
sort($vals);
return $vals[0];
return $min;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps

View File

@ -390,7 +390,7 @@ class dolReceiptPrinter extends Printer
$error = 0;
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'printer_receipt';
$sql .= ' (name, fk_type, fk_profile, parameter, entity)';
$sql .= ' VALUES ("'.$this->db->escape($name).'", '.$type.', '.$profile.', "'.$this->db->escape($parameter).'", '.$conf->entity.')';
$sql .= ' VALUES ("'.$this->db->escape($name).'", '.((int) $type).', '.((int) $profile).', "'.$this->db->escape($parameter).'", '.$conf->entity.')';
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
@ -415,10 +415,10 @@ class dolReceiptPrinter extends Printer
$error = 0;
$sql = 'UPDATE '.MAIN_DB_PREFIX.'printer_receipt';
$sql .= ' SET name="'.$this->db->escape($name).'"';
$sql .= ', fk_type='.$type;
$sql .= ', fk_profile='.$profile;
$sql .= ', fk_type='.((int) $type);
$sql .= ', fk_profile='.((int) $profile);
$sql .= ', parameter="'.$this->db->escape($parameter).'"';
$sql .= ' WHERE rowid='.$printerid;
$sql .= ' WHERE rowid='.((int) $printerid);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
@ -438,7 +438,7 @@ class dolReceiptPrinter extends Printer
global $conf;
$error = 0;
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'printer_receipt';
$sql .= ' WHERE rowid='.$printerid;
$sql .= ' WHERE rowid='.((int) $printerid);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
@ -480,7 +480,7 @@ class dolReceiptPrinter extends Printer
global $conf;
$error = 0;
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'printer_receipt_template';
$sql .= " WHERE rowid = ".((int) $this->db->escape($templateid));
$sql .= " WHERE rowid = ".((int) $templateid);
$sql .= " AND entity = ".$conf->entity;
$resql = $this->db->query($sql);
if (!$resql) {
@ -505,7 +505,7 @@ class dolReceiptPrinter extends Printer
$sql = 'UPDATE '.MAIN_DB_PREFIX.'printer_receipt_template';
$sql .= ' SET name="'.$this->db->escape($name).'"';
$sql .= ', template="'.$this->db->escape($template).'"';
$sql .= ' WHERE rowid='.$templateid;
$sql .= ' WHERE rowid='.((int) $templateid);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
@ -524,6 +524,7 @@ class dolReceiptPrinter extends Printer
public function sendTestToPrinter($printerid)
{
global $conf;
$error = 0;
$img = EscposImage::load(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo_bw.png');
//$this->profile = CapabilityProfile::load("TM-T88IV");
@ -543,7 +544,7 @@ class dolReceiptPrinter extends Printer
// If is DummyPrintConnector send to log to debugging
if ($this->printer->connector instanceof DummyPrintConnector) {
$data = $this->printer->connector-> getData();
$data = $this->printer->connector->getData();
dol_syslog($data);
}
$this->printer->close();
@ -899,7 +900,7 @@ class dolReceiptPrinter extends Printer
public function initPrinter($printerid)
{
global $conf;
if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") {
if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") {
$this->connector = new DummyPrintConnector();
$this->printer = new Printer($this->connector, $this->profile);
return;
@ -934,8 +935,8 @@ class dolReceiptPrinter extends Printer
$parameters = explode(':', $parameter);
$this->connector = new NetworkPrintConnector($parameters[0], $parameters[1]);
break;
case 4:
$this->connector = new WindowsPrintConnector($parameter);
case 4: // LPT1, smb://...
$this->connector = new WindowsPrintConnector(dol_sanitizePathName($parameter));
break;
case 5:
$this->connector = new CupsPrintConnector($parameter);

View File

@ -936,7 +936,7 @@ class ExtraFields
$this->attribute_computed[$tab->name] = $tab->fieldcomputed;
$this->attribute_unique[$tab->name] = $tab->fieldunique;
$this->attribute_required[$tab->name] = $tab->fieldrequired;
$this->attribute_param[$tab->name] = ($tab->param ? unserialize($tab->param) : '');
$this->attribute_param[$tab->name] = ($tab->param ? jsonOrUnserialize($tab->param) : '');
$this->attribute_pos[$tab->name] = $tab->pos;
$this->attribute_alwayseditable[$tab->name] = $tab->alwayseditable;
$this->attribute_perms[$tab->name] = (strlen($tab->perms) == 0 ? 1 : $tab->perms);
@ -954,7 +954,7 @@ class ExtraFields
$this->attributes[$tab->elementtype]['computed'][$tab->name] = $tab->fieldcomputed;
$this->attributes[$tab->elementtype]['unique'][$tab->name] = $tab->fieldunique;
$this->attributes[$tab->elementtype]['required'][$tab->name] = $tab->fieldrequired;
$this->attributes[$tab->elementtype]['param'][$tab->name] = ($tab->param ? unserialize($tab->param) : '');
$this->attributes[$tab->elementtype]['param'][$tab->name] = ($tab->param ? jsonOrUnserialize($tab->param) : '');
$this->attributes[$tab->elementtype]['pos'][$tab->name] = $tab->pos;
$this->attributes[$tab->elementtype]['alwayseditable'][$tab->name] = $tab->alwayseditable;
$this->attributes[$tab->elementtype]['perms'][$tab->name] = (strlen($tab->perms) == 0 ? 1 : $tab->perms);

View File

@ -589,6 +589,7 @@ class Form
if (!$htmltext) {
return $text;
}
$direction = (int) $direction; // For backward compatibility when $direction was set to '' instead of 0
$tag = 'td';
if ($notabs == 2) {
@ -1251,6 +1252,9 @@ class Form
if (is_null($ajaxoptions)) {
$ajaxoptions = array();
}
require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
// No immediate load of all database
$placeholder = '';
if ($selected && empty($selected_input_value)) {
@ -2176,7 +2180,7 @@ class Form
*
* @param int $selected Preselected products
* @param string $htmlname Name of HTML select field (must be unique in page).
* @param int $filtertype Filter on product type (''=nofilter, 0=product, 1=service)
* @param int|string $filtertype Filter on product type (''=nofilter, 0=product, 1=service)
* @param int $limit Limit on number of returned lines
* @param int $price_level Level of price to show
* @param int $status Sell status -1=Return all products, 0=Products not on sell, 1=Products on sell
@ -2604,7 +2608,7 @@ class Form
}
}
if ($showempty) {
$out .= '<option value="0" selected>'.($textifempty ? $textifempty : '&nbsp;').'</option>';
$out .= '<option value="-1" selected>'.($textifempty ? $textifempty : '&nbsp;').'</option>';
}
$i = 0;

View File

@ -393,9 +393,10 @@ class FormAdmin
* @param string $htmlname Name of HTML select field
* @param string $filter Value to filter on code
* @param int $showempty Add empty value
* @param int $forcecombo Force to load all values and output a standard combobox (with no beautification)
* @return string Return HTML output
*/
public function select_paper_format($selected = '', $htmlname = 'paperformat_id', $filter = 0, $showempty = 0)
public function select_paper_format($selected = '', $htmlname = 'paperformat_id', $filter = 0, $showempty = 0, $forcecombo = 0)
{
// phpcs:enable
global $langs;
@ -444,6 +445,11 @@ class FormAdmin
}
$out .= '</select>';
if (!$forcecombo) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlname);
}
return $out;
}
}

View File

@ -57,10 +57,11 @@ class FormIntervention
* @param int $selected Id intervention preselected
* @param string $htmlname Nom de la zone html
* @param int $maxlength Maximum length of label
* @param int $showempty Show empty line
* @param int $showempty Show empty line ('1' or string to show for empty line)
* @param int $draftonly Show only drafts intervention
* @return int Nbre of project if OK, <0 if KO
*/
public function select_interventions($socid = -1, $selected = '', $htmlname = 'interventionid', $maxlength = 16, $showempty = 1)
public function select_interventions($socid = -1, $selected = '', $htmlname = 'interventionid', $maxlength = 16, $showempty = 1, $draftonly = false)
{
// phpcs:enable
global $db, $user, $conf, $langs;
@ -80,13 +81,17 @@ class FormIntervention
$sql .= " AND f.fk_soc = ".((int) $socid);
}
}
if ($draftonly) $sql .= " AND f.fk_statut = 0";
dol_syslog(get_class($this)."::select_intervention", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$out .= '<select id="interventionid" class="flat" name="'.dol_escape_htmltag($htmlname).'">';
if ($showempty) {
$out .= '<option value="0">&nbsp;</option>';
$out .= '<option value="0">';
if (!is_numeric($showempty)) $out .= $showempty;
else $out .= '&nbsp;';
$out .= '</option>';
}
$num = $this->db->num_rows($resql);
$i = 0;
@ -102,7 +107,7 @@ class FormIntervention
$out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>';
} else {
$disabled = 0;
if (!$obj->fk_statut > 0) {
if (!$obj->fk_statut > 0 && ! $draftonly) {
$disabled = 1;
$labeltoshow .= ' ('.$langs->trans("Draft").')';
}

View File

@ -697,7 +697,8 @@ class FormTicket
if ($num_rows == 1) {
return '<input type="hidden" name="'.$htmlname.'" id="'.$htmlname.'" value="'.dol_escape_htmltag($groupvalue).'">';
}
$stringtoprint .= '</select>&nbsp';
$stringtoprint .= '</select>&nbsp;';
$levelid = 1;
while ($levelid <= $use_multilevel) {
$tabscript = array();
@ -741,7 +742,7 @@ class FormTicket
$iselected = $groupticketchild == $obj->code ?'selected':'';
$stringtoprint .= '<option '.$iselected.' class="'.$htmlname.'_'.dol_escape_htmltag($fatherid).'_child_'.$levelid.'" value="'.dol_escape_htmltag($groupvalue).'" data-html="'.dol_escape_htmltag($grouplabel).'">'.dol_escape_htmltag($grouplabel).'</option>';
if (empty($tabscript[$groupcodefather])) {
$tabscript[$groupcodefather] = 'if($("#'.$htmlname.($levelid > 1 ?'_child_'.$levelid-1:'').'")[0].value == "'.dol_escape_js($groupcodefather).'"){
$tabscript[$groupcodefather] = 'if ($("#'.$htmlname.($levelid > 1 ?'_child_'.$levelid-1:'').'")[0].value == "'.dol_escape_js($groupcodefather).'"){
$(".'.$htmlname.'_'.dol_escape_htmltag($fatherid).'_child_'.$levelid.'").show()
console.log("We show childs tickets of '.$groupcodefather.' group ticket")
}else{
@ -756,23 +757,31 @@ class FormTicket
dol_print_error($this->db);
}
$stringtoprint .='</select>';
//$stringtoprint .= ajax_combobox($htmlname.'_child_'.$levelid);
$stringtoprint .='<script>';
$stringtoprint .='arraynotparents = '.json_encode($arraycodenotparent).';';
$stringtoprint .='if (arraynotparents.includes($("#'.$htmlname.($levelid > 1 ?'_child_'.$levelid-1:'').'")[0].value)){$("#'.$htmlname.'_child_'.$levelid.'").hide()}
$("#'.$htmlname.($levelid > 1 ?'_child_'.$levelid-1:'').'").change(function() {
child_id = this.attributes.child_id.value;
child_id = $("#'.$htmlname.($levelid > 1 ?'_child_'.$levelid-1:'').'").attr("child_id");
console.log("We select a new value into combo child_id="+child_id);
/* Hide all selected box that are child of the one modified */
$(".groupticketchild").each(function(){
if(this.attributes.child_id.value > child_id){
this.value = ""
$(this).attr("style", "display : none;")
if ($(this).attr("child_id") > child_id) {
console.log("hide child_id="+$(this).attr("child_id"));
$(this).val("");
$(this).hide();
}
})
$("#'.$htmlname.'_child_'.$levelid.'")[0].value = ""
/* Now we enable the next combo */
$("#'.$htmlname.'_child_'.$levelid.'").val("");
if (!arraynotparents.includes(this.value)) {
$("#'.$htmlname.'_child_'.$levelid.'").show()
$("#'.$htmlname.'_child_'.$levelid.'").show()
} else {
$("#'.$htmlname.'_child_'.$levelid.'").hide()
$("#'.$htmlname.'_child_'.$levelid.'").hide()
}
';
$levelid++;
@ -782,6 +791,8 @@ class FormTicket
$stringtoprint .='})';
$stringtoprint .='</script>';
}
$stringtoprint .= ajax_combobox($htmlname);
return $stringtoprint;
}
}

View File

@ -37,7 +37,7 @@ if (class_exists($keyforclass)) {
/*
* case 'sellist':
* $tmp='';
* $tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null
* $tmpparam=jsonOrUnserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null
* if ($tmpparam['options'] && is_array($tmpparam['options'])) {
* $tmpkeys=array_keys($tmpparam['options']);
* $tmp=array_shift($tmpkeys);

View File

@ -39,7 +39,7 @@ if ($resql) { // This can fail when class is used on old database (during mig
case 'checkbox':
case 'select':
if (!empty($conf->global->EXPORT_LABEL_FOR_SELECT)) {
$tmpparam = unserialize($obj->param); // $tmpparam may be array with 'options' = array(key1=>val1, key2=>val2 ...)
$tmpparam = jsonOrUnserialize($obj->param); // $tmpparam may be array with 'options' = array(key1=>val1, key2=>val2 ...)
if ($tmpparam['options'] && is_array($tmpparam['options'])) {
$typeFilter = "Select:".$obj->param;
}
@ -47,7 +47,7 @@ if ($resql) { // This can fail when class is used on old database (during mig
break;
case 'sellist':
$tmp = '';
$tmpparam = unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null
$tmpparam = jsonOrUnserialize($obj->param); // $tmp may be array 'options' => array 'c_currencies:code_iso:code_iso' => null
if ($tmpparam['options'] && is_array($tmpparam['options'])) {
$tmpkeys = array_keys($tmpparam['options']);
$tmp = array_shift($tmpkeys);

View File

@ -47,6 +47,11 @@ session_cache_limiter('public');
require_once '../../main.inc.php';
/*
* View
*/
// Define javascript type
top_httphead('text/javascript; charset=UTF-8');
// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.

View File

@ -50,6 +50,11 @@ session_cache_limiter('public');
require_once '../../main.inc.php';
/*
* View
*/
// Define javascript type
top_httphead('text/javascript; charset=UTF-8');
// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.

View File

@ -41,132 +41,147 @@ if (!defined('NOREQUIREHTML')) {
define('NOREQUIREHTML', 1);
}
session_cache_limiter('public');
require_once '../../main.inc.php';
if (!($_SERVER['HTTP_REFERER'] === $dolibarr_main_url_root.'/' || $_SERVER['HTTP_REFERER'] === $dolibarr_main_url_root.'/index.php'
|| preg_match('/getmenu_div\.php/', $_SERVER['HTTP_REFERER']))) {
global $langs, $conf;
top_httphead('text/javascript; charset=UTF-8');
/*
* View
*/
print 'var login = \''.$_SESSION['dol_login'].'\';'."\n";
print 'var nowtime = Date.now();';
print 'var time_auto_update = '.$conf->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY.';'."\n"; // Always defined
print 'var time_js_next_test;'."\n";
?>
/* Check if permission ok */
if (Notification.permission !== "granted") {
console.log("Ask Notification.permission");
Notification.requestPermission()
}
/* Launch timer */
// We set a delay before launching first test so next check will arrive after the time_auto_update compared to previous one.
//var time_first_execution = (time_auto_update + (time_js_next_test - nowtime)) * 1000; //need milliseconds
var time_first_execution = <?php echo max(3, empty($conf->global->MAIN_BROWSER_NOTIFICATION_CHECK_FIRST_EXECUTION) ? 0 : $conf->global->MAIN_BROWSER_NOTIFICATION_CHECK_FIRST_EXECUTION); ?>;
if (login != '') {
setTimeout(first_execution, time_first_execution * 1000);
time_js_next_test = nowtime + time_first_execution;
console.log("Launch browser notif check: setTimeout is set to launch 'first_execution' function after a wait of time_first_execution="+time_first_execution+". nowtime (time php page generation) = "+nowtime+" time_js_next_check = "+time_js_next_test);
} //first run auto check
top_httphead('text/javascript; charset=UTF-8');
// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
if (empty($dolibarr_nocache)) {
header('Cache-Control: max-age=10800, public, must-revalidate');
} else {
header('Cache-Control: no-cache');
}
function first_execution() {
console.log("Call first_execution then set repeat time to time_auto_update = MAIN_BROWSER_NOTIFICATION_FREQUENCY = "+time_auto_update);
check_events(); //one check before setting the new time for other checks
setInterval(check_events, time_auto_update * 1000); // Set new time to run next check events
}
print "jQuery(document).ready(function () {\n";
function check_events() {
if (Notification.permission === "granted")
{
time_js_next_test += time_auto_update;
console.log("Call ajax to check_events with time_js_next_test = "+time_js_next_test);
//print " console.log('referrer=".dol_escape_js($_SERVER['HTTP_REFERER'])."');\n";
$.ajax("<?php print DOL_URL_ROOT.'/core/ajax/check_notifications.php'; ?>", {
type: "post", // Usually post or get
async: true,
data: { time_js_next_test: time_js_next_test, forcechecknow: 1, token: 'notrequired' },
dataType: "json",
success: function (result) {
//console.log(result);
var arrayofpastreminders = Object.values(result.pastreminders);
if (arrayofpastreminders && arrayofpastreminders.length > 0) {
console.log("Retrieved "+arrayofpastreminders.length+" reminders to do.");
var audio = null;
<?php
if (!empty($conf->global->AGENDA_REMINDER_BROWSER_SOUND)) {
print 'audio = new Audio(\''.DOL_URL_ROOT.'/theme/common/sound/notification_agenda.wav\');';
print ' var nowtime = Date.now();';
print ' var time_auto_update = '.$conf->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY.';'."\n"; // Always defined
print ' var time_js_next_test;'."\n";
?>
/* Check if permission ok */
if (Notification.permission !== "granted") {
console.log("Ask Notification.permission");
Notification.requestPermission()
}
/* Launch timer */
// We set a delay before launching first test so next check will arrive after the time_auto_update compared to previous one.
//var time_first_execution = (time_auto_update + (time_js_next_test - nowtime)) * 1000; //need milliseconds
var time_first_execution = <?php echo max(3, empty($conf->global->MAIN_BROWSER_NOTIFICATION_CHECK_FIRST_EXECUTION) ? 0 : $conf->global->MAIN_BROWSER_NOTIFICATION_CHECK_FIRST_EXECUTION); ?>;
setTimeout(first_execution, time_first_execution * 1000);
time_js_next_test = nowtime + time_first_execution;
console.log("Launch browser notif check: setTimeout is set to launch 'first_execution' function after a wait of time_first_execution="+time_first_execution+". nowtime (time php page generation) = "+nowtime+" time_js_next_check = "+time_js_next_test);
function first_execution() {
console.log("Call first_execution then set repeat time to time_auto_update = MAIN_BROWSER_NOTIFICATION_FREQUENCY = "+time_auto_update);
check_events(); //one check before setting the new time for other checks
setInterval(check_events, time_auto_update * 1000); // Set new time to run next check events
}
function check_events() {
if (Notification.permission === "granted")
{
time_js_next_test += time_auto_update;
console.log("Call ajax to check_events with time_js_next_test = "+time_js_next_test);
$.ajax("<?php print DOL_URL_ROOT.'/core/ajax/check_notifications.php'; ?>", {
type: "post", // Usually post or get
async: true,
data: { time_js_next_test: time_js_next_test, forcechecknow: 1, token: 'notrequired' },
dataType: "json",
success: function (result) {
//console.log(result);
var arrayofpastreminders = Object.values(result.pastreminders);
if (arrayofpastreminders && arrayofpastreminders.length > 0) {
console.log("Retrieved "+arrayofpastreminders.length+" reminders to do.");
var audio = null;
<?php
if (!empty($conf->global->AGENDA_REMINDER_BROWSER_SOUND)) {
print 'audio = new Audio(\''.DOL_URL_ROOT.'/theme/common/sound/notification_agenda.wav\');';
}
?>
var listofreminderids = '';
var noti = []
$.each(arrayofpastreminders, function (index, value) {
console.log(value);
var url = "notdefined";
var title = "Not defined";
var body = value.label;
if (value.type == 'agenda' && value.location != null && value.location != '') {
body += '\n' + value.location;
}
?>
var listofreminderids = '';
var noti = []
$.each(arrayofpastreminders, function (index, value) {
console.log(value);
var url = "notdefined";
var title = "Not defined";
var body = value.label;
if (value.type == 'agenda' && value.location != null && value.location != '') {
body += '\n' + value.location;
}
if (value.type == 'agenda' && (value.event_date_start_formated != null || value.event_date_start_formated['event_date_start'] != '')) {
body += '\n' + value.event_date_start_formated;
}
if (value.type == 'agenda' && (value.event_date_start_formated != null || value.event_date_start_formated['event_date_start'] != '')) {
body += '\n' + value.event_date_start_formated;
}
if (value.type == 'agenda')
{
url = '<?php print DOL_URL_ROOT.'/comm/action/card.php?id='; ?>' + value.id_agenda;
title = '<?php print dol_escape_js($langs->trans('EventReminder')) ?>';
}
var extra = {
icon: '<?php print DOL_URL_ROOT.'/theme/common/bell.png'; ?>',
//image: '<?php print DOL_URL_ROOT.'/theme/common/bell.png'; ?>',
body: body,
tag: value.id_agenda,
requireInteraction: true
};
if (value.type == 'agenda')
{
url = '<?php print DOL_URL_ROOT.'/comm/action/card.php?id='; ?>' + value.id_agenda;
title = '<?php print dol_escape_js($langs->trans('EventReminder')) ?>';
}
var extra = {
icon: '<?php print DOL_URL_ROOT.'/theme/common/bell.png'; ?>',
//image: '<?php print DOL_URL_ROOT.'/theme/common/bell.png'; ?>',
body: body,
tag: value.id_agenda,
requireInteraction: true
// We release the notify
console.log("Send notification on browser");
noti[index] = new Notification(title, extra);
if (index==0 && audio)
{
audio.play();
}
if (noti[index]) {
noti[index].onclick = function (event) {
console.log("A click on notification on browser has been done");
event.preventDefault(); // prevent the browser from focusing the Notification's tab
window.focus();
window.open(url, '_blank');
noti[index].close();
};
// We release the notify
console.log("Send notification on browser");
noti[index] = new Notification(title, extra);
if (index==0 && audio)
{
audio.play();
}
listofreminderids = (listofreminderids == '' ? '' : listofreminderids + ',') + value.id_reminder
}
});
if (noti[index]) {
noti[index].onclick = function (event) {
console.log("A click on notification on browser has been done");
event.preventDefault(); // prevent the browser from focusing the Notification's tab
window.focus();
window.open(url, '_blank');
noti[index].close();
};
listofreminderids = (listofreminderids == '' ? '' : listofreminderids + ',') + value.id_reminder
}
});
// Update status of all notifications we sent on browser (listofreminderids)
console.log("Flag notification as done for listofreminderids="+listofreminderids);
$.ajax("<?php print DOL_URL_ROOT.'/core/ajax/check_notifications.php?action=stopreminder&listofreminderids='; ?>"+listofreminderids, {
type: "POST", // Usually post or get
async: true,
data: { time_js_next_test: time_js_next_test, token: 'notrequired' }
});
} else {
console.log("No reminder to do found, next search at "+time_js_next_test);
}
// Update status of all notifications we sent on browser (listofreminderids)
console.log("Flag notification as done for listofreminderids="+listofreminderids);
$.ajax("<?php print DOL_URL_ROOT.'/core/ajax/check_notifications.php?action=stopreminder&listofreminderids='; ?>"+listofreminderids, {
type: "POST", // Usually post or get
async: true,
data: { time_js_next_test: time_js_next_test, token: 'notrequired' }
});
} else {
console.log("No reminder to do found, next search at "+time_js_next_test);
}
});
}
else
{
console.log("Cancel check_events. Useless because javascript Notification.permission is "+Notification.permission+" (blocked manualy or web site is not https).");
}
}
});
}
else
{
console.log("Cancel check_events. Useless because javascript Notification.permission is "+Notification.permission+" (blocked manualy or web site is not https).");
}
<?php
}
<?php
print "\n";
print '})'."\n";

View File

@ -47,6 +47,10 @@ session_cache_limiter('public');
require_once '../../main.inc.php';
/*
* View
*/
// Define javascript type
top_httphead('text/javascript; charset=UTF-8');
// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.

View File

@ -775,22 +775,48 @@ function checkVal($out = '', $check = 'alphanohtml', $filter = null, $options =
}
break;
case 'restricthtml': // Recommended for most html textarea
case 'restricthtmlallowunvalid':
do {
$oldstringtoclean = $out;
if (!empty($out) && !empty($conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML) && $check != 'restricthtmlallowunvalid') {
try {
$dom = new DOMDocument;
// Add a trick to solve pb with text without parent tag
// like '<h1>Foo</h1><p>bar</p>' that ends up with '<h1>Foo<p>bar</p></h1>'
// like 'abc' that ends up with '<p>abc</p>'
$out = '<div class="tricktoremove">'.$out.'</div>';
$dom->loadHTML($out, LIBXML_ERR_NONE|LIBXML_HTML_NOIMPLIED|LIBXML_HTML_NODEFDTD|LIBXML_NONET|LIBXML_NOWARNING|LIBXML_NOXMLDECL);
$out = trim($dom->saveHTML());
// Remove the trick added to solve pb with text without parent tag
$out = preg_replace('/^<div class="tricktoremove">/', '', $out);
$out = preg_replace('/<\/div>$/', '', $out);
} catch (Exception $e) {
//print $e->getMessage();
return 'InvalidHTMLString';
}
}
// Ckeditor use the numeric entitic for apostrophe so we force it to text entity (all other special chars are correctly
// encoded using text entities). This is a fix for CKeditor (CKeditor still encode in HTML4 instead of HTML5).
$out = preg_replace('/&#39;/i', '&apos;', $out);
// We replace chars from a/A to z/Z encoded with numeric HTML entities with the real char so we won't loose the chars at the next step.
// No need to use a loop here, this step is not to sanitize (this is done at next step, this is to try to save chars, even if they are
// using a non coventionnel way to be encoded, to not have them sanitized just after)
$out = preg_replace_callback('/&#(x?[0-9][0-9a-f]+;?)/i', 'realCharForNumericEntities', $out);
// Now we remove all remaining HTML entities staring with a number. We don't want such entities.
// Now we remove all remaining HTML entities starting with a number. We don't want such entities.
$out = preg_replace('/&#x?[0-9]+/i', '', $out); // For example if we have j&#x61vascript with an entities without the ; to hide the 'a' of 'javascript'.
$out = dol_string_onlythesehtmltags($out, 0, 1, 1);
// We should also exclude non expected attributes
if (!empty($conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES)) {
$out = dol_string_onlythesehtmlattributes($out);
// Warning, the function may add a LF so we are forced to trim to compare with old $out without having always a difference and an infinit loop.
$out = trim(dol_string_onlythesehtmlattributes($out));
}
} while ($oldstringtoclean != $out);
break;
@ -993,7 +1019,7 @@ function dol_buildpath($path, $type = 0, $returnemptyifnotfound = 0)
function dol_clone($object, $native = 0)
{
if (empty($native)) {
$myclone = unserialize(serialize($object));
$myclone = unserialize(serialize($object)); // serialize then unserialize is hack to be sure to have a new object for all fields
} else {
$myclone = clone $object; // PHP clone is a shallow copy only, not a real clone, so properties of references will keep the reference (refering to the same target/variable)
}
@ -1025,10 +1051,11 @@ function dol_size($size, $type = '')
/**
* Clean a string to use it as a file name
* Clean a string to use it as a file name.
* Replace also '--' and ' -' strings, they are used for parameters separation.
*
* @param string $str String to clean
* @param string $newstr String to replace bad chars with
* @param string $newstr String to replace bad chars with.
* @param int $unaccent 1=Remove also accent (default), 0 do not remove them
* @return string String cleaned (a-zA-Z_)
*
@ -1040,12 +1067,16 @@ function dol_sanitizeFileName($str, $newstr = '_', $unaccent = 1)
// Char '>' '<' '|' '$' and ';' are special chars for shells.
// Char '/' and '\' are file delimiters.
// -- car can be used into filename to inject special paramaters like --use-compress-program to make command with file as parameter making remote execution of command
$filesystem_forbidden_chars = array('<', '>', '/', '\\', '?', '*', '|', '"', ':', '°', '$', ';', '--');
return dol_string_nospecial($unaccent ? dol_string_unaccent($str) : $str, $newstr, $filesystem_forbidden_chars);
$filesystem_forbidden_chars = array('<', '>', '/', '\\', '?', '*', '|', '"', ':', '°', '$', ';');
$tmp = dol_string_nospecial($unaccent ? dol_string_unaccent($str) : $str, $newstr, $filesystem_forbidden_chars);
$tmp = preg_replace('/\-\-+/', '_', $tmp);
$tmp = preg_replace('/\s+\-/', ' _', $tmp);
return $tmp;
}
/**
* Clean a string to use it as a path name
* Clean a string to use it as a path name.
* Replace also '--' and ' -' strings, they are used for parameters separation.
*
* @param string $str String to clean
* @param string $newstr String to replace bad chars with
@ -1057,7 +1088,10 @@ function dol_sanitizeFileName($str, $newstr = '_', $unaccent = 1)
function dol_sanitizePathName($str, $newstr = '_', $unaccent = 1)
{
$filesystem_forbidden_chars = array('<', '>', '?', '*', '|', '"', '°');
return dol_string_nospecial($unaccent ? dol_string_unaccent($str) : $str, $newstr, $filesystem_forbidden_chars);
$tmp = dol_string_nospecial($unaccent ? dol_string_unaccent($str) : $str, $newstr, $filesystem_forbidden_chars);
$tmp = preg_replace('/\-\-+/', '_', $tmp);
$tmp = preg_replace('/\s+\-/', ' _', $tmp);
return $tmp;
}
/**
@ -1153,21 +1187,26 @@ function dol_string_unaccent($str)
* Clean a string from all punctuation characters to use it as a ref or login.
* This is a more complete function than dol_sanitizeFileName.
*
* @param string $str String to clean
* @param string $newstr String to replace forbidden chars with
* @param array $badcharstoreplace List of forbidden characters
* @return string Cleaned string
* @param string $str String to clean
* @param string $newstr String to replace forbidden chars with
* @param array|string $badcharstoreplace List of forbidden characters to replace
* @param array|string $badcharstoremove List of forbidden characters to remove
* @return string Cleaned string
*
* @see dol_sanitizeFilename(), dol_string_unaccent(), dol_string_nounprintableascii()
*/
function dol_string_nospecial($str, $newstr = '_', $badcharstoreplace = '')
function dol_string_nospecial($str, $newstr = '_', $badcharstoreplace = '', $badcharstoremove = '')
{
$forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ",", ";", "=", '°'); // more complete than dol_sanitizeFileName
$forbidden_chars_to_remove = array();
//$forbidden_chars_to_remove=array("(",")");
if (is_array($badcharstoreplace)) {
$forbidden_chars_to_replace = $badcharstoreplace;
}
//$forbidden_chars_to_remove=array("(",")");
if (is_array($badcharstoremove)) {
$forbidden_chars_to_remove = $badcharstoremove;
}
return str_replace($forbidden_chars_to_replace, $newstr, str_replace($forbidden_chars_to_remove, "", $str));
}
@ -3521,8 +3560,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'github', 'jabber', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp',
'chevron-left', 'chevron-right', 'chevron-down', 'chevron-top', 'commercial', 'companies',
'generic', 'home', 'hrm', 'members', 'products', 'invoicing',
'partnership', 'payment', 'pencil-ruler', 'preview', 'project', 'projectpub', 'projecttask', 'question', 'refresh', 'salary', 'shipment',
'supplier_invoice', 'supplier_invoicea', 'supplier_invoicer', 'supplier_invoiced',
'partnership', 'payment', 'pencil-ruler', 'preview', 'project', 'projectpub', 'projecttask', 'question', 'refresh', 'region',
'salary', 'shipment', 'state', 'supplier_invoice', 'supplier_invoicea', 'supplier_invoicer', 'supplier_invoiced',
'technic', 'ticket',
'error', 'warning',
'recent', 'reception', 'recruitmentcandidature', 'recruitmentjobposition', 'resource',
@ -3571,8 +3610,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'partnership'=>'handshake', 'payment'=>'money-check-alt', 'phoning'=>'phone', 'phoning_mobile'=>'mobile-alt', 'phoning_fax'=>'fax', 'previous'=>'arrow-alt-circle-left', 'printer'=>'print', 'product'=>'cube', 'service'=>'concierge-bell',
'recent' => 'question', 'reception'=>'dolly', 'recruitmentjobposition'=>'id-card-alt', 'recruitmentcandidature'=>'id-badge',
'resize'=>'crop', 'supplier_order'=>'dol-order_supplier', 'supplier_proposal'=>'file-signature',
'refresh'=>'redo', 'resource'=>'laptop-house',
'security'=>'key', 'salary'=>'wallet', 'shipment'=>'dolly', 'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'stripe'=>'stripe-s',
'refresh'=>'redo', 'region'=>'map-marked', 'resource'=>'laptop-house',
'state'=>'map-marked-alt', 'security'=>'key', 'salary'=>'wallet', 'shipment'=>'dolly', 'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'stripe'=>'stripe-s',
'supplier'=>'building', 'supplier_invoice'=>'file-invoice-dollar', 'technic'=>'cogs', 'ticket'=>'ticket-alt',
'timespent'=>'clock', 'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach',
'title_agenda'=>'calendar-alt',
@ -3610,13 +3649,13 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
}
if (in_array($pictowithouttext, array('dollyrevert', 'member', 'members', 'contract', 'group', 'resource', 'shipment'))) {
$morecss = 'em092';
$morecss .= ' em092';
}
if (in_array($pictowithouttext, array('conferenceorbooth', 'collab', 'eventorganization', 'holiday', 'info', 'project', 'workstation'))) {
$morecss = 'em088';
$morecss .= ' em088';
}
if (in_array($pictowithouttext, array('asset', 'intervention', 'payment', 'loan', 'partnership', 'stock', 'technic'))) {
$morecss = 'em080';
$morecss .= ' em080';
}
// Define $marginleftonlyshort
@ -3673,7 +3712,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'partnership'=>'#6c6aa8', 'playdisabled'=>'#ccc', 'printer'=>'#444', 'projectpub'=>'#986c6a', 'reception'=>'#a69944', 'resize'=>'#444', 'rss'=>'#cba',
//'shipment'=>'#a69944',
'security'=>'#999', 'stats'=>'#444', 'switch_off'=>'#999', 'technic'=>'#999', 'timespent'=>'#555',
'uncheck'=>'#800', 'uparrow'=>'#555', 'user-cog'=>'#999', 'country'=>'#aaa', 'globe-americas'=>'#aaa',
'uncheck'=>'#800', 'uparrow'=>'#555', 'user-cog'=>'#999', 'country'=>'#aaa', 'globe-americas'=>'#aaa', 'region'=>'#aaa', 'state'=>'#aaa',
'website'=>'#304', 'workstation'=>'#a69944'
);
if (isset($arrayconvpictotocolor[$pictowithouttext])) {
@ -3956,7 +3995,7 @@ function img_edit($titlealt = 'default', $float = 0, $other = '')
* @param string $other Add more attributes on img
* @return string Return tag img
*/
function img_view($titlealt = 'default', $float = 0, $other = '')
function img_view($titlealt = 'default', $float = 0, $other = 'class="valignmiddle"')
{
global $langs;
@ -5470,7 +5509,7 @@ function get_localtax($vatrate, $local, $thirdparty_buyer = "", $thirdparty_sell
} else {
$sql .= " AND t.recuperableonly = '".$db->escape($vatnpr)."'";
}
dol_syslog("get_localtax", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql) {
@ -6298,7 +6337,7 @@ function dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles = 1,
$stringtoclean = preg_replace('/&#58;|&#0+58|&#x3A/i', '', $stringtoclean); // refused string ':' encoded (no reason to have a : encoded like this) to disable 'javascript:...'
$stringtoclean = preg_replace('/javascript\s*:/i', '', $stringtoclean);
$temp = strip_tags($stringtoclean, $allowed_tags_string);
$temp = strip_tags($stringtoclean, $allowed_tags_string); // Warning: This remove also undesired </> changing string obfuscated with </> that pass injection detection into harmfull string
if ($cleanalsosomestyles) { // Clean for remaining html tags
$temp = preg_replace('/position\s*:\s*(absolute|fixed)\s*!\s*important/i', '', $temp); // Note: If hacker try to introduce css comment into string to bypass this regex, the string must also be encoded by the dol_htmlentitiesbr during output so it become harmless
@ -6348,8 +6387,8 @@ function dol_string_onlythesehtmlattributes($stringtoclean, $allowed_attributes
}
$return = $dom->saveHTML();
//$return = '<html><body>aaaa</p>bb<p>ssdd</p>'."\n<p>aaa</p>aa<p>bb</p>";
$return = preg_replace('/^<html><body>/', '', $return);
$return = preg_replace('/<\/body><\/html>$/', '', $return);
return $return;
@ -7435,7 +7474,7 @@ function print_date_range($date_start, $date_end, $format = '', $outputlangs = '
* @param int $date_end End date
* @param string $format Output format
* @param Translate $outputlangs Output language
* @param integer $withparenthesis 1=Add parenthesis, 0=non parenthesis
* @param integer $withparenthesis 1=Add parenthesis, 0=no parenthesis
* @return string String
*/
function get_date_range($date_start, $date_end, $format = '', $outputlangs = '', $withparenthesis = 1)
@ -8087,7 +8126,7 @@ function picto_from_langcode($codelang, $moreatt = '')
}
if ($codelang == 'auto') {
return '<span class="fa fa-globe"></span>';
return '<span class="fa fa-language"></span>';
}
$langtocountryflag = array(
@ -10301,9 +10340,10 @@ function readfileLowMemory($fullpath_original_file_osencoded, $method = -1)
*/
function showValueWithClipboardCPButton($valuetocopy, $showonlyonhover = 1, $texttoshow = '')
{
/*
global $conf;
/*if (!empty($conf->dol_no_mouse_hover)) {
if (!empty($conf->dol_no_mouse_hover)) {
$showonlyonhover = 0;
}*/
@ -10315,3 +10355,20 @@ function showValueWithClipboardCPButton($valuetocopy, $showonlyonhover = 1, $tex
return $result;
}
/**
* Decode an encode string. The string can be encoded in json format (recommended) or with serialize (avoid this)
*
* @param string $stringtodecode String to decode (json or serialize coded)
* @return mixed The decoded object.
*/
function jsonOrUnserialize($stringtodecode)
{
$result = json_decode($stringtodecode);
if ($result === null) {
$result = unserialize($stringtodecode);
}
return $result;
}

View File

@ -849,7 +849,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
// Contacts of task
if (count($arrayfields) > 0 && !empty($arrayfields['c.assigned']['checked'])) {
print '<td>';
print '<td class="center">';
foreach (array('internal', 'external') as $source) {
$tab = $lines[$i]->liste_contact(-1, $source);
$num = count($tab);

View File

@ -476,8 +476,8 @@ function getRandomPassword($generic = false, $replaceambiguouschars = null, $len
}
$generated_password = str_shuffle($randomCode);
} else // Old platform, non cryptographic random
{
} else {
// Old platform, non cryptographic random
$max = strlen($lowercase) - 1;
for ($x = 0; $x < $nbofchar; $x++) {
$tmp = mt_rand(0, $max);

View File

@ -906,7 +906,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
}
// Use MAIN_OPTIMIZEFORTEXTBROWSER
if ($foruserprofile) {
if ($foruserprofile && !empty($fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) {
//$default=yn($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER);
$default = $langs->trans('No');
print '<tr class="oddeven">';
@ -953,7 +953,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
// Use MAIN_OPTIMIZEFORTEXTBROWSER
if ($foruserprofile) {
if ($foruserprofile && !empty($fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND)) {
//$default=yn($conf->global->MAIN_OPTIMIZEFORCOLORBLIND);
$default = $langs->trans('No');
print '<tr class="oddeven">';

View File

@ -29,7 +29,7 @@
*
* @param string $usertotest Login
* @param string $passwordtotest Password
* @param int $entitytotest Number of instance (always 1 if module multicompany not enabled)
* @param int $entitytotest Numero of instance (always 1 if module multicompany not enabled)
* @return string Login if OK, '' if KO
*/
function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
@ -151,10 +151,13 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
if ($result > 0) {
if ($result == 2) { // Connection is ok for user/pass into LDAP
$login = $usertotest;
if (!empty($conf->global->LDAP_FIELD_LOGIN)) {
$login = $ldap->login;
}
dol_syslog("functions_ldap::check_user_password_ldap $login authentication ok");
// For the case, we search the user id using a search key without the login (but using other fields like id),
// we need to get the real login to use in the ldap answer.
if (!empty($conf->global->LDAP_FIELD_LOGIN) && !empty($ldap->login)) {
$login = $ldap->login;
dol_syslog("functions_ldap::check_user_password_ldap login is now $login (LDAP_FIELD_LOGIN=".$conf->global->LDAP_FIELD_LOGIN.")");
}
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
@ -207,7 +210,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
}
$usertmp = new User($db);
$resultFetchUser = $usertmp->fetch('', $login, $sid);
$resultFetchUser = $usertmp->fetch('', $login, $sid, 1, ($entitytotest > 0 ? $entitytotest : -1));
if ($resultFetchUser > 0) {
dol_syslog("functions_ldap::check_user_password_ldap Sync user found user id=".$usertmp->id);
// On verifie si le login a change et on met a jour les attributs dolibarr
@ -215,7 +218,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
if ($usertmp->login != $ldap->login && $ldap->login) {
$usertmp->login = $ldap->login;
$usertmp->update($usertmp);
// TODO Que faire si update echoue car on update avec un login deja existant.
// TODO Que faire si update echoue car on update avec un login deja existant pour un autre compte.
}
//$resultUpdate = $usertmp->update_ldap2dolibarr($ldap);
@ -231,7 +234,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
$usertmp->fetch('', $login);
$ret = $mc->checkRight($usertmp->id, $entitytotest);
if ($ret < 0) {
dol_syslog("functions_ldap::check_user_password_ldap Authentication KO entity '".$entitytotest."' not allowed for user '".$usertmp->id."'", LOG_NOTICE);
dol_syslog("functions_ldap::check_user_password_ldap Authentication KO entity '".$entitytotest."' not allowed for user id '".$usertmp->id."'", LOG_NOTICE);
$login = ''; // force authentication failure
}
unset($usertmp);

View File

@ -1797,11 +1797,11 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
$newmenu->add("/holiday/card.php?mainmenu=hrm&leftmenu=holiday&action=create", $langs->trans("New"), 1, $user->rights->holiday->write);
$newmenu->add("/holiday/list.php?mainmenu=hrm&leftmenu=hrm", $langs->trans("List"), 1, $user->rights->holiday->read);
if ($usemenuhider || empty($leftmenu) || $leftmenu == "hrm") {
$newmenu->add("/holiday/list.php?search_statut=1&mainmenu=hrm&leftmenu=hrm", $langs->trans("DraftCP"), 2, $user->rights->holiday->read);
$newmenu->add("/holiday/list.php?search_statut=2&mainmenu=hrm&leftmenu=hrm", $langs->trans("ToReviewCP"), 2, $user->rights->holiday->read);
$newmenu->add("/holiday/list.php?search_statut=3&mainmenu=hrm&leftmenu=hrm", $langs->trans("ApprovedCP"), 2, $user->rights->holiday->read);
$newmenu->add("/holiday/list.php?search_statut=4&mainmenu=hrm&leftmenu=hrm", $langs->trans("CancelCP"), 2, $user->rights->holiday->read);
$newmenu->add("/holiday/list.php?search_statut=5&mainmenu=hrm&leftmenu=hrm", $langs->trans("RefuseCP"), 2, $user->rights->holiday->read);
$newmenu->add("/holiday/list.php?search_status=1&mainmenu=hrm&leftmenu=hrm", $langs->trans("DraftCP"), 2, $user->rights->holiday->read);
$newmenu->add("/holiday/list.php?search_status=2&mainmenu=hrm&leftmenu=hrm", $langs->trans("ToReviewCP"), 2, $user->rights->holiday->read);
$newmenu->add("/holiday/list.php?search_status=3&mainmenu=hrm&leftmenu=hrm", $langs->trans("ApprovedCP"), 2, $user->rights->holiday->read);
$newmenu->add("/holiday/list.php?search_status=4&mainmenu=hrm&leftmenu=hrm", $langs->trans("CancelCP"), 2, $user->rights->holiday->read);
$newmenu->add("/holiday/list.php?search_status=5&mainmenu=hrm&leftmenu=hrm", $langs->trans("RefuseCP"), 2, $user->rights->holiday->read);
}
$newmenu->add("/holiday/define_holiday.php?mainmenu=hrm&action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->read);
$newmenu->add("/holiday/month_report.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->readall);

View File

@ -277,8 +277,8 @@ class ExportCsv extends ModeleExports
$newvalue = $this->csvClean($newvalue, $outputlangs->charset_output);
if (preg_match('/^Select:/i', $typefield, $reg) && $typefield = substr($typefield, 7)) {
$array = unserialize($typefield);
if (preg_match('/^Select:/i', $typefield) && $typefield = substr($typefield, 7)) {
$array = json_decode($typefield, true);
$array = $array['options'];
$newvalue = $array[$newvalue];
}

View File

@ -315,8 +315,8 @@ class ExportExcel2007 extends ModeleExports
$newvalue = $this->excel_clean($newvalue);
$typefield = isset($array_types[$code]) ? $array_types[$code] : '';
if (preg_match('/^Select:/i', $typefield, $reg) && $typefield = substr($typefield, 7)) {
$array = unserialize($typefield);
if (preg_match('/^Select:/i', $typefield) && $typefield = substr($typefield, 7)) {
$array = json_decode($typefield, true);
$array = $array['options'];
$newvalue = $array[$newvalue];
}

View File

@ -252,8 +252,8 @@ class ExportTsv extends ModeleExports
$newvalue = $this->tsv_clean($newvalue, $outputlangs->charset_output);
if (preg_match('/^Select:/i', $typefield, $reg) && $typefield = substr($typefield, 7)) {
$array = unserialize($typefield);
if (preg_match('/^Select:/i', $typefield) && $typefield = substr($typefield, 7)) {
$array = json_decode($typefield, true);
$array = $array['options'];
$newvalue = $array[$newvalue];
}

View File

@ -623,6 +623,12 @@ class ImportCsv extends ModeleImports
}
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'numeric') {
$newval = price2num($newval);
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'accountingaccount') {
if (empty($conf->global->ACCOUNTING_MANAGE_ZERO)) {
$newval = rtrim(trim($newval), "0");
} else {
$newval = trim($newval);
}
}
//print 'Val to use as insert is '.$newval.'<br>';

View File

@ -664,6 +664,12 @@ class ImportXlsx extends ModeleImports
}
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'numeric') {
$newval = price2num($newval);
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'accountingaccount') {
if (empty($conf->global->ACCOUNTING_MANAGE_ZERO)) {
$newval = rtrim(trim($newval), "0");
} else {
$newval = trim($newval);
}
}
//print 'Val to use as insert is '.$newval.'<br>';

View File

@ -60,7 +60,7 @@ class modAccounting extends DolibarrModules
$this->dirs = array('/accounting/temp');
// Config pages
$this->config_page_url = array('accounting.php');
$this->config_page_url = array('accounting.php?mainmenu=accountancy&leftmenu=accountancy_admin');
// Dependencies
$this->depends = array("modFacture", "modBanque", "modTax"); // List of modules id that must be enabled if this module is enabled
@ -297,6 +297,10 @@ class modAccounting extends DolibarrModules
);
$this->import_fieldshidden_array[$r] = array('b.doc_type'=>'const-import_from_external', 'b.fk_doc'=>'const-0', 'b.fk_docdet'=>'const-0', 'b.fk_user_author'=>'user->id', 'b.date_creation'=>'const-'.dol_print_date(dol_now(), 'standard')); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
$this->import_regex_array[$r] = array('b.doc_date'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$');
$this->import_convertvalue_array[$r] = array(
'b.numero_compte' => array('rule' => 'accountingaccount'),
'b.subledger_account' => array('rule' => 'accountingaccount')
);
$this->import_examplevalues_array[$r] = array(
'b.piece_num'=>'123 (!!! use next value not already used)',
'b.doc_date'=>dol_print_date(dol_now(), "%Y-%m-%d"),
@ -350,6 +354,8 @@ class modAccounting extends DolibarrModules
'b.sens'=>'rule-computeSens'
); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
$this->import_convertvalue_array[$r]=array(
'b.numero_compte'=>array('rule'=>'accountingaccount'),
'b.subledger_account'=>array('rule'=>'accountingaccount'),
'b.montant' => array('rule' => 'compute', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'computeAmount', 'element' => 'Accountancy'),
'b.sens' => array('rule' => 'compute', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'computeDirection', 'element' => 'Accountancy'),
);
@ -395,6 +401,7 @@ class modAccounting extends DolibarrModules
$this->import_fields_array[$r] = array('aa.fk_pcg_version'=>"Chartofaccounts*", 'aa.account_number'=>"AccountAccounting*", 'aa.label'=>"Label*", 'aa.account_parent'=>"Accountparent", "aa.fk_accounting_category"=>"AccountingCategory", "aa.pcg_type"=>"Pcgtype*", 'aa.active'=>'Status*', 'aa.datec'=>"DateCreation");
$this->import_regex_array[$r] = array('aa.fk_pcg_version'=>'pcg_version@'.MAIN_DB_PREFIX.'accounting_system', 'aa.account_number'=>'^.{1,32}$', 'aa.label'=>'^.{1,255}$', 'aa.account_parent'=>'^.{0,32}$', 'aa.fk_accounting_category'=>'rowid@'.MAIN_DB_PREFIX.'c_accounting_category', 'aa.pcg_type'=>'^.{1,20}$', 'aa.active'=>'^0|1$', 'aa.datec'=>'^\d{4}-\d{2}-\d{2}$');
$this->import_convertvalue_array[$r] = array(
'aa.account_number'=>array('rule'=>'accountingaccount'),
'aa.account_parent'=>array('rule'=>'fetchidfromref', 'classfile'=>'/accountancy/class/accountingaccount.class.php', 'class'=>'AccountingAccount', 'method'=>'fetch', 'element'=>'AccountingAccount'),
'aa.fk_accounting_category'=>array('rule'=>'fetchidfromcodeorlabel', 'classfile'=>'/accountancy/class/accountancycategory.class.php', 'class'=>'AccountancyCategory', 'method'=>'fetch', 'dict'=>'DictionaryAccountancyCategory'),
);

View File

@ -18,7 +18,7 @@
/**
* \defgroup clicktodial Module clicktodial
* \brief Module pour gerer l'appel automatique
* \brief Module to manage a ClickToDial system
* \file htdocs/core/modules/modClickToDial.class.php
* \ingroup clicktodial
* \brief Description and activation file for the module Click to Dial
@ -46,7 +46,8 @@ class modClickToDial extends DolibarrModules
$this->family = "interface";
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i', '', get_class($this));
$this->description = "Gestion du Click To Dial";
$this->description = "Integration of a ClickToDial system (Asterisk, ...)";
$this->descriptionlong = "Support a Click To Dial feature with a SIP system. When clicking on a phone number, your phone system automatically call the callee.";
$this->version = 'dolibarr'; // 'development' or 'experimental' or 'dolibarr' or version

View File

@ -285,7 +285,7 @@ class modFournisseur extends DolibarrModules
$r++;
$this->export_code[$r] = $this->rights_class.'_'.$r;
$this->export_label[$r] = 'Vendor invoices and lines of invoices';
$this->export_icon[$r] = 'bill';
$this->export_icon[$r] = 'invoice';
$this->export_permission[$r] = array(array("fournisseur", "facture", "export"));
$this->export_fields_array[$r] = array(
's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 'ps.nom'=>'ParentCompany', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'c.code'=>'CountryCode', 's.phone'=>'Phone',
@ -328,81 +328,14 @@ class modFournisseur extends DolibarrModules
);
$this->export_dependencies_array[$r] = array('invoice_line'=>'fd.rowid', 'product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
// Add extra fields object
$sql = "SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn' AND entity IN (0, ".$conf->entity.")";
$resql = $this->db->query($sql);
if ($resql) { // This can fail when class is used on old database (during migration for example)
while ($obj = $this->db->fetch_object($resql)) {
$fieldname = 'extra.'.$obj->name;
$fieldlabel = ucfirst($obj->label);
$typeFilter = "Text";
switch ($obj->type) {
case 'int':
case 'double':
case 'price':
$typeFilter = "Numeric";
break;
case 'date':
case 'datetime':
$typeFilter = "Date";
break;
case 'boolean':
$typeFilter = "Boolean";
break;
case 'sellist':
$tmp = '';
$tmpparam = unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null
if ($tmpparam['options'] && is_array($tmpparam['options'])) {
$var = array_keys($tmpparam['options']);
$tmp = array_shift($var);
}
if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) {
$typeFilter = "List:".$tmp;
}
break;
}
$this->export_fields_array[$r][$fieldname] = $fieldlabel;
$this->export_TypeFields_array[$r][$fieldname] = $typeFilter;
$this->export_entities_array[$r][$fieldname] = 'invoice';
}
}
// End add extra fields
// Add extra fields line
$sql = "SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn_det' AND entity IN (0, ".$conf->entity.")";
$resql = $this->db->query($sql);
if ($resql) { // This can fail when class is used on old database (during migration for example)
while ($obj = $this->db->fetch_object($resql)) {
$fieldname = 'extraline.'.$obj->name;
$fieldlabel = ucfirst($obj->label);
$typeFilter = "Text";
switch ($obj->type) {
case 'int':
case 'double':
case 'price':
$typeFilter = "Numeric";
break;
case 'date':
case 'datetime':
$typeFilter = "Date";
break;
case 'boolean':
$typeFilter = "Boolean";
break;
case 'sellist':
$tmp = '';
$tmpparam = unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null
if ($tmpparam['options'] && is_array($tmpparam['options'])) {
$tmp = array_shift(array_keys($tmpparam['options']));
}
if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) {
$typeFilter = "List:".$tmp;
}
break;
}
$this->export_fields_array[$r][$fieldname] = $fieldlabel;
$this->export_TypeFields_array[$r][$fieldname] = $typeFilter;
$this->export_entities_array[$r][$fieldname] = 'invoice_line';
}
}
$keyforselect = 'facture_fourn';
$keyforelement = 'invoice';
$keyforaliasextra = 'extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
$keyforselect = 'facture_fourn_det';
$keyforelement = 'invoice_line';
$keyforaliasextra = 'extraline';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
// End add extra fields line
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'societe as s';
@ -426,7 +359,7 @@ class modFournisseur extends DolibarrModules
$r++;
$this->export_code[$r] = $this->rights_class.'_'.$r;
$this->export_label[$r] = 'Factures fournisseurs et reglements';
$this->export_icon[$r] = 'bill';
$this->export_icon[$r] = 'invoice';
$this->export_permission[$r] = array(array("fournisseur", "facture", "export"));
$this->export_fields_array[$r] = array(
's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'c.code'=>'CountryCode', 's.phone'=>'Phone',
@ -465,43 +398,10 @@ class modFournisseur extends DolibarrModules
'p.datep'=>'payment', 'p.num_paiement'=>'payment', 'p.fk_bank'=>'account', 'project.rowid'=>'project', 'project.ref'=>'project', 'project.title'=>'project');
$this->export_dependencies_array[$r] = array('payment'=>'p.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
// Add extra fields object
$sql = "SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn' AND entity IN (0, ".$conf->entity.")";
$resql = $this->db->query($sql);
if ($resql) { // This can fail when class is used on old database (during migration for example)
while ($obj = $this->db->fetch_object($resql)) {
$fieldname = 'extra.'.$obj->name;
$fieldlabel = ucfirst($obj->label);
$typeFilter = "Text";
switch ($obj->type) {
case 'int':
case 'double':
case 'price':
$typeFilter = "Numeric";
break;
case 'date':
case 'datetime':
$typeFilter = "Date";
break;
case 'boolean':
$typeFilter = "Boolean";
break;
case 'sellist':
$tmp = '';
$tmpparam = unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null
if ($tmpparam['options'] && is_array($tmpparam['options'])) {
$array_keys = array_keys($tmpparam['options']);
$tmp = array_shift($array_keys);
}
if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) {
$typeFilter = "List:".$tmp;
}
break;
}
$this->export_fields_array[$r][$fieldname] = $fieldlabel;
$this->export_TypeFields_array[$r][$fieldname] = $typeFilter;
$this->export_entities_array[$r][$fieldname] = 'invoice';
}
}
$keyforselect = 'facture_fourn';
$keyforelement = 'invoice';
$keyforaliasextra = 'extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
// End add extra fields object
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'societe as s';
@ -564,83 +464,16 @@ class modFournisseur extends DolibarrModules
);
$this->export_dependencies_array[$r] = array('order_line'=>'fd.rowid', 'product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
// Add extra fields object
$sql = "SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'commande_fournisseur' AND entity IN (0, ".$conf->entity.")";
$resql = $this->db->query($sql);
if ($resql) { // This can fail when class is used on old database (during migration for example)
while ($obj = $this->db->fetch_object($resql)) {
$fieldname = 'extra.'.$obj->name;
$fieldlabel = ucfirst($obj->label);
$typeFilter = "Text";
switch ($obj->type) {
case 'int':
case 'double':
case 'price':
$typeFilter = "Numeric";
break;
case 'date':
case 'datetime':
$typeFilter = "Date";
break;
case 'boolean':
$typeFilter = "Boolean";
break;
case 'sellist':
$tmp = '';
$tmpparam = unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null
$tmpkey = array_keys($tmpparam['options']);
if ($tmpparam['options'] && is_array($tmpparam['options'])) {
$tmp = array_shift($tmpkey);
}
if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) {
$typeFilter = "List:".$tmp;
}
break;
}
$this->export_fields_array[$r][$fieldname] = $fieldlabel;
$this->export_TypeFields_array[$r][$fieldname] = $typeFilter;
$this->export_entities_array[$r][$fieldname] = 'order';
}
}
$keyforselect = 'commande_fournisseur';
$keyforelement = 'order';
$keyforaliasextra = 'extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
// End add extra fields object
// Add extra fields line
$sql = "SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'commande_fournisseurdet' AND entity IN (0, ".$conf->entity.")";
$resql = $this->db->query($sql);
if ($resql) { // This can fail when class is used on old database (during migration for example)
while ($obj = $this->db->fetch_object($resql)) {
$fieldname = 'extraline.'.$obj->name;
$fieldlabel = ucfirst($obj->label);
$typeFilter = "Text";
switch ($obj->type) {
case 'int':
case 'double':
case 'price':
$typeFilter = "Numeric";
break;
case 'date':
case 'datetime':
$typeFilter = "Date";
break;
case 'boolean':
$typeFilter = "Boolean";
break;
case 'sellist':
$tmp = '';
$tmpparam = unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null
if ($tmpparam['options'] && is_array($tmpparam['options'])) {
$tmpparam_param_key = array_keys($tmpparam['options']);
$tmp = array_shift($tmpparam_param_key);
}
if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) {
$typeFilter = "List:".$tmp;
}
break;
}
$this->export_fields_array[$r][$fieldname] = $fieldlabel;
$this->export_TypeFields_array[$r][$fieldname] = $typeFilter;
$this->export_entities_array[$r][$fieldname] = 'order_line';
}
}
$keyforselect = 'commande_fournisseurdet';
$keyforelement = 'order_line';
$keyforaliasextra = 'extraline';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
// End add extra fields line
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'societe as s';

View File

@ -322,7 +322,7 @@ class modProduct extends DolibarrModules
$this->export_code[$r] = $this->rights_class.'_'.$r;
$this->export_label[$r] = "ProductsMultiPrice"; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_permission[$r] = array(array("produit", "export"));
$this->export_fields_array[$r] = array('p.rowid'=>"Id", 'p.ref'=>"Ref",
$this->export_fields_array[$r] = array('p.rowid'=>"Id", 'p.ref'=>"Ref", 'p.label'=>"Label",
'pr.price_base_type'=>"PriceBase", 'pr.price_level'=>"PriceLevel",
'pr.price'=>"PriceLevelUnitPriceHT", 'pr.price_ttc'=>"PriceLevelUnitPriceTTC",
'pr.price_min'=>"MinPriceLevelUnitPriceHT", 'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC",
@ -337,7 +337,7 @@ class modProduct extends DolibarrModules
// 'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",
// 'p.datec'=>'Date','p.tms'=>'Date'
//);
$this->export_entities_array[$r] = array('p.rowid'=>"product", 'p.ref'=>"product",
$this->export_entities_array[$r] = array('p.rowid'=>"product", 'p.ref'=>"product", 'p.label'=>"Label",
'pr.price_base_type'=>"product", 'pr.price_level'=>"product", 'pr.price'=>"product",
'pr.price_ttc'=>"product",
'pr.price_min'=>"product", 'pr.price_min_ttc'=>"product",
@ -348,6 +348,8 @@ class modProduct extends DolibarrModules
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity
$this->export_sql_end[$r] .= ' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
$this->export_sql_end[$r] .= ' AND pr.date_price = (SELECT MAX(pr2.date_price) FROM '.MAIN_DB_PREFIX.'product_price as pr2 WHERE pr2.fk_product = pr.fk_product AND pr2.entity IN ('.getEntity('product').'))'; // export only latest prices not full history
$this->export_sql_end[$r] .= ' ORDER BY p.ref, pr.price_level';
}
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
@ -356,7 +358,7 @@ class modProduct extends DolibarrModules
$this->export_code[$r] = $this->rights_class.'_'.$r;
$this->export_label[$r] = "ProductsPricePerCustomer"; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_permission[$r] = array(array("produit", "export"));
$this->export_fields_array[$r] = array('p.rowid'=>"Id", 'p.ref'=>"Ref",
$this->export_fields_array[$r] = array('p.rowid'=>"Id", 'p.ref'=>"Ref", 'p.label'=>"Label",
's.nom'=>'ThirdParty',
'pr.price_base_type'=>"PriceBase",
'pr.price'=>"PriceUnitPriceHT", 'pr.price_ttc'=>"PriceUnitPriceTTC",
@ -367,7 +369,7 @@ class modProduct extends DolibarrModules
if (is_object($mysoc) && $usenpr) {
$this->export_fields_array[$r]['pr.recuperableonly'] = 'NPR';
}
$this->export_entities_array[$r] = array('p.rowid'=>"product", 'p.ref'=>"product",
$this->export_entities_array[$r] = array('p.rowid'=>"product", 'p.ref'=>"product", 'p.label'=>"Label",
's.nom'=>'company',
'pr.price_base_type'=>"product", 'pr.price'=>"product",
'pr.price_ttc'=>"product",
@ -572,7 +574,13 @@ class modProduct extends DolibarrModules
'class' => 'CProductNature',
'method' => 'fetch',
'dict' => 'DictionaryProductNature'
),
),
'p.accountancy_code_sell'=>array('rule'=>'accountingaccount'),
'p.accountancy_code_sell_intra'=>array('rule'=>'accountingaccount'),
'p.accountancy_code_sell_export'=>array('rule'=>'accountingaccount'),
'p.accountancy_code_buy'=>array('rule'=>'accountingaccount'),
'p.accountancy_code_buy_intra'=>array('rule'=>'accountingaccount'),
'p.accountancy_code_buy_export'=>array('rule'=>'accountingaccount'),
);
$this->import_regex_array[$r] = array(

View File

@ -127,19 +127,19 @@ class modTicket extends DolibarrModules
'tabsql' => array(
'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_type as f',
'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_severity as f',
'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default, f.public FROM '.MAIN_DB_PREFIX.'c_ticket_category as f',
'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default, f.public, f.fk_parent FROM '.MAIN_DB_PREFIX.'c_ticket_category as f',
'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_resolution as f'
),
'tabsqlsort' => array("pos ASC", "pos ASC", "pos ASC", "pos ASC"),
'tabfield' => array("code,label,pos,use_default", "code,label,pos,use_default", "code,label,pos,use_default,public", "code,label,pos,use_default"),
'tabfieldvalue' => array("code,label,pos,use_default", "code,label,pos,use_default", "code,label,pos,use_default,public", "code,label,pos,use_default"),
'tabfieldinsert' => array("code,label,pos,use_default", "code,label,pos,use_default", "code,label,pos,use_default,public", "code,label,pos,use_default"),
'tabfield' => array("code,label,pos,use_default", "code,label,pos,use_default", "code,label,pos,use_default,public,fk_parent", "code,label,pos,use_default"),
'tabfieldvalue' => array("code,label,pos,use_default", "code,label,pos,use_default", "code,label,pos,use_default,public,fk_parent", "code,label,pos,use_default"),
'tabfieldinsert' => array("code,label,pos,use_default", "code,label,pos,use_default", "code,label,pos,use_default,public,fk_parent", "code,label,pos,use_default"),
'tabrowid' => array("rowid", "rowid", "rowid", "rowid"),
'tabcond' => array($conf->ticket->enabled, $conf->ticket->enabled, $conf->ticket->enabled, $conf->ticket->enabled),
'tabhelp' => array(
array('code'=>$langs->trans("EnterAnyCode"), 'use_default'=>$langs->trans("Enter0or1")),
array('code'=>$langs->trans("EnterAnyCode"), 'use_default'=>$langs->trans("Enter0or1")),
array('code'=>$langs->trans("EnterAnyCode"), 'use_default'=>$langs->trans("Enter0or1"), 'public'=>$langs->trans("Enter0or1").'<br>'.$langs->trans("TicketGroupIsPublicDesc")),
array('code'=>$langs->trans("EnterAnyCode"), 'use_default'=>$langs->trans("Enter0or1"), 'public'=>$langs->trans("Enter0or1").'<br>'.$langs->trans("TicketGroupIsPublicDesc"), 'fk_parent'=>$langs->trans("IfThisCategoryIsChildOfAnother")),
array('code'=>$langs->trans("EnterAnyCode"), 'use_default'=>$langs->trans("Enter0or1"))
),
);

View File

@ -99,7 +99,7 @@ class modGeneratePassStandard extends ModeleGenPassword
$password = "";
// define possible characters
$possible = "0123456789bcdfghjkmnpqrstvwxyz";
$possible = "0123456789qwertyuiopasdfghjklzxcvbnmASDFGHJKLZXCVBNMQWERTYUIOP";
// set up a counter
$i = 0;
@ -107,10 +107,13 @@ class modGeneratePassStandard extends ModeleGenPassword
// add random characters to $password until $length is reached
while ($i < $this->length) {
// pick a random character from the possible ones
$char = substr($possible, mt_rand(0, dol_strlen($possible) - 1), 1);
if (function_exists('random_int')) { // Cryptographic random
$char = substr($possible, random_int(0, dol_strlen($possible) - 1), 1);
} else {
$char = substr($possible, mt_rand(0, dol_strlen($possible) - 1), 1);
}
// we don't want this character if it's already in the password
if (!strstr($password, $char)) {
if (substr_count($password, $char) <= 6) { // we don't want this character if it's already 5 times in the password
$password .= $char;
$i++;
}

View File

@ -47,7 +47,7 @@ foreach ($object->fields as $key => $val) {
print '<tr class="field_'.$key.'">';
print '<td';
print ' class="titlefieldcreate';
if ($val['notnull'] > 0) {
if (isset($val['notnull']) && $val['notnull'] > 0) {
print ' fieldrequired';
}
if ($val['type'] == 'text' || $val['type'] == 'html') {
@ -63,7 +63,7 @@ foreach ($object->fields as $key => $val) {
print '</td>';
print '<td class="valuefieldcreate">';
if (!empty($val['picto'])) {
print img_picto('', $val['picto']);
print img_picto('', $val['picto'], '', false, 0, 0, '', 'pictofixedwidth');
}
if (in_array($val['type'], array('int', 'integer'))) {
$value = GETPOST($key, 'int');

View File

@ -48,7 +48,7 @@ foreach ($object->fields as $key => $val) {
print '<tr class="field_'.$key.'"><td';
print ' class="titlefieldcreate';
if ($val['notnull'] > 0) {
if (isset($val['notnull']) && $val['notnull'] > 0) {
print ' fieldrequired';
}
if (preg_match('/^(text|html)/', $val['type'])) {
@ -63,7 +63,7 @@ foreach ($object->fields as $key => $val) {
print '</td>';
print '<td class="valuefieldcreate">';
if (!empty($val['picto'])) {
print img_picto('', $val['picto']);
print img_picto('', $val['picto'], '', false, 0, 0, '', 'pictofixedwidth');
}
if (in_array($val['type'], array('int', 'integer'))) {
$value = GETPOSTISSET($key) ?GETPOST($key, 'int') : $object->$key;

View File

@ -356,7 +356,7 @@ if (!empty($conf->global->MAIN_EASTER_EGG_COMMITSTRIP)) {
<?php if ($main_home) {
?>
<div class="center login_main_home paddingtopbottom <?php echo empty($conf->global->MAIN_LOGIN_BACKGROUND) ? '' : ' backgroundsemitransparent'; ?>" style="max-width: 70%">
<div class="center login_main_home paddingtopbottom <?php echo empty($conf->global->MAIN_LOGIN_BACKGROUND) ? '' : ' backgroundsemitransparent boxshadow'; ?>" style="max-width: 70%">
<?php echo $main_home; ?>
</div><br>
<?php

View File

@ -448,7 +448,7 @@ if ($nolinesbefore) {
$coldisplay += $colspan;
?>
<td class="nobottom linecoledit center valignmiddle" colspan="<?php echo $colspan; ?>">
<input type="submit" class="button" value="<?php echo $langs->trans('Add'); ?>" name="addline" id="addline">
<input type="submit" class="button reposition" value="<?php echo $langs->trans('Add'); ?>" name="addline" id="addline">
</td>
</tr>

View File

@ -130,8 +130,16 @@ $coldisplay++;
$reshook = $hookmanager->executeHooks('formEditProductOptions', $parameters, $this, $action);
}
$situationinvoicelinewithparent = 0;
if ($line->fk_prev_id != null && in_array($object->element, array('facture', 'facturedet'))) {
if ($object->type == $object::TYPE_SITUATION) { // The constant TYPE_SITUATION exists only for object invoice
// Set constant to disallow editing during a situation cycle
$situationinvoicelinewithparent = 1;
}
}
// Do not allow editing during a situation cycle
if ($line->fk_prev_id == null) {
if (!$situationinvoicelinewithparent) {
// editor wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$nbrows = ROWS_2;
@ -181,7 +189,7 @@ $coldisplay++;
}
$coldisplay++;
if ($line->fk_prev_id == null) {
if (!$situationinvoicelinewithparent) {
print '<td class="right">'.$form->load_tva('tva_tx', $line->tva_tx.($line->vat_src_code ? (' ('.$line->vat_src_code.')') : ''), $seller, $buyer, 0, $line->info_bits, $line->product_type, false, 1).'</td>';
} else {
print '<td class="right"><input size="1" type="text" class="flat right" name="tva_tx" value="'.price($line->tva_tx).'" readonly />%</td>';
@ -189,7 +197,7 @@ $coldisplay++;
$coldisplay++;
print '<td class="right"><input type="text" class="flat right" size="5" id="price_ht" name="price_ht" value="'.(isset($line->pu_ht) ?price($line->pu_ht, 0, '', 0) : price($line->subprice, 0, '', 0)).'"';
if ($line->fk_prev_id != null) {
if ($situationinvoicelinewithparent) {
print ' readonly';
}
print '></td>';
@ -211,12 +219,12 @@ $coldisplay++;
<td class="right">
<?php $coldisplay++;
if (($line->info_bits & 2) != 2) {
// I comment this because it shows info even when not required
// I comment warning of stock because it shows the info even when it should not.
// for example always visible on invoice but must be visible only if stock module on and stock decrease option is on invoice validation and status is not validated
// must also not be output for most entities (proposal, intervention, ...)
//if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." ";
print '<input size="3" type="text" class="flat right" name="qty" id="qty" value="'.$line->qty.'"';
if ($line->fk_prev_id != null) {
if ($situationinvoicelinewithparent) { // Do not allow editing during a situation cycle
print ' readonly';
}
print '>';
@ -249,7 +257,7 @@ $coldisplay++;
<?php $coldisplay++;
if (($line->info_bits & 2) != 2) {
print '<input size="1" type="text" class="flat right" name="remise_percent" id="remise_percent" value="'.$line->remise_percent.'"';
if ($line->fk_prev_id != null) {
if ($situationinvoicelinewithparent) {
print ' readonly';
}
print '>%';

View File

@ -135,7 +135,7 @@ if (($line->info_bits & 2) == 2) {
$format = (!empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 'dayhour' : 'day');
if ($line->fk_product > 0) {
print $form->textwithtooltip($text, $description, 3, '', '', $i, 0, (!empty($line->fk_parent_line) ?img_picto('', 'rightarrow') : ''));
print $form->textwithtooltip($text, $description, 3, 0, '', $i, 0, (!empty($line->fk_parent_line) ?img_picto('', 'rightarrow') : ''));
} else {
$type = (!empty($line->product_type) ? $line->product_type : $line->fk_product_type);
if ($type == 1) {
@ -146,7 +146,7 @@ if (($line->info_bits & 2) == 2) {
if (!empty($line->label)) {
$text .= ' <strong>'.$line->label.'</strong>';
print $form->textwithtooltip($text, dol_htmlentitiesbr($line->description), 3, '', '', $i, 0, (!empty($line->fk_parent_line) ?img_picto('', 'rightarrow') : ''));
print $form->textwithtooltip($text, dol_htmlentitiesbr($line->description), 3, 0, '', $i, 0, (!empty($line->fk_parent_line) ?img_picto('', 'rightarrow') : ''));
} else {
if (!empty($line->fk_parent_line)) {
print img_picto('', 'rightarrow');
@ -179,7 +179,7 @@ if (($line->info_bits & 2) == 2) {
}
} else {
if ($line->date_start || $line->date_end) {
print '<br><div class="clearboth nowraponall">'.get_date_range($line->date_start, $line->date_end, $format).'</div>';
print '<br><div class="clearboth nowraponall opacitymedium">'.get_date_range($line->date_start, $line->date_end, $format).'</div>';
}
//print get_date_range($line->date_start, $line->date_end, $format);
}
@ -353,7 +353,15 @@ if ($outputalsopricetotalwithtax) {
$coldisplay++;
}
if ($this->statut == 0 && ($object_rights->creer) && $action != 'selectlines') {
if ($this->statut == 0 && !empty($object_rights->creer) && $action != 'selectlines') {
$situationinvoicelinewithparent = 0;
if ($line->fk_prev_id != null && in_array($object->element, array('facture', 'facturedet'))) {
if ($object->type == $object::TYPE_SITUATION) { // The constant TYPE_SITUATION exists only for object invoice
// Set constant to disallow editing during a situation cycle
$situationinvoicelinewithparent = 1;
}
}
print '<td class="linecoledit center">';
$coldisplay++;
if (($line->info_bits & 2) == 2 || !empty($disableedit)) {
@ -365,7 +373,7 @@ if ($this->statut == 0 && ($object_rights->creer) && $action != 'selectlines') {
print '<td class="linecoldelete center">';
$coldisplay++;
if (($line->fk_prev_id == null) && empty($disableremove)) { //La suppression n'est autorisée que si il n'y a pas de ligne dans une précédente situation
if (!$situationinvoicelinewithparent && empty($disableremove)) { // For situation invoice, deletion is not possible if there is a parent company.
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=ask_deleteline&amp;lineid='.$line->id.'">';
print img_delete();
print '</a>';

View File

@ -216,7 +216,7 @@ if (!empty($morelogincontent)) {
</form>
<div class="center login_main_home divpasswordmessagedesc paddingtopbottom<?php echo empty($conf->global->MAIN_LOGIN_BACKGROUND) ? '' : ' backgroundsemitransparent'; ?>" style="max-width: 70%">
<div class="center login_main_home divpasswordmessagedesc paddingtopbottom<?php echo empty($conf->global->MAIN_LOGIN_BACKGROUND) ? '' : ' backgroundsemitransparent boxshadow'; ?>" style="max-width: 70%">
<?php if ($mode == 'dolibarr' || !$disabled) { ?>
<span class="passwordmessagedesc">
<?php echo $langs->trans('SendNewPasswordDesc'); ?>

View File

@ -108,7 +108,7 @@ class ConferenceOrBooth extends ActionComm
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>0, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'help'=>"Help text", 'showoncombobox'=>'1',),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"LinkToThirparty",),
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1::eventorganization', 'label'=>'Project', 'enabled'=>'1', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1,),
'note' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>1,),
'note' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>1),
'fk_action' => array('type'=>'sellist:c_actioncomm:libelle:id::module LIKE (\'%@eventorganization\')', 'label'=>'Format', 'enabled'=>'1', 'position'=>60, 'notnull'=>1, 'visible'=>1,),
'datep' => array('type'=>'datetime', 'label'=>'DateStart', 'enabled'=>'1', 'position'=>70, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'2',),
'datep2' => array('type'=>'datetime', 'label'=>'DateEnd', 'enabled'=>'1', 'position'=>71, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'3',),
@ -118,6 +118,7 @@ class ConferenceOrBooth extends ActionComm
'fk_user_mod' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>'1', 'position'=>511, 'notnull'=>-1, 'visible'=>-2,),
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,),
'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'notnull'=>1, 'visible'=>1, 'default'=>'0', 'index'=>1, 'arrayofkeyval'=>array('0'=>'EvntOrgDraft', '1'=>'EvntOrgSuggested', '2'=> 'EvntOrgConfirmed', '3' =>'EvntOrgNotQualified', '4' =>'EvntOrgDone', '9'=>'EvntOrgCancelled'),),
'num_vote' => array('type'=>'smallint', 'label'=>'NbVotes', 'enabled'=>'1', 'position'=>1001, 'notnull'=>-1, 'visible'=>5, 'default'=>'0', 'index'=>0),
);
public $rowid;
public $id;

View File

@ -119,7 +119,7 @@ foreach ($object->fields as $key => $val) {
'checked'=>(($visible < 0) ? 0 : 1),
'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)),
'position'=>$val['position'],
'help'=>$val['help']
'help'=> isset($val['help']) ? $val['help'] : ''
);
}
}

View File

@ -1,6 +1,5 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) ---Put here your own copyright and developer email---
*
* 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
@ -571,10 +570,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Show object lines
$result = $object->getLinesArray();
print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '#addline' : '#line_'.GETPOST('lineid', 'int')).'" method="POST">
print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '' : '#line_'.GETPOST('lineid', 'int')).'" method="POST">
<input type="hidden" name="token" value="' . newToken().'">
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'">
<input type="hidden" name="mode" value="">
<input type="hidden" name="page_y" value="">
<input type="hidden" name="id" value="' . $object->id.'">
';

View File

@ -128,7 +128,7 @@ foreach ($object->fields as $key => $val) {
'checked'=>(($visible < 0) ? 0 : 1),
'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)),
'position'=>$val['position'],
'help'=>$val['help']
'help'=> isset($val['help']) ? $val['help'] : ''
);
}
}

View File

@ -1084,7 +1084,7 @@ if (empty($reshook)) {
$fk_c_exp_tax_cat = GETPOST('fk_c_exp_tax_cat', 'int');
$qty = GETPOST('qty', 'int');
$qty = price2num(GETPOST('qty', 'alpha'));
if (empty($qty)) {
$qty = 1;
}
@ -1101,21 +1101,21 @@ if (empty($reshook)) {
$action = '';
}
// Si aucune date n'est rentrée
// If no date entered
if (empty($date) || $date == "--") {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
} elseif ($date < $object->date_debut || $date > ($object->date_fin + (24 * 3600 - 1))) {
// Warning if date out of range
$langs->load("errors");
setEventMessages($langs->trans("WarningDateOfLineMustBeInExpenseReportRange"), null, 'warnings');
}
// Si aucun prix n'est rentré
// If no price entered
if ($value_unit == 0) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PriceUTTC")), null, 'errors');
}
// Warning if date out of range
if ($date < $object->date_debut || $date > ($object->date_fin + (24 * 3600 - 1))) {
$langs->load("errors");
setEventMessages($langs->trans("WarningDateOfLineMustBeInExpenseReportRange"), null, 'warnings');
}
if (!$error) {
$type = 0; // TODO What if service ? We should take the type product/service from the type of expense report llx_c_type_fees
@ -1215,12 +1215,12 @@ if (empty($reshook)) {
}
}
$rowid = $_POST['rowid'];
$rowid = GETPOST('rowid', 'int');
$type_fees_id = GETPOST('fk_c_type_fees', 'int');
$fk_c_exp_tax_cat = GETPOST('fk_c_exp_tax_cat', 'int');
$projet_id = $fk_project;
$comments = GETPOST('comments', 'restricthtml');
$qty = GETPOST('qty', 'int');
$qty = price2num(GETPOST('qty', 'alpha'));
$vatrate = GETPOST('vatrate', 'alpha');
// if VAT is not used in Dolibarr, set VAT rate to 0 because VAT rate is necessary.
@ -2474,32 +2474,32 @@ if ($action == 'create') {
print '</tr>';
} // Fin si c'est payé/validé
print '</table>';
print '</div>';
print '</table>';
print '</div>';
print '<script javascript>
print '<script javascript>
/* JQuery for product free or predefined select */
jQuery(document).ready(function() {
jQuery("#value_unit_ht").keyup(function(event) {
console.log(event.which); // discard event tag and arrows
if (event.which != 9 && (event.which < 37 ||event.which > 40) && jQuery("#value_unit_ht").val() != "") {
jQuery("#value_unit").val("");
}
});
jQuery("#value_unit").keyup(function(event) {
console.log(event.which); // discard event tag and arrows
if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#value_unit").val() != "") {
jQuery("#value_unit_ht").val("");
}
});
/* JQuery for product free or predefined select */
jQuery(document).ready(function() {
jQuery("#value_unit_ht").keyup(function(event) {
console.log(event.which); // discard event tag and arrows
if (event.which != 9 && (event.which < 37 ||event.which > 40) && jQuery("#value_unit_ht").val() != "") {
jQuery("#value_unit").val("");
}
});
jQuery("#value_unit").keyup(function(event) {
console.log(event.which); // discard event tag and arrows
if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#value_unit").val() != "") {
jQuery("#value_unit_ht").val("");
}
});
});
</script>';
</script>';
print '</form>';
print '</form>';
print dol_get_fiche_end();
print dol_get_fiche_end();
}
} else {
dol_print_error($db);
@ -2511,9 +2511,11 @@ if ($action == 'create') {
exit(1);
}
/*
* Action bar
*/
print '<div class="tabsAction">';
if ($action != 'create' && $action != 'edit') {

View File

@ -2119,7 +2119,7 @@ class ExpenseReport extends CommonObject
$this->line->fk_ecm_files = $fk_ecm_files;
$this->line->id = $rowid;
$this->line->id = ((int) $rowid);
// Select des infos sur le type fees
$sql = "SELECT c.code as code_type_fees, c.label as libelle_type_fees";
@ -2703,10 +2703,10 @@ class ExpenseReportLine
$sql .= " '".$this->db->escape(empty($this->vat_src_code) ? '' : $this->vat_src_code)."',";
$sql .= " '".$this->db->escape($this->comments)."',";
$sql .= " ".((float) $this->qty).",";
$sql .= " ".((int) $this->value_unit).",";
$sql .= " ".price2num($this->total_ht).",";
$sql .= " ".price2num($this->total_tva).",";
$sql .= " ".price2num($this->total_ttc).",";
$sql .= " ".((float) $this->value_unit).",";
$sql .= " ".((float) price2num($this->total_ht)).",";
$sql .= " ".((float) price2num($this->total_tva)).",";
$sql .= " ".((float) price2num($this->total_ttc)).",";
$sql .= " '".$this->db->idate($this->date)."',";
$sql .= " ".(empty($this->rule_warning_message) ? 'null' : "'".$this->db->escape($this->rule_warning_message)."'").",";
$sql .= " ".((int) $this->fk_c_exp_tax_cat).",";
@ -2811,26 +2811,26 @@ class ExpenseReportLine
// Update line in database
$sql = "UPDATE ".MAIN_DB_PREFIX."expensereport_det SET";
$sql .= " comments='".$this->db->escape($this->comments)."'";
$sql .= ",value_unit = ".((float) $this->value_unit);
$sql .= ",qty=".((float) $this->qty);
$sql .= ",date='".$this->db->idate($this->date)."'";
$sql .= ",total_ht=".((float) price2num($this->total_ht, 'MT'))."";
$sql .= ",total_tva=".((float) price2num($this->total_tva, 'MT'))."";
$sql .= ",total_ttc=".((float) price2num($this->total_ttc, 'MT'))."";
$sql .= ",tva_tx=".((float) $this->vatrate);
$sql .= ",vat_src_code='".$this->db->escape($this->vat_src_code)."'";
$sql .= ",rule_warning_message='".$this->db->escape($this->rule_warning_message)."'";
$sql .= ",fk_c_exp_tax_cat=".$this->db->escape($this->fk_c_exp_tax_cat);
$sql .= ",fk_ecm_files=".($this->fk_ecm_files > 0 ? ((int) $this->fk_ecm_files) : 'null');
$sql .= ", value_unit = ".((float) $this->value_unit);
$sql .= ", qty=".((float) $this->qty);
$sql .= ", date='".$this->db->idate($this->date)."'";
$sql .= ", total_ht=".((float) price2num($this->total_ht, 'MT'))."";
$sql .= ", total_tva=".((float) price2num($this->total_tva, 'MT'))."";
$sql .= ", total_ttc=".((float) price2num($this->total_ttc, 'MT'))."";
$sql .= ", tva_tx=".((float) $this->vatrate);
$sql .= ", vat_src_code='".$this->db->escape($this->vat_src_code)."'";
$sql .= ", rule_warning_message='".$this->db->escape($this->rule_warning_message)."'";
$sql .= ", fk_c_exp_tax_cat=".$this->db->escape($this->fk_c_exp_tax_cat);
$sql .= ", fk_ecm_files=".($this->fk_ecm_files > 0 ? ((int) $this->fk_ecm_files) : 'null');
if ($this->fk_c_type_fees) {
$sql .= ",fk_c_type_fees = ".((int) $this->fk_c_type_fees);
$sql .= ", fk_c_type_fees = ".((int) $this->fk_c_type_fees);
} else {
$sql .= ",fk_c_type_fees=null";
$sql .= ", fk_c_type_fees=null";
}
if ($this->fk_project > 0) {
$sql .= ",fk_projet=".((int) $this->fk_project);
$sql .= ", fk_projet=".((int) $this->fk_project);
} else {
$sql .= ",fk_projet=null";
$sql .= ", fk_projet=null";
}
$sql .= " WHERE rowid = ".((int) ($this->rowid ? $this->rowid : $this->id));

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