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

This commit is contained in:
Laurent Destailleur 2019-08-01 16:30:32 +02:00
commit 3d8f6dca76
17 changed files with 112 additions and 81 deletions

View File

@ -38,6 +38,7 @@ require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php
$langs->loadLangs(array("accountancy", "bills", "compta")); $langs->loadLangs(array("accountancy", "bills", "compta"));
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$id = GETPOST('id', 'int'); // id of record $id = GETPOST('id', 'int'); // id of record
$mode = GETPOST('mode', 'aZ09'); // '' or 'tmp' $mode = GETPOST('mode', 'aZ09'); // '' or 'tmp'
@ -346,6 +347,8 @@ if ($action == 'create')
} }
print '<form action="' . $_SERVER["PHP_SELF"] . '" name="create_mvt" method="POST">'; print '<form action="' . $_SERVER["PHP_SELF"] . '" name="create_mvt" method="POST">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="confirm_create">' . "\n"; print '<input type="hidden" name="action" value="confirm_create">' . "\n";
print '<input type="hidden" name="next_num_mvt" value="' . $next_num_mvt . '">' . "\n"; print '<input type="hidden" name="next_num_mvt" value="' . $next_num_mvt . '">' . "\n";
print '<input type="hidden" name="mode" value="_tmp">' . "\n"; print '<input type="hidden" name="mode" value="_tmp">' . "\n";
@ -441,7 +444,8 @@ if ($action == 'create')
print '</td><td colspan="3">'; print '</td><td colspan="3">';
if ($action == 'editdate') { if ($action == 'editdate') {
print '<form name="setdate" action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $object->piece_num . '" method="post">'; print '<form name="setdate" action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $object->piece_num . '" method="post">';
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setdate">'; print '<input type="hidden" name="action" value="setdate">';
print '<input type="hidden" name="mode" value="'.$mode.'">'; print '<input type="hidden" name="mode" value="'.$mode.'">';
print $form->selectDate($object->doc_date ? $object->doc_date : - 1, 'doc_date', '', '', '', "setdate"); print $form->selectDate($object->doc_date ? $object->doc_date : - 1, 'doc_date', '', '', '', "setdate");
@ -464,7 +468,8 @@ if ($action == 'create')
print '</td><td>'; print '</td><td>';
if ($action == 'editjournal') { if ($action == 'editjournal') {
print '<form name="setjournal" action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $object->piece_num . '" method="post">'; print '<form name="setjournal" action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $object->piece_num . '" method="post">';
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setjournal">'; print '<input type="hidden" name="action" value="setjournal">';
print '<input type="hidden" name="mode" value="'.$mode.'">'; print '<input type="hidden" name="mode" value="'.$mode.'">';
print $formaccounting->select_journal($object->code_journal, 'code_journal', 0, 0, array(), 1, 1); print $formaccounting->select_journal($object->code_journal, 'code_journal', 0, 0, array(), 1, 1);
@ -487,7 +492,8 @@ if ($action == 'create')
print '</td><td>'; print '</td><td>';
if ($action == 'editdocref') { if ($action == 'editdocref') {
print '<form name="setdocref" action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $object->piece_num . '" method="post">'; print '<form name="setdocref" action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $object->piece_num . '" method="post">';
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setdocref">'; print '<input type="hidden" name="action" value="setdocref">';
print '<input type="hidden" name="mode" value="'.$mode.'">'; print '<input type="hidden" name="mode" value="'.$mode.'">';
print '<input type="text" size="20" name="doc_ref" value="'.dol_escape_htmltag($object->doc_ref).'">'; print '<input type="text" size="20" name="doc_ref" value="'.dol_escape_htmltag($object->doc_ref).'">';
@ -583,6 +589,8 @@ if ($action == 'create')
print load_fiche_titre($langs->trans("ListeMvts"), '', ''); print load_fiche_titre($langs->trans("ListeMvts"), '', '');
print '<form action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $object->piece_num . '" method="post">'; print '<form action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $object->piece_num . '" method="post">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="doc_date" value="' . $object->doc_date . '">' . "\n"; print '<input type="hidden" name="doc_date" value="' . $object->doc_date . '">' . "\n";
print '<input type="hidden" name="doc_type" value="' . $object->doc_type . '">' . "\n"; print '<input type="hidden" name="doc_type" value="' . $object->doc_type . '">' . "\n";
print '<input type="hidden" name="doc_ref" value="' . $object->doc_ref . '">' . "\n"; print '<input type="hidden" name="doc_ref" value="' . $object->doc_ref . '">' . "\n";

View File

@ -284,7 +284,6 @@ class AccountancyExport
* Export format : CEGID * Export format : CEGID
* *
* @param array $objectLines data * @param array $objectLines data
*
* @return void * @return void
*/ */
public function exportCegid($objectLines) public function exportCegid($objectLines)
@ -310,7 +309,6 @@ class AccountancyExport
* Export format : COGILOG * Export format : COGILOG
* *
* @param array $objectLines data * @param array $objectLines data
*
* @return void * @return void
*/ */
public function exportCogilog($objectLines) public function exportCogilog($objectLines)
@ -344,7 +342,6 @@ class AccountancyExport
* Export format : COALA * Export format : COALA
* *
* @param array $objectLines data * @param array $objectLines data
*
* @return void * @return void
*/ */
public function exportCoala($objectLines) public function exportCoala($objectLines)
@ -372,7 +369,6 @@ class AccountancyExport
* Export format : BOB50 * Export format : BOB50
* *
* @param array $objectLines data * @param array $objectLines data
*
* @return void * @return void
*/ */
public function exportBob50($objectLines) public function exportBob50($objectLines)
@ -411,7 +407,6 @@ class AccountancyExport
* Export format : CIEL * Export format : CIEL
* *
* @param array $TData data * @param array $TData data
*
* @return void * @return void
*/ */
public function exportCiel(&$TData) public function exportCiel(&$TData)
@ -452,7 +447,6 @@ class AccountancyExport
* Export format : Quadratus * Export format : Quadratus
* *
* @param array $TData data * @param array $TData data
*
* @return void * @return void
*/ */
public function exportQuadratus(&$TData) public function exportQuadratus(&$TData)
@ -536,7 +530,6 @@ class AccountancyExport
* Export format : EBP * Export format : EBP
* *
* @param array $objectLines data * @param array $objectLines data
*
* @return void * @return void
*/ */
public function exportEbp($objectLines) public function exportEbp($objectLines)
@ -573,7 +566,6 @@ class AccountancyExport
* Export format : Agiris Isacompta * Export format : Agiris Isacompta
* *
* @param array $objectLines data * @param array $objectLines data
*
* @return void * @return void
*/ */
public function exportAgiris($objectLines) public function exportAgiris($objectLines)
@ -614,7 +606,6 @@ class AccountancyExport
* Export format : OpenConcerto * Export format : OpenConcerto
* *
* @param array $objectLines data * @param array $objectLines data
*
* @return void * @return void
*/ */
public function exportOpenConcerto($objectLines) public function exportOpenConcerto($objectLines)
@ -644,16 +635,17 @@ class AccountancyExport
} }
/** /**
* Export format : Configurable * Export format : Configurable CSV
* *
* @param array $objectLines data * @param array $objectLines data
*
* @return void * @return void
*/ */
public function exportConfigurable($objectLines) public function exportConfigurable($objectLines)
{ {
global $conf; global $conf;
$separator = $this->separator;
foreach ($objectLines as $line) { foreach ($objectLines as $line) {
$tab = array(); $tab = array();
// export configurable // export configurable
@ -661,15 +653,14 @@ class AccountancyExport
$tab[] = $line->piece_num; $tab[] = $line->piece_num;
$tab[] = $date; $tab[] = $date;
$tab[] = $line->doc_ref; $tab[] = $line->doc_ref;
$tab[] = $line->label_operation; $tab[] = preg_match('/'.$separator.'/', $line->label_operation) ? "'".$line->label_operation."'" : $line->label_operation;
$tab[] = length_accountg($line->numero_compte); $tab[] = length_accountg($line->numero_compte);
$tab[] = length_accounta($line->subledger_account); $tab[] = length_accounta($line->subledger_account);
$tab[] = price($line->debit); $tab[] = price2num($line->debit);
$tab[] = price($line->credit); $tab[] = price2num($line->credit);
$tab[] = price($line->montant); $tab[] = price2num($line->montant);
$tab[] = $line->code_journal; $tab[] = $line->code_journal;
$separator = $this->separator;
print implode($separator, $tab) . $this->end_line; print implode($separator, $tab) . $this->end_line;
} }
} }
@ -678,7 +669,6 @@ class AccountancyExport
* Export format : FEC * Export format : FEC
* *
* @param array $objectLines data * @param array $objectLines data
*
* @return void * @return void
*/ */
public function exportFEC($objectLines) public function exportFEC($objectLines)

View File

@ -446,8 +446,10 @@ print "\n";
<br> <br>
<div class="center"><input type="submit" class="button" <div class="center">
value="<?php echo $langs->trans("GenerateBackup") ?>" id="buttonGo" /><br> <input type="submit" class="button reposition" value="<?php echo $langs->trans("GenerateBackup") ?>" id="buttonGo">
<input type="hidden" name="page_y" value="<?php echo GETPOST('page_y', 'int'); ?>">
<br>
<br> <br>
<?php <?php
@ -459,7 +461,7 @@ if (! empty($_SESSION["commandbackuplastdone"]))
//print $paramclear; //print $paramclear;
// Now run command and show result // Now show result
print '<b>'.$langs->trans("BackupResult").':</b> '; print '<b>'.$langs->trans("BackupResult").':</b> ';
print $_SESSION["commandbackupresult"]; print $_SESSION["commandbackupresult"];
@ -598,9 +600,6 @@ print '<br>';
</fieldset> </fieldset>
</form> </form>
<?php <?php
// End of page // End of page

View File

@ -50,7 +50,7 @@ if (! $user->admin) accessforbidden();
if ($file && ! $what) if ($file && ! $what)
{ {
//print DOL_URL_ROOT.'/dolibarr_export.php'; //print DOL_URL_ROOT.'/dolibarr_export.php';
header("Location: ".DOL_URL_ROOT.'/admin/tools/dolibarr_export.php?msg='.urlencode($langs->trans("ErrorFieldRequired", $langs->transnoentities("ExportMethod")))); header("Location: ".DOL_URL_ROOT.'/admin/tools/dolibarr_export.php?msg='.urlencode($langs->trans("ErrorFieldRequired", $langs->transnoentities("ExportMethod"))).(GETPOST('page_y', 'int')?'&page_y='.GETPOST('page_y', 'int'):''));
exit; exit;
} }
@ -122,25 +122,15 @@ $utils = new Utils($db);
// MYSQL // MYSQL
if ($what == 'mysql') if ($what == 'mysql')
{ {
$cmddump=GETPOST("mysqldump"); // Do not sanitize here with 'alpha', will be sanitize later by dol_sanitizePathName and escapeshellarg $cmddump=GETPOST("mysqldump"); // Do not sanitize here with 'alpha', will be sanitize later by dol_sanitizePathName and escapeshellarg
$cmddump=dol_sanitizePathName($cmddump); $cmddump=dol_sanitizePathName($cmddump);
if (! empty($dolibarr_main_restrict_os_commands)) if (! empty($dolibarr_main_restrict_os_commands))
{ {
$arrayofallowedcommand=explode(',', $dolibarr_main_restrict_os_commands); $arrayofallowedcommand=explode(',', $dolibarr_main_restrict_os_commands);
$ok=0;
dol_syslog("Command are restricted to ".$dolibarr_main_restrict_os_commands.". We check that one of this command is inside ".$cmddump); dol_syslog("Command are restricted to ".$dolibarr_main_restrict_os_commands.". We check that one of this command is inside ".$cmddump);
foreach($arrayofallowedcommand as $allowedcommand) $basenamecmddump=basename($cmddump);
{ if (! in_array($basenamecmddump, $arrayofallowedcommand)) // the provided command $cmddump must be an allowed command
$basenamecmddump=basename($cmddump);
if (preg_match('/^'.preg_quote($allowedcommand, '/').'$/', $basenamecmddump)) // the provided command $cmddump must be an allowed command
{
$ok=1;
break;
}
}
if (! $ok)
{ {
$errormsg=$langs->trans('CommandIsNotInsideAllowedCommands'); $errormsg=$langs->trans('CommandIsNotInsideAllowedCommands');
} }
@ -176,6 +166,18 @@ if ($what == 'postgresql')
$cmddump=GETPOST("postgresqldump"); // Do not sanitize here with 'alpha', will be sanitize later by dol_sanitizePathName and escapeshellarg $cmddump=GETPOST("postgresqldump"); // Do not sanitize here with 'alpha', will be sanitize later by dol_sanitizePathName and escapeshellarg
$cmddump=dol_sanitizePathName($cmddump); $cmddump=dol_sanitizePathName($cmddump);
/* Not required, the command is output on screen but not ran for pgsql
if (! empty($dolibarr_main_restrict_os_commands))
{
$arrayofallowedcommand=explode(',', $dolibarr_main_restrict_os_commands);
dol_syslog("Command are restricted to ".$dolibarr_main_restrict_os_commands.". We check that one of this command is inside ".$cmddump);
$basenamecmddump=basename($cmddump);
if (! in_array($basenamecmddump, $arrayofallowedcommand)) // the provided command $cmddump must be an allowed command
{
$errormsg=$langs->trans('CommandIsNotInsideAllowedCommands');
}
} */
if (! $errormsg && $cmddump) if (! $errormsg && $cmddump)
{ {
dolibarr_set_const($db, 'SYSTEMTOOLS_POSTGRESQLDUMP', $cmddump, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, 'SYSTEMTOOLS_POSTGRESQLDUMP', $cmddump, 'chaine', 0, '', $conf->entity);
@ -193,7 +195,6 @@ if ($what == 'postgresql')
} }
if ($errormsg) if ($errormsg)
{ {
setEventMessages($langs->trans("Error")." : ".$errormsg, null, 'errors'); setEventMessages($langs->trans("Error")." : ".$errormsg, null, 'errors');
@ -230,8 +231,8 @@ $result=$formfile->list_of_documents($filearray,null,'systemtools','',1,'backup/
print '<br>'; print '<br>';
*/ */
// Redirect t backup page // Redirect to backup page
header("Location: dolibarr_export.php"); header("Location: dolibarr_export.php".(GETPOST('page_y', 'int')?'?page_y='.GETPOST('page_y', 'int'):''));
$time_end = time(); $time_end = time();

View File

@ -281,7 +281,7 @@ if ($resql)
print '<td align="center">'; print '<td align="center">';
if ($obj->periode) if ($obj->periode)
{ {
print '<a href="list.php?year='.strftime("%Y",$db->jdate($obj->periode)).'">'.dol_print_date($db->jdate($obj->periode),'day').'</a>'; print '<a href="list.php?year='.strftime("%Y", $db->jdate($obj->periode)).'">'.dol_print_date($db->jdate($obj->periode), 'day').'</a>';
} }
else else
{ {

View File

@ -6084,6 +6084,12 @@ abstract class CommonObject
$type='link'; $type='link';
$param['options']=array($reg[1].':'.$reg[2]=>$reg[1].':'.$reg[2]); $param['options']=array($reg[1].':'.$reg[2]=>$reg[1].':'.$reg[2]);
} }
elseif(preg_match('/^sellist:(.*):(.*):(.*):(.*)/i', $val['type'], $reg)) {
$param['options'] = array($reg[1] . ':' . $reg[2] . ':' . $reg[3] . ':' . $reg[4] => 'N');
$type = 'sellist';
}
$langfile=$val['langfile']; $langfile=$val['langfile'];
$list=$val['list']; $list=$val['list'];
$help=$val['help']; $help=$val['help'];

View File

@ -199,8 +199,6 @@ class FormMargin
if (! $user->rights->margins->liretous) return; if (! $user->rights->margins->liretous) return;
$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT);
$marginInfo = $this->getMarginInfosArray($object, $force_price); $marginInfo = $this->getMarginInfosArray($object, $force_price);
if (! empty($conf->global->MARGIN_ADD_SHOWHIDE_BUTTON)) // TODO Warning this feature rely on an external js file that may be removed. Using native js function document.cookie should be better if (! empty($conf->global->MARGIN_ADD_SHOWHIDE_BUTTON)) // TODO Warning this feature rely on an external js file that may be removed. Using native js function document.cookie should be better
@ -240,13 +238,13 @@ class FormMargin
//if ($marginInfo['margin_on_products'] != 0 && $marginInfo['margin_on_services'] != 0) { //if ($marginInfo['margin_on_products'] != 0 && $marginInfo['margin_on_services'] != 0) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans('MarginOnProducts').'</td>'; print '<td>'.$langs->trans('MarginOnProducts').'</td>';
print '<td class="right">'.price($marginInfo['pv_products'], null, null, null, null, $rounding).'</td>'; print '<td class="right">'.price($marginInfo['pv_products']).'</td>';
print '<td class="right">'.price($marginInfo['pa_products'], null, null, null, null, $rounding).'</td>'; print '<td class="right">'.price($marginInfo['pa_products']).'</td>';
print '<td class="right">'.price($marginInfo['margin_on_products'], null, null, null, null, $rounding).'</td>'; print '<td class="right">'.price($marginInfo['margin_on_products']).'</td>';
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) if (! empty($conf->global->DISPLAY_MARGIN_RATES))
print '<td class="right">'.(($marginInfo['margin_rate_products'] == '')?'':price($marginInfo['margin_rate_products'], null, null, null, null, $rounding).'%').'</td>'; print '<td class="right">'.(($marginInfo['margin_rate_products'] == '')?'':price($marginInfo['margin_rate_products'], null, null, null, null, 2).'%').'</td>';
if (! empty($conf->global->DISPLAY_MARK_RATES)) if (! empty($conf->global->DISPLAY_MARK_RATES))
print '<td class="right">'.(($marginInfo['mark_rate_products'] == '')?'':price($marginInfo['mark_rate_products'], null, null, null, null, $rounding).'%').'</td>'; print '<td class="right">'.(($marginInfo['mark_rate_products'] == '')?'':price($marginInfo['mark_rate_products'], null, null, null, null, 2).'%').'</td>';
print '</tr>'; print '</tr>';
} }
@ -254,13 +252,13 @@ class FormMargin
{ {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans('MarginOnServices').'</td>'; print '<td>'.$langs->trans('MarginOnServices').'</td>';
print '<td class="right">'.price($marginInfo['pv_services'], null, null, null, null, $rounding).'</td>'; print '<td class="right">'.price($marginInfo['pv_services']).'</td>';
print '<td class="right">'.price($marginInfo['pa_services'], null, null, null, null, $rounding).'</td>'; print '<td class="right">'.price($marginInfo['pa_services']).'</td>';
print '<td class="right">'.price($marginInfo['margin_on_services'], null, null, null, null, $rounding).'</td>'; print '<td class="right">'.price($marginInfo['margin_on_services']).'</td>';
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) if (! empty($conf->global->DISPLAY_MARGIN_RATES))
print '<td class="right">'.(($marginInfo['margin_rate_services'] == '')?'':price($marginInfo['margin_rate_services'], null, null, null, null, $rounding).'%').'</td>'; print '<td class="right">'.(($marginInfo['margin_rate_services'] == '')?'':price($marginInfo['margin_rate_services'], null, null, null, null, 2).'%').'</td>';
if (! empty($conf->global->DISPLAY_MARK_RATES)) if (! empty($conf->global->DISPLAY_MARK_RATES))
print '<td class="right">'.(($marginInfo['mark_rate_services'] == '')?'':price($marginInfo['mark_rate_services'], null, null, null, null, $rounding).'%').'</td>'; print '<td class="right">'.(($marginInfo['mark_rate_services'] == '')?'':price($marginInfo['mark_rate_services'], null, null, null, null, 2).'%').'</td>';
print '</tr>'; print '</tr>';
} }
@ -268,13 +266,13 @@ class FormMargin
{ {
print '<tr class="liste_total">'; print '<tr class="liste_total">';
print '<td>'.$langs->trans('TotalMargin').'</td>'; print '<td>'.$langs->trans('TotalMargin').'</td>';
print '<td class="right">'.price($marginInfo['pv_total'], null, null, null, null, $rounding).'</td>'; print '<td class="right">'.price($marginInfo['pv_total']).'</td>';
print '<td class="right">'.price($marginInfo['pa_total'], null, null, null, null, $rounding).'</td>'; print '<td class="right">'.price($marginInfo['pa_total']).'</td>';
print '<td class="right">'.price($marginInfo['total_margin'], null, null, null, null, $rounding).'</td>'; print '<td class="right">'.price($marginInfo['total_margin']).'</td>';
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) if (! empty($conf->global->DISPLAY_MARGIN_RATES))
print '<td class="right">'.(($marginInfo['total_margin_rate'] == '')?'':price($marginInfo['total_margin_rate'], null, null, null, null, $rounding).'%').'</td>'; print '<td class="right">'.(($marginInfo['total_margin_rate'] == '')?'':price($marginInfo['total_margin_rate'], null, null, null, null, 2).'%').'</td>';
if (! empty($conf->global->DISPLAY_MARK_RATES)) if (! empty($conf->global->DISPLAY_MARK_RATES))
print '<td class="right">'.(($marginInfo['total_mark_rate'] == '')?'':price($marginInfo['total_mark_rate'], null, null, null, null, $rounding).'%').'</td>'; print '<td class="right">'.(($marginInfo['total_mark_rate'] == '')?'':price($marginInfo['total_mark_rate'], null, null, null, null, 2).'%').'</td>';
print '</tr>'; print '</tr>';
} }
print '</table>'; print '</table>';

View File

@ -148,6 +148,7 @@ print '
/* Set handler to add page_y param on output (click on href links or submit button) */ /* Set handler to add page_y param on output (click on href links or submit button) */
jQuery(".reposition").click(function() { jQuery(".reposition").click(function() {
var page_y = $(document).scrollTop(); var page_y = $(document).scrollTop();
if (page_y > 0) if (page_y > 0)
{ {
if (this.href) if (this.href)
@ -157,7 +158,7 @@ print '
} }
else else
{ {
console.log("We click on tag with .reposition class but element is not an <a> html tag, so we try to update form field page_y with value "+page_y); console.log("We click on tag with .reposition class but element is not an <a> html tag, so we try to update input form field page_y with value "+page_y);
jQuery("input[type=hidden][name=page_y]").val(page_y); jQuery("input[type=hidden][name=page_y]").val(page_y);
} }
} }

View File

@ -4400,7 +4400,7 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $
{ {
if ($currency_code == 'auto') $currency_code=$conf->currency; if ($currency_code == 'auto') $currency_code=$conf->currency;
$listofcurrenciesbefore=array('USD','GBP','AUD','HKD','MXN','PEN','CNY'); $listofcurrenciesbefore=array('USD','GBP','AUD','HKD','MXN','PEN','CNY','CAD');
$listoflanguagesbefore=array('nl_NL'); $listoflanguagesbefore=array('nl_NL');
if (in_array($currency_code, $listofcurrenciesbefore) || in_array($outlangs->defaultlang, $listoflanguagesbefore)) if (in_array($currency_code, $listofcurrenciesbefore) || in_array($outlangs->defaultlang, $listoflanguagesbefore))
{ {
@ -6554,10 +6554,17 @@ function dol_htmloutput_mesg($mesgstring = '', $mesgarray = array(), $style = 'o
$newmesgarray=array(); $newmesgarray=array();
foreach($mesgarray as $val) foreach($mesgarray as $val)
{ {
$tmpmesgstring=preg_replace('/<\/div><div class="(error|warning)">/', '<br>', $val); if (is_string($val))
$tmpmesgstring=preg_replace('/<div class="(error|warning)">/', '', $tmpmesgstring); {
$tmpmesgstring=preg_replace('/<\/div>/', '', $tmpmesgstring); $tmpmesgstring=preg_replace('/<\/div><div class="(error|warning)">/', '<br>', $val);
$newmesgarray[]=$tmpmesgstring; $tmpmesgstring=preg_replace('/<div class="(error|warning)">/', '', $tmpmesgstring);
$tmpmesgstring=preg_replace('/<\/div>/', '', $tmpmesgstring);
$newmesgarray[]=$tmpmesgstring;
}
else
{
dol_syslog("Error call of dol_htmloutput_mesg with an array with a value that is not a string", LOG_WARNING);
}
} }
$mesgarray=$newmesgarray; $mesgarray=$newmesgarray;
} }

View File

@ -252,7 +252,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
$pdf->MultiCell(22, 2, $outputlangs->transnoentities("Owner"), 0, 'L'); $pdf->MultiCell(22, 2, $outputlangs->transnoentities("Owner"), 0, 'L');
$pdf->SetFont('', '', $default_font_size); $pdf->SetFont('', '', $default_font_size);
$pdf->SetXY(32, 26); $pdf->SetXY(32, 26);
$pdf->MultiCell(60, 2, $outputlangs->convToOutputCharset($this->account->proprio), 0, 'L'); $pdf->MultiCell(80, 2, $outputlangs->convToOutputCharset($this->account->proprio), 0, 'L');
$pdf->SetFont('', '', $default_font_size); $pdf->SetFont('', '', $default_font_size);
$pdf->SetXY(10, 32); $pdf->SetXY(10, 32);

View File

@ -622,7 +622,7 @@ class ImportXlsx extends ModeleImports
if (! empty($objimport->array_import_regex[0][$val]) && ($newval != '')) if (! empty($objimport->array_import_regex[0][$val]) && ($newval != ''))
{ {
// If test is "Must exist in a field@table or field@table:..." // If test is "Must exist in a field@table or field@table:..."
if (preg_match('/^(.+)@([^:]+)(:.+)?$/',$objimport->array_import_regex[0][$val],$reg)) if (preg_match('/^(.+)@([^:]+)(:.+)?$/', $objimport->array_import_regex[0][$val], $reg))
{ {
$field=$reg[1]; $field=$reg[1];
$table=$reg[2]; $table=$reg[2];

View File

@ -438,7 +438,7 @@ class pdf_beluga extends ModelePDFProjects
$pdf->MultiCell($this->posxstatut - $this->posxamountht, 3, "", 1, 'R'); $pdf->MultiCell($this->posxstatut - $this->posxamountht, 3, "", 1, 'R');
} }
$pdf->SetXY($this->posxstatut, $curY); $pdf->SetXY($this->posxstatut, $curY);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxstatut, 3, $outputlangs->transnoentities("Statut"), 1, 'R'); $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxstatut, 3, $outputlangs->transnoentities("Status"), 1, 'R');
if (is_array($elementarray) && count($elementarray) > 0) if (is_array($elementarray) && count($elementarray) > 0)
{ {

View File

@ -114,8 +114,8 @@ class InterfaceWorkflowManager extends DolibarrTriggers
if ($element->statut == Propal::STATUS_SIGNED || $element->statut == Propal::STATUS_BILLED) $totalonlinkedelements += $element->total_ht; if ($element->statut == Propal::STATUS_SIGNED || $element->statut == Propal::STATUS_BILLED) $totalonlinkedelements += $element->total_ht;
} }
dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of order = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht)); dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of order = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht));
if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) ) if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht))
{ {
foreach($object->linkedObjects['propal'] as $element) foreach($object->linkedObjects['propal'] as $element)
{ {
$ret=$element->classifyBilled($user); $ret=$element->classifyBilled($user);
@ -143,7 +143,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
if ($element->statut == Commande::STATUS_VALIDATED || $element->statut == Commande::STATUS_SHIPMENTONPROCESS || $element->statut == Commande::STATUS_CLOSED) $totalonlinkedelements += $element->total_ht; if ($element->statut == Commande::STATUS_VALIDATED || $element->statut == Commande::STATUS_SHIPMENTONPROCESS || $element->statut == Commande::STATUS_CLOSED) $totalonlinkedelements += $element->total_ht;
} }
dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht)); dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht));
if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) ) if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht))
{ {
foreach($object->linkedObjects['commande'] as $element) foreach($object->linkedObjects['commande'] as $element)
{ {
@ -166,7 +166,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
if ($element->statut == Propal::STATUS_SIGNED || $element->statut == Propal::STATUS_BILLED) $totalonlinkedelements += $element->total_ht; if ($element->statut == Propal::STATUS_SIGNED || $element->statut == Propal::STATUS_BILLED) $totalonlinkedelements += $element->total_ht;
} }
dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht)); dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht));
if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) ) if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht))
{ {
foreach($object->linkedObjects['propal'] as $element) foreach($object->linkedObjects['propal'] as $element)
{ {
@ -195,8 +195,8 @@ class InterfaceWorkflowManager extends DolibarrTriggers
if ($element->statut == CommandeFournisseur::STATUS_ACCEPTED || $element->statut == CommandeFournisseur::STATUS_ORDERSENT || $element->statut == CommandeFournisseur::STATUS_RECEIVED_PARTIALLY || $element->statut == CommandeFournisseur::STATUS_RECEIVED_COMPLETELY) $totalonlinkedelements += $element->total_ht; if ($element->statut == CommandeFournisseur::STATUS_ACCEPTED || $element->statut == CommandeFournisseur::STATUS_ORDERSENT || $element->statut == CommandeFournisseur::STATUS_RECEIVED_PARTIALLY || $element->statut == CommandeFournisseur::STATUS_RECEIVED_COMPLETELY) $totalonlinkedelements += $element->total_ht;
} }
dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht)); dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht));
if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) ) if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht))
{ {
foreach($object->linkedObjects['order_supplier'] as $element) foreach($object->linkedObjects['order_supplier'] as $element)
{ {
$ret=$element->classifyBilled($user); $ret=$element->classifyBilled($user);
@ -218,7 +218,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
if ($element->statut == SupplierProposal::STATUS_SIGNED || $element->statut == SupplierProposal::STATUS_BILLED) $totalonlinkedelements += $element->total_ht; if ($element->statut == SupplierProposal::STATUS_SIGNED || $element->statut == SupplierProposal::STATUS_BILLED) $totalonlinkedelements += $element->total_ht;
} }
dol_syslog("Amount of linked supplier proposals = ".$totalonlinkedelements.", of supplier invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht)); dol_syslog("Amount of linked supplier proposals = ".$totalonlinkedelements.", of supplier invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht));
if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) ) if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht))
{ {
foreach($object->linkedObjects['supplier_proposal'] as $element) foreach($object->linkedObjects['supplier_proposal'] as $element)
{ {
@ -246,7 +246,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
if ($element->statut == Commande::STATUS_VALIDATED || $element->statut == Commande::STATUS_SHIPMENTONPROCESS || $element->statut == Commande::STATUS_CLOSED) $totalonlinkedelements += $element->total_ht; if ($element->statut == Commande::STATUS_VALIDATED || $element->statut == Commande::STATUS_SHIPMENTONPROCESS || $element->statut == Commande::STATUS_CLOSED) $totalonlinkedelements += $element->total_ht;
} }
dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht)); dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht));
if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) ) if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht))
{ {
foreach($object->linkedObjects['commande'] as $element) foreach($object->linkedObjects['commande'] as $element)
{ {
@ -345,4 +345,24 @@ class InterfaceWorkflowManager extends DolibarrTriggers
return 0; return 0;
} }
/**
* @param Object $conf Dolibarr settings object
* @param float $totalonlinkedelements Sum of total amounts (excl VAT) of
* invoices linked to $object
* @param float $object_total_ht The total amount (excl VAT) of the object
* (an order, a proposal, a bill, etc.)
* @return bool True if the amounts are equal (rounded on total amount)
* True if the module is configured to skip the amount equality check
* False otherwise.
*/
private function shouldClassify($conf, $totalonlinkedelements, $object_total_ht)
{
// if the configuration allows unmatching amounts, allow classification anyway
if (!empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) {
return true;
}
// if the amount are same, allow classification, else deny
return (price2num($totalonlinkedelements, 'MT') == price2num($object_total_ht, 'MT'));
}
} }

View File

@ -1958,7 +1958,7 @@ else
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $total = 0; $i = 0; $totalpaid = 0;
while ($i < $num) while ($i < $num)
{ {
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);

View File

@ -453,7 +453,7 @@ if ($action == "set")
// Replace the prefix in table names // Replace the prefix in table names
if ($dolibarr_main_db_prefix != 'llx_') if ($dolibarr_main_db_prefix != 'llx_')
{ {
$buffer=preg_replace('/llx_/i',$dolibarr_main_db_prefix,$buffer); $buffer=preg_replace('/llx_/i', $dolibarr_main_db_prefix,$buffer);
} }
dolibarr_install_syslog("step2: request: " . $buffer); dolibarr_install_syslog("step2: request: " . $buffer);
print "<!-- Insert line : ".$buffer."<br>-->\n"; print "<!-- Insert line : ".$buffer."<br>-->\n";

View File

@ -533,7 +533,9 @@ foreach($object->fields as $key => $val)
} }
print '<td class="liste_titre'.($cssforfield?' '.$cssforfield:'').'">'; print '<td class="liste_titre'.($cssforfield?' '.$cssforfield:'').'">';
//var_dump($arrayofstatus);var_dump($search['fk_statut']);var_dump(array_values($search[$key])); //var_dump($arrayofstatus);var_dump($search['fk_statut']);var_dump(array_values($search[$key]));
print Form::multiselectarray('search_fk_statut', $arrayofstatus, array_values($search[$key]), 0, 0, 'minwidth150', 1, 0, '', '', ''); $selectedarray = null;
if ($search[$key]) $selectedarray = array_values($search[$key]);
print Form::multiselectarray('search_fk_statut', $arrayofstatus, $selectedarray, 0, 0, 'minwidth150', 1, 0, '', '', '');
print '</td>'; print '</td>';
} }
elseif ($key == "fk_soc") elseif ($key == "fk_soc")

View File

@ -365,5 +365,4 @@ class HolidayTest extends PHPUnit\Framework\TestCase
$localobjecta->updateBalance(); $localobjecta->updateBalance();
} }
} }