2
0
forked from Wavyzz/dolibarr

Merge remote-tracking branch 'upstream/develop' into 14a2

This commit is contained in:
Alexandre SPANGARO
2020-11-10 04:09:00 +01:00
144 changed files with 2771 additions and 2092 deletions

View File

@@ -518,15 +518,17 @@ abstract class CommonInvoice extends CommonObject
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=long label + picto
* @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, -1 otherwise)
* @param int $type Type invoice
* @param int $type Type invoice. If -1, we use $this->type
* @return string Label of status
*/
public function LibStatut($paye, $status, $mode = 0, $alreadypaid = -1, $type = 0)
public function LibStatut($paye, $status, $mode = 0, $alreadypaid = -1, $type = -1)
{
// phpcs:enable
global $langs;
$langs->load('bills');
if ($type == -1) $type = $this->type;
$statusType = 'status0';
$prefix = 'Short';
if (!$paye) {
@@ -931,6 +933,9 @@ abstract class CommonInvoiceLine extends CommonObjectLine
*/
public $total_ttc;
public $date_start_fill; // If set to 1, when invoice is created from a template invoice, it will also auto set the field date_start at creation
public $date_end_fill; // If set to 1, when invoice is created from a template invoice, it will also auto set the field date_end at creation
/**
* List of cumulative options:
* Bit 0: 0 si TVA normal - 1 si TVA NPR
@@ -939,13 +944,7 @@ abstract class CommonInvoiceLine extends CommonObjectLine
*/
public $info_bits = 0;
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
public function __construct(DoliDB $db)
{
$this->db = $db;
}
public $special_code = 0;
public $fk_multicurrency;
}

View File

@@ -347,6 +347,11 @@ abstract class CommonObject
*/
public $fk_account;
/**
* @var string Open ID
*/
public $openid;
/**
* @var string Public note
* @see update_note()
@@ -7507,8 +7512,7 @@ abstract class CommonObject
// Depending on field type ('datetime', ...)
if ($this->isDate($info))
{
if (empty($this->{$field}))
{
if (empty($this->{$field})) {
$queryarray[$field] = null;
} else {
$queryarray[$field] = $this->db->idate($this->{$field});
@@ -7526,16 +7530,27 @@ abstract class CommonObject
} elseif ($this->isDuration($info))
{
// $this->{$field} may be null, '', 0, '0', 123, '123'
if ($this->{$field} != '' || !empty($info['notnull'])) $queryarray[$field] = (int) $this->{$field}; // If '0', it may be set to null later if $info['notnull'] == -1
if ((isset($this->{$field}) && $this->{$field} != '') || !empty($info['notnull'])) {
if (!isset($this->{$field})) {
$queryarray[$field] = 0;
} else {
$queryarray[$field] = (int) $this->{$field}; // If '0', it may be set to null later if $info['notnull'] == -1
}
}
else $queryarray[$field] = null;
} elseif ($this->isInt($info) || $this->isFloat($info))
{
if ($field == 'entity' && is_null($this->{$field})) $queryarray[$field] = $conf->entity;
else {
// $this->{$field} may be null, '', 0, '0', 123, '123'
if ($this->{$field} != '' || !empty($info['notnull'])) {
if ($this->isInt($info)) $queryarray[$field] = (int) $this->{$field}; // If '0', it may be set to null later if $info['notnull'] == -1
if ($this->isFloat($info)) $queryarray[$field] = (double) $this->{$field}; // If '0', it may be set to null later if $info['notnull'] == -1
if ((isset($this->{$field}) && $this->{$field} != '') || !empty($info['notnull'])) {
if (!isset($this->{$field})) {
$queryarray[$field] = 0;
} elseif ($this->isInt($info)) {
$queryarray[$field] = (int) $this->{$field}; // If '0', it may be set to null later if $info['notnull'] == -1
} elseif ($this->isFloat($info)) {
$queryarray[$field] = (double) $this->{$field}; // If '0', it may be set to null later if $info['notnull'] == -1
}
} else $queryarray[$field] = null;
}
} else {
@@ -7912,6 +7927,7 @@ abstract class CommonObject
unset($fieldvalues['rowid']); // The field 'rowid' is reserved field name for autoincrement field so we don't need it into update.
if (array_key_exists('ref', $fieldvalues)) $fieldvalues['ref'] = dol_string_nospecial($fieldvalues['ref']); // If field is a ref, we sanitize data
// Add quotes and escape on fields with type string
$keys = array();
$values = array();
$tmp = array();
@@ -7922,7 +7938,7 @@ abstract class CommonObject
$tmp[] = $k.'='.$this->quote($v, $this->fields[$k]);
}
// Clean and check mandatory
// Clean and check mandatory fields
foreach ($keys as $key)
{
if (preg_match('/^integer:/i', $this->fields[$key]['type']) && $values[$key] == '-1') $values[$key] = ''; // This is an implicit foreign key field

View File

@@ -19,7 +19,7 @@
/**
* \file htdocs/core/class/commonobjectline.class.php
* \ingroup core
* \brief File of the superclass of classes of lines of business objects (invoice, contract, PROPAL, commands, etc. ...)
* \brief File of the superclass of classes of lines of business objects (invoice, contract, proposal, orders, etc. ...)
*/

View File

@@ -121,6 +121,12 @@ abstract class CommonOrderLine extends CommonObjectLine
*/
public $remise_percent;
/**
* VAT code
* @var string
*/
public $vat_src_code;
/**
* VAT %
* @var float
@@ -151,4 +157,6 @@ abstract class CommonOrderLine extends CommonObjectLine
public $info_bits = 0;
public $special_code = 0;
public $fk_multicurrency;
}

View File

@@ -141,7 +141,7 @@ class Events // extends CommonObject
// Clean parameters
$this->description = trim($this->description);
if (empty($this->user_agent) && !empty($_SERVER['HTTP_USER_AGENT'])) $this->user_agent = $_SERVER['HTTP_USER_AGENT'];
if (empty($this->user_agent)) $this->user_agent = (empty($_SERVER['HTTP_USER_AGENT'])?'':$_SERVER['HTTP_USER_AGENT']);
// Check parameters
if (empty($this->description)) { $this->error = 'ErrorBadValueForParameterCreateEventDesc'; return -1; }

View File

@@ -6448,7 +6448,7 @@ class Form
* Note: Do not apply langs->trans function on returned content of Ajax service, content may be entity encoded twice.
*
* @param string $htmlname Name of html select area
* @param string $array Array (key=>array('text'=>'A text', 'url'=>'An url'), ...)
* @param array $array Array (key=>array('text'=>'A text', 'url'=>'An url'), ...)
* @param string $id Preselected key
* @param string $moreparam Add more parameters onto the select tag
* @param int $disableFiltering If set to 1, results are not filtered with searched string

View File

@@ -79,9 +79,10 @@ class FormFile
* @param string $sectiondir If upload must be done inside a particular directory (if sectiondir defined, sectionid must not be)
* @param int $usewithoutform 0=Default, 1=Disable <form> and style to use in existing area
* @param int $capture 1=Add tag capture="capture" to force use of micro or video recording to generate file. When setting this to 1, you must also provide a value for $accept.
* @param int $disablemulti 0=Default, 1=Disable multiple file upload
* @return int <0 if KO, >0 if OK
*/
public function form_attach_new_file($url, $title = '', $addcancel = 0, $sectionid = 0, $perm = 1, $size = 50, $object = '', $options = '', $useajax = 1, $savingdocmask = '', $linkfiles = 1, $htmlname = 'formuserfile', $accept = '', $sectiondir = '', $usewithoutform = 0, $capture = 0)
public function form_attach_new_file($url, $title = '', $addcancel = 0, $sectionid = 0, $perm = 1, $size = 50, $object = '', $options = '', $useajax = 1, $savingdocmask = '', $linkfiles = 1, $htmlname = 'formuserfile', $accept = '', $sectiondir = '', $usewithoutform = 0, $capture = 0, $disablemulti = 0)
{
// phpcs:enable
global $conf, $langs, $hookmanager;
@@ -170,7 +171,7 @@ class FormFile
$out .= '<input class="flat minwidth400 maxwidth200onsmartphone" type="file"';
//$out .= ((!empty($conf->global->MAIN_DISABLE_MULTIPLE_FILEUPLOAD) || $conf->browser->layout != 'classic') ? ' name="userfile"' : ' name="userfile[]" multiple');
$out .= ((!empty($conf->global->MAIN_DISABLE_MULTIPLE_FILEUPLOAD)) ? ' name="userfile"' : ' name="userfile[]" multiple');
$out .= ((!empty($conf->global->MAIN_DISABLE_MULTIPLE_FILEUPLOAD) || $disablemulti) ? ' name="userfile"' : ' name="userfile[]" multiple');
$out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm) ? ' disabled' : '');
$out .= (!empty($accept) ? ' accept="'.$accept.'"' : ' accept=""');
$out .= (!empty($capture) ? ' capture="capture"' : '');