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

Conflicts:
	htdocs/core/lib/ajax.lib.php
	htdocs/margin/agentMargins.php
	htdocs/margin/customerMargins.php
This commit is contained in:
Laurent Destailleur 2021-02-02 13:22:23 +01:00
commit 4d029194d3
15 changed files with 113 additions and 161 deletions

View File

@ -73,7 +73,7 @@ print load_fiche_titre($title, '', 'title_setup');
// Version
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Version").'</td><td>'.$langs->trans("Value").'</td></tr>'."\n";
print '<tr class="liste_titre"><td class="titlefieldcreate">'.$langs->trans("Version").'</td><td>'.$langs->trans("Value").'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("CurrentVersion").' ('.$langs->trans("Programs").')</td><td>'.DOL_VERSION;
// If current version differs from last upgrade
if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE))
@ -139,7 +139,7 @@ print '<br>';
// Session
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Session").'</td><td colspan="2">'.$langs->trans("Value").'</td></tr>'."\n";
print '<tr class="liste_titre"><td class="titlefieldcreate">'.$langs->trans("Session").'</td><td colspan="2">'.$langs->trans("Value").'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("SessionSavePath").'</td><td colspan="2">'.session_save_path().'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("SessionName").'</td><td colspan="2">'.session_name().'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("SessionId").'</td><td colspan="2">'.session_id().'</td></tr>'."\n";
@ -180,7 +180,7 @@ if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_S
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td class="titlefield">'.$langs->trans("LanguageFilesCachedIntoShmopSharedMemory").'</td>';
print '<td class="titlefieldcreate">'.$langs->trans("LanguageFilesCachedIntoShmopSharedMemory").'</td>';
print '<td>'.$langs->trans("NbOfEntries").'</td>';
print '<td class="right">'.$langs->trans("Address").'</td>';
print '</tr>'."\n";
@ -202,7 +202,7 @@ if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_S
// Localisation
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>'.$langs->trans("LocalisationDolibarrParameters").'</td><td>'.$langs->trans("Value").'</td></tr>'."\n";
print '<tr class="liste_titre"><td class="titlefieldcreate">'.$langs->trans("LocalisationDolibarrParameters").'</td><td>'.$langs->trans("Value").'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("LanguageBrowserParameter", "HTTP_ACCEPT_LANGUAGE").'</td><td>'.$_SERVER["HTTP_ACCEPT_LANGUAGE"].'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("CurrentUserLanguage").'</td><td>'.$langs->getDefaultLang().'</td></tr>'."\n";
// Thousands
@ -342,7 +342,7 @@ $configfileparameters = array(
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td class="titlefield">'.$langs->trans("Parameters").' ';
print '<td class="titlefieldcreate">'.$langs->trans("Parameters").' ';
print $langs->trans("ConfigurationFile").' ('.$conffiletoshowshort.')';
print '</td>';
print '<td>'.$langs->trans("Parameter").'</td>';

View File

@ -93,13 +93,13 @@ if ($maxphp > 0 && $maxphp2 > 0 && $maxphp > $maxphp2)
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
$ErrorPicturePath = "../../theme/eldy/img/error.png";
$WarningPicturePath = "../../theme/eldy/img/warning.png";
$OkayPicturePath = "../../theme/eldy/img/tick.png";
print '<tr><td width="220">'.$langs->trans("Version").'</td><td>';
print '<tr><td>'.$langs->trans("Version").'</td><td>';
$arrayphpminversionerror = array(5, 5, 0);
$arrayphpminversionwarning = array(5, 6, 0);
@ -153,11 +153,8 @@ $loadedExtensions = array_map('strtolower', get_loaded_extensions(false));
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td width="200">'.$langs->trans("Extension").'</td>';
//print '<td align="center">'.$langs->trans("EnabledInSetup").'</td>';
print '<td align="center">'.$langs->trans("Loaded").'</td>';
print '<td align="center">'.$langs->trans("FunctionTest").'</td>';
print '<td>'.$langs->trans("Result").'</td>';
print '<td class="titlefield">'.$langs->trans("Extension").'</td>';
print '<td>'.$langs->trans("Test").'</td>';
print '</tr>';
$functions = ["mb_check_encoding"];
@ -165,9 +162,6 @@ $name = "MBString";
print "<tr>";
print "<td>".$name."</td>";
//print getTableColumn($name, $activatedExtensions);
print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print "</tr>";
@ -176,9 +170,6 @@ $name = "JSON";
print "<tr>";
print "<td>".$name."</td>";
//print getTableColumn($name, $activatedExtensions);
print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print "</tr>";
@ -187,8 +178,6 @@ $name = "GD";
print "<tr>";
print "<td>".$name."</td>";
print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print "</tr>";
@ -197,8 +186,6 @@ $name = "Curl";
print "<tr>";
print "<td>".$name."</td>";
print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print "</tr>";
@ -209,8 +196,6 @@ if (empty($_SERVER["SERVER_ADMIN"]) || $_SERVER["SERVER_ADMIN"] != 'doliwamp@loc
print "<tr>";
print "<td>".$name."</td>";
print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print "</tr>";
}
@ -220,8 +205,6 @@ $name = "IMAP";
print "<tr>";
print "<td>".$name."</td>";
print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print "</tr>";
@ -230,8 +213,6 @@ $name = "xDebug";
print "<tr>";
print "<td>".$name."</td>";
print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print "</tr>";
@ -246,7 +227,7 @@ foreach ($phparray as $key => $value)
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder">';
print '<tr class="liste_titre">';
print '<td width="220px">'.$key.'</td>';
print '<td class="titlefield">'.$key.'</td>';
print '<td colspan="2">'.$langs->trans("Value").'</td>';
print "</tr>\n";
@ -293,69 +274,6 @@ llxFooter();
$db->close();
/**
* Return a table column with a indicator (okay or warning), based on the given name and list
*
* @param string $name The name to check inside the given list
* @param array $list A list that should contains the given name
*
* @return string
*/
function getTableColumn($name, array $list)
{
global $langs;
$name = strtolower($name);
$html = "<td align='center'>";
if (in_array($name, $list))
{
if ($name == 'xdebug') $html .= '<img src="../../theme/eldy/img/warning.png" title="'.$langs->trans("ModuleActivated", "xdebug").'">';
else $html .= '<img src="../../theme/eldy/img/tick.png" title="Ok">';
} else {
if ($name == 'xdebug') $html .= yn(0);
else $html .= '<img src="../../theme/eldy/img/warning.png" title="Warning">';
}
$html .= "</td>";
return $html;
}
/**
* Return a table column with a indicator (okay or warning), based on the given functions to check
*
* @param array $functions A list with functions to check
*
* @return string
*/
function getTableColumnFunction(array $functions)
{
if (count($functions) < 1)
{
return "<td align='center'>-</td>";
}
$result = true;
$html = "<td align='center'>";
foreach ($functions as $function)
{
$result = $result && function_exists($function);
}
if ($result)
{
$html .= '<img src="../../theme/eldy/img/tick.png" alt="Ok">';
} else {
$html .= '<img src="../../theme/eldy/img/warning.png" alt="Warning">';
}
$html .= "</td>";
return $html;
}
/**
* Return a result column with a translated result text
*
@ -363,7 +281,6 @@ function getTableColumnFunction(array $functions)
* @param array $activated A list with all activated PHP extensions. Deprecated.
* @param array $loaded A list with all loaded PHP extensions
* @param array $functions A list with all PHP functions to check
*
* @return string
*/
function getResultColumn($name, array $activated, array $loaded, array $functions)
@ -371,6 +288,7 @@ function getResultColumn($name, array $activated, array $loaded, array $function
global $langs;
$result = true;
//$result = $result && in_array(strtolower($name), $activated);
$result = $result && in_array(strtolower($name), $loaded);
@ -380,7 +298,29 @@ function getResultColumn($name, array $activated, array $loaded, array $function
}
$html = "<td>";
$html .= $result ? $langs->trans("PHPSupport", $name) : $langs->trans("ErrorPHPDoesNotSupport", $name);
if ($result) {
if (strtolower($name) == 'xdebug') $html .= img_warning($langs->trans("ModuleActivated", "xdebug"));
else $html .= img_picto($langs->trans("Ok"), 'tick');
if (in_array(strtolower($name), $loaded)) {
$html .= ' '.$langs->trans("Loaded").' - ';
} else {
//$html .= ' '.$langs->trans("NotLoaded").' - ';
}
if (strtolower($name) == 'xdebug') {
$html .= ' '.$langs->trans("ModuleActivated", "xdebug");
} else {
$html .= ' '.$langs->trans("PHPSupport", $name);
}
} else {
if (strtolower($name) == 'xdebug') $html .= yn(0);
else $html .= img_warning($langs->trans("ModuleActivated", "xdebug"));
if (in_array(strtolower($name), $loaded)) {
$html .= ' '.$langs->trans("Loaded").' - ';
} else {
//$html .= ' '.$langs->trans("NotLoaded").' - ';
}
$html .= ' '.$langs->trans("ErrorPHPDoesNotSupport", $name);
}
$html .= "</td>";
return $html;

View File

@ -43,9 +43,6 @@ if (GETPOST('action', 'aZ09') == 'donothing')
* View
*/
$form = new Form($db);
$nowstring = dol_print_date(dol_now(), 'dayhourlog');
llxHeader();
print load_fiche_titre($langs->trans("Security"), '', 'title_setup');
@ -78,7 +75,7 @@ else {
print '<br>';
print '<br>';
print load_fiche_titre($langs->trans("ConfigFile"), '', 'folder');
print load_fiche_titre($langs->trans("ConfigurationFile"), '', 'folder');
print '<strong>'.$langs->trans("dolibarr_main_prod").'</strong>: '.$dolibarr_main_prod;
if (empty($dolibarr_main_prod)) {
@ -90,7 +87,12 @@ print '<strong>'.$langs->trans("dolibarr_nocsrfcheck").'</strong>: '.$dolibarr_n
if (!empty($dolibarr_nocsrfcheck)) {
print img_picto('', 'warning').' &nbsp; '.$langs->trans("IfYouAreOnAProductionSetThis", 0);
}
print '<br>';
print '<strong>'.$langs->trans("dolibarr_main_restrict_ip").'</strong>: '.$dolibarr_main_restrict_ip;
/*if (empty($dolibarr_main_restrict_ip)) {
print ' &nbsp; '.img_picto('', 'warning').' '.$langs->trans("IfYouAreOnAProductionSetThis", 1);
}*/
print '<br>';
print '<br>';
@ -102,9 +104,17 @@ print '<strong>'.$langs->trans("PermissionsOnFilesInWebRoot").'</strong>: ';
print 'TODO';
print '<br>';
print '<strong>'.$langs->trans("PermissionsOnFile", 'conf.php').'</strong>: ';
// TODO Check permission on file conf.php (read only for the web user)
print 'TODO';
print '<strong>'.$langs->trans("PermissionsOnFile", $conffile).'</strong>: '; // $conffile is defined into filefunc.inc.php
$perms = fileperms($dolibarr_main_document_root.'/'.$conffile);
if ($perms) {
if (($perms & 0x0004) || ($perms & 0x0002)) {
print img_warning().' '.$langs->trans("ConfFileIsReadableOrWritableByAnyUsers");
} else {
print img_picto('', 'tick');
}
} else {
print img_warning().' '.$langs->trans("FailedToReadFile", $conffile);
}
print '<br>';
print '<br>';
@ -137,14 +147,15 @@ print '<br>';
print load_fiche_titre($langs->trans("Menu").' '.$langs->trans("SecuritySetup"), '', 'folder');
//print '<strong>'.$langs->trans("PasswordEncryption").'</strong>: ';
print '<strong>MAIN_SECURITY_HASH_ALGO</strong> = '.(empty($conf->global->MAIN_SECURITY_HASH_ALGO) ? 'unset' : '')." &nbsp; ";
print '<strong>MAIN_SECURITY_HASH_ALGO</strong> = '.(empty($conf->global->MAIN_SECURITY_HASH_ALGO) ? $langs->trans("Undefined") : '')." &nbsp; ";
print '<span class="opacitymedium"> &nbsp; If unset: \'md5\'</span> ';
print '<span class="opacitymedium"> - Recommanded value: \'password_hash\'</span><br>';
print '<strong>MAIN_SECURITY_SALT</strong> = '.$conf->global->MAIN_SECURITY_SALT.'<br>';
print '<strong>MAIN_SECURITY_SALT</strong> = '.(empty($conf->global->MAIN_SECURITY_SALT) ? $langs->trans("Undefined") : '').'<br>';
print '<br>';
// TODO
print '<strong>'.$langs->trans("AntivirusEnabledOnUpload").'</strong>: ';
print empty($conf->global->MAIN_ANTIVIRUS_COMMAND) ? '' : img_picto('', 'tick').' ';
print yn($conf->global->MAIN_ANTIVIRUS_COMMAND ? 1 : 0);
if (!empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) {
print ' &nbsp; - '.$conf->global->MAIN_ANTIVIRUS_COMMAND;

View File

@ -424,6 +424,10 @@ if ($result)
{
$obj = $db->fetch_object($result);
$variousstatic->id = $obj->rowid;
$variousstatic->ref = $obj->rowid;
$variousstatic->label = $obj->label;
print '<tr class="oddeven">';
// No
@ -433,15 +437,13 @@ if ($result)
// Ref
if ($arrayfields['ref']['checked']) {
$variousstatic->id = $obj->rowid;
$variousstatic->ref = $obj->rowid;
print "<td>".$variousstatic->getNomUrl(1)."</td>";
print '<td>'.$variousstatic->getNomUrl(1)."</td>";
if (!$i) $totalarray['nbfield']++;
}
// Label payment
if ($arrayfields['label']['checked']) {
print "<td>".dol_trunc($obj->label, 40)."</td>";
print '<td class="tdoverflowmax150" title="'.$variousstatic->label.'">'.$variousstatic->label."</td>";
if (!$i) $totalarray['nbfield']++;
}
@ -460,7 +462,13 @@ if ($result)
// Type
if ($arrayfields['type']['checked']) {
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'</td>';
print '<td>';
if ($obj->payment_code) {
print $langs->trans("PaymentTypeShort".$obj->payment_code);
print ' ';
}
print $obj->num_payment;
print '</td>';
if (!$i) $totalarray['nbfield']++;
}

View File

@ -110,7 +110,8 @@ class box_factures_imp extends ModeleBoxes
$sql .= " AND fk_statut = 1";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
$sql .= " GROUP BY s.nom, s.rowid, s.email, s.code_client, s.logo, f.ref, f.date_lim_reglement,";
$sql .= " GROUP BY s.rowid, s.nom, s.name_alias, s.code_client, s.code_compta, s.client, s.logo, s.email, s.entity, s.tva_intra, s.siren, s.siret, s.ape, s.idprof4, s.idprof5, s.idprof6,";
$sql .= " f.ref, f.date_lim_reglement,";
$sql .= " f.type, f.datef, f.total, f.tva, f.total_ttc, f.paye, f.fk_statut, f.rowid";
//$sql.= " ORDER BY f.datef DESC, f.ref DESC ";
$sql .= " ORDER BY datelimite ASC, f.ref ASC ";

View File

@ -1927,7 +1927,7 @@ class Form
* Return list of products for customer in Ajax if Ajax activated or go to select_produits_list
*
* @param int $selected Preselected products
* @param string $htmlname Name of HTML select field (must be unique in page)
* @param string $htmlname Name of HTML select field (must be unique in page).
* @param int $filtertype Filter on product type (''=nofilter, 0=product, 1=service)
* @param int $limit Limit on number of returned lines
* @param int $price_level Level of price to show
@ -1949,7 +1949,7 @@ class Form
* @param string $nooutput No print, return the output into a string
* @return void|string
*/
public function select_produits($selected = '', $htmlname = 'productid', $filtertype = '', $limit = 0, $price_level = 0, $status = 1, $finished = 2, $selected_input_value = '', $hidelabel = 0, $ajaxoptions = array(), $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '', $selected_combinations = array(), $nooutput = 0)
public function select_produits($selected = '', $htmlname = 'productid', $filtertype = '', $limit = 0, $price_level = 0, $status = 1, $finished = 2, $selected_input_value = '', $hidelabel = 0, $ajaxoptions = array(), $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '', $selected_combinations = null, $nooutput = 0)
{
// phpcs:enable
global $langs, $conf;
@ -1997,10 +1997,13 @@ class Form
}
$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
if (!empty($conf->variants->enabled)) {
if (!empty($conf->variants->enabled) && is_array($selected_combinations)) {
// Code to automatically insert with javascript the select of attributes under the select of product
// when a parent of variant has been selected.
$out .= '
<!-- script to auto show attributes select tags if a variant was selected -->
<script>
// auto show attributes fields
selected = '.json_encode($selected_combinations).';
combvalues = {};
@ -2019,6 +2022,8 @@ class Form
return;
}
console.log("A change has started. We get variants fields to inject html select");
jQuery.getJSON("'.DOL_URL_ROOT.'/variants/ajax/getCombinations.php", {
id: jQuery(this).val()
}, function (data) {
@ -2035,8 +2040,7 @@ class Form
span.append(
jQuery(document.createElement(\'div\')).text(val.label).css({
\'font-weight\': \'bold\',
\'display\': \'table-cell\',
\'text-align\': \'right\'
\'display\': \'table-cell\'
})
);

View File

@ -149,9 +149,11 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
dataType: "json",
minLength: '.$minLength.',
select: function( event, ui ) { // Function ran once new value has been selected into javascript combo
console.log("Call change on input '.$htmlname.' because of select definition of autocomplete select call on input#search_'.$htmlname.'");
console.log("We will trigger change on input '.$htmlname.' because of the select definition of autocomplete code for input#search_'.$htmlname.'");
console.log("Selected id = "+ui.item.id+" - If this value is null, it means you select a record with key that is null so selection is not effective");
console.log("Propagate before some properties");
//console.log(ui.item);
//For supplier price
$("#'.$htmlname.'").attr("data-up", ui.item.up);
@ -162,7 +164,6 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
//For customer price
';
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) {
$script .= '
$("#' . $htmlname . '").attr("data-pbq", ui.item.pbq);
@ -181,6 +182,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
}
$script .= '
$("#'.$htmlname.'").val(ui.item.id).trigger("change"); // Select new value
// Disable an element
if (options.option_disabled) {
console.log("Make action option_disabled on #"+options.option_disabled+" with disabled="+ui.item.disabled)
@ -196,6 +198,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
$("#" + options.option_disabled).removeAttr("disabled");
}
}
if (options.disabled) {
console.log("Make action disabled on each "+options.option_disabled)
$.each(options.disabled, function(key, value) {
@ -208,6 +211,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
$("#" + value).show().trigger("show");
});
}
// Update an input
if (ui.item.update) {
console.log("Make action update on each ui.item.update")
@ -228,7 +232,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
}
});
}
console.log("ajax_autocompleter new value selected, we trigger change on original component so field #search_'.$htmlname.'");
console.log("ajax_autocompleter new value selected, we trigger change also on original component so on field #search_'.$htmlname.'");
$("#search_'.$htmlname.'").trigger("change"); // We have changed value of the combo select, we must be sure to trigger all js hook binded on this event. This is required to trigger other javascript change method binded on original field by other code.
}

View File

@ -214,8 +214,7 @@ if ($nolinesbefore) {
if (empty($senderissupplier))
{
$statustoshow = 1;
if (!empty($conf->global->ENTREPOT_EXTRA_STATUS))
{
if (!empty($conf->global->ENTREPOT_EXTRA_STATUS)) {
// hide products in closed warehouse, but show products for internal transfer
$form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array'));
} else {

View File

@ -2319,7 +2319,7 @@ class ExpenseReport extends CommonObject
while ($i < $num)
{
$obj = $this->db->fetch_object($result);
$ret[$obj->code] = (($langs->trans($obj->code) != $obj->code) ? $langs->trans($obj->code) : $obj->label);
$ret[$obj->code] = (($langs->transnoentitiesnoconv($obj->code) != $obj->code) ? $langs->transnoentitiesnoconv($obj->code) : $obj->label);
$i++;
}
} else {

View File

@ -2101,3 +2101,4 @@ SeeLinkToOnlineDocumentation=See link to online documention on top menu for exam
SHOW_SUBPRODUCT_REF_IN_PDF=If the feature "%s" of module <b>%s</b> is used, show details of subproducts of a kit on PDF.
AskThisIDToYourBank=Contact your bank to get this ID
AdvancedModeOnly=Permision available in Advanced permission mode only
ConfFileIsReadableOrWritableByAnyUsers=The conf file is reabable or writable by any users. Give permission to web server user and group only.

View File

@ -106,6 +106,7 @@ $titre = $langs->trans("Margins");
$picto = 'margin';
print '<form method="post" name="sel" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print dol_get_fiche_head($head, 'agentMargins', $titre, 0, $picto);
@ -113,7 +114,7 @@ print '<table class="border centpercent">';
print '<tr><td class="titlefield">'.$langs->trans('ContactOfInvoice').'</td>';
print '<td class="maxwidthonsmartphone" colspan="4">';
print $form->select_dolusers($agentid, 'agentid', 1, '', $user->rights->margins->read->all ? 0 : 1, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
print img_picto('', 'user').$form->select_dolusers($agentid, 'agentid', 1, '', $user->rights->margins->read->all ? 0 : 1, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
print '</td></tr>';
// Start date
@ -333,10 +334,7 @@ $db->free($result);
print "\n".'<script type="text/javascript">
$(document).ready(function() {
$("#agentid").change(function() {
$("div.fiche form").submit();
});
console.log("Init some values");
$("#totalMargin").html("'.price(price2num($totalMargin, 'MT')).'");
$("#marginRate").html("'.(($marginRate === '') ? 'n/a' : price(price2num($marginRate, 'MT'))."%").'");
$("#markRate").html("'.(($markRate === '') ? 'n/a' : price(price2num($markRate, 'MT'))."%").'");

View File

@ -87,6 +87,7 @@ $picto = 'margin';
print '<form method="post" name="sel" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print dol_get_fiche_head($head, 'customerMargins', $titre, 0, $picto);
@ -101,7 +102,7 @@ if ($socid > 0) {
{
print '<tr><td class="titlefield">'.$langs->trans('ThirdPartyName').'</td>';
print '<td class="maxwidthonsmartphone" colspan="4">';
print $form->select_company($socid, 'socid', '(client=1 OR client=3)', 1, 0, 0);
print img_picto('', 'company').$form->select_company($socid, 'socid', '(client=1 OR client=3)', 1, 0, 0);
print '</td></tr>';
$client = true;
@ -111,7 +112,7 @@ if ($socid > 0) {
} else {
print '<tr><td class="titlefield">'.$langs->trans('ThirdPartyName').'</td>';
print '<td class="maxwidthonsmartphone" colspan="4">';
print $form->select_company(null, 'socid', '(client=1 OR client=3)', 1, 0, 0);
print img_picto('', 'company').$form->select_company(null, 'socid', '(client=1 OR client=3)', 1, 0, 0);
print '</td></tr>';
}
@ -138,16 +139,16 @@ foreach ($TRes as $prod) {
$TProducts[$prod['key']] = $prod['label'];
}
print '<tr><td class="titlefield">'.$langs->trans('ChooseProduct/Service').'</td>';
print '<tr><td class="titlefield">'.$langs->trans('ProductOrService').'</td>';
print '<td class="maxwidthonsmartpone" colspan="4">';
print $form->multiselectarray('products', $TProducts, $TSelectedProducts, 0, 0, 'minwidth500');
print img_picto('', 'product').$form->multiselectarray('products', $TProducts, $TSelectedProducts, 0, 0, 'minwidth500');
print '</td></tr>';
// Categories
$TCats = $form->select_all_categories(0, array(), '', 64, 0, 1);
print '<tr>';
print '<td class="titlefield">'.$langs->trans('ChooseCategory').'</td>';
print '<td class="titlefield">'.$langs->trans('Category').'</td>';
print '<td class="maxwidthonsmartphone" colspan="4">';
print img_picto('', 'category').$form->multiselectarray('categories', $TCats, $TSelectedCats, 0, 0, 'quatrevingtpercent widthcentpercentminusx');
print '</td>';
@ -365,11 +366,7 @@ $db->free($result);
print '<script type="text/javascript">
$(document).ready(function() {
/*
$("#socid").change(function() {
$("div.fiche form").submit();
});*/
console.log("Init some values");
$("#totalMargin").html("'.price(price2num($totalMargin, 'MT')).'");
$("#marginRate").html("'.(($marginRate === '') ? 'n/a' : price(price2num($marginRate, 'MT'))."%").'");
$("#markRate").html("'.(($markRate === '') ? 'n/a' : price(price2num($markRate, 'MT'))."%").'");

View File

@ -99,31 +99,23 @@ $titre = $langs->trans("Margins");
$picto = 'margin';
print '<form method="post" name="sel" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print dol_get_fiche_head($head, 'productMargins', $titre, 0, $picto);
print '<table class="border centpercent">';
if ($id > 0) {
print '<tr><td class="titlefield">'.$langs->trans('ChooseProduct/Service').'</td>';
print '<td class="maxwidthonsmartpone" colspan="4">';
$form->select_produits($id, 'id', '', 20, 0, 1, 2, '', 1, array(), 0, 'All');
print '</td></tr>';
if (!$sortorder) $sortorder = "DESC";
if (!$sortfield) $sortfield = "f.datef";
} else {
print '<tr><td class="titlefield">'.$langs->trans('ChooseProduct/Service').'</td>';
print '<td class="maxwidthonsmartphone" colspan="4">';
$form->select_produits('', 'id', '', 20, 0, 1, 2, '', 1, array(), 0, 'All');
print '</td></tr>';
}
// Product
print '<tr><td class="titlefield">'.$langs->trans('ProductOrService').'</td>';
print '<td class="maxwidthonsmartphone" colspan="4">';
print img_picto('', 'product').$form->select_produits(($id > 0 ? $id : ''), 'id', '', 20, 0, 1, 2, '', 1, array(), 0, 'All', 0, '', 0, '', null, 1);
print '</td></tr>';
// Categories
$TCats = $form->select_all_categories(0, array(), '', 64, 0, 1);
print '<tr>';
print '<td class="titlefield">'.$langs->trans('ChooseCategory').'</td>';
print '<td class="titlefield">'.$langs->trans('Category').'</td>';
print '<td class="maxwidthonsmartphone" colspan="4">';
print img_picto('', 'category').$form->multiselectarray('categories', $TCats, $TSelectedCats, 0, 0, 'quatrevingtpercent widthcentpercentminusx');
print '</td>';
@ -350,15 +342,10 @@ $db->free($result);
print '
<script type="text/javascript">
$(document).ready(function() {
$("#id").change(function() {
$("div.fiche form").submit();
});
console.log("Init some values");
$("#totalMargin").html("'.price(price2num($totalMargin, 'MT')).'");
$("#marginRate").html("'.(($marginRate === '') ? 'n/a' : price(price2num($marginRate, 'MT'))."%").'");
$("#markRate").html("'.(($markRate === '') ? 'n/a' : price(price2num($markRate, 'MT'))."%").'");
});
</script>
';

View File

@ -317,7 +317,7 @@ class Stripe extends CommonObject
* @param int $mode automatic=automatic confirmation/payment when conditions are ok, manual=need to call confirm() on intent
* @param boolean $confirmnow false=default, true=try to confirm immediatly after create (if conditions are ok)
* @param string $payment_method 'pm_....' (if known)
* @param string $off_session If we use an already known payment method to pay off line.
* @param string $off_session If we use an already known payment method to pay when customer is not available during the checkout flow.
* @param string $noidempotency_key Do not use the idempotency_key when creating the PaymentIntent
* @return \Stripe\PaymentIntent|null Stripe PaymentIntent or null if not found and failed to create
*/

View File

@ -107,7 +107,9 @@ if (($action == 'add' || $action == 'create') && empty($massaction) && !GETPOST(
$features = $_SESSION['addvariant_'.$object->id];
if (!$features) {
setEventMessages($langs->trans('ErrorFieldsRequired'), null, 'errors');
if ($action == 'create') {
setEventMessages($langs->trans('ErrorFieldsRequired'), null, 'errors');
}
} else {
$reference = trim($reference);
if (empty($reference)) {
@ -763,11 +765,11 @@ if (!empty($id) || !empty($ref))
print ' <div class="inline-block divButAction">';
print '<a href="combinations.php?id='.$object->id.'&action=add" class="butAction">'.$langs->trans('NewProductCombination').'</a>'; // NewVariant
print '<a href="combinations.php?id='.$object->id.'&action=add&token='.newToken().'" class="butAction">'.$langs->trans('NewProductCombination').'</a>'; // NewVariant
if ($productCombinations)
{
print '<a href="combinations.php?id='.$object->id.'&action=copy" class="butAction">'.$langs->trans('PropagateVariant').'</a>';
print '<a href="combinations.php?id='.$object->id.'&action=copy&token='.newToken().'" class="butAction">'.$langs->trans('PropagateVariant').'</a>';
}
print ' </div>';