Merge branch 'develop' into dev_importproduct_measuringunit

This commit is contained in:
Laurent Destailleur 2019-02-13 16:35:46 +01:00 committed by GitHub
commit 2311912d8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 53 additions and 56 deletions

View File

@ -3,6 +3,7 @@
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -96,7 +97,7 @@ class ICal
* Translate Calendar * Translate Calendar
* *
* @param string $uri Url * @param string $uri Url
* @return array * @return array|string
*/ */
function parse($uri) function parse($uri)
{ {
@ -363,9 +364,9 @@ class ICal
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Return sorted eventlist as array or false if calenar is empty * Return sorted eventlist as array or false if calendar is empty
* *
* @return array * @return array|false
*/ */
function get_sort_event_list() function get_sort_event_list()
{ {
@ -398,7 +399,7 @@ class ICal
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Return eventlist array (not sort eventlist array) * Return eventlist array (not sorted eventlist array)
* *
* @return array * @return array
*/ */
@ -422,7 +423,7 @@ class ICal
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/** /**
* Return to do array (not sort to do array) * Return to do array (not sorted todo array)
* *
* @return array * @return array
*/ */

View File

@ -50,8 +50,8 @@ class RssParser
private $_rssarray=array(); private $_rssarray=array();
// For parsing with xmlparser // For parsing with xmlparser
var $stack = array(); // parser stack public $stack = array(); // parser stack
var $_CONTENT_CONSTRUCTS = array('content', 'summary', 'info', 'title', 'tagline', 'copyright'); private $_CONTENT_CONSTRUCTS = array('content', 'summary', 'info', 'title', 'tagline', 'copyright');
/** /**
@ -246,7 +246,7 @@ class RssParser
$str = file_get_contents($this->_urlRSS, false, $context); $str = file_get_contents($this->_urlRSS, false, $context);
} }
catch (Exception $e) { catch (Exception $e) {
print 'Error retrieving URL '.$this->urlRSS.' - '.$e->getMessage(); print 'Error retrieving URL '.$this->_urlRSS.' - '.$e->getMessage();
} }
} }

View File

@ -104,7 +104,7 @@ function dol_getImageSize($file, $url = false)
* @param int $newHeight Hauteur maximum que dois faire l'image destination (0=keep ratio) * @param int $newHeight Hauteur maximum que dois faire l'image destination (0=keep ratio)
* @param int $src_x Position of croping image in source image (not use if mode=0) * @param int $src_x Position of croping image in source image (not use if mode=0)
* @param int $src_y Position of croping image in source image (not use if mode=0) * @param int $src_y Position of croping image in source image (not use if mode=0)
* @return int File name if OK, error message if KO * @return string File name if OK, error message if KO
*/ */
function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0, $src_y = 0) function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0, $src_y = 0)
{ {

View File

@ -86,7 +86,7 @@ function tax_prepare_head(ChargeSociales $object)
* @param string $direction 'sell' or 'buy' * @param string $direction 'sell' or 'buy'
* @param int $m Month * @param int $m Month
* @param int $q Quarter * @param int $q Quarter
* @return array Array with details of VATs (per third parties), -1 if no accountancy module, -2 if not yet developped, -3 if error * @return array|int Array with details of VATs (per third parties), -1 if no accountancy module, -2 if not yet developped, -3 if error
*/ */
function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $direction, $m = 0, $q = 0) function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $direction, $m = 0, $q = 0)
{ {
@ -111,7 +111,7 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di
$paymentfacturetable='paiement_facture'; $paymentfacturetable='paiement_facture';
$invoicefieldref='ref'; $invoicefieldref='ref';
} }
if ($direction == 'buy') elseif ($direction == 'buy')
{ {
$invoicetable='facture_fourn'; $invoicetable='facture_fourn';
$invoicedettable='facture_fourn_det'; $invoicedettable='facture_fourn_det';
@ -554,7 +554,7 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di
* @param int $modetax Not used * @param int $modetax Not used
* @param int $direction 'sell' (customer invoice) or 'buy' (supplier invoices) * @param int $direction 'sell' (customer invoice) or 'buy' (supplier invoices)
* @param int $m Month * @param int $m Month
* @return array Array with details of VATs (per rate), -1 if no accountancy module, -2 if not yet developped, -3 if error * @return array|int Array with details of VATs (per rate), -1 if no accountancy module, -2 if not yet developped, -3 if error
*/ */
function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $direction, $m = 0) function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $direction, $m = 0)
{ {

View File

@ -108,7 +108,7 @@ $arrayfields=array(
'origin'=>array('label'=>$langs->trans("Origin"), 'checked'=>1), 'origin'=>array('label'=>$langs->trans("Origin"), 'checked'=>1),
'm.value'=>array('label'=>$langs->trans("Qty"), 'checked'=>1), 'm.value'=>array('label'=>$langs->trans("Qty"), 'checked'=>1),
'm.price'=>array('label'=>$langs->trans("UnitPurchaseValue"), 'checked'=>0), 'm.price'=>array('label'=>$langs->trans("UnitPurchaseValue"), 'checked'=>0),
//'m.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), //'m.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
//'m.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500) //'m.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500)
); );
@ -221,16 +221,19 @@ if ($action == "correct_stock")
$origin_id $origin_id
); // We do not change value of stock for a correction ); // We do not change value of stock for a correction
} }
if ($result > 0)
{ if ($result > 0)
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id); {
exit(); header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
} else { exit;
$error ++; }
setEventMessages($product->error, $product->errors, 'errors'); else
$action = 'correction'; {
} $error++;
} setEventMessages($product->error, $product->errors, 'errors');
$action='correction';
}
}
if (! $error) $action=''; if (! $error) $action='';
} }
@ -337,7 +340,7 @@ if ($action == "transfert_stock" && ! $cancel)
$sellby, $sellby,
$batch, $batch,
GETPOST('inventorycode', 'alpha') GETPOST('inventorycode', 'alpha')
); );
// Add stock // Add stock
$result2=$product->correct_stock_batch( $result2=$product->correct_stock_batch(
$user, $user,
@ -350,7 +353,7 @@ if ($action == "transfert_stock" && ! $cancel)
$sellby, $sellby,
$batch, $batch,
GETPOST('inventorycode', 'alpha') GETPOST('inventorycode', 'alpha')
); );
} }
} }
else else
@ -364,7 +367,7 @@ if ($action == "transfert_stock" && ! $cancel)
GETPOST("label", 'alpha'), GETPOST("label", 'alpha'),
$pricesrc, $pricesrc,
GETPOST('inventorycode', 'alpha') GETPOST('inventorycode', 'alpha')
); );
// Add stock // Add stock
$result2=$product->correct_stock( $result2=$product->correct_stock(
@ -375,7 +378,7 @@ if ($action == "transfert_stock" && ! $cancel)
GETPOST("label", 'alpha'), GETPOST("label", 'alpha'),
$pricedest, $pricedest,
GETPOST('inventorycode', 'alpha') GETPOST('inventorycode', 'alpha')
); );
} }
if (! $error && $result1 >= 0 && $result2 >= 0) if (! $error && $result1 >= 0 && $result2 >= 0)
{ {
@ -734,7 +737,7 @@ if ($resql)
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
if ($id > 0) print '<input type="hidden" name="id" value="'.$id.'">'; if ($id > 0) print '<input type="hidden" name="id" value="'.$id.'">';
if ($id > 0) print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, '', '', $limit); if ($id > 0) print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, '', '', $limit);
else print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic', 0, '', '', $limit); else print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic', 0, '', '', $limit);
if ($sall) if ($sall)
@ -942,19 +945,12 @@ if ($resql)
// Extra fields // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields // Hook fields
$parameters = array( $parameters=array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
'arrayfields' => $arrayfields, $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
'param' => $param, print $hookmanager->resPrint;
'sortfield' => $sortfield, if (! empty($arrayfields['m.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
'sortorder' => $sortorder if (! empty($arrayfields['m.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (! empty($arrayfields['m.datec']['checked']))
print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
if (! empty($arrayfields['m.tms']['checked']))
print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
print "</tr>\n"; print "</tr>\n";
@ -1072,21 +1068,21 @@ if ($resql)
} }
if (! empty($arrayfields['m.type_mouvement']['checked'])) if (! empty($arrayfields['m.type_mouvement']['checked']))
{ {
// Type of movement // Type of movement
switch ($objp->type_mouvement) { switch($objp->type_mouvement) {
case "0" : case "0":
print '<td align="center">' . $langs->trans('StockIncreaseAfterCorrectTransfer') . '</td>'; print '<td align="center">'.$langs->trans('StockIncreaseAfterCorrectTransfer').'</td>';
break; break;
case "1" : case "1":
print '<td align="center">' . $langs->trans('StockDecreaseAfterCorrectTransfer') . '</td>'; print '<td align="center">'.$langs->trans('StockDecreaseAfterCorrectTransfer').'</td>';
break; break;
case "2" : case "2":
print '<td align="center">' . $langs->trans('StockDecrease') . '</td>'; print '<td align="center">'.$langs->trans('StockDecrease').'</td>';
break; break;
case "3" : case "3":
print '<td align="center">' . $langs->trans('StockIncrease') . '</td>'; print '<td align="center">'.$langs->trans('StockIncrease').'</td>';
break; break;
} }
} }
if (! empty($arrayfields['origin']['checked'])) if (! empty($arrayfields['origin']['checked']))
{ {