Merge branch 'Dolibarr:develop' into add-ticket-categories-views
This commit is contained in:
commit
3bc2dec696
@ -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().'">';
|
||||
|
||||
@ -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
|
||||
*
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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>';
|
||||
}
|
||||
|
||||
@ -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']; ?>
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -68,16 +68,21 @@ if ($id) {
|
||||
$caneditfieldmember = $user->rights->adherent->creer;
|
||||
}
|
||||
|
||||
$hookmanager->initHooks(array('membernote'));
|
||||
|
||||
// Security check
|
||||
$result = restrictedArea($user, 'adherent', $object->id, '', '', 'socid', 'rowid', 0);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
||||
|
||||
$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
if (empty($reshook)) {
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -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";
|
||||
|
||||
|
||||
@ -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";
|
||||
|
||||
@ -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))
|
||||
//{
|
||||
|
||||
@ -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>';
|
||||
}
|
||||
|
||||
@ -74,6 +74,8 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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.'">';
|
||||
|
||||
@ -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 = '';
|
||||
|
||||
@ -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),
|
||||
|
||||
@ -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++;
|
||||
|
||||
@ -255,7 +255,7 @@ if ($action == 'update') {
|
||||
|
||||
$_SESSION["mainmenu"] = ""; // Le gestionnaire de menu a pu changer
|
||||
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup".(GETPOSTISSET('page_y', 'int') ? '&page_y='.GETPOST('page_y', 'int') : ''));
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -281,6 +281,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
print '<form enctype="multipart/form-data" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="page_y" value="">';
|
||||
|
||||
clearstatcache();
|
||||
|
||||
@ -292,8 +293,9 @@ print '</tr>';
|
||||
|
||||
// Default language
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("DefaultLanguage").'</td><td>';
|
||||
print img_picto('', 'language', 'class="pictofixedwidth"');
|
||||
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'MAIN_LANG_DEFAULT', 1, null, '', 0, 0, 'minwidth300', 2);
|
||||
print '<input class="button button-save" type="submit" name="submit" value="'.$langs->trans("Save").'">';
|
||||
//print '<input class="button button-save smallpaddingimp" type="submit" name="submit" value="'.$langs->trans("Save").'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -303,12 +305,24 @@ print ajax_constantonoff("MAIN_MULTILANGS", array(), $conf->entity, 0, 0, 1, 0);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table><br>'."\n";
|
||||
print '</table>'."\n";
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
print '<div class="center">';
|
||||
print '<input class="button button-save" type="submit" name="submit" value="'.$langs->trans("Save").'">';
|
||||
print '</div>';
|
||||
|
||||
print '<br><br>';
|
||||
|
||||
// Themes and themes options
|
||||
showSkins(null, 1);
|
||||
print '<br>';
|
||||
print '<div class="center">';
|
||||
print '<input class="button button-save reposition" type="submit" name="submit" value="'.$langs->trans("Save").'">';
|
||||
print '</div>';
|
||||
|
||||
print '<br><br>';
|
||||
|
||||
// Other
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
@ -440,6 +454,12 @@ print '</div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input class="button button-save reposition" type="submit" name="submit" value="'.$langs->trans("Save").'">';
|
||||
print '</div>';
|
||||
|
||||
print '<br><br>';
|
||||
|
||||
// Other
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table summary="edit" class="noborder centpercent editmode tableforfield">';
|
||||
@ -497,7 +517,7 @@ print '</div>';
|
||||
|
||||
print '<br>';
|
||||
print '<div class="center">';
|
||||
print '<input class="button button-save" type="submit" name="submit" value="'.$langs->trans("Save").'">';
|
||||
print '<input class="button button-save reposition" type="submit" name="submit" value="'.$langs->trans("Save").'">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
@ -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])) {
|
||||
|
||||
@ -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]).'">';
|
||||
}
|
||||
|
||||
@ -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') {
|
||||
|
||||
@ -91,6 +91,7 @@ print dol_get_fiche_head($head, 'services', '', -1, 'technic');
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("ListOfSupportedOauthProviders").'</span><br><br>';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
$i = 0;
|
||||
@ -145,6 +146,7 @@ foreach ($list as $key) {
|
||||
}
|
||||
|
||||
print '</table>'."\n";
|
||||
print '</div>';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
|
||||
@ -230,7 +230,7 @@ if ($mode == 'setup' && $user->admin) {
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="setconst">';
|
||||
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
@ -262,15 +262,15 @@ if ($mode == 'setup' && $user->admin) {
|
||||
print $langs->trans("NoAccessToken");
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print '<td width="50%">';
|
||||
// Links to delete/checks token
|
||||
if (is_object($tokenobj)) {
|
||||
//test on $storage->hasAccessToken($OAUTH_SERVICENAME) ?
|
||||
print '<a class="button" href="'.$urltodelete.'">'.$langs->trans('DeleteAccess').'</a><br>';
|
||||
print '<a class="button smallpaddingimp" href="'.$urltodelete.'">'.$langs->trans('DeleteAccess').'</a><br>';
|
||||
}
|
||||
// Request remote token
|
||||
if ($urltorenew) {
|
||||
print '<a class="button" href="'.$urltorenew.'">'.$langs->trans('RequestAccess').'</a><br>';
|
||||
print '<a class="button smallpaddingimp" href="'.$urltorenew.'">'.$langs->trans('RequestAccess').'</a><br>';
|
||||
}
|
||||
// Check remote access
|
||||
if ($urltocheckperms) {
|
||||
@ -330,6 +330,7 @@ if ($mode == 'setup' && $user->admin) {
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
if (!empty($driver)) {
|
||||
if ($submit_enabled) {
|
||||
@ -345,6 +346,7 @@ if ($mode == 'setup' && $user->admin) {
|
||||
if ($mode == 'test' && $user->admin) {
|
||||
print $langs->trans('PrintTestDesc'.$driver)."<br><br>\n";
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder centpercent">';
|
||||
if (!empty($driver)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/printing/'.$driver.'.modules.php';
|
||||
@ -364,11 +366,13 @@ if ($mode == 'test' && $user->admin) {
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
if ($mode == 'userconf' && $user->admin) {
|
||||
print $langs->trans('PrintUserConfDesc'.$driver)."<br><br>\n";
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("User").'</th>';
|
||||
@ -395,6 +399,7 @@ if ($mode == 'userconf' && $user->admin) {
|
||||
print "</tr>\n";
|
||||
}
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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>';
|
||||
|
||||
|
||||
@ -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";
|
||||
|
||||
|
||||
@ -309,57 +309,59 @@ 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"),
|
||||
'dolibarr_main_db_readonly' => $langs->trans("ReadOnlyMode"),
|
||||
'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 +402,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 +424,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');
|
||||
}
|
||||
@ -441,6 +450,13 @@ foreach ($configfileparameters as $key => $value) {
|
||||
if (!empty($valuetoshow)) {
|
||||
print img_warning($langs->trans('SwitchThisForABetterSecurity', 0));
|
||||
}
|
||||
} elseif ($newkey == 'dolibarr_main_db_readonly') {
|
||||
print ${$newkey};
|
||||
|
||||
$valuetoshow = ${$newkey};
|
||||
if (!empty($valuetoshow)) {
|
||||
print img_warning($langs->trans('ReadOnlyMode', 1));
|
||||
}
|
||||
} else {
|
||||
print (empty(${$newkey}) ? '' : ${$newkey});
|
||||
}
|
||||
|
||||
@ -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").' <span class="opacitymedium">('.$langs->trans("Recommanded").': '.$langs->trans("SetOptionTo", $langs->transnoentitiesnoconv("MainDbPasswordFileConfEncrypted"), yn(1)).')</span>';
|
||||
print img_picto('', 'warning').' '.$langs->trans("DatabasePasswordNotObfuscated").' <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)." ";
|
||||
if (empty($conf->global->MAIN_SECURITY_HASH_ALGO)) {
|
||||
print '<span class="opacitymedium"> 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> <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 <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 ' <span class="opacitymedium">("exec" PHP method will be used for shell commands)</span>';
|
||||
}
|
||||
if ($execmethod == 2) {
|
||||
print ' <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)." ";
|
||||
if (empty($conf->global->MAIN_SECURITY_HASH_ALGO)) {
|
||||
print '<span class="opacitymedium"> 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> <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 <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").' ('.$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").' ('.$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 ' <span class="opacitymedium">("exec" PHP method will be used for shell commands)</span>';
|
||||
}
|
||||
if ($execmethod == 2) {
|
||||
print ' <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").' ('.$langs->trans("Example").': endpoint1:1,endpoint2:1,...)</span>' : $conf->global->API_ENDPOINT_RULES)."<br>\n";
|
||||
print '<br>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,8 +70,13 @@ $permissionnote = 1;
|
||||
* Actions
|
||||
*/
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
||||
|
||||
$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
if (empty($reshook)) {
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
|
||||
@ -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.'">
|
||||
';
|
||||
|
||||
|
||||
@ -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, '');
|
||||
}
|
||||
|
||||
@ -70,7 +70,13 @@ restrictedArea($user, 'bom', $object->id, 'bom_bom', '', '', 'rowid', $isdraft);
|
||||
* Actions
|
||||
*/
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
||||
$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
if (empty($reshook)) {
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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>';
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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>';
|
||||
|
||||
|
||||
@ -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)."'";
|
||||
|
||||
@ -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.'&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.'&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
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
*/
|
||||
|
||||
@ -52,6 +52,10 @@ if ($user->socid > 0) {
|
||||
$socid = $user->socid;
|
||||
$object->id = $user->socid;
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('propalnote'));
|
||||
|
||||
restrictedArea($user, 'propal', $object->id, 'propal');
|
||||
|
||||
|
||||
@ -61,7 +65,13 @@ restrictedArea($user, 'propal', $object->id, 'propal');
|
||||
|
||||
$permissionnote = $user->rights->propale->creer; // Used by the include of actions_setnotes.inc.php
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
||||
$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
if (empty($reshook)) {
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -91,6 +91,10 @@ $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (!empty($con
|
||||
if (!empty($user->socid)) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('ordercard', 'globalcard'));
|
||||
|
||||
$result = restrictedArea($user, 'commande', $id);
|
||||
|
||||
$object = new Commande($db);
|
||||
@ -102,9 +106,6 @@ $extrafields->fetch_name_optionals_label($object->table_element);
|
||||
// Load object
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('ordercard', 'globalcard'));
|
||||
|
||||
$usercanread = $user->rights->commande->lire;
|
||||
$usercancreate = $user->rights->commande->creer;
|
||||
$usercandelete = $user->rights->commande->supprimer;
|
||||
@ -645,15 +646,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 +662,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 +681,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 +691,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 +2418,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) {
|
||||
|
||||
@ -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").",";
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -45,6 +45,10 @@ $socid = 0;
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('ordernote'));
|
||||
|
||||
$result = restrictedArea($user, 'commande', $id, '');
|
||||
|
||||
|
||||
@ -61,7 +65,13 @@ $permissionnote = $user->rights->commande->creer; // Used by the include of acti
|
||||
* Actions
|
||||
*/
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
||||
$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
if (empty($reshook)) {
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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)."'";
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -98,44 +98,6 @@ if (GETPOST("account") || GETPOST("ref")) {
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
print '<br>';
|
||||
|
||||
$solde = $object->solde(0);
|
||||
if ($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED) {
|
||||
$colspan = 6;
|
||||
} else {
|
||||
$colspan = 5;
|
||||
}
|
||||
|
||||
// Show next coming entries
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
// Ligne de titre tableau des ecritures
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("DateDue").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
if ($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED) {
|
||||
print '<td>'.$langs->trans("Entity").'</td>';
|
||||
}
|
||||
print '<td>'.$langs->trans("ThirdParty").'</td>';
|
||||
print '<td class="right">'.$langs->trans("Debit").'</td>';
|
||||
print '<td class="right">'.$langs->trans("Credit").'</td>';
|
||||
print '<td class="right" width="80">'.$langs->trans("BankBalance").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Current balance
|
||||
print '<tr class="liste_total">';
|
||||
print '<td class="left" colspan="5">'.$langs->trans("CurrentBalance").'</td>';
|
||||
print '<td class="nowrap right">'.price($solde).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="left" colspan="'.$colspan.'">'.$langs->trans("RemainderToPay").'</td>';
|
||||
print '<td class="nowrap right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Remainder to pay in future
|
||||
$sqls = array();
|
||||
@ -183,10 +145,12 @@ if (GETPOST("account") || GETPOST("ref")) {
|
||||
$error = 0;
|
||||
$tab_sqlobjOrder = array();
|
||||
$tab_sqlobj = array();
|
||||
$nbtotalofrecords = 0;
|
||||
|
||||
foreach ($sqls as $sql) {
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$nbtotalofrecords += $db->num_rows($resql);
|
||||
while ($sqlobj = $db->fetch_object($resql)) {
|
||||
$tmpobj = new stdClass();
|
||||
$tmpobj->family = $sqlobj->family;
|
||||
@ -194,7 +158,7 @@ if (GETPOST("account") || GETPOST("ref")) {
|
||||
$tmpobj->ref = $sqlobj->ref;
|
||||
$tmpobj->total_ttc = $sqlobj->total_ttc;
|
||||
$tmpobj->type = $sqlobj->type;
|
||||
$tmpobj->dlt = $sqlobj->dlr;
|
||||
$tmpobj->dlr = $db->jdate($sqlobj->dlr);
|
||||
$tmpobj->socid = $sqlobj->socid;
|
||||
$tmpobj->name = $sqlobj->name;
|
||||
$tmpobj->fournisseur = $sqlobj->fournisseur;
|
||||
@ -208,6 +172,48 @@ if (GETPOST("account") || GETPOST("ref")) {
|
||||
}
|
||||
}
|
||||
|
||||
$param = '';
|
||||
$sortfield = '';
|
||||
$sortorder = '';
|
||||
$massactionbutton = '';
|
||||
$num = 0;
|
||||
$picto = '';
|
||||
$morehtml = '';
|
||||
$limit = 0;
|
||||
|
||||
print_barre_liste($langs->trans("RemainderToPay"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $picto, 0, $morehtml, '', $limit, 0, 0, 1);
|
||||
|
||||
|
||||
$solde = $object->solde(0);
|
||||
if ($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED) {
|
||||
$colspan = 6;
|
||||
} else {
|
||||
$colspan = 5;
|
||||
}
|
||||
|
||||
// Show next coming entries
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
// Ligne de titre tableau des ecritures
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("DateDue").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
if ($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED) {
|
||||
print '<td>'.$langs->trans("Entity").'</td>';
|
||||
}
|
||||
print '<td>'.$langs->trans("ThirdParty").'</td>';
|
||||
print '<td class="right">'.$langs->trans("Debit").'</td>';
|
||||
print '<td class="right">'.$langs->trans("Credit").'</td>';
|
||||
print '<td class="right" width="80">'.$langs->trans("BankBalance").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Current balance
|
||||
print '<tr class="liste_total">';
|
||||
print '<td class="left" colspan="5">'.$langs->trans("CurrentBalance").'</td>';
|
||||
print '<td class="nowrap right">'.price($solde).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Sort array
|
||||
if (!$error) {
|
||||
array_multisort($tab_sqlobjOrder, $tab_sqlobj);
|
||||
@ -220,60 +226,60 @@ if (GETPOST("account") || GETPOST("ref")) {
|
||||
$refcomp = '';
|
||||
$totalpayment = '';
|
||||
|
||||
$obj = array_shift($tab_sqlobj);
|
||||
$tmpobj = array_shift($tab_sqlobj);
|
||||
|
||||
if ($obj->family == 'invoice_supplier') {
|
||||
if ($tmpobj->family == 'invoice_supplier') {
|
||||
$showline = 1;
|
||||
// Uncomment this line to avoid to count suppliers credit note (ff.type = 2)
|
||||
//$showline=(($obj->total_ttc < 0 && $obj->type != 2) || ($obj->total_ttc > 0 && $obj->type == 2))
|
||||
//$showline=(($tmpobj->total_ttc < 0 && $tmpobj->type != 2) || ($tmpobj->total_ttc > 0 && $tmpobj->type == 2))
|
||||
if ($showline) {
|
||||
$ref = $obj->ref;
|
||||
$ref = $tmpobj->ref;
|
||||
$facturefournstatic->ref = $ref;
|
||||
$facturefournstatic->id = $obj->objid;
|
||||
$facturefournstatic->type = $obj->type;
|
||||
$facturefournstatic->id = $tmpobj->objid;
|
||||
$facturefournstatic->type = $tmpobj->type;
|
||||
$ref = $facturefournstatic->getNomUrl(1, '');
|
||||
|
||||
$societestatic->id = $obj->socid;
|
||||
$societestatic->name = $obj->name;
|
||||
$societestatic->id = $tmpobj->socid;
|
||||
$societestatic->name = $tmpobj->name;
|
||||
$refcomp = $societestatic->getNomUrl(1, '', 24);
|
||||
|
||||
$totalpayment = -1 * $facturefournstatic->getSommePaiement(); // Payment already done
|
||||
}
|
||||
}
|
||||
if ($obj->family == 'invoice') {
|
||||
$facturestatic->ref = $obj->ref;
|
||||
$facturestatic->id = $obj->objid;
|
||||
$facturestatic->type = $obj->type;
|
||||
if ($tmpobj->family == 'invoice') {
|
||||
$facturestatic->ref = $tmpobj->ref;
|
||||
$facturestatic->id = $tmpobj->objid;
|
||||
$facturestatic->type = $tmpobj->type;
|
||||
$ref = $facturestatic->getNomUrl(1, '');
|
||||
|
||||
$societestatic->id = $obj->socid;
|
||||
$societestatic->name = $obj->name;
|
||||
$societestatic->id = $tmpobj->socid;
|
||||
$societestatic->name = $tmpobj->name;
|
||||
$refcomp = $societestatic->getNomUrl(1, '', 24);
|
||||
|
||||
$totalpayment = $facturestatic->getSommePaiement(); // Payment already done
|
||||
$totalpayment += $facturestatic->getSumDepositsUsed();
|
||||
$totalpayment += $facturestatic->getSumCreditNotesUsed();
|
||||
}
|
||||
if ($obj->family == 'social_contribution') {
|
||||
$socialcontribstatic->ref = $obj->ref;
|
||||
$socialcontribstatic->id = $obj->objid;
|
||||
$socialcontribstatic->label = $obj->type;
|
||||
if ($tmpobj->family == 'social_contribution') {
|
||||
$socialcontribstatic->ref = $tmpobj->ref;
|
||||
$socialcontribstatic->id = $tmpobj->objid;
|
||||
$socialcontribstatic->label = $tmpobj->type;
|
||||
$ref = $socialcontribstatic->getNomUrl(1, 24);
|
||||
|
||||
$totalpayment = -1 * $socialcontribstatic->getSommePaiement(); // Payment already done
|
||||
}
|
||||
|
||||
$parameters = array('obj' => $obj, 'ref' => $ref, 'refcomp' => $refcomp, 'totalpayment' => $totalpayment);
|
||||
$reshook = $hookmanager->executeHooks('moreFamily', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
$parameters = array('obj' => $tmpobj, 'ref' => $ref, 'refcomp' => $refcomp, 'totalpayment' => $totalpayment);
|
||||
$reshook = $hookmanager->executeHooks('moreFamily', $parameters, $tmpobject, $action); // Note that $action and $tmpobject may have been modified by hook
|
||||
if (empty($reshook)) {
|
||||
$ref = isset($hookmanager->resArray['ref']) ? $hookmanager->resArray['ref'] : $ref;
|
||||
$refcomp = isset($hookmanager->resArray['refcomp']) ? $hookmanager->resArray['refcomp'] : $refcomp;
|
||||
$totalpayment = isset($hookmanager->resArray['totalpayment']) ? $hookmanager->resArray['totalpayment'] : $totalpayment;
|
||||
}
|
||||
|
||||
$total_ttc = $obj->total_ttc;
|
||||
$total_ttc = $tmpobj->total_ttc;
|
||||
if ($totalpayment) {
|
||||
$total_ttc = $obj->total_ttc - $totalpayment;
|
||||
$total_ttc = $tmpobj->total_ttc - $totalpayment;
|
||||
}
|
||||
$solde += $total_ttc;
|
||||
|
||||
@ -282,26 +288,26 @@ if (GETPOST("account") || GETPOST("ref")) {
|
||||
// Show line
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
if ($obj->dlr) {
|
||||
print dol_print_date($db->jdate($obj->dlr), "day");
|
||||
if ($tmpobj->dlr) {
|
||||
print dol_print_date($tmpobj->dlr, "day");
|
||||
} else {
|
||||
print $langs->trans("NotDefined");
|
||||
}
|
||||
print "</td>";
|
||||
print "<td>".$ref."</td>";
|
||||
if ($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED) {
|
||||
if ($obj->family == 'invoice') {
|
||||
$mc->getInfo($obj->entity);
|
||||
if ($tmpobj->family == 'invoice') {
|
||||
$mc->getInfo($tmpobj->entity);
|
||||
print "<td>".$mc->label."</td>";
|
||||
} else {
|
||||
print "<td></td>";
|
||||
}
|
||||
}
|
||||
print "<td>".$refcomp."</td>";
|
||||
if ($obj->total_ttc < 0) {
|
||||
if ($tmpobj->total_ttc < 0) {
|
||||
print '<td class="nowrap right">'.price(abs($total_ttc))."</td><td> </td>";
|
||||
};
|
||||
if ($obj->total_ttc >= 0) {
|
||||
if ($tmpobj->total_ttc >= 0) {
|
||||
print '<td> </td><td class="nowrap right">'.price($total_ttc)."</td>";
|
||||
};
|
||||
print '<td class="nowrap right">'.price($solde).'</td>';
|
||||
|
||||
@ -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'] : ''
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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.'&fac_avoir='.$object->id.'&action=create&type=2'.($object->fk_project > 0 ? '&projectid='.$object->fk_project : '').($object->entity > 0 ? '&originentity='.$object->entity : '').'">'.$langs->trans("CreateCreditNote").'</a>';
|
||||
}
|
||||
|
||||
@ -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;
|
||||
@ -5342,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) {
|
||||
@ -5377,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).",";
|
||||
|
||||
@ -54,6 +54,8 @@ $socid = 0;
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$hookmanager->initHooks(array('invoicenote'));
|
||||
|
||||
$result = restrictedArea($user, 'facture', $id, '');
|
||||
|
||||
|
||||
@ -61,7 +63,13 @@ $result = restrictedArea($user, 'facture', $id, '');
|
||||
* Actions
|
||||
*/
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
||||
$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
if (empty($reshook)) {
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -151,6 +151,15 @@ $dolibarr_main_db_character_set='utf8';
|
||||
$dolibarr_main_db_collation='utf8_unicode_ci';
|
||||
|
||||
|
||||
// dolibarr_main_db_readonly
|
||||
// Set this to 1 to have the application working in readonly mode. All sql access INSERT/UPDATE/DELETE/CREATE/ALTER/TRUNCATE/DROP will be disabled.
|
||||
// Default value: 0
|
||||
// Examples:
|
||||
// $dolibarr_main_db_readonly='0';
|
||||
//
|
||||
$dolibarr_main_db_readonly=0;
|
||||
|
||||
|
||||
// dolibarr_main_instance_unique_id
|
||||
// An secret ID that is unique for each installation.
|
||||
// This value is also visible and never propagated outside of Dolibarr, so it can be used as a salt / key for some encryption.
|
||||
|
||||
@ -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']; ?>
|
||||
|
||||
@ -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>';
|
||||
}
|
||||
|
||||
@ -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),
|
||||
|
||||
@ -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']++;
|
||||
}
|
||||
|
||||
@ -49,13 +49,20 @@ if ($id > 0) {
|
||||
$permissionnote = $user->rights->societe->creer; // Used by the include of actions_setnotes.inc.php
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('contactcard'));
|
||||
// $hookmanager->initHooks(array('contactcard')); -> Name conflict with product/card.php
|
||||
$hookmanager->initHooks(array('contactnote'));
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
||||
$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
if (empty($reshook)) {
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -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++;
|
||||
}
|
||||
|
||||
@ -44,6 +44,10 @@ $ref = GETPOST('ref', 'alpha');
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
//$hookmanager->initHooks(array('contractcard', 'globalcard')); -> Conflict with contrat\card.php
|
||||
$hookmanager->initHooks(array('contractnote'));
|
||||
|
||||
$result = restrictedArea($user, 'contrat', $id);
|
||||
|
||||
$object = new Contrat($db);
|
||||
@ -51,16 +55,18 @@ $object->fetch($id, $ref);
|
||||
|
||||
$permissionnote = $user->rights->contrat->creer; // Used by the include of actions_setnotes.inc.php
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('contractcard', 'globalcard'));
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
||||
$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
if (empty($reshook)) {
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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 : ' ').'</option>';
|
||||
$out .= '<option value="-1" selected>'.($textifempty ? $textifempty : ' ').'</option>';
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -561,28 +561,27 @@ class FormTicket
|
||||
/**
|
||||
* Return html list of ticket anaytic codes
|
||||
*
|
||||
* @param string $selected Id categorie pre-selectionnée
|
||||
* @param string $htmlname Nom de la zone select
|
||||
* @param string $filtertype To filter on some properties in llx_c_ticket_category ('public = 1'). This parameter must not come from input of users.
|
||||
* @param int $format 0=id+libelle, 1=code+code, 2=code+libelle, 3=id+code
|
||||
* @param int $empty 1=peut etre vide, 0 sinon
|
||||
* @param int $noadmininfo 0=Add admin info, 1=Disable admin info
|
||||
* @param int $maxlength Max length of label
|
||||
* @param string $morecss More CSS
|
||||
* @param int $use_multilevel if > 0 create a multilevel select which use $htmlname example: $use_multilevel = 1 permit to have 2 select boxes.
|
||||
* @param string $selected Id categorie pre-selectionnée
|
||||
* @param string $htmlname Name of select component
|
||||
* @param string $filtertype To filter on some properties in llx_c_ticket_category ('public = 1'). This parameter must not come from input of users.
|
||||
* @param int $format 0=id+libelle, 1=code+code, 2=code+libelle, 3=id+code
|
||||
* @param int $empty 1=peut etre vide, 0 sinon
|
||||
* @param int $noadmininfo 0=Add admin info, 1=Disable admin info
|
||||
* @param int $maxlength Max length of label
|
||||
* @param string $morecss More CSS
|
||||
* @param int $use_multilevel If > 0 create a multilevel select which use $htmlname example: $use_multilevel = 1 permit to have 2 select boxes.
|
||||
* @return void
|
||||
*/
|
||||
public function selectGroupTickets($selected = '', $htmlname = 'ticketcategory', $filtertype = '', $format = 0, $empty = 0, $noadmininfo = 0, $maxlength = 0, $morecss = '', $use_multilevel = 0)
|
||||
{
|
||||
global $langs, $user;
|
||||
|
||||
dol_syslog(get_class($this)."::selectCategoryTickets ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG);
|
||||
|
||||
$ticketstat = new Ticket($this->db);
|
||||
$ticketstat->loadCacheCategoriesTickets();
|
||||
|
||||
if ($use_multilevel <= 0) {
|
||||
$ticketstat = new Ticket($this->db);
|
||||
|
||||
dol_syslog(get_class($this)."::selectCategoryTickets ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG);
|
||||
|
||||
$ticketstat->loadCacheCategoriesTickets();
|
||||
|
||||
print '<select id="select'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
|
||||
if ($empty) {
|
||||
print '<option value=""> </option>';
|
||||
@ -667,15 +666,17 @@ class FormTicket
|
||||
$sql = "SELECT ctc.rowid, ctc.code, ctc.label, ctc.fk_parent, ";
|
||||
$sql .= $this->db->ifsql("ctc.rowid NOT IN (SELECT ctcfather.rowid FROM llx_c_ticket_category as ctcfather JOIN llx_c_ticket_category as ctcjoin ON ctcfather.rowid = ctcjoin.fk_parent)", "'NOTPARENT'", "'PARENT'")." as isparent";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_category as ctc";
|
||||
$sql .= " WHERE ctc.public = 1";
|
||||
$sql .= " AND ctc.active = 1";
|
||||
$sql .= " WHERE ctc.active > 0";
|
||||
if ($filtertype == 'public=1') {
|
||||
$sql .= " AND ctc.public = 1";
|
||||
}
|
||||
$sql .= " AND ctc.fk_parent = 0";
|
||||
$sql .= $this->db->order('ctc.pos', 'ASC');
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num_rows = $this->db->num_rows($resql);
|
||||
$num_rows_level0 = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num_rows) {
|
||||
while ($i < $num_rows_level0) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj) {
|
||||
$grouprowid = $obj->rowid;
|
||||
@ -694,10 +695,11 @@ class FormTicket
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
if ($num_rows == 1) {
|
||||
if ($num_rows_level0 == 1) {
|
||||
return '<input type="hidden" name="'.$htmlname.'" id="'.$htmlname.'" value="'.dol_escape_htmltag($groupvalue).'">';
|
||||
}
|
||||
$stringtoprint .= '</select> ';
|
||||
$stringtoprint .= '</select> ';
|
||||
|
||||
$levelid = 1;
|
||||
while ($levelid <= $use_multilevel) {
|
||||
$tabscript = array();
|
||||
@ -708,8 +710,10 @@ class FormTicket
|
||||
$sql .= $this->db->ifsql("ctc.rowid NOT IN (SELECT ctcfather.rowid FROM llx_c_ticket_category as ctcfather JOIN llx_c_ticket_category as ctcjoin ON ctcfather.rowid = ctcjoin.fk_parent)", "'NOTPARENT'", "'PARENT'")." as isparent";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_category as ctc";
|
||||
$sql .= " JOIN ".MAIN_DB_PREFIX."c_ticket_category as ctcjoin ON ctc.fk_parent = ctcjoin.rowid";
|
||||
$sql .= " WHERE ctc.public = 1";
|
||||
$sql .= " AND ctc.active = 1";
|
||||
$sql .= " WHERE ctc.active = 1";
|
||||
if ($filtertype == 'public=1') {
|
||||
$sql .= " AND ctc.public = 1";
|
||||
}
|
||||
if (!empty($arrayidused)) {
|
||||
$sql .= " AND ctc.fk_parent IN ( ";
|
||||
foreach ($arrayidused as $idused) {
|
||||
@ -741,7 +745,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 +760,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 +794,9 @@ class FormTicket
|
||||
$stringtoprint .='})';
|
||||
$stringtoprint .='</script>';
|
||||
}
|
||||
|
||||
$stringtoprint .= ajax_combobox($htmlname);
|
||||
|
||||
return $stringtoprint;
|
||||
}
|
||||
}
|
||||
|
||||
@ -266,7 +266,7 @@ class DoliDBMysqli extends DoliDB
|
||||
*/
|
||||
public function query($query, $usesavepoint = 0, $type = 'auto')
|
||||
{
|
||||
global $conf;
|
||||
global $conf, $dolibarr_main_db_readonly;
|
||||
|
||||
$query = trim($query);
|
||||
|
||||
@ -278,6 +278,15 @@ class DoliDBMysqli extends DoliDB
|
||||
return false; // Return false = error if empty request
|
||||
}
|
||||
|
||||
if (!empty($dolibarr_main_db_readonly)) {
|
||||
if (preg_match('/^(INSERT|UPDATE|REPLACE|DELETE|CREATE|ALTER|TRUNCATE|DROP)/i', $query)) {
|
||||
$this->lasterror = 'Application in read-only mode';
|
||||
$this->lasterrno = 'APPREADONLY';
|
||||
$this->lastquery = $query;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$this->database_name) {
|
||||
// Ordre SQL ne necessitant pas de connexion a une base (exemple: CREATE DATABASE)
|
||||
$ret = $this->db->query($query);
|
||||
|
||||
@ -498,7 +498,7 @@ class DoliDBPgsql extends DoliDB
|
||||
*/
|
||||
public function query($query, $usesavepoint = 0, $type = 'auto')
|
||||
{
|
||||
global $conf;
|
||||
global $conf, $dolibarr_main_db_readonly;
|
||||
|
||||
$query = trim($query);
|
||||
|
||||
@ -527,6 +527,18 @@ class DoliDBPgsql extends DoliDB
|
||||
$SYSLOG_SQL_LIMIT = 10000; // limit log to 10kb per line to limit DOS attacks
|
||||
dol_syslog('sql='.substr($query, 0, $SYSLOG_SQL_LIMIT), LOG_DEBUG);
|
||||
}
|
||||
if (empty($query)) {
|
||||
return false; // Return false = error if empty request
|
||||
}
|
||||
|
||||
if (!empty($dolibarr_main_db_readonly)) {
|
||||
if (preg_match('/^(INSERT|UPDATE|REPLACE|DELETE|CREATE|ALTER|TRUNCATE|DROP)/i', $query)) {
|
||||
$this->lasterror = 'Application in read-only mode';
|
||||
$this->lasterrno = 'APPREADONLY';
|
||||
$this->lastquery = $query;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$ret = @pg_query($this->db, $query);
|
||||
|
||||
|
||||
@ -397,7 +397,7 @@ class DoliDBSqlite3 extends DoliDB
|
||||
*/
|
||||
public function query($query, $usesavepoint = 0, $type = 'auto')
|
||||
{
|
||||
global $conf;
|
||||
global $conf, $dolibarr_main_db_readonly;
|
||||
|
||||
$ret = null;
|
||||
|
||||
@ -455,6 +455,15 @@ class DoliDBSqlite3 extends DoliDB
|
||||
return false; // Return false = error if empty request
|
||||
}
|
||||
|
||||
if (!empty($dolibarr_main_db_readonly)) {
|
||||
if (preg_match('/^(INSERT|UPDATE|REPLACE|DELETE|CREATE|ALTER|TRUNCATE|DROP)/i', $query)) {
|
||||
$this->lasterror = 'Application in read-only mode';
|
||||
$this->lasterrno = 'APPREADONLY';
|
||||
$this->lastquery = $query;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Ordre SQL ne necessitant pas de connexion a une base (exemple: CREATE DATABASE)
|
||||
try {
|
||||
//$ret = $this->db->exec($query);
|
||||
|
||||
@ -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.
|
||||
@ -245,3 +250,59 @@ print 'jQuery(\'.clipboardCPButton, .clipboardCPValueToPrint\').click(function()
|
||||
lastchild.innerHTML = \''.dol_escape_js($langs->trans('CopiedToClipboard')).'\';
|
||||
setTimeout(() => { lastchild.innerHTML = tmp; }, 1000);
|
||||
})'."\n";
|
||||
|
||||
|
||||
print "\n/* JS CODE TO ENABLE DIALOG CONFIRM POPUP ON ACTION BUTTON */\n";
|
||||
print '$( document ).ready(function() {
|
||||
$(document).on("click", \'.butActionConfirm\', function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
// I don\'t use jquery $(this).data(\'confirm-url\'); to get $(this).attr(\'data-confirm-url\'); because .data() can doesn\'t work with ajax
|
||||
var confirmUrl = $(this).attr(\'data-confirm-url\');
|
||||
var confirmTitle = $(this).attr(\'data-confirm-title\');
|
||||
var confirmContent = $(this).attr(\'data-confirm-content\');
|
||||
var confirmActionBtnLabel = $(this).attr(\'data-confirm-action-btn-label\');
|
||||
var confirmCancelBtnLabel = $(this).attr(\'data-confirm-cancel-btn-label\');
|
||||
|
||||
var confirmId = \'confirm-dialog-box\';
|
||||
if($(this).attr(\'id\') != undefined){ var confirmId = confirmId + "-" + $(this).attr(\'id\'); }
|
||||
if($("#" + confirmId) != undefined) { $(\'#\' + confirmId).remove(); }
|
||||
|
||||
// Create modal box
|
||||
|
||||
var $confirmBox = $(\'<div/>\', {
|
||||
id: confirmId,
|
||||
title: confirmTitle
|
||||
}).appendTo(\'body\');
|
||||
|
||||
$confirmBox.dialog({
|
||||
autoOpen: true,
|
||||
modal: false,
|
||||
//width: Math.min($( window ).width() - 50, 1700),
|
||||
dialogClass: \'confirm-dialog-box\',
|
||||
buttons: [
|
||||
{
|
||||
text: confirmActionBtnLabel,
|
||||
"class": \'ui-state-information\',
|
||||
click: function () {
|
||||
window.location.replace(confirmUrl);
|
||||
}
|
||||
},
|
||||
{
|
||||
text: confirmCancelBtnLabel,
|
||||
"class": \'ui-state-information\',
|
||||
click: function () {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
],
|
||||
close: function( event, ui ) {
|
||||
$(\'#\'+confirmBox).remove();
|
||||
},
|
||||
open: function( event, ui ) {
|
||||
$confirmBox.html(confirmContent);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
'."\n";
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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";
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -1789,7 +1789,14 @@ function addFileIntoDatabaseIndex($dir, $file, $fullpathorig = '', $mode = 'uplo
|
||||
|
||||
if (is_object($object) && $object->id > 0) {
|
||||
$ecmfile->src_object_id = $object->id;
|
||||
$ecmfile->src_object_type = $object->table_element;
|
||||
if (isset($object->table_element)) {
|
||||
$ecmfile->src_object_type = $object->table_element;
|
||||
} else {
|
||||
dol_syslog('Error: object ' . get_class($object) . ' has no table_element attribute.');
|
||||
return -1;
|
||||
}
|
||||
if (isset($object->src_object_description)) $ecmfile->description = $object->src_object_description;
|
||||
if (isset($object->src_object_keywords)) $ecmfile->keywords = $object->src_object_keywords;
|
||||
}
|
||||
|
||||
if ($setsharekey) {
|
||||
|
||||
@ -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('/'/i', ''', $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 javascript 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;
|
||||
@ -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|:/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(
|
||||
@ -9734,6 +9773,8 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
|
||||
*/
|
||||
function dolGetButtonAction($label, $html = '', $actionType = 'default', $url = '', $id = '', $userRight = 1, $params = array())
|
||||
{
|
||||
global $hookmanager, $action, $object, $langs;
|
||||
|
||||
$class = 'butAction';
|
||||
if ($actionType == 'danger' || $actionType == 'delete') {
|
||||
$class = 'butActionDelete';
|
||||
@ -9774,12 +9815,27 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url =
|
||||
}
|
||||
}
|
||||
|
||||
// Js Confirm button
|
||||
if (!empty($params['confirm'])) {
|
||||
if (!is_array($params['confirm'])) {
|
||||
$params['confirm'] = array(
|
||||
'url' => $url . (strpos($url, '?') > 0 ? '&' : '?') . 'confirm=yes'
|
||||
);
|
||||
}
|
||||
|
||||
// for js desabled compatibility set $url as call to confirm action and $params['confirm']['url'] to confirmed action
|
||||
$attr['data-confirm-url'] = $params['confirm']['url'];
|
||||
$attr['data-confirm-title'] = !empty($params['confirm']['title']) ? $params['confirm']['title'] : $langs->trans('ConfirmBtnCommonTitle', $label);
|
||||
$attr['data-confirm-content'] = !empty($params['confirm']['content']) ? $params['confirm']['content'] : $langs->trans('ConfirmBtnCommonContent', $label);
|
||||
$attr['data-confirm-action-btn-label'] = !empty($params['confirm']['action-btn-label']) ? $params['confirm']['action-btn-label'] : $langs->trans('Confirm');
|
||||
$attr['data-confirm-cancel-btn-label'] = !empty($params['confirm']['cancel-btn-label']) ? $params['confirm']['cancel-btn-label'] : $langs->trans('CloseDialog');
|
||||
$attr['class'].= ' butActionConfirm';
|
||||
}
|
||||
|
||||
if (isset($attr['href']) && empty($attr['href'])) {
|
||||
unset($attr['href']);
|
||||
}
|
||||
|
||||
// TODO : add a hook
|
||||
|
||||
// escape all attribute
|
||||
$attr = array_map('dol_escape_htmltag', $attr);
|
||||
|
||||
@ -9792,7 +9848,29 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url =
|
||||
|
||||
$tag = !empty($attr['href']) ? 'a' : 'span';
|
||||
|
||||
return '<'.$tag.' '.$compiledAttributes.'>'.$html.'</'.$tag.'>';
|
||||
|
||||
$parameters = array(
|
||||
'TCompiledAttr' => $TCompiledAttr,
|
||||
'compiledAttributes' => $compiledAttributes,
|
||||
'attr' => $attr,
|
||||
'tag' => $tag,
|
||||
'label' => $label,
|
||||
'html' => $html,
|
||||
'actionType' => $actionType,
|
||||
'url' => $url,
|
||||
'id' => $id,
|
||||
'userRight' => $userRight,
|
||||
'params' => $params
|
||||
);
|
||||
|
||||
$reshook = $hookmanager->executeHooks('dolGetButtonAction', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if (empty($reshook)) {
|
||||
return '<' . $tag . ' ' . $compiledAttributes . '>' . $html . '</' . $tag . '>';
|
||||
} else {
|
||||
return $hookmanager->resPrint;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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">';
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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"))
|
||||
),
|
||||
);
|
||||
|
||||
@ -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++;
|
||||
}
|
||||
|
||||
@ -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');
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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>
|
||||
|
||||
|
||||
@ -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.'&action=ask_deleteline&lineid='.$line->id.'">';
|
||||
print img_delete();
|
||||
print '</a>';
|
||||
|
||||
@ -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'); ?>
|
||||
|
||||
@ -47,6 +47,8 @@ $socid = 0;
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$hookmanager->initHooks(array('donnote'));
|
||||
|
||||
$result = restrictedArea($user, 'don', $id, '');
|
||||
|
||||
$object = new Don($db);
|
||||
@ -58,7 +60,13 @@ $permissionnote = $user->rights->don->creer; // Used by the include of actions_s
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
||||
$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
if (empty($reshook)) {
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
||||
}
|
||||
|
||||
if ($action == 'classin' && $user->rights->don->creer) {
|
||||
$object->fetch($id);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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'] : ''
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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.'">
|
||||
';
|
||||
|
||||
|
||||
@ -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'] : ''
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user