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

This commit is contained in:
Laurent Destailleur 2023-07-23 00:33:20 +02:00
commit 838c5683fb
20 changed files with 116 additions and 78 deletions

View file

@ -334,8 +334,8 @@ if ($resql) {
$resql_supplier_price = $object->db->query($sql_supplier_price);
if ($resql_supplier_price) {
$obj = $object->db->fetch_object($resql_supplier_price);
if(!empty($obj->qty) && !empty($sub_bom_line->qty) && !empty($line->qty)) $line_cost = $obj->min_price/$obj->qty * $sub_bom_line->qty * $line->qty;
else $line_cost = $obj->min_price;
if (!empty($obj->qty) && !empty($sub_bom_line->qty) && !empty($line->qty)) $line_cost = $obj->min_price/$obj->qty * $sub_bom_line->qty * $line->qty;
else $line_cost = $obj->min_price;
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'"><span class="amount">'.price2num($line_cost, 'MT').'</span></td>';
$total_cost+= $line_cost;

View file

@ -626,13 +626,13 @@ if (!empty($arrayfields['f.total_ttc']['checked'])) {
}
if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) {
// Payment term
print '<td class="liste_titre right">';
print '<td class="liste_titre">';
print $form->getSelectConditionsPaiements($search_payment_term, 'search_payment_term', -1, 1, 1, 'maxwidth100');
print "</td>";
}
if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) {
// Payment mode
print '<td class="liste_titre right">';
print '<td class="liste_titre">';
print $form->select_types_paiements($search_payment_mode, 'search_payment_mode', '', 0, 1, 1, 0, 1, 'maxwidth100', 1);
print '</td>';
}

View file

@ -448,6 +448,7 @@ abstract class CommonDocGenerator
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Define array with couple substitution key => substitution value
* Note that vars into substitutions array are formatted.
*
* @param Object $object Main object to use as data source
* @param Translate $outputlangs Lang object to use for output
@ -498,14 +499,15 @@ abstract class CommonDocGenerator
$array_key.'_hour'=>dol_print_date($date, 'hour'),
$array_key.'_date'=>dol_print_date($date, 'day'),
$array_key.'_date_rfc'=>dol_print_date($date, 'dayrfc'),
$array_key.'_date_limit'=>(!empty($object->date_lim_reglement) ?dol_print_date($object->date_lim_reglement, 'day') : ''),
$array_key.'_date_end'=>(!empty($object->fin_validite) ?dol_print_date($object->fin_validite, 'day') : ''),
$array_key.'_date_limit'=>(!empty($object->date_lim_reglement) ? dol_print_date($object->date_lim_reglement, 'day') : ''),
$array_key.'_date_limit_rfc'=>(!empty($object->date_lim_reglement) ? dol_print_date($object->date_lim_reglement, 'dayrfc') : ''),
$array_key.'_date_end'=>(!empty($object->fin_validite) ? dol_print_date($object->fin_validite, 'day') : ''),
$array_key.'_date_creation'=>dol_print_date($object->date_creation, 'day'),
$array_key.'_date_modification'=>(!empty($object->date_modification) ?dol_print_date($object->date_modification, 'day') : ''),
$array_key.'_date_validation'=>(!empty($object->date_validation) ?dol_print_date($object->date_validation, 'dayhour') : ''),
$array_key.'_date_approve'=>(!empty($object->date_approve) ?dol_print_date($object->date_approve, 'day') : ''),
$array_key.'_date_delivery_planed'=>(!empty($object->delivery_date) ?dol_print_date($object->delivery_date, 'day') : ''),
$array_key.'_date_close'=>(!empty($object->date_cloture) ?dol_print_date($object->date_cloture, 'dayhour') : ''),
$array_key.'_date_modification'=>(!empty($object->date_modification) ? dol_print_date($object->date_modification, 'day') : ''),
$array_key.'_date_validation'=>(!empty($object->date_validation) ? dol_print_date($object->date_validation, 'dayhour') : ''),
$array_key.'_date_approve'=>(!empty($object->date_approve) ? dol_print_date($object->date_approve, 'day') : ''),
$array_key.'_date_delivery_planed'=>(!empty($object->delivery_date) ? dol_print_date($object->delivery_date, 'day') : ''),
$array_key.'_date_close'=>(!empty($object->date_cloture) ? dol_print_date($object->date_cloture, 'dayhour') : ''),
$array_key.'_payment_mode_code'=>$object->mode_reglement_code,
$array_key.'_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code) != 'PaymentType'.$object->mode_reglement_code ? $outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code) : $object->mode_reglement),
@ -641,6 +643,7 @@ abstract class CommonDocGenerator
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Define array with couple substitution key => substitution value
* Note that vars into substitutions array are formatted.
*
* @param Object $line Object line
* @param Translate $outputlangs Lang object to use for output
@ -650,8 +653,6 @@ abstract class CommonDocGenerator
public function get_substitutionarray_lines($line, $outputlangs, $linenumber = 0)
{
// phpcs:enable
global $conf;
$resarray = array(
'line_pos' => $linenumber,
'line_fulldesc'=>doc_getlinedesc($line, $outputlangs),
@ -765,6 +766,7 @@ abstract class CommonDocGenerator
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Define array with couple substitution key => substitution value
* Note that vars into substitutions array are formatted.
*
* @param Expedition $object Main object to use as data source
* @param Translate $outputlangs Lang object to use for output
@ -831,6 +833,7 @@ abstract class CommonDocGenerator
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Define array with couple substitution key => substitution value
* Note that vars into substitutions array are formatted.
*
* @param ExpeditionLigne $line Object line
* @param Translate $outputlangs Lang object to use for output
@ -839,7 +842,6 @@ abstract class CommonDocGenerator
public function get_substitutionarray_shipment_lines($line, $outputlangs)
{
// phpcs:enable
global $conf;
dol_include_once('/core/lib/product.lib.php');
$resarray = array(
@ -930,6 +932,7 @@ abstract class CommonDocGenerator
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Fill array with couple extrafield key => extrafield value
* Note that vars into substitutions array are formatted.
*
* @param Object $object Object with extrafields (must have $object->array_options filled)
* @param array $array_to_fill Substitution array
@ -945,49 +948,51 @@ abstract class CommonDocGenerator
if (is_array($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label) {
$formatedarrayoption = $object->array_options;
if ($extrafields->attributes[$object->table_element]['type'][$key] == 'price') {
$object->array_options['options_'.$key] = price2num($object->array_options['options_'.$key]);
$object->array_options['options_'.$key.'_currency'] = price($object->array_options['options_'.$key], 0, $outputlangs, 0, 0, -1, $conf->currency);
$formatedarrayoption['options_'.$key] = price2num($formatedarrayoption['options_'.$key]);
$formatedarrayoption['options_'.$key.'_currency'] = price($formatedarrayoption['options_'.$key], 0, $outputlangs, 0, 0, -1, $conf->currency);
//Add value to store price with currency
$array_to_fill = array_merge($array_to_fill, array($array_key.'_options_'.$key.'_currency' => $object->array_options['options_'.$key.'_currency']));
$array_to_fill = array_merge($array_to_fill, array($array_key.'_options_'.$key.'_currency' => $formatedarrayoption['options_'.$key.'_currency']));
} elseif ($extrafields->attributes[$object->table_element]['type'][$key] == 'select') {
$valueofselectkey = $object->array_options['options_'.$key];
$valueofselectkey = $formatedarrayoption['options_'.$key];
if (array_key_exists($valueofselectkey, $extrafields->attributes[$object->table_element]['param'][$key]['options'])) {
$object->array_options['options_'.$key] = $extrafields->attributes[$object->table_element]['param'][$key]['options'][$valueofselectkey];
$formatedarrayoption['options_'.$key] = $extrafields->attributes[$object->table_element]['param'][$key]['options'][$valueofselectkey];
} else {
$object->array_options['options_'.$key] = '';
$formatedarrayoption['options_'.$key] = '';
}
} elseif ($extrafields->attributes[$object->table_element]['type'][$key] == 'checkbox') {
$valArray = explode(',', $object->array_options['options_'.$key]);
$valArray = explode(',', $formatedarrayoption['options_'.$key]);
$output = array();
foreach ($extrafields->attributes[$object->table_element]['param'][$key]['options'] as $keyopt => $valopt) {
if (in_array($keyopt, $valArray)) {
$output[] = $valopt;
}
}
$object->array_options['options_'.$key] = implode(', ', $output);
$formatedarrayoption['options_'.$key] = implode(', ', $output);
} elseif ($extrafields->attributes[$object->table_element]['type'][$key] == 'date') {
if (strlen($object->array_options['options_'.$key]) > 0) {
$date = $object->array_options['options_'.$key];
$object->array_options['options_'.$key] = dol_print_date($date, 'day'); // using company output language
$object->array_options['options_'.$key.'_locale'] = dol_print_date($date, 'day', 'tzserver', $outputlangs); // using output language format
$object->array_options['options_'.$key.'_rfc'] = dol_print_date($date, 'dayrfc'); // international format
if (strlen($formatedarrayoption['options_'.$key]) > 0) {
$date = $formatedarrayoption['options_'.$key];
$formatedarrayoption['options_'.$key] = dol_print_date($date, 'day'); // using company output language
$formatedarrayoption['options_'.$key.'_locale'] = dol_print_date($date, 'day', 'tzserver', $outputlangs); // using output language format
$formatedarrayoption['options_'.$key.'_rfc'] = dol_print_date($date, 'dayrfc'); // international format
} else {
$object->array_options['options_'.$key] = '';
$object->array_options['options_'.$key.'_locale'] = '';
$object->array_options['options_'.$key.'_rfc'] = '';
$formatedarrayoption['options_'.$key] = '';
$formatedarrayoption['options_'.$key.'_locale'] = '';
$formatedarrayoption['options_'.$key.'_rfc'] = '';
}
$array_to_fill = array_merge($array_to_fill, array($array_key.'_options_'.$key.'_locale' => $object->array_options['options_'.$key.'_locale']));
$array_to_fill = array_merge($array_to_fill, array($array_key.'_options_'.$key.'_rfc' => $object->array_options['options_'.$key.'_rfc']));
$array_to_fill = array_merge($array_to_fill, array($array_key.'_options_'.$key.'_locale' => $formatedarrayoption['options_'.$key.'_locale']));
$array_to_fill = array_merge($array_to_fill, array($array_key.'_options_'.$key.'_rfc' => $formatedarrayoption['options_'.$key.'_rfc']));
} elseif ($extrafields->attributes[$object->table_element]['type'][$key] == 'datetime') {
$datetime = $object->array_options['options_'.$key];
$object->array_options['options_'.$key] = ($datetime != "0000-00-00 00:00:00" ?dol_print_date($object->array_options['options_'.$key], 'dayhour') : ''); // using company output language
$object->array_options['options_'.$key.'_locale'] = ($datetime != "0000-00-00 00:00:00" ?dol_print_date($object->array_options['options_'.$key], 'dayhour', 'tzserver', $outputlangs) : ''); // using output language format
$object->array_options['options_'.$key.'_rfc'] = ($datetime != "0000-00-00 00:00:00" ?dol_print_date($object->array_options['options_'.$key], 'dayhourrfc') : ''); // international format
$array_to_fill = array_merge($array_to_fill, array($array_key.'_options_'.$key.'_locale' => $object->array_options['options_'.$key.'_locale']));
$array_to_fill = array_merge($array_to_fill, array($array_key.'_options_'.$key.'_rfc' => $object->array_options['options_'.$key.'_rfc']));
$datetime = $formatedarrayoption['options_'.$key];
$formatedarrayoption['options_'.$key] = ($datetime != "0000-00-00 00:00:00" ? dol_print_date($datetime, 'dayhour') : ''); // using company output language
$formatedarrayoption['options_'.$key.'_locale'] = ($datetime != "0000-00-00 00:00:00" ? dol_print_date($datetime, 'dayhour', 'tzserver', $outputlangs) : ''); // using output language format
$formatedarrayoption['options_'.$key.'_rfc'] = ($datetime != "0000-00-00 00:00:00" ? dol_print_date($datetime, 'dayhourrfc') : ''); // international format
$array_to_fill = array_merge($array_to_fill, array($array_key.'_options_'.$key.'_locale' => $formatedarrayoption['options_'.$key.'_locale']));
$array_to_fill = array_merge($array_to_fill, array($array_key.'_options_'.$key.'_rfc' => $formatedarrayoption['options_'.$key.'_rfc']));
} elseif ($extrafields->attributes[$object->table_element]['type'][$key] == 'link') {
$id = $object->array_options['options_'.$key];
$id = $formatedarrayoption['options_'.$key];
if ($id != "") {
$param = $extrafields->attributes[$object->table_element]['param'][$key];
$param_list = array_keys($param['options']); // $param_list='ObjectName:classPath'
@ -1000,14 +1005,14 @@ abstract class CommonDocGenerator
$tmpobject = new $classname($this->db);
$tmpobject->fetch($id);
// completely replace the id with the linked object name
$object->array_options['options_'.$key] = $tmpobject->name;
$formatedarrayoption['options_'.$key] = $tmpobject->name;
}
}
}
}
if (array_key_exists('options_'.$key, $object->array_options)) {
$array_to_fill = array_merge($array_to_fill, array($array_key.'_options_'.$key => $object->array_options['options_'.$key]));
if (array_key_exists('options_'.$key, $formatedarrayoption)) {
$array_to_fill = array_merge($array_to_fill, array($array_key.'_options_'.$key => $formatedarrayoption['options_'.$key]));
} else {
$array_to_fill = array_merge($array_to_fill, array($array_key.'_options_'.$key => ''));
}

View file

@ -9140,12 +9140,13 @@ abstract class CommonObject
* Sets all object fields to null. Useful for example in lists, when printing multiple lines and a different object os fetched for each line.
* @return void
*/
public function emtpyObjectVars() {
public function emtpyObjectVars()
{
foreach ($this->fields as $field => $arr) {
$this->$field = null;
}
}
/**
* Function to concat keys of fields
*

View file

@ -1591,9 +1591,9 @@ class Form
if (empty($outputmode)) {
if (in_array($obj->rowid, $selected)) {
$out .= '<option value="' . $obj->rowid . '" selected data-html="' . dol_escape_htmltag($labelhtml) . '">' . $label . '</option>';
$out .= '<option value="' . $obj->rowid . '" selected data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label) . '</option>';
} else {
$out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml) . '">' . $label . '</option>';
$out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label) . '</option>';
}
} else {
array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label, 'labelhtml' => $labelhtml));
@ -8614,9 +8614,10 @@ class Form
$out .= ' selected';
}
if (!empty($tmplabelhtml)) {
$out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml) . '"';
$out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"';
} else {
$out .= ' data-html="' . dol_escape_htmltag(($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #' . $tmpcolor . '"') : '') . $newval) . '"';
$tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #' . $tmpcolor . '"') : '') . $newval;
$out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"';
}
$out .= '>';
$out .= dol_htmlentitiesbr($newval);
@ -8633,7 +8634,9 @@ class Form
if ($addjscombo == 1) {
$tmpplugin = empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) ? constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT;
$out .= 'function formatResult(record, container) {' . "\n";
$out .= ' if ($(record.element).attr("data-html") != undefined) return htmlEntityDecodeJs($(record.element).attr("data-html")); // If property html set, we decode html entities and use this' . "\n";
// If property html set, we decode html entities and use this.
// Note that HTML content must have been sanitized from js with dol_escape_htmltag(xxx, 0, 0, '', 0, 1) when building the select option.
$out .= ' if ($(record.element).attr("data-html") != undefined) { return htmlEntityDecodeJs($(record.element).attr("data-html")); }'."\n";
$out .= ' return record.text;';
$out .= '}' . "\n";
$out .= 'function formatSelection(record) {' . "\n";

View file

@ -464,7 +464,7 @@ function urlencode(s) {
/*
* =================================================================
* Purpose: Clean string to have it url encoded
* Purpose: Clean string to get a HTML coded string.
* Input: s
* Author: Laurent Destailleur
* Licence: GPL

View file

@ -506,11 +506,15 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete =
templateResult: function (data, container) { /* Format visible output into combo list */
/* Code to add class of origin OPTION propagated to the new select2 <li> tag */
if (data.element) { $(container).addClass($(data.element).attr("class")); }
//console.log($(data.element).attr("data-html"));
//console.log("data html is "+$(data.element).attr("data-html"));
if (data.id == '.((int) $idforemptyvalue).' && $(data.element).attr("data-html") == undefined) {
return \'&nbsp;\';
}
if ($(data.element).attr("data-html") != undefined) return htmlEntityDecodeJs($(data.element).attr("data-html")); // If property html set, we decode html entities and use this
if ($(data.element).attr("data-html") != undefined) {
/* If property html set, we decode html entities and use this. */
/* Note that HTML content must have been sanitized from js with dol_escape_htmltag(xxx, 0, 0, \'\', 0, 1) when building the select option. */
return htmlEntityDecodeJs($(data.element).attr("data-html"));
}
return data.text;
},
templateSelection: function (selection) { /* Format visible output of selected value */

View file

@ -1594,14 +1594,18 @@ function dol_escape_json($stringtoescape)
* @param int $keepn 1=Preserve \r\n strings (otherwise, replace them with escaped value). Set to 1 when escaping for a <textarea>.
* @param string $noescapetags '' or 'common' or list of tags to not escape. TODO Does not works yet when there is attributes into tag.
* @param int $escapeonlyhtmltags 1=Escape only html tags, not the special chars like accents.
* @param int $cleanalsojavascript Clean also javascript. @TODO switch this option to 1 by default.
* @return string Escaped string
* @see dol_string_nohtmltag(), dol_string_nospecial(), dol_string_unaccent(), dol_htmlentitiesbr()
* @see dol_string_nohtmltag(), dol_string_onlythesehtmltags(), dol_string_nospecial(), dol_string_unaccent(), dol_htmlentitiesbr()
*/
function dol_escape_htmltag($stringtoescape, $keepb = 0, $keepn = 0, $noescapetags = '', $escapeonlyhtmltags = 0)
function dol_escape_htmltag($stringtoescape, $keepb = 0, $keepn = 0, $noescapetags = '', $escapeonlyhtmltags = 0, $cleanalsojavascript = 0)
{
if ($noescapetags == 'common') {
$noescapetags = 'html,body,a,b,em,hr,i,u,ul,li,br,div,img,font,p,span,strong,table,tr,td,th,tbody';
}
if ($cleanalsojavascript) {
$stringtoescape = dol_string_onlythesehtmltags($stringtoescape, 0, 0, $cleanalsojavascript, 0, array(), 0);
}
// escape quotes and backslashes, newlines, etc.
if ($escapeonlyhtmltags) {

View file

@ -1109,7 +1109,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
if (count($arrayfields) > 0 && !empty($arrayfields['c.assigned']['checked'])) {
print '<td></td>';
}
// Check if Extrafields is totalizable
foreach ($extrafields->attributes['projet_task']['totalizable'] as $key => $value) {
if (!empty($arrayfields['ef.'.$key]['checked']) && $arrayfields['ef.'.$key]['checked'] == 1) {

View file

@ -49,7 +49,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc
*/
public function __construct($db)
{
global $conf, $langs, $mysoc;
global $langs, $mysoc;
// Load translation files required by the page
$langs->loadLangs(array("main", "companies"));
@ -203,6 +203,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc
{
// phpcs:enable
global $user, $langs, $conf, $mysoc, $hookmanager;
global $action;
if (empty($srctemplatepath)) {
dol_syslog("doc_generic_odt::write_file parameter srctemplatepath empty", LOG_WARNING);
@ -215,7 +216,6 @@ class doc_generic_odt extends ModeleThirdPartyDoc
$hookmanager = new HookManager($this->db);
}
$hookmanager->initHooks(array('odtgeneration'));
global $action;
if (!is_object($outputlangs)) {
$outputlangs = $langs;
@ -357,6 +357,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc
$array_other = $this->get_substitutionarray_other($outputlangs);
$tmparray = array_merge($array_user, $array_soc, $array_thirdparty, $array_other);
complete_substitutions_array($tmparray, $outputlangs, $object);
// Call the ODTSubstitution hook

View file

@ -68,11 +68,14 @@ if (!$sortfield) {
}
$object = new Don($db);
if ($id > 0 || $ref) {
if ($id > 0 || !empty($ref)) {
$object->fetch($id, $ref);
}
$upload_dir = $conf->don->dir_output.'/'.get_exdir($id, 0, 0, 0, $object, 'donation').'/'.dol_sanitizeFileName($object->ref);
if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->don->multidir_output[$object->entity ? $object->entity : $conf->entity]."/".get_exdir(0, 0, 0, 1, $object);
}
$modulepart = 'don';
// Security check

View file

@ -0,0 +1,2 @@
Language code for ZH language in China.
This is the simplified chinese.

View file

@ -0,0 +1,2 @@
Language code for ZH language in Hong Kong.
This is the traditionnal chinese.

View file

@ -0,0 +1,2 @@
Language code for ZH language in Taiwan.
This is the traditionnal chinese.

View file

@ -790,7 +790,7 @@ while ($i < $imaxinloop) {
$parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
/*if (!empty($arrayfields['anotherfield']['checked'])) {
print '<td class="right">'.$obj->anotherfield.'</td>';
}*/

View file

@ -702,7 +702,7 @@ while ($i < $imaxinloop) {
$warehouse->sellvalue = $obj->sellvalue;
$object = $warehouse;
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';

View file

@ -1074,6 +1074,8 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
print '<br>';
}
$param = '';
// Link to create time
$linktocreatetimeBtnStatus = 0;
$linktocreatetimeUrl = '';
@ -1844,8 +1846,8 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
print '<td class="center">';
$form->buttonsSaveCancel();
print '<input type="submit" name="save" class="button buttongen marginleftonly margintoponlyshort marginbottomonlyshort button-add reposition" value="'.$langs->trans("Add").'">';
print '<input type="submit" name="cancel" class="button buttongen marginleftonly margintoponlyshort marginbottomonlyshort button-cancel" value="'.$langs->trans("Cancel").'">';
print '<input type="submit" name="save" class="button buttongen smallpaddingimp marginleftonly margintoponlyshort marginbottomonlyshort button-add reposition" value="'.$langs->trans("Add").'">';
print '<input type="submit" name="cancel" class="button buttongen smallpaddingimp marginleftonly margintoponlyshort marginbottomonlyshort button-cancel" value="'.$langs->trans("Cancel").'">';
print '</td></tr>';
print '</table>';
@ -2092,12 +2094,12 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="center nowraponall maxwidth75">';
print '<td class="center nowraponall">';
if (($action == 'editline' || $action == 'splitline') && GETPOST('lineid', 'int') == $task_time->rowid) {
print '<input type="hidden" name="lineid" value="'.GETPOST('lineid', 'int').'">';
print '<input type="submit" class="button buttongen margintoponlyshort marginbottomonlyshort button-save" name="save" value="'.$langs->trans("Save").'">';
print '<input type="submit" class="button buttongen smallpaddingimp margintoponlyshort marginbottomonlyshort button-save" name="save" value="'.$langs->trans("Save").'">';
print ' ';
print '<input type="submit" class="button buttongen margintoponlyshort marginbottomonlyshort button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
print '<input type="submit" class="button buttongen smallpaddingimp margintoponlyshort marginbottomonlyshort button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
} elseif ($user->hasRight('projet', 'time') || $user->hasRight('projet', 'all', 'creer')) { // Read project and enter time consumed on assigned tasks
if (in_array($task_time->fk_user, $childids) || $user->hasRight('projet', 'all', 'creer')) {
if (getDolGlobalString('MAIN_FEATURES_LEVEL') >= 2) {

View file

@ -388,7 +388,7 @@ if ($event->type == 'payout.created') {
$paiement->ext_payment_site = $service;
$ispaymentdone = 0;
$sql = "SELECT p.id FROM llx_paiement as p";
$sql = "SELECT p.rowid FROM llx_paiement as p";
$sql .= " WHERE p.ext_payment_id = '".$db->escape($paiement->ext_payment_id)."'";
$sql .= " AND p.ext_payment_site = '".$db->escape($paiement->ext_payment_site)."'";
$result = $db->query($sql);
@ -398,7 +398,9 @@ if ($event->type == 'payout.created') {
dol_syslog('* Payment for ext_payment_id '.$paiement->ext_payment_id.' already done. We do not recreate the payment');
}
}
$db->begin();
if (!$error && !$ispaymentdone) {
dol_syslog('* Record payment for invoice id ' . $invoice_id . '. It includes closing of invoice and regenerating document');
@ -408,15 +410,19 @@ if ($event->type == 'payout.created') {
$postactionmessages[] = $paiement->error . ($paiement->error ? ' ' : '') . join("<br>\n", $paiement->errors);
$ispostactionok = -1;
$error++;
dol_syslog("Failed to create the payment for invoice id " . $invoice_id);
} else {
$postactionmessages[] = 'Payment created';
}
dol_syslog("The payment has been created for invoice id " . $invoice_id);
dol_syslog("The payment has been created for invoice id " . $invoice_id);
}
}
if (!$error && isModEnabled('banque')) {
// Search again the payment to see if it is already linked to a bank payment record (We should always find the payement now we have created before).
$ispaymentdone = 0;
$sql = "SELECT p.id, p.fk_bank FROM llx_paiement as p";
$sql = "SELECT p.rowid, p.fk_bank FROM llx_paiement as p";
$sql .= " WHERE p.ext_payment_id = '".$db->escape($paiement->ext_payment_id)."'";
$sql .= " AND p.ext_payment_site = '".$db->escape($paiement->ext_payment_site)."'";
$sql .= " AND p.fk_bank <> 0";
@ -425,13 +431,14 @@ if ($event->type == 'payout.created') {
if ($db->num_rows($result)) {
$ispaymentdone = 1;
$obj = $db->fetch_object($result);
dol_syslog('* Payment already linked to bank record '.$obj->fk_bank.' . We do not recrate the link');
dol_syslog('* Payment already linked to bank record '.$obj->fk_bank.' . We do not recreate the link');
}
}
if (!$ispaymentdone) {
dol_syslog('* Add payment to bank');
// The bank used is the one defined into Stripe setup
$paymentmethod = 'stripe';
$bankaccountid = getDolGlobalInt("STRIPE_BANK_ACCOUNT_FOR_PAYMENTS");
if ($bankaccountid > 0) {

View file

@ -1075,7 +1075,7 @@ if ($action == 'create' || $action == 'adduserldap') {
// We do not use a field password but a field text to show new password to use.
$valuetoshow .= ($valuetoshow ? ' + '.$langs->trans("DolibarrPassword") : '').'<input class="minwidth300 maxwidth400 widthcentpercentminusx" maxlength="128" type="text" id="password" name="password" value="'.dol_escape_htmltag($password).'" autocomplete="new-password">';
if (!empty($conf->use_javascript_ajax)) {
$valuetoshow .= '&nbsp;'.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_password" class="linkobject"');
$valuetoshow .= img_picto($langs->trans('Generate'), 'refresh', 'id="generate_password" class="linkobject paddingleft"');
}
}
}
@ -1097,9 +1097,9 @@ if ($action == 'create' || $action == 'adduserldap') {
//$generated_password = getRandomPassword(false);
print '<tr><td>'.$langs->trans("ApiKey").'</td>';
print '<td>';
print '<input class="minwidth300 maxwidth400 widthcentpercentminusx" minlength="16" maxlength="128" type="text" id="api_key" name="api_key" value="'.GETPOST('api_key', 'alphanohtml').'" autocomplete="off">';
print '<input class="minwidth300 maxwidth400 widthcentpercentminusx" minlength="12" maxlength="128" type="text" id="api_key" name="api_key" value="'.GETPOST('api_key', 'alphanohtml').'" autocomplete="off">';
if (!empty($conf->use_javascript_ajax)) {
print '&nbsp;'.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_api_key" class="linkobject"');
print img_picto($langs->trans('Generate'), 'refresh', 'id="generate_api_key" class="linkobject paddingleft"');
}
print '</td></tr>';
} else {
@ -2445,7 +2445,7 @@ if ($action == 'create' || $action == 'adduserldap') {
if ($caneditpassword) {
$valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').'<input maxlength="128" type="password" class="flat" id="password" name="password" value="'.dol_escape_htmltag($object->pass).'" autocomplete="new-password">';
if (!empty($conf->use_javascript_ajax)) {
$valuetoshow .= '&nbsp;'.img_picto((getDolGlobalString('USER_PASSWORD_GENERATED') === 'none' ? $langs->trans('NoPasswordGenerationRuleConfigured') : $langs->trans('Generate')), 'refresh', 'id="generate_password" class="'.(getDolGlobalString('USER_PASSWORD_GENERATED') === 'none' ? ' opacitymedium' : ' linkobject').'"');
$valuetoshow .= img_picto((getDolGlobalString('USER_PASSWORD_GENERATED') === 'none' ? $langs->trans('NoPasswordGenerationRuleConfigured') : $langs->trans('Generate')), 'refresh', 'id="generate_password" class="paddingleft'.(getDolGlobalString('USER_PASSWORD_GENERATED') === 'none' ? ' opacitymedium' : ' linkobject').'"');
}
} else {
$valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').preg_replace('/./i', '*', $object->pass);
@ -2468,9 +2468,9 @@ if ($action == 'create' || $action == 'adduserldap') {
print '<tr><td>'.$langs->trans("ApiKey").'</td>';
print '<td>';
if ($caneditpassword || $user->hasRight("api", "apikey", "generate")) {
print '<input class="minwidth300" minlength="16" maxlength="128" type="text" id="api_key" name="api_key" value="'.$object->api_key.'" autocomplete="off">';
print '<input class="minwidth300 maxwidth400 widthcentpercentminusx" minlength="12" maxlength="128" type="text" id="api_key" name="api_key" value="'.$object->api_key.'" autocomplete="off">';
if (!empty($conf->use_javascript_ajax)) {
print '&nbsp;'.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_api_key" class="linkobject"');
print img_picto($langs->trans('Generate'), 'refresh', 'id="generate_api_key" class="linkobject paddingleft"');
}
}
print '</td></tr>';

View file

@ -802,7 +802,9 @@ class Workstation extends CommonObject
$dir = dol_buildpath($reldir."core/modules/workstation/");
// Load file with numbering class (if found)
$mybool |= @include_once $dir.$file;
if (file_exists($dir.$file)) {
$mybool |= @include_once $dir.$file;
}
}
if ($mybool === false) {