Merge branch '14.0' of git@github.com:Dolibarr/dolibarr.git into 14.0

This commit is contained in:
Laurent Destailleur 2021-10-22 10:49:29 +02:00
commit f0394c42d5
69 changed files with 340 additions and 190 deletions

View File

@ -358,6 +358,37 @@ Following changes may create regressions for some external modules, but were nec
* v14 seems to work correctly on PHP v8 but it generates a lot of verbose warnings. Currently, v14 i snot yet officialy supported with PHP 8.
***** ChangeLog for 13.0.5 compared to 13.0.4 *****
FIX: 13.0: class CommandeFournisseurDispatch provides trigger for UPDATE but not for CREATE / DELETE
FIX: #18389 Accountancy - Bug on LDcompta10 export for supplier invoice
FIX: #18591 : Remove double quotes of SQL Queries for postgresql compatibility
FIX: Accountancy - Debug Export Sage50 / CIEL Compta / CIEL Compta Evo (Format XIMPORT)
FIX: Accountancy - Some problems of length with general & subledger account
FIX: add DISTINCT
FIX: an approved holiday can be canceled by an admin.
FIX: autocalculation of the supplier price in main currency.
FIX: better sql request
FIX: cannot add time spend when column ref is not displayed
FIX: compatibility postgre sql
FIX: holiday card: hooks uninitialized
FIX: Invoice - Missing button to reopen an abandoned situation invoice
FIX: invoice validation: when checking if any VAT rate has a negative amount, prevent false positives with -1.0E-14 amounts
FIX: list of categories in stats of supplier invoices
FIX: Manage credit note on situation invoice for calculate margin
FIX: method_exists needs object at first param
FIX: move fetch_optionnal into $ac_static->fetch()
FIX: multicompany transverse mode compatibility
FIX: on supplier order, JOIN with product fourn price table must be done with fk_soc too to avoid display several times a same line (because of same supplier product ref)
FIX: postgre filter select search extrafield
FIX: products/services card: hidden extrafields were overridden
FIX: shipping validation workflow: 'ORDER_NEW' trigger called from wrong object
FIX: task time: can't filter by user with pgsql + show error message
FIX: task time: keep on using natural_search
FIX: wrong users count in multicompany transverse mode
***** ChangeLog for 13.0.4 compared to 13.0.3 *****
FIX: Allow disabling of a module (not a dangerous action) even if there is problem with token (due to bugged modules).

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2011-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
@ -91,19 +91,19 @@ $tabsql[32] = "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account
$tabsqlsort = array();
$tabsqlsort[32] = "position ASC";
// Nom des champs en resultat de select pour affichage du dictionnaire
// Name of the fields in the result of select to display the dictionary
$tabfield = array();
$tabfield[32] = "code,label,range_account,category_type,formula,position,country";
// Nom des champs d'edition pour modification d'un enregistrement
// Name of editing fields for record modification
$tabfieldvalue = array();
$tabfieldvalue[32] = "code,label,range_account,category_type,formula,position,country_id";
// Nom des champs dans la table pour insertion d'un enregistrement
// Name of the fields in the table for inserting a record
$tabfieldinsert = array();
$tabfieldinsert[32] = "code,label,range_account,category_type,formula,position,fk_country";
// Nom du rowid si le champ n'est pas de type autoincrement
// Name of the rowid if the field is not of type autoincrement
// Example: "" if id field is "rowid" and has autoincrement on
// "nameoffield" if id field is not "rowid" or has not autoincrement on
$tabrowid = array();
@ -151,7 +151,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) {
if ($value == 'range_account' && empty($_POST['range_account'])) {
continue;
}
if ($value == 'country' || $value == 'country_id') {
if (($value == 'country' || $value == 'country_id') && (!empty($_POST['country_id']))) {
continue;
}
if (!GETPOSTISSET($value) || GETPOST($value) == '') {
@ -176,6 +176,9 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) {
if ($fieldnamekey == 'category_type') {
$fieldnamekey = 'Calculated';
}
if ($fieldnamekey == 'country') {
$fieldnamekey = 'Country';
}
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
}
@ -263,7 +266,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) {
}
}
// Si verif ok et action modify, on modifie la ligne
// If check ok and action modify, we modify the line
if ($ok && GETPOST('actionmodify', 'alpha')) {
if ($tabrowid[$id]) {
$rowidcol = $tabrowid[$id];
@ -430,12 +433,12 @@ print load_fiche_titre($titre, $linkback, $titlepicto);
print '<span class="opacitymedium">'.$langs->trans("AccountingAccountGroupsDesc", $langs->transnoentitiesnoconv("ByPersonalizedAccountGroups")).'</span><br><br>';
// Confirmation de la suppression de la ligne
// Confirmation of the deletion of the line
if ($action == 'delete') {
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id.($search_country_id > 0 ? '&search_country_id='.$search_country_id : ''), $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1);
}
// Complete requete recherche valeurs avec critere de tri
// Complete search query with sorting criteria
$sql = $tabsql[$id];
if ($search_country_id > 0) {
@ -634,14 +637,14 @@ if ($resql) {
// Title of lines
print '<tr class="liste_titre">';
foreach ($fieldlist as $field => $value) {
// Determine le nom du champ par rapport aux noms possibles
// dans les dictionnaires de donnees
$showfield = 1; // By defaut
// Determines the name of the field in relation to the possible names
// in data dictionaries
$showfield = 1; // By default
$class = "left";
$sortable = 1;
$valuetoshow = '';
$valuetoshow = ucfirst($fieldlist[$field]); // By defaut
$valuetoshow = ucfirst($fieldlist[$field]); // By default
$valuetoshow = $langs->trans($valuetoshow); // try to translate
if ($fieldlist[$field] == 'source') {
$valuetoshow = $langs->trans("Contact");

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
@ -260,6 +260,22 @@ $linkback = '';
//$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php?restore_lastsearch_values=1">' . $langs->trans("BackToModuleList") . '</a>';
print load_fiche_titre($title, $linkback, 'accountancy');
// Show message if accountancy hidden options are activated to help to resolve some problems
if (!$user->admin) {
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
print '<div class="info">' . $langs->trans("ConstantIsOn", "FACTURE_DEPOSITS_ARE_JUST_PAYMENTS") . '</div>';
}
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
print '<div class="info">' . $langs->trans("ConstantIsOn", "ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY") . '</div>';
}
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
print '<div class="info">' . $langs->trans("ConstantIsOn", "MAIN_COMPANY_PERENTITY_SHARED") . '</div>';
}
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
print '<div class="info">' . $langs->trans("ConstantIsOn", "MAIN_PRODUCT_PERENTITY_SHARED") . '</div>';
}
}
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">';

View File

@ -937,7 +937,6 @@ class BookKeeping extends CommonObject
$line->piece_num = $obj->piece_num;
$line->date_creation = $this->db->jdate($obj->date_creation);
$line->date_export = $this->db->jdate($obj->date_export);
$line->date_validation = $this->db->jdate($obj->date_validated);
$line->date_validation = $this->db->jdate($obj->date_validation);
$this->lines[] = $line;
@ -1090,7 +1089,6 @@ class BookKeeping extends CommonObject
$line->date_lim_reglement = $this->db->jdate($obj->date_lim_reglement);
$line->date_modification = $this->db->jdate($obj->date_modification);
$line->date_export = $this->db->jdate($obj->date_export);
$line->date_validation = $this->db->jdate($obj->date_validated);
$line->date_validation = $this->db->jdate($obj->date_validation);
$this->lines[] = $line;
@ -1751,7 +1749,6 @@ class BookKeeping extends CommonObject
$line->date_creation = $obj->date_creation;
$line->date_modification = $obj->date_modification;
$line->date_export = $obj->date_export;
$line->date_validation = $obj->date_validated;
$line->date_validation = $obj->date_validation;
$this->linesmvt[] = $line;
@ -1816,7 +1813,6 @@ class BookKeeping extends CommonObject
$line->sens = $obj->sens;
$line->code_journal = $obj->code_journal;
$line->piece_num = $obj->piece_num;
$line->date_validation = $obj->date_validated;
$line->date_validation = $obj->date_validation;
$this->linesexport[] = $line;

View File

@ -228,7 +228,7 @@ print "</td></tr>\n";
// Allow members to change type on renewal forms
/* To test during next beta
print '<tr class="oddeven"><td>'.$langs->trans("MemberAllowchangeOfType").'</td><td>';
print $form->selectyesno('ADHERENT_LOGIN_NOT_REQUIRED', (!empty($conf->global->MEMBER_ALLOW_CHANGE_OF_TYPE) ? 0 : 1), 1);
print $form->selectyesno('MEMBER_ALLOW_CHANGE_OF_TYPE', (!empty($conf->global->MEMBER_ALLOW_CHANGE_OF_TYPE) ? 0 : 1), 1);
print "</td></tr>\n";
*/

View File

@ -913,7 +913,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$object->state_id = GETPOST('state_id', 'int');
// We set country_id, country_code and country for the selected country
$object->country_id = GETPOST('country_id', 'int') ?GETPOST('country_id', 'int') : $mysoc->country_id;
$object->country_id = GETPOST('country_id', 'int') ? GETPOST('country_id', 'int') : $mysoc->country_id;
if ($object->country_id) {
$tmparray = getCountry($object->country_id, 'all');
$object->country_code = $tmparray['code'];
@ -921,12 +921,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
if (!empty($socid)) {
$object = new Societe($db);
$soc = new Societe($db);
if ($socid > 0) {
$object->fetch($socid);
$soc->fetch($socid);
}
if (!($object->id > 0)) {
if (!($soc->id > 0)) {
$langs->load("errors");
print($langs->trans('ErrorRecordNotFound'));
exit;
@ -1009,7 +1009,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print "</td>\n";
// Company
print '<tr><td id="tdcompany">'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="minwidth300" maxlength="128" value="'.(GETPOSTISSET('societe') ? GETPOST('societe', 'alphanohtml') : $object->company).'"></td></tr>';
print '<tr><td id="tdcompany">'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="minwidth300" maxlength="128" value="'.(GETPOSTISSET('societe') ? GETPOST('societe', 'alphanohtml') : $soc->name).'"></td></tr>';
// Civility
print '<tr><td>'.$langs->trans("UserTitle").'</td><td>';
@ -1033,7 +1033,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// EMail
print '<tr><td>'.($conf->global->ADHERENT_MAIL_REQUIRED ? '<span class="fieldrequired">' : '').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED ? '</span>' : '').'</td>';
print '<td>'.img_picto('', 'object_email').' <input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(GETPOSTISSET('member_email') ? GETPOST('member_email', 'alpha') : $object->email).'"></td></tr>';
print '<td>'.img_picto('', 'object_email').' <input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(GETPOSTISSET('member_email') ? GETPOST('member_email', 'alpha') : $soc->email).'"></td></tr>';
// Website
print '<tr><td>'.$form->editfieldkey('Web', 'member_url', '', $object, 0).'</td>';
@ -1041,21 +1041,25 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Address
print '<tr><td class="tdtop">'.$langs->trans("Address").'</td><td>';
print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="2">'.(GETPOSTISSET('address') ?GETPOST('address', 'alphanohtml') : $object->address).'</textarea>';
print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="2">'.(GETPOSTISSET('address') ?GETPOST('address', 'alphanohtml') : $soc->address).'</textarea>';
print '</td></tr>';
// Zip / Town
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>';
print $formcompany->select_ziptown((GETPOSTISSET('zipcode') ? GETPOST('zipcode', 'alphanohtml') : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
print $formcompany->select_ziptown((GETPOSTISSET('zipcode') ? GETPOST('zipcode', 'alphanohtml') : $soc->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
print ' ';
print $formcompany->select_ziptown((GETPOSTISSET('town') ? GETPOST('town', 'alphanohtml') : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id'));
print $formcompany->select_ziptown((GETPOSTISSET('town') ? GETPOST('town', 'alphanohtml') : $soc->town), 'town', array('zipcode', 'selectcountry_id', 'state_id'));
print '</td></tr>';
// Country
$object->country_id = $object->country_id ? $object->country_id : $mysoc->country_id;
print '<tr><td width="25%">'.$langs->trans('Country').'</td><td>';
if (empty($soc->country_id)) {
$soc->country_id = $mysoc->country_id;
$soc->country_code = $mysoc->country_code;
$soc->state_id = $mysoc->state_id;
}
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');
print $form->select_country(GETPOSTISSET('country_id') ? GETPOST('country_id', 'alpha') : $soc->country_id, 'country_id');
if ($user->admin) {
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
}
@ -1064,9 +1068,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// State
if (empty($conf->global->MEMBER_DISABLE_STATE)) {
print '<tr><td>'.$langs->trans('State').'</td><td>';
if ($object->country_id) {
if ($soc->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);
print $formcompany->select_state(GETPOSTISSET('state_id') ? GETPOST('state_id', 'int') : $soc->state_id, $soc->country_code);
} else {
print $countrynotdefined;
}
@ -1075,7 +1079,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Pro phone
print '<tr><td>'.$langs->trans("PhonePro").'</td>';
print '<td>'.img_picto('', 'object_phoning').' <input type="text" name="phone" size="20" value="'.(GETPOSTISSET('phone') ? GETPOST('phone', 'alpha') : $object->phone).'"></td></tr>';
print '<td>'.img_picto('', 'object_phoning').' <input type="text" name="phone" size="20" value="'.(GETPOSTISSET('phone') ? GETPOST('phone', 'alpha') : $soc->phone).'"></td></tr>';
// Personal phone
print '<tr><td>'.$langs->trans("PhonePerso").'</td>';

View File

@ -961,7 +961,7 @@ while ($i < min($num, $limit)) {
// Firstname
if (!empty($arrayfields['d.firstname']['checked'])) {
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->firstname).'">';
print $memberstatic->getNomUrl(0, 0, 'card', 'fistname');
print $memberstatic->getNomUrl(0, 0, 'card', 'firstname');
//print $obj->firstname;
print "</td>\n";
if (!$i) {

View File

@ -963,7 +963,7 @@ if ($rowid > 0) {
if ($adht->subscription) {
// Amount
print '<tr><td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="subscription" size="6" value="'.GETPOST('subscription').'"> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="subscription" size="6" value="'. price(GETPOSTISSET('subscription') ? GETPOST('subscription') : $adht->amount).'"> '.$langs->trans("Currency".$conf->currency) .'</td></tr>';
// Label
print '<tr><td>'.$langs->trans("Label").'</td>';

View File

@ -115,7 +115,7 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">';
print '<table class="noborder centpercent editmode">';
print '<tr class="liste_titre"><th class="titlefield wordbreak">'.$langs->trans("CompanyInfo").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n";
print '<tr class="liste_titre"><th class="titlefieldcreate wordbreak">'.$langs->trans("CompanyInfo").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n";
// Name
print '<tr class="oddeven"><td><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';

View File

@ -104,13 +104,11 @@ print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">';
// Social networks
print '<br>';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent editmode">';
print '<tr class="liste_titre">';
print '<td class="titlefield">'.$langs->trans("SocialNetworksInformation").'</td><td>'.$langs->trans("Url").'</td><td>'.$langs->trans("SocialNetworkId").'</td><td></td>';
print '<td class="titlefieldcreate">'.$langs->trans("SocialNetworksInformation").'</td><td>'.$langs->trans("Url").'</td><td>'.$langs->trans("SocialNetworkId").'</td><td></td>';
print "</tr>\n";

View File

@ -220,7 +220,7 @@ $tabsql[21] = "SELECT c.rowid as rowid, c.code, c.label, c.active, c.position FR
$tabsql[22] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_input_reason";
$tabsql[23] = "SELECT t.rowid as rowid, t.taux, t.revenuestamp_type, c.label as country, c.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid";
$tabsql[24] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_type_resource";
$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[25] = "SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity = ".getEntity($tabname[25]);
//$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";
@ -233,7 +233,7 @@ $tabsql[34] = "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PR
$tabsql[35] = "SELECT c.rowid, c.label, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_cat c";
$tabsql[36] = "SELECT r.rowid, r.fk_c_exp_tax_cat, r.range_ik, r.active, r.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_range r";
$tabsql[37] = "SELECT r.rowid, r.code, r.label, r.short_label, r.unit_type, r.scale, r.active FROM ".MAIN_DB_PREFIX."c_units r";
$tabsql[38] = "SELECT rowid, entity, code, label, url, icon, active FROM ".MAIN_DB_PREFIX."c_socialnetworks";
$tabsql[38] = "SELECT s.rowid, s.entity, s.code, s.label, s.url, s.icon, s.active FROM ".MAIN_DB_PREFIX."c_socialnetworks as s WHERE s.entity = ".getEntity($tabname[38]);
$tabsql[39] = "SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX."c_prospectcontactlevel";
$tabsql[40] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcommcontact";
$tabsql[41] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_transport_mode";
@ -1454,6 +1454,10 @@ if ($id) {
print $tdsoffields;
// Line to enter new values
print '<!-- line to add new entry -->';
print '<tr class="oddeven nodrag nodrop nohover">';
$obj = new stdClass();
// If data was already input, we define them in obj to populate input fields.
if (GETPOST('actionadd')) {
@ -1473,9 +1477,6 @@ if ($id) {
unset($fieldlist[2]); // Remove field ??? if dictionary Regions
}
// Line to enter new values
print '<!-- line to add new entry -->';
print '<tr class="oddeven nodrag nodrop nohover">';
if (empty($reshook)) {
fieldList($fieldlist, $obj, $tabname[$id], 'add');

View File

@ -92,7 +92,7 @@ if (empty($action) || $action == 'edit' || $action == 'updateedit') {
print '<input type="hidden" name="action" value="update">';
print '<table class="noborder centpercent editmode">';
print '<tr class="liste_titre"><th class="titlefield wordbreak">'.$langs->trans("Day").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n";
print '<tr class="liste_titre"><th class="titlefieldcreate wordbreak">'.$langs->trans("Day").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n";
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("Monday"), $langs->trans("OpeningHoursFormatDesc"));

View File

@ -389,7 +389,7 @@ if ($action == 'create') {
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook)) {
print $object->showOptionals($extrafields, 'edit', $parameters);
print $object->showOptionals($extrafields, 'create', $parameters);
}
print '<tbody>';
print "</table>\n";

View File

@ -266,7 +266,7 @@ if ($user->rights->categorie->creer) {
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook)) {
print $object->showOptionals($extrafields, 'edit', $parameters);
print $object->showOptionals($extrafields, 'create', $parameters);
}
print '</table>';

View File

@ -75,8 +75,13 @@ if ($complete == 'na' || $complete == -2) {
$complete = -1;
}
$datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'));
$datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'));
if ($fulldayevent) {
$datep = dol_mktime('00', '00', 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'));
$datef = dol_mktime('23', '59', '59', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'));
} else {
$datep = dol_mktime($aphour, $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'));
$datef = dol_mktime($p2hour, $p2min, '59', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'));
}
// Security check
$socid = GETPOST('socid', 'int');
@ -1262,7 +1267,7 @@ if ($action == 'create') {
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook)) {
print $object->showOptionals($extrafields, 'edit', $parameters);
print $object->showOptionals($extrafields, 'create', $parameters);
}
print '</table>';

View File

@ -484,7 +484,7 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
$viewmode = '';
$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/list.php?action=show_list&restore_lastsearch_values=1'.$paramnoactionodate.'">';
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
$viewmode .= img_picto($langs->trans("List"), 'object_list', 'class="pictoactionview block"');
$viewmode .= img_picto($langs->trans("List"), 'object_list', 'class="imgforviewmode pictoactionview block"');
//$viewmode .= '</span>';
$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewList").'</span></a>';

View File

@ -608,7 +608,7 @@ if ($resql) {
$viewmode = '';
$viewmode .= '<a class="btnTitle btnTitleSelected reposition" href="'.DOL_URL_ROOT.'/comm/action/list.php?action=show_list&restore_lastsearch_values=1'.$paramnoactionodate.'">';
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
$viewmode .= img_picto($langs->trans("List"), 'object_list', 'class="pictoactionview block"');
$viewmode .= img_picto($langs->trans("List"), 'object_list', 'class="imgforviewmode pictoactionview block"');
//$viewmode .= '</span>';
$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewList").'</span></a>';

View File

@ -416,7 +416,7 @@ $massactionbutton = '';
$viewmode = '';
$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/list.php?action=show_list&restore_lastsearch_values=1'.$paramnoactionodate.'">';
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
$viewmode .= img_picto($langs->trans("List"), 'object_list', 'class="pictoactionview block"');
$viewmode .= img_picto($langs->trans("List"), 'object_list', 'class="imgforviewmode pictoactionview block"');
//$viewmode .= '</span>';
$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewList").'</span></a>';

View File

@ -426,7 +426,7 @@ $massactionbutton = '';
$viewmode = '';
$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/list.php?action=show_list&restore_lastsearch_values=1'.$paramnoactionodate.'">';
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
$viewmode .= img_picto($langs->trans("List"), 'object_list', 'class="pictoactionview block"');
$viewmode .= img_picto($langs->trans("List"), 'object_list', 'class="imgforviewmode pictoactionview block"');
//$viewmode .= '</span>';
$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewList").'</span></a>';

View File

@ -726,7 +726,7 @@ if ($action == 'create') {
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook)) {
print $object->showOptionals($extrafields, 'edit');
print $object->showOptionals($extrafields, 'create');
}
print '</table>';

View File

@ -2563,8 +2563,13 @@ class Propal extends CommonObject
$outputlangs->setDefaultLang($newlang);
}
// PDF
$hidedetails = (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0);
$hidedesc = (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0);
$hideref = (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0);
//$ret=$object->fetch($id); // Reload to get new records
$this->generateDocument($modelpdf, $outputlangs);
$this->generateDocument($modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
if (!$error) {
@ -2651,8 +2656,13 @@ class Propal extends CommonObject
$outputlangs->setDefaultLang($newlang);
}
// PDF
$hidedetails = (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0);
$hidedesc = (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0);
$hideref = (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0);
//$ret=$object->fetch($id); // Reload to get new records
$this->generateDocument($modelpdf, $outputlangs);
$this->generateDocument($modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
$this->oldcopy = clone $this;

View File

@ -1721,7 +1721,7 @@ if ($action == 'create' && $usercancreate) {
}
};
print $object->showOptionals($extrafields, 'edit', $parameters);
print $object->showOptionals($extrafields, 'create', $parameters);
}
// Template to use by default

View File

@ -444,7 +444,7 @@ if ($action == 'create') {
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook)) {
print $object->showOptionals($extrafields, 'edit', $parameters);
print $object->showOptionals($extrafields, 'create', $parameters);
}
print '</table>';

View File

@ -3636,7 +3636,7 @@ if ($action == 'create') {
}
};
print $object->showOptionals($extrafields, 'edit', $parameters);
print $object->showOptionals($extrafields, 'create', $parameters);
}
// Template to use by default
@ -3845,6 +3845,15 @@ if ($action == 'create') {
// $resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
$resteapayer = price2num($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
// Multicurrency
if (!empty($conf->multicurrency->enabled)) {
$multicurrency_totalpaye = $object->getSommePaiement(1);
$multicurrency_totalcreditnotes = $object->getSumCreditNotesUsed(1);
$multicurrency_totaldeposits = $object->getSumDepositsUsed(1);
$multicurrency_resteapayer = price2num($object->multicurrency_total_ttc - $multicurrency_totalpaye - $multicurrency_totalcreditnotes - $multicurrency_totaldeposits, 'MT');
$resteapayer = price2num($multicurrency_resteapayer / $object->multicurrency_tx, 'MT');
}
if ($object->paye) {
$resteapayer = 0;
}

View File

@ -110,6 +110,10 @@ if ($mode == 'supplier') {
if ($object_status != '' && $object_status >= 0) {
$stats->where .= ' AND f.fk_statut IN ('.$db->sanitize($object_status).')';
}
if (is_array($custcats) && !empty($custcats)) {
$stats->from .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_fournisseur as cat ON (f.fk_soc = cat.fk_soc)';
$stats->where .= ' AND cat.fk_categorie IN ('.$db->sanitize(implode(',', $custcats)).')';
}
}
// Build graphic number of object

View File

@ -64,7 +64,7 @@ if ($cancel && !$id) {
exit;
}
if ($action == 'add' && $cancel) {
if ($action == 'add' && !$cancel) {
$db->begin();
$datev = dol_mktime(12, 0, 0, GETPOST("datevmonth"), GETPOST("datevday"), GETPOST("datevyear"));

View File

@ -2220,11 +2220,18 @@ class ExtraFields
continue; // Value was not provided, we should not set it.
}
$value_arr = GETPOST($keysuffix."options_".$key.$keyprefix);
if ($keysuffix != 'search_') { // If value is for a search, we must keep complex string like '>100 <=150'
if ($keysuffix != 'search_') { // If value is for a search, we must keep complex string like '>100 <=150'
$value_key = price2num($value_arr);
} else {
$value_key = $value_arr;
}
} elseif (in_array($key_type, array('boolean'))) {
if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) {
$value_key = '';
} else {
$value_arr = GETPOST($keysuffix."options_".$key.$keyprefix);
$value_key = $value_arr;
}
} else {
if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) {
continue; // Value was not provided, we should not set it.

View File

@ -309,7 +309,7 @@ class FormActions
$tmpa = dol_getdate($actioncomm->datep);
$tmpb = dol_getdate($actioncomm->datef);
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) {
if ($tmpa['hours'] != $tmpb['hours'] || $tmpa['minutes'] != $tmpb['minutes'] && $tmpa['seconds'] != $tmpb['seconds']) {
if ($tmpa['hours'] != $tmpb['hours'] || $tmpa['minutes'] != $tmpb['minutes']) {
print '-'.dol_print_date($actioncomm->datef, 'hour', 'tzuserrel');
}
} else {

View File

@ -792,6 +792,7 @@ class FormMail extends Form
if (count($listofpaths)) {
foreach ($listofpaths as $key => $val) {
$relativepathtofile = substr($val, (strlen(DOL_DATA_ROOT) - strlen($val)));
if ($conf->entity > 1) {
$relativepathtofile = str_replace($conf->entity.'/', '', $relativepathtofile);
}
@ -802,6 +803,7 @@ class FormMail extends Form
$out .= '<div id="attachfile_'.$key.'">';
// Preview of attachment
$out .= img_mime($listofnames[$key]).' '.$listofnames[$key];
$out .= $formfile->showPreview(array(), $formfile_params[2], $formfile_params[4]);
if (!$this->withfilereadonly) {
$out .= ' <input type="image" style="border: 0px;" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/delete.png" value="'.($key + 1).'" class="removedfile" id="removedfile_'.$key.'" name="removedfile_'.$key.'" />';

View File

@ -103,7 +103,7 @@ function length_accountg($account)
return $account;
}
$g = $conf->global->ACCOUNTING_LENGTH_GACCOUNT;
$g = getDolGlobalInt('ACCOUNTING_LENGTH_GACCOUNT');
if (!is_empty($g)) {
// Clean parameters
$i = strlen($account);
@ -142,7 +142,7 @@ function length_accounta($accounta)
return $accounta;
}
$a = $conf->global->ACCOUNTING_LENGTH_AACCOUNT;
$a = getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT');
if (!is_empty($a)) {
// Clean parameters
$i = strlen($accounta);

View File

@ -2707,13 +2707,14 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
if ($fuser->rights->expedition->{$lire} || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
$original_file = $conf->expedition->dir_output."/sending/".$original_file;
$original_file = $conf->expedition->dir_output."/".(strpos('sending/', $original_file) === 0 ? '' : 'sending/').$original_file;
//$original_file = $conf->expedition->dir_output."/".$original_file;
} elseif (($modulepart == 'livraison' || $modulepart == 'delivery') && !empty($conf->expedition->dir_output)) {
// Delivery Note Wrapping
if ($fuser->rights->expedition->delivery->{$lire} || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
$original_file = $conf->expedition->dir_output."/receipt/".$original_file;
$original_file = $conf->expedition->dir_output."/".(strpos('receipt/', $original_file) === 0 ? '' : 'receipt/').$original_file;
} elseif ($modulepart == 'actions' && !empty($conf->agenda->dir_output)) {
// Wrapping pour les actions
if ($fuser->rights->agenda->myactions->{$read} || preg_match('/^specimen/i', $original_file)) {

View File

@ -1055,7 +1055,7 @@ function dol_size($size, $type = '')
/**
* Clean a string to use it as a file name.
* Replace also '--' and ' -' strings, they are used for parameters separation.
* Replace also '--' and ' -' strings, they are used for parameters separation (Note: ' - ' is allowed).
*
* @param string $str String to clean
* @param string $newstr String to replace bad chars with.
@ -1073,13 +1073,13 @@ function dol_sanitizeFileName($str, $newstr = '_', $unaccent = 1)
$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);
$tmp = preg_replace('/\s+\-([^\s])/', ' _$1', $tmp);
return $tmp;
}
/**
* Clean a string to use it as a path name.
* Replace also '--' and ' -' strings, they are used for parameters separation.
* Replace also '--' and ' -' strings, they are used for parameters separation (Note: ' - ' is allowed).
*
* @param string $str String to clean
* @param string $newstr String to replace bad chars with
@ -1093,7 +1093,7 @@ function dol_sanitizePathName($str, $newstr = '_', $unaccent = 1)
$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);
$tmp = preg_replace('/\s+\-([^\s])/', ' _$1', $tmp);
return $tmp;
}
@ -2284,8 +2284,17 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
} elseif ($tzoutput == 'tzuser' || $tzoutput == 'tzuserrel') {
$to_gmt = true;
$offsettzstring = (empty($_SESSION['dol_tz_string']) ? 'UTC' : $_SESSION['dol_tz_string']); // Example 'Europe/Berlin' or 'Indian/Reunion'
$offsettz = (empty($_SESSION['dol_tz']) ? 0 : $_SESSION['dol_tz']) * 60 * 60; // Will not be used anymore
$offsetdst = (empty($_SESSION['dol_dst']) ? 0 : $_SESSION['dol_dst']) * 60 * 60; // Will not be used anymore
if (class_exists('DateTimeZone')) {
$user_date_tz = new DateTimeZone($offsettzstring);
$user_dt = new DateTime();
$user_dt->setTimezone($user_date_tz);
$user_dt->setTimestamp($tzoutput == 'tzuser' ? dol_now() : $time);
$offsettz = $user_dt->getOffset();
} else { // old method (The 'tzuser' was processed like the 'tzuserrel')
$offsettz = (empty($_SESSION['dol_tz']) ? 0 : $_SESSION['dol_tz']) * 60 * 60; // Will not be used anymore
$offsetdst = (empty($_SESSION['dol_dst']) ? 0 : $_SESSION['dol_dst']) * 60 * 60; // Will not be used anymore
}
}
}
}

View File

@ -99,12 +99,9 @@ if ($massaction == 'presend') {
print '<input type="hidden" name="massaction" value="confirm_presend">';
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
print dol_get_fiche_head(null, '', '');
// Cree l'objet formulaire mail
// Create mail form
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
$formmail->withform = -1;

View File

@ -296,7 +296,8 @@ $coldisplay++;
echo '<td class="right nowrap margininfos"><input class="right maxwidth75" type="text" name="np_marginRate" value="'.$margin_rate.'"><span class="hideonsmartphone">%</span></td>';
}
$coldisplay++;
} elseif (!empty($conf->global->DISPLAY_MARK_RATES)) {
}
if (!empty($conf->global->DISPLAY_MARK_RATES)) {
$mark_rate = (GETPOSTISSET("np_markRate") ? GETPOST("np_markRate", 'alpha', 2) : price($line->marque_tx));
// if credit note, dont allow to modify margin
if ($line->subprice < 0) {

View File

@ -133,7 +133,7 @@ class ActionsDatapolicy
header('Content-Disposition: attachment; filename=datapolicy_portabilite.csv');
header('Pragma: no-cache');
$object->fetch(GETPOST('socid'));
echo 'Name;Fistname;Civility;Thirdparty;Function;Address;ZipCode;City;Department;Country;Email;Pro Phone;Perso Phone;Mobile Phone;Instant Mail;Birthday;'.PHP_EOL;
echo 'Name;Firstname;Civility;Thirdparty;Function;Address;ZipCode;City;Department;Country;Email;Pro Phone;Perso Phone;Mobile Phone;Instant Mail;Birthday;'.PHP_EOL;
echo $object->name.';';
echo ';';
echo ';';
@ -157,7 +157,7 @@ class ActionsDatapolicy
header('Pragma: no-cache');
$soc = $object->fetch_thirdparty();
echo 'Name;Fistname;Civility;Thirdparty;Function;Address;ZipCode;City;Department;Country;Email;Pro Phone;Perso Phone;Mobile Phone;Instant Mail;Birthday;'.PHP_EOL;
echo 'Name;Firstname;Civility;Thirdparty;Function;Address;ZipCode;City;Department;Country;Email;Pro Phone;Perso Phone;Mobile Phone;Instant Mail;Birthday;'.PHP_EOL;
echo $object->lastname.';';
echo $object->firstname.';';
echo $object->getCivilityLabel().';';
@ -181,7 +181,7 @@ class ActionsDatapolicy
header('Content-Disposition: attachment; filename=datapolicy_portabilite.csv');
header('Pragma: no-cache');
$soc = $object->fetch_thirdparty();
echo 'Name;Fistname;Civility;Thirdparty;Function;Address;ZipCode;City;Department;Country;Email;Pro Phone;Perso Phone;Mobile Phone;Instant Mail;Birthday;'.PHP_EOL;
echo 'Name;Firstname;Civility;Thirdparty;Function;Address;ZipCode;City;Department;Country;Email;Pro Phone;Perso Phone;Mobile Phone;Instant Mail;Birthday;'.PHP_EOL;
echo $object->lastname.';';
echo $object->firstname.';';
echo $object->getCivilityLabel().';';

View File

@ -492,7 +492,7 @@ if ($action == 'create') {
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook)) {
print $object->showOptionals($extrafields, 'edit', $parameters);
print $object->showOptionals($extrafields, 'create', $parameters);
}
print '</tbody>';

View File

@ -67,7 +67,7 @@ if (!$section) {
dol_print_error('', 'Error, section parameter missing');
exit;
}
$urlfile = (string) dol_sanitizePathName(GETPOST("urlfile"));
$urlfile = (string) dol_sanitizePathName(GETPOST("urlfile"), '_', 0);
if (!$urlfile) {
dol_print_error('', "ErrorParamNotDefined");
exit;
@ -131,7 +131,7 @@ if ($action == 'update' && $permtoadd) {
$error = 0;
$oldlabel = GETPOST('urlfile', 'alpha');
$newlabel = dol_sanitizeFileName(GETPOST('label', 'alpha'));
$newlabel = dol_sanitizeFileName(GETPOST('label', 'alpha'), '_', 0);
$shareenabled = GETPOST('shareenabled', 'alpha');
//$db->begin();

View File

@ -2552,8 +2552,8 @@ if ($action == 'create') {
// Presend form
$modelmail = 'shipping_send';
$defaulttopic = 'SendShippingRef';
$diroutput = $conf->expedition->dir_output;
$defaulttopic = $langs->trans('SendShippingRef');
$diroutput = $conf->expedition->dir_output.'/sending';
$trackid = 'shi'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
@ -1421,7 +1421,7 @@ if ($action == 'create') {
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by
print $hookmanager->resPrint;
if (empty($reshook)) {
print $object->showOptionals($extrafields, 'edit', $parameters);
print $object->showOptionals($extrafields, 'create', $parameters);
}
print '<tbody>';
@ -2282,7 +2282,7 @@ if ($action == 'create') {
// Quantity
print '<td class="right">';
print '<input type="number" min="0" class="right maxwidth50" name="qty" value="'.dol_escape_htmltag($line->qty).'" />';
print '<input type="text" min="0" class="right maxwidth50" name="qty" value="'.dol_escape_htmltag($line->qty).'" />'; // We must be able to enter decimal qty
print '</td>';
//print '<td class="right">'.$langs->trans('AmountHT').'</td>';
@ -2524,7 +2524,7 @@ if ($action == 'create') {
print '<div class="tabsAction">';
if ($action != 'create' && $action != 'edit') {
if ($action != 'create' && $action != 'edit' && $action != 'editline') {
$object = new ExpenseReport($db);
$object->fetch($id, $ref);

View File

@ -379,13 +379,13 @@ class Export
*/
public function conditionDate($Field, $Value, $Sens)
{
// TODO date_format is forbidden, not performant and not portable. Use instead BETWEEN
// TODO date_format is forbidden, not performant and not portable. Use instead $Value to forge the range date.
if (strlen($Value) == 4) {
$Condition = " date_format(".$Field.",'%Y') ".$Sens." '".$Value."'";
$Condition = " date_format(".$Field.",'%Y') ".$Sens." '".$this->db->escape($Value)."'";
} elseif (strlen($Value) == 6) {
$Condition = " date_format(".$Field.",'%Y%m') ".$Sens." '".$Value."'";
$Condition = " date_format(".$Field.",'%Y%m') ".$Sens." '".$this->db->escape($Value)."'";
} else {
$Condition = " date_format(".$Field.",'%Y%m%d') ".$Sens." ".$Value;
$Condition = " date_format(".$Field.",'%Y%m%d') ".$Sens." '".$this->db->escape($Value)."'";
}
return $Condition;
}
@ -416,7 +416,7 @@ class Export
case 'Duree':
case 'Numeric':
case 'Number':
// Must be a string text to allow to use comparison strings like "<= 999"
// Must be a string text to allow to use comparison strings like "<= 99.9"
$szFilterField = '<input type="text" size="6" name="'.$NameField.'" value="'.$ValueField.'">';
break;
case 'Status':

View File

@ -930,7 +930,7 @@ if ($action == 'create') {
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook)) {
print $object->showOptionals($extrafields, 'edit');
print $object->showOptionals($extrafields, 'create');
}
// Show link to origin object

View File

@ -176,6 +176,8 @@ if (empty($dolibarr_strict_mode)) {
$dolibarr_strict_mode = 0; // For debug in php strict mode
}
define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root); // Filesystem core php (htdocs)
// Security: CSRF protection
// This test check if referrer ($_SERVER['HTTP_REFERER']) is same web site than Dolibarr ($_SERVER['HTTP_HOST'])
// when we post forms (we allow GET and HEAD to accept direct link from a particular page).
@ -196,6 +198,7 @@ if (!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck)) {
if ($csrfattack) {
//print 'NOCSRFCHECK='.defined('NOCSRFCHECK').' REQUEST_METHOD='.$_SERVER['REQUEST_METHOD'].' HTTP_HOST='.$_SERVER['HTTP_HOST'].' HTTP_REFERER='.$_SERVER['HTTP_REFERER'];
// Note: We can't use dol_escape_htmltag here to escape output because lib functions.lib.ph is not yet loaded.
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
dol_syslog("--- Access to ".(empty($_SERVER["REQUEST_METHOD"])?'':$_SERVER["REQUEST_METHOD"].' ').$_SERVER["PHP_SELF"]." refused by CSRF protection (Bad referer).", LOG_WARNING);
print "Access refused by CSRF protection in main.inc.php. Referer of form (".htmlentities($_SERVER['HTTP_REFERER'], ENT_COMPAT, 'UTF-8').") is outside the server that serve this page (with method = ".htmlentities($_SERVER['REQUEST_METHOD'], ENT_COMPAT, 'UTF-8').").\n";
print "If you access your server behind a proxy using url rewriting, you might check that all HTTP headers are propagated (or add the line \$dolibarr_nocsrfcheck=1 into your conf.php file to remove this security check).\n";
@ -228,7 +231,6 @@ if (empty($dolibarr_main_data_root)) {
// Define some constants
define('DOL_CLASS_PATH', 'class/'); // Filesystem path to class dir (defined only for some code that want to be compatible with old versions without this parameter)
define('DOL_DATA_ROOT', $dolibarr_main_data_root); // Filesystem data (documents)
define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root); // Filesystem core php (htdocs)
// Try to autodetect DOL_MAIN_URL_ROOT and DOL_URL_ROOT.
// Note: autodetect works only in case 1, 2, 3 and 4 of phpunit test CoreTest.php. For case 5, 6, only setting value into conf.php will works.
$tmp = '';

View File

@ -2927,11 +2927,11 @@ class CommandeFournisseur extends CommonOrder
$this->user_approve_id2 = $obj->fk_user_approve2;
}
$this->date_creation = $this->db->idate($obj->datec);
$this->date_modification = $this->db->idate($obj->datem);
$this->date_approve = $this->db->idate($obj->datea);
$this->date_approve2 = $this->db->idate($obj->datea2);
$this->date_validation = $this->db->idate($obj->date_validation);
$this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->datem);
$this->date_approve = $this->db->jdate($obj->datea);
$this->date_approve2 = $this->db->jdate($obj->datea2);
$this->date_validation = $this->db->jdate($obj->date_validation);
}
$this->db->free($result);
} else {

View File

@ -1760,7 +1760,7 @@ if ($action == 'create') {
print $hookmanager->resPrint;
if (empty($reshook)) {
print $object->showOptionals($extrafields, 'edit');
print $object->showOptionals($extrafields, 'create');
}
// Bouton "Create Draft"

View File

@ -1219,7 +1219,7 @@ if ($id > 0 || !empty($ref)) {
// Qty
print '<td class="right">';
if ($action == 'editline' && $lineid == $objp->dispatchlineid) {
print '<input style="width: 50px;" type="number" min="1" name="qty" value="'.$objp->qty.'" />';
print '<input style="width: 50px;" type="text" min="1" name="qty" value="'.$objp->qty.'" />';
} else {
print $objp->qty;
}

View File

@ -2270,7 +2270,7 @@ if ($action == 'create') {
}
if (empty($reshook)) {
print $object->showOptionals($extrafields, 'edit');
print $object->showOptionals($extrafields, 'create');
}
// Public note
@ -2406,6 +2406,15 @@ if ($action == 'create') {
// $resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
$resteapayer = price2num($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
// Multicurrency
if (!empty($conf->multicurrency->enabled)) {
$multicurrency_totalpaye = $object->getSommePaiement(1);
$multicurrency_totalcreditnotes = $object->getSumCreditNotesUsed(1);
$multicurrency_totaldeposits = $object->getSumDepositsUsed(1);
$multicurrency_resteapayer = price2num($object->multicurrency_total_ttc - $multicurrency_totalpaye - $multicurrency_totalcreditnotes - $multicurrency_totaldeposits, 'MT');
$resteapayer = price2num($multicurrency_resteapayer / $object->multicurrency_tx, 'MT');
}
if ($object->paye) {
$resteapayer = 0;
}

View File

@ -642,13 +642,19 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print '<td class="right">';
if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) {
print price($objp->multicurrency_am);
print price($sign * $multicurrency_payment);
if ($multicurrency_creditnotes) {
print '+'.price($multicurrency_creditnotes);
}
if ($multicurrency_deposits) {
print '+'.price($multicurrency_deposits);
}
}
print '</td>';
print '<td class="right">';
if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) {
print price($objp->multicurrency_total_ttc - $objp->multicurrency_am);
print price($sign * $multicurrency_remaintopay);
}
print '</td>';
}

View File

@ -627,3 +627,5 @@ CREATE TABLE llx_onlinesignature
ALTER TABLE llx_facture_fourn CHANGE COLUMN fk_mode_transport fk_transport_mode integer;
ALTER TABLE llx_c_socialnetworks DROP INDEX idx_c_socialnetworks_code;
ALTER TABLE llx_c_socialnetworks ADD UNIQUE INDEX idx_c_socialnetworks_code_entity (code, entity);

View File

@ -16,4 +16,4 @@
-- ========================================================================
ALTER TABLE llx_c_socialnetworks ADD UNIQUE INDEX idx_c_socialnetworks_code (code);
ALTER TABLE llx_c_socialnetworks ADD UNIQUE INDEX idx_c_socialnetworks_code_entity (code, entity);

View File

@ -565,7 +565,7 @@ if ($ok && GETPOST('restore_user_pictures', 'alpha')) {
$filetotestsmall = $dolibarr_main_data_root.'/users/'.substr(sprintf('%08d', $obj->rowid), -1, 1).'/'.substr(sprintf('%08d', $obj->rowid), -2, 1).'/thumbs/'.$name.'_small'.$ext;
$filetotestmini = $dolibarr_main_data_root.'/users/'.substr(sprintf('%08d', $obj->rowid), -1, 1).'/'.substr(sprintf('%08d', $obj->rowid), -2, 1).'/thumbs/'.$name.'_mini'.$ext;
$exists = dol_is_file($filetotest);
print 'Check user '.$obj->rowid.' lastname='.$obj->lastname.' fistname='.$obj->firstname.' photo='.$obj->photo.' file '.$filetotest." exists=".$exists."<br>\n";
print 'Check user '.$obj->rowid.' lastname='.$obj->lastname.' firstname='.$obj->firstname.' photo='.$obj->photo.' file '.$filetotest." exists=".$exists."<br>\n";
if ($exists) {
$filetarget = $dolibarr_main_data_root.'/users/'.$obj->rowid.'/'.$name.$ext;
$filetargetsmall = $dolibarr_main_data_root.'/users/'.$obj->rowid.'/thumbs/'.$name.'_small'.$ext;

View File

@ -530,7 +530,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
// Can call a dedicated external upgrade process
if (!$error) {
$parameters = array('versionfrom'=>$versionfrom, 'versionto='.$versionto);
$parameters = array('versionfrom' => $versionfrom, 'versionto' => $versionto);
$object = new stdClass();
$action = "upgrade";
$reshook = $hookmanager->executeHooks('doUpgrade2', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks

View File

@ -182,3 +182,4 @@ BankColorizeMovementName2=Background color for credit movement
IfYouDontReconcileDisableProperty=If you don't make the bank reconciliations on some bank accounts, disable the property "%s" on them to remove this warning.
NoBankAccountDefined=No bank account defined
NoRecordFoundIBankcAccount=No record found in bank account. Commonly, this occurs when a record has been deleted manually from the list of transaction in the bank account (for example during a reconciliation of the bank account). Another reason is that the payment was recorded when the module "%s" was disabled.
AlreadyOneBankAccount=Already one bank account defined

View File

@ -1296,19 +1296,31 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) &&
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Type")), null, 'errors');
}
if (!$error) {
$addfieldentry = array(
'name'=>GETPOST('propname', 'aZ09'), 'label'=>GETPOST('proplabel', 'alpha'), 'type'=>GETPOST('proptype', 'alpha'),
'arrayofkeyval'=>GETPOST('proparrayofkeyval', 'restricthtml'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}'
'visible'=>GETPOST('propvisible', 'int'), 'enabled'=>GETPOST('propenabled', 'int'),
'position'=>GETPOST('propposition', 'int'), 'notnull'=>GETPOST('propnotnull', 'int'), 'index'=>GETPOST('propindex', 'int'), 'searchall'=>GETPOST('propsearchall', 'int'),
'isameasure'=>GETPOST('propisameasure', 'int'), 'comment'=>GETPOST('propcomment', 'alpha'), 'help'=>GETPOST('prophelp', 'alpha'),
'css'=>GETPOST('propcss', 'aZ09'), 'cssview'=>GETPOST('propcssview', 'aZ09'), 'csslist'=>GETPOST('propcsslist', 'aZ09')
);
}
if (!$error) {
$addfieldentry = array(
'name'=>GETPOST('propname', 'aZ09'),
'label'=>GETPOST('proplabel', 'alpha'),
'type'=>GETPOST('proptype', 'alpha'),
'arrayofkeyval'=>GETPOST('proparrayofkeyval', 'restricthtml'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}'
'visible'=>GETPOST('propvisible', 'int'),
'enabled'=>GETPOST('propenabled', 'int'),
'position'=>GETPOST('propposition', 'int'),
'notnull'=>GETPOST('propnotnull', 'int'),
'index'=>GETPOST('propindex', 'int'),
'searchall'=>GETPOST('propsearchall', 'int'),
'isameasure'=>GETPOST('propisameasure', 'int'),
'comment'=>GETPOST('propcomment', 'alpha'),
'help'=>GETPOST('prophelp', 'alpha'),
'css'=>GETPOST('propcss', 'aZ09'),
'cssview'=>GETPOST('propcssview', 'aZ09'),
'csslist'=>GETPOST('propcsslist', 'aZ09'),
'default'=>GETPOST('propdefault', 'restricthtml'),
'noteditable'=>intval(GETPOST('propnoteditable', 'int')),
);
if (!empty($addfieldentry['arrayofkeyval']) && !is_array($addfieldentry['arrayofkeyval'])) {
$addfieldentry['arrayofkeyval'] = json_decode($addfieldentry['arrayofkeyval'], true);
}
if (!empty($addfieldentry['arrayofkeyval']) && !is_array($addfieldentry['arrayofkeyval'])) {
$addfieldentry['arrayofkeyval'] = json_decode($addfieldentry['arrayofkeyval'], true);
}
}
@ -2800,7 +2812,7 @@ if ($module == 'initmodule') {
print '<input class="center" name="propvisible" size="2" value="'.dol_escape_htmltag($propvisible).'">';
print '</td>';
print '<td>';
print '<input class="center" name="propnoeditable" size="2" value="'.dol_escape_htmltag($propnoteditable).'">';
print '<input class="center" name="propnoteditable" size="2" value="'.dol_escape_htmltag($propnoteditable).'">';
print '</td>';
print '<td>';
print '<input class="center" name="propsearchall" size="2" value="'.dol_escape_htmltag($propsearchall).'">';

View File

@ -479,7 +479,7 @@ if ($resql) {
// var_dump($obj);
print ' <td><input class="minwidth200" name="dateinput" value="'. date('Y-m-d', dol_stringtotime($obj->date_sync)) .'" type="date"></td>';
print '<td>' . $form->selectMultiCurrency($obj->code, 'multicurrency_code', 1, " code != '".$conf->currency."'", true) . '</td>';
print ' <td><input type="number" min ="0" step="any" class="minwidth200" name="rateinput" value="' . dol_escape_htmltag($obj->rate) . '"></td>';
print ' <td><input type="text" min ="0" step="any" class="minwidth200" name="rateinput" value="' . dol_escape_htmltag($obj->rate) . '"></td>';
print '<td class="center nowrap ">';
print '<input type="hidden" name="page" value="'.dol_escape_htmltag($page).'">';

View File

@ -1334,7 +1334,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook)) {
print $object->showOptionals($extrafields, 'edit', $parameters);
print $object->showOptionals($extrafields, 'create', $parameters);
}
// Note (private, no output on invoices, propales...)

View File

@ -1617,7 +1617,7 @@ class Products extends DolibarrApi
$combinations[$key]->attributes = $prodc2vp->fetchByFkCombination((int) $combination->id);
$combinations[$key] = $this->_cleanObjectDatas($combinations[$key]);
if ($includestock==1) {
if ($includestock==1 && DolibarrApiAccess::$user->rights->stock->lire) {
$productModel = new Product($this->db);
$productModel->fetch((int) $combination->fk_product_child);
$productModel->load_stock();
@ -1859,7 +1859,7 @@ class Products extends DolibarrApi
public function getStock($id, $selected_warehouse_id = null)
{
if (!DolibarrApiAccess::$user->rights->produit->lire) {
if (!DolibarrApiAccess::$user->rights->produit->lire || !DolibarrApiAccess::$user->rights->stock->lire) {
throw new RestException(401);
}
@ -1945,6 +1945,10 @@ class Products extends DolibarrApi
unset($object->supplierprices); // Mut use another API to get them
if(!DolibarrApiAccess::$user->rights->stock->lire){
unset($object->stock_reel);
unset($object->stock_theorique);
}
return $object;
}
@ -2008,7 +2012,7 @@ class Products extends DolibarrApi
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if ($includestockdata) {
if ($includestockdata && DolibarrApiAccess::$user->rights->stock->lire) {
$this->product->load_stock();
if (is_array($this->product->stock_warehouse)) {

View File

@ -5271,7 +5271,7 @@ class Product extends CommonObject
$stock_sending_client = $this->stats_expedition['qty'];
}
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled)) {
$filterStatus = empty($conf->global->SUPPLIER_ORDER_STATUS_FOR_VIRTUAL_STOCK) ? '2,3,4' : $conf->global->SUPPLIER_ORDER_STATUS_FOR_VIRTUAL_STOCK;
$filterStatus = empty($conf->global->SUPPLIER_ORDER_STATUS_FOR_VIRTUAL_STOCK) ? '3,4' : $conf->global->SUPPLIER_ORDER_STATUS_FOR_VIRTUAL_STOCK;
if (isset($includedraftpoforvirtual)) {
$filterStatus = '0,1,2,'.$filterStatus; // 1,2 may have already been inside $filterStatus but it is better to have twice than missing $filterStatus does not include them
}
@ -5281,7 +5281,7 @@ class Product extends CommonObject
}
$stock_commande_fournisseur = $this->stats_commande_fournisseur['qty'];
}
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && empty($conf->reception->enabled)) {
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && !empty($conf->reception->enabled)) {
$filterStatus = '4';
if (isset($includedraftpoforvirtual)) {
$filterStatus = '0,'.$filterStatus;

View File

@ -523,6 +523,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="newmember">'.
print '<input type="hidden" name="token" value="'.newToken().'" / >';
print '<input type="hidden" name="entity" value="'.$entity.'" />';
print '<input type="hidden" name="action" value="add" />';
print '<input type="hidden" name="page_y" value="" />';
print '<br>';
@ -563,7 +564,7 @@ jQuery(document).ready(function () {
print '<table class="border" summary="form to subscribe" id="tablesubscribe">'."\n";
// Type
// Type
if (empty($conf->global->MEMBER_NEWFORM_FORCETYPE)) {
$listoftype = $adht->liste_array();
$tmp = array_keys($listoftype);
@ -596,7 +597,7 @@ if (empty($conf->global->MEMBER_NEWFORM_FORCEMORPHY)) {
// Company
print '<tr id="trcompany" class="trcompany"><td>'.$langs->trans("Company").'</td><td>';
print img_picto('', 'company', 'class="pictofixedwidth"');
print '<input type="text" name="societe" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('societe')).'"></td></tr>'."\n";
print '<input type="text" name="societe" class="minwidth150 widthcentpercentminusx" value="'.dol_escape_htmltag(GETPOST('societe')).'"></td></tr>'."\n";
// Title
print '<tr><td class="titlefield">'.$langs->trans('UserTitle').'</td><td>';
print $formcompany->select_civility(GETPOST('civility_id'), 'civility_id').'</td></tr>'."\n";
@ -625,7 +626,7 @@ print '<tr><td>'.$langs->trans("Address").'</td><td>'."\n";
print '<textarea name="address" id="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.dol_escape_htmltag(GETPOST('address', 'restricthtml'), 0, 1).'</textarea></td></tr>'."\n";
// Zip / Town
print '<tr><td>'.$langs->trans('Zip').' / '.$langs->trans('Town').'</td><td>';
print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6, 1);
print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 1, '', 'width75');
print ' / ';
print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1);
print '</td></tr>';

View File

@ -869,7 +869,7 @@ if ($action == 'create') {
if ($objectsrc->fetch_optionals() > 0) {
$recept->array_options = array_merge($recept->array_options, $objectsrc->array_options);
}
print $object->showOptionals($extrafields, 'edit', $parameters);
print $object->showOptionals($extrafields, 'create', $parameters);
}
// Incoterms

View File

@ -698,8 +698,14 @@ class RecruitmentJobPosition extends CommonObject
$newlang = (GETPOST('lang_id', 'aZ09') ? GETPOST('lang_id', 'aZ09') : $this->thirdparty->default_lang);
$outputlangs->setDefaultLang($newlang);
}
// PDF
$hidedetails = (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0);
$hidedesc = (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0);
$hideref = (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0);
//$ret=$object->fetch($id); // Reload to get new records
$this->generateDocument($modelpdf, $outputlangs);
$this->generateDocument($modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
if (!$error) {

View File

@ -576,7 +576,7 @@ if ($action == 'create') {
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook)) {
print $object->showOptionals($extrafields, 'edit');
print $object->showOptionals($extrafields, 'create');
}
print '</table>';

View File

@ -1151,6 +1151,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$("#typent_id").change();
$("#effectif_id").val(id_ef15);
$("#effectif_id").change();
/* Force to recompute the width of a select2 field when it was hidden and then shown programatically */
if ($("#civility_id").data("select2")) {
$("#civility_id").select2({width: "resolve"});
}
$("#TypeName").html(document.formsoc.LastName.value);
document.formsoc.private.value=1;
});

View File

@ -1233,7 +1233,7 @@ if ($action == 'create') {
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook)) {
print $object->showOptionals($extrafields, 'edit', $parameters);
print $object->showOptionals($extrafields, 'create', $parameters);
}

View File

@ -37,9 +37,9 @@ if (!defined('NOREQUIREMENU')) {
if (!defined('NOREQUIREHTML')) {
define('NOREQUIREHTML', '1');
}
if (!defined('NOREQUIREAJAX')) {
define('NOREQUIREAJAX', '1');
}
//if (!defined('NOREQUIREAJAX')) {
// define('NOREQUIREAJAX', '1');
//}
require '../main.inc.php'; // Load $user and permissions
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
@ -258,37 +258,33 @@ if ($conf->global->TAKEPOS_NUMPAD == 0) {
</script>
<div style="position:relative; padding-top: 20px; left:5%; height:150px; width:90%;">
<div class="paymentbordline paymentbordlinetotal">
<center><span class="takepospay"><font color="white"><?php echo $langs->trans('TotalTTC'); ?>: </font><span id="totaldisplay" class="colorwhite"><?php echo price($invoice->total_ttc, 1, '', 1, -1, -1, $invoice->multicurrency_code); ?></span></span></center>
<div class="paymentbordline paymentbordlinetotal center">
<span class="takepospay colorwhite"><?php echo $langs->trans('TotalTTC'); ?>: <span id="totaldisplay" class="colorwhite"><?php echo price($invoice->total_ttc, 1, '', 1, -1, -1, $invoice->multicurrency_code); ?></span></span>
</div>
<?php if ($remaintopay != $invoice->total_ttc) { ?>
<div class="paymentbordline paymentbordlineremain center">
<span class="takepospay colorwhite"><?php echo $langs->trans('RemainToPay'); ?>: <span id="remaintopaydisplay" class="colorwhite"><?php echo price($remaintopay, 1, '', 1, -1, -1, $invoice->multicurrency_code); ?></span></span>
</div>
<?php } ?>
<div class="paymentbordline paymentbordlinereceived center">
<span class="takepospay colorwhite"><?php echo $langs->trans("Received"); ?>: <span class="change1 colorred"><?php echo price(0, 1, '', 1, -1, -1, $invoice->multicurrency_code); ?></span><input type="hidden" id="change1" class="change1" value="0"></span>
</div>
<div class="paymentbordline paymentbordlinechange center">
<span class="takepospay colorwhite"><?php echo $langs->trans("Change"); ?>: <span class="change2 colorwhite"><?php echo price(0, 1, '', 1, -1, -1, $invoice->multicurrency_code); ?></span><input type="hidden" id="change2" class="change2" value="0"></span>
</div>
<?php
if (!empty($conf->global->TAKEPOS_CAN_FORCE_BANK_ACCOUNT_DURING_PAYMENT)) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
print '<div class="paymentbordline paddingtop paddingbottom center">';
$filter = '';
$form = new Form($db);
print '<span class="takepospay colorwhite">'.$langs->trans("BankAccount").': </span>';
$form->select_comptes(0, 'accountid', 0, $filter, 1, '');
print ajax_combobox('selectaccountid');
print '</div>';
}
?>
</div>
<?php if ($remaintopay != $invoice->total_ttc) { ?>
<div class="paymentbordline paymentbordlineremain">
<center><span class="takepospay"><font color="white"><?php echo $langs->trans('RemainToPay'); ?>: </font><span id="remaintopaydisplay" class="colorwhite"><?php echo price($remaintopay, 1, '', 1, -1, -1, $invoice->multicurrency_code); ?></span></span></center>
</div>
<?php } ?>
<div class="paymentbordline paymentbordlinereceived">
<center><span class="takepospay"><font color="white"><?php echo $langs->trans("Received"); ?>: </font><span class="change1 colorred"><?php echo price(0, 1, '', 1, -1, -1, $invoice->multicurrency_code); ?></span><input type="hidden" id="change1" class="change1" value="0"></span></center>
</div>
<div class="paymentbordline paymentbordlinechange">
<center><span class="takepospay"><font color="white"><?php echo $langs->trans("Change"); ?>: </font><span class="change2 colorwhite"><?php echo price(0, 1, '', 1, -1, -1, $invoice->multicurrency_code); ?></span><input type="hidden" id="change2" class="change2" value="0"></span></center>
</div>
<?php
if (!empty($conf->global->TAKEPOS_CAN_FORCE_BANK_ACCOUNT_DURING_PAYMENT)) {
print '<div class="paymentbordline paddingtop paddingbottom">
<center>';
$filter = '';
$form = new Form($db);
print '<span class="takepospay"><font color="white">'.$langs->trans("BankAccount").': </font></span>';
$form->select_comptes(0, 'accountid', 0, $filter, 1, '');
print ajax_combobox('selectaccountid');
print '</center>
</div>';
}
?>
</div>
<div style="position:absolute; left:5%; height:52%; width:90%;">
<?php

View File

@ -1549,7 +1549,7 @@ select.widthcentpercentminusxx, span.widthcentpercentminusxx:not(.select2-select
height: 64px !important;
}
.divmainbodylarge { margin-left: 20px !important; margin-right: 20px !important; }
.divmainbodylarge { margin-left: 10px !important; margin-right: 10px !important; }
.tdoverflowonsmartphone {
max-width: 0;

View File

@ -1576,7 +1576,7 @@ table[summary="list_of_modules"] .fa-cog {
min-width: 150px !important;
}
.divmainbodylarge { margin-left: 20px; margin-right: 20px; }
.divmainbodylarge { margin-left: 10px; margin-right: 10px; }
.tdoverflowonsmartphone {
max-width: 0;

View File

@ -1671,7 +1671,7 @@ class Ticket extends CommonObject
$actioncomm->userassigned = array($user->id);
$actioncomm->userownerid = $user->id;
$actioncomm->datep = $now;
$actioncomm->percentage = 100;
$actioncomm->percentage = -1; // percentage is not relevant for punctual events
$actioncomm->elementtype = 'ticket';
$actioncomm->fk_element = $this->id;

View File

@ -1,12 +1,12 @@
<?php
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Peter Fontaine <contact@peterfontaine.fr>
* Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Peter Fontaine <contact@peterfontaine.fr>
* Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.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
@ -324,7 +324,8 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac
$ret .= '</form>';
print $ret;
} else {
print dol_getIdFromCode($db, $object->default_c_exp_tax_cat, 'c_exp_tax_cat', 'rowid', 'label');
$label_exp_tax_cat = dol_getIdFromCode($db, $object->default_c_exp_tax_cat, 'c_exp_tax_cat', 'rowid', 'label');
print $langs->trans($label_exp_tax_cat);
//print $form->editfieldval("DefaultCategoryCar", 'default_c_exp_tax_cat', $object->default_c_exp_tax_cat, $object, $user->rights->user->user->creer, 'string', ($object->default_c_exp_tax_cat != '' ? $object->default_c_exp_tax_cat : ''));
}
print '</td>';
@ -356,7 +357,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
// Nbre max d'elements des petites listes
// Max number of elements in small lists
$MAXLIST = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
// Latest payments of salaries

View File

@ -76,9 +76,6 @@ $userlogin = $argv[2];
$version = DOL_VERSION;
$error = 0;
// Language Management
$langs->loadLangs(array('main', 'admin', 'cron', 'dict'));
/*
* Main
@ -125,7 +122,7 @@ if ($userlogin == 'firstadmin') {
// Check user login
$user = new User($db);
$result = $user->fetch('', $userlogin);
$result = $user->fetch('', $userlogin, '', 1);
if ($result < 0) {
echo "User Error: ".$user->error;
dol_syslog("cron_run_jobs.php:: User Error:".$user->error, LOG_ERR);
@ -137,6 +134,19 @@ if ($result < 0) {
exit(-1);
}
}
// Reload langs
$langcode = (empty($conf->global->MAIN_LANG_DEFAULT) ? 'auto' : $conf->global->MAIN_LANG_DEFAULT);
if (!empty($user->conf->MAIN_LANG_DEFAULT)) {
$langcode = $user->conf->MAIN_LANG_DEFAULT;
}
if ($langs->getDefaultLang() != $langcode) {
$langs->setDefaultLang($langcode);
$langs->tab_translate = array();
}
// Language Management
$langs->loadLangs(array('main', 'admin', 'cron', 'dict'));
$user->getrights();
if (isset($argv[3]) && $argv[3]) {
@ -195,8 +205,8 @@ if (is_array($qualifiedjobs) && (count($qualifiedjobs) > 0)) {
$mysoc->setMysoc($conf);
// Force recheck that user is ok for the entity to process and reload permission for entity
if ($conf->entity != $user->entity && $user->entity != 0) {
$result = $user->fetch('', $userlogin, '', 0, $conf->entity);
if ($conf->entity != $user->entity) {
$result = $user->fetch('', $userlogin, '', 1);
if ($result < 0) {
echo "\nUser Error: ".$user->error."\n";
dol_syslog("cron_run_jobs.php:: User Error:".$user->error, LOG_ERR);
@ -218,6 +228,8 @@ if (is_array($qualifiedjobs) && (count($qualifiedjobs) > 0)) {
}
if ($langs->getDefaultLang() != $langcode) {
$langs->setDefaultLang($langcode);
$langs->tab_translate = array();
$langs->loadLangs(array('main', 'admin', 'cron', 'dict'));
}
}