Skip to content

Commit

Permalink
Merge branch '10.0' of git@github.com:Dolibarr/dolibarr.git into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Aug 1, 2019
2 parents d7a41c6 + 5a71976 commit 3d8f6dc
Show file tree
Hide file tree
Showing 17 changed files with 112 additions and 81 deletions.
14 changes: 11 additions & 3 deletions htdocs/accountancy/bookkeeping/card.php
Expand Up @@ -38,6 +38,7 @@
$langs->loadLangs(array("accountancy", "bills", "compta"));

$action = GETPOST('action', 'aZ09');
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')

$id = GETPOST('id', 'int'); // id of record
$mode = GETPOST('mode', 'aZ09'); // '' or 'tmp'
Expand Down Expand Up @@ -346,6 +347,8 @@
}

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="next_num_mvt" value="' . $next_num_mvt . '">' . "\n";
print '<input type="hidden" name="mode" value="_tmp">' . "\n";
Expand Down Expand Up @@ -441,7 +444,8 @@
print '</td><td colspan="3">';
if ($action == 'editdate') {
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="mode" value="'.$mode.'">';
print $form->selectDate($object->doc_date ? $object->doc_date : - 1, 'doc_date', '', '', '', "setdate");
Expand All @@ -464,7 +468,8 @@
print '</td><td>';
if ($action == 'editjournal') {
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="mode" value="'.$mode.'">';
print $formaccounting->select_journal($object->code_journal, 'code_journal', 0, 0, array(), 1, 1);
Expand All @@ -487,7 +492,8 @@
print '</td><td>';
if ($action == 'editdocref') {
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="mode" value="'.$mode.'">';
print '<input type="text" size="20" name="doc_ref" value="'.dol_escape_htmltag($object->doc_ref).'">';
Expand Down Expand Up @@ -583,6 +589,8 @@
print load_fiche_titre($langs->trans("ListeMvts"), '', '');

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_type" value="' . $object->doc_type . '">' . "\n";
print '<input type="hidden" name="doc_ref" value="' . $object->doc_ref . '">' . "\n";
Expand Down
24 changes: 7 additions & 17 deletions htdocs/accountancy/class/accountancyexport.class.php
Expand Up @@ -284,7 +284,6 @@ public function export(&$TData)
* Export format : CEGID
*
* @param array $objectLines data
*
* @return void
*/
public function exportCegid($objectLines)
Expand All @@ -310,7 +309,6 @@ public function exportCegid($objectLines)
* Export format : COGILOG
*
* @param array $objectLines data
*
* @return void
*/
public function exportCogilog($objectLines)
Expand Down Expand Up @@ -344,7 +342,6 @@ public function exportCogilog($objectLines)
* Export format : COALA
*
* @param array $objectLines data
*
* @return void
*/
public function exportCoala($objectLines)
Expand Down Expand Up @@ -372,7 +369,6 @@ public function exportCoala($objectLines)
* Export format : BOB50
*
* @param array $objectLines data
*
* @return void
*/
public function exportBob50($objectLines)
Expand Down Expand Up @@ -411,7 +407,6 @@ public function exportBob50($objectLines)
* Export format : CIEL
*
* @param array $TData data
*
* @return void
*/
public function exportCiel(&$TData)
Expand Down Expand Up @@ -452,7 +447,6 @@ public function exportCiel(&$TData)
* Export format : Quadratus
*
* @param array $TData data
*
* @return void
*/
public function exportQuadratus(&$TData)
Expand Down Expand Up @@ -536,7 +530,6 @@ public function exportQuadratus(&$TData)
* Export format : EBP
*
* @param array $objectLines data
*
* @return void
*/
public function exportEbp($objectLines)
Expand Down Expand Up @@ -573,7 +566,6 @@ public function exportEbp($objectLines)
* Export format : Agiris Isacompta
*
* @param array $objectLines data
*
* @return void
*/
public function exportAgiris($objectLines)
Expand Down Expand Up @@ -614,7 +606,6 @@ public function exportAgiris($objectLines)
* Export format : OpenConcerto
*
* @param array $objectLines data
*
* @return void
*/
public function exportOpenConcerto($objectLines)
Expand Down Expand Up @@ -644,32 +635,32 @@ public function exportOpenConcerto($objectLines)
}

/**
* Export format : Configurable
* Export format : Configurable CSV
*
* @param array $objectLines data
*
* @return void
*/
public function exportConfigurable($objectLines)
{
global $conf;

$separator = $this->separator;

foreach ($objectLines as $line) {
$tab = array();
// export configurable
$date = dol_print_date($line->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
$tab[] = $line->piece_num;
$tab[] = $date;
$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_accounta($line->subledger_account);
$tab[] = price($line->debit);
$tab[] = price($line->credit);
$tab[] = price($line->montant);
$tab[] = price2num($line->debit);
$tab[] = price2num($line->credit);
$tab[] = price2num($line->montant);
$tab[] = $line->code_journal;

$separator = $this->separator;
print implode($separator, $tab) . $this->end_line;
}
}
Expand All @@ -678,7 +669,6 @@ public function exportConfigurable($objectLines)
* Export format : FEC
*
* @param array $objectLines data
*
* @return void
*/
public function exportFEC($objectLines)
Expand Down
11 changes: 5 additions & 6 deletions htdocs/admin/tools/dolibarr_export.php
Expand Up @@ -446,8 +446,10 @@ function hideoptions () {


<br>
<div class="center"><input type="submit" class="button"
value="<?php echo $langs->trans("GenerateBackup") ?>" id="buttonGo" /><br>
<div class="center">
<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>

<?php
Expand All @@ -459,7 +461,7 @@ function hideoptions () {

//print $paramclear;

// Now run command and show result
// Now show result
print '<b>'.$langs->trans("BackupResult").':</b> ';
print $_SESSION["commandbackupresult"];

Expand Down Expand Up @@ -598,9 +600,6 @@ function hideoptions () {
</fieldset>
</form>




<?php

// End of page
Expand Down
33 changes: 17 additions & 16 deletions htdocs/admin/tools/export.php
Expand Up @@ -50,7 +50,7 @@
if ($file && ! $what)
{
//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;
}

Expand Down Expand Up @@ -122,25 +122,15 @@
// MYSQL
if ($what == 'mysql')
{

$cmddump=GETPOST("mysqldump"); // Do not sanitize here with 'alpha', will be sanitize later by dol_sanitizePathName and escapeshellarg
$cmddump=dol_sanitizePathName($cmddump);

if (! empty($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);
foreach($arrayofallowedcommand as $allowedcommand)
{
$basenamecmddump=basename($cmddump);
if (preg_match('/^'.preg_quote($allowedcommand, '/').'$/', $basenamecmddump)) // the provided command $cmddump must be an allowed command
{
$ok=1;
break;
}
}
if (! $ok)
$basenamecmddump=basename($cmddump);
if (! in_array($basenamecmddump, $arrayofallowedcommand)) // the provided command $cmddump must be an allowed command
{
$errormsg=$langs->trans('CommandIsNotInsideAllowedCommands');
}
Expand Down Expand Up @@ -176,6 +166,18 @@
$cmddump=GETPOST("postgresqldump"); // Do not sanitize here with 'alpha', will be sanitize later by dol_sanitizePathName and escapeshellarg
$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)
{
dolibarr_set_const($db, 'SYSTEMTOOLS_POSTGRESQLDUMP', $cmddump, 'chaine', 0, '', $conf->entity);
Expand All @@ -193,7 +195,6 @@
}



if ($errormsg)
{
setEventMessages($langs->trans("Error")." : ".$errormsg, null, 'errors');
Expand Down Expand Up @@ -230,8 +231,8 @@
print '<br>';
*/

// Redirect t backup page
header("Location: dolibarr_export.php");
// Redirect to backup page
header("Location: dolibarr_export.php".(GETPOST('page_y', 'int')?'?page_y='.GETPOST('page_y', 'int'):''));

$time_end = time();

Expand Down
2 changes: 1 addition & 1 deletion htdocs/compta/sociales/list.php
Expand Up @@ -281,7 +281,7 @@
print '<td align="center">';
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
{
Expand Down
6 changes: 6 additions & 0 deletions htdocs/core/class/commonobject.class.php
Expand Up @@ -6084,6 +6084,12 @@ public function showOutputField($val, $key, $value, $moreparam = '', $keysuffix
$type='link';
$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'];
$list=$val['list'];
$help=$val['help'];
Expand Down
32 changes: 15 additions & 17 deletions htdocs/core/class/html.formmargin.class.php
Expand Up @@ -199,8 +199,6 @@ public function displayMarginInfos($object, $force_price = false)

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);

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
Expand Down Expand Up @@ -240,41 +238,41 @@ public function displayMarginInfos($object, $force_price = false)
//if ($marginInfo['margin_on_products'] != 0 && $marginInfo['margin_on_services'] != 0) {
print '<tr class="oddeven">';
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['pa_products'], null, null, null, null, $rounding).'</td>';
print '<td class="right">'.price($marginInfo['margin_on_products'], null, null, null, null, $rounding).'</td>';
print '<td class="right">'.price($marginInfo['pv_products']).'</td>';
print '<td class="right">'.price($marginInfo['pa_products']).'</td>';
print '<td class="right">'.price($marginInfo['margin_on_products']).'</td>';
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))
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>';
}

if (! empty($conf->service->enabled))
{
print '<tr class="oddeven">';
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['pa_services'], null, null, null, null, $rounding).'</td>';
print '<td class="right">'.price($marginInfo['margin_on_services'], null, null, null, null, $rounding).'</td>';
print '<td class="right">'.price($marginInfo['pv_services']).'</td>';
print '<td class="right">'.price($marginInfo['pa_services']).'</td>';
print '<td class="right">'.price($marginInfo['margin_on_services']).'</td>';
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))
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>';
}

if (! empty($conf->product->enabled) && ! empty($conf->service->enabled))
{
print '<tr class="liste_total">';
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['pa_total'], null, null, null, null, $rounding).'</td>';
print '<td class="right">'.price($marginInfo['total_margin'], null, null, null, null, $rounding).'</td>';
print '<td class="right">'.price($marginInfo['pv_total']).'</td>';
print '<td class="right">'.price($marginInfo['pa_total']).'</td>';
print '<td class="right">'.price($marginInfo['total_margin']).'</td>';
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))
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 '</table>';
Expand Down
3 changes: 2 additions & 1 deletion htdocs/core/js/lib_foot.js.php
Expand Up @@ -148,6 +148,7 @@
/* Set handler to add page_y param on output (click on href links or submit button) */
jQuery(".reposition").click(function() {
var page_y = $(document).scrollTop();
if (page_y > 0)
{
if (this.href)
Expand All @@ -157,7 +158,7 @@
}
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);
}
}
Expand Down

0 comments on commit 3d8f6dc

Please sign in to comment.