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

This commit is contained in:
Laurent Destailleur 2018-04-20 01:47:54 +02:00
commit e621daa61d
4 changed files with 21 additions and 7 deletions

View File

@ -63,7 +63,7 @@ if ($action == 'add' && ! empty($permissiontoadd))
if (! empty($object->fields[$key]['foreignkey']) && $value == '-1') $value=''; // This is an explicit foreign key field
$object->$key=$value;
if ($val['notnull'] > 0 && $object->$key == '')
if ($val['notnull'] > 0 && $object->$key == '' && is_null($val['default']))
{
$error++;
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv($val['label'])), null, 'errors');
@ -118,7 +118,7 @@ if ($action == 'update' && ! empty($permissiontoadd))
if (! empty($object->fields[$key]['foreignkey']) && $value == '-1') $value=''; // This is an explicit foreign key field
$object->$key=$value;
if ($val['notnull'] > 0 && $object->$key == '')
if ($val['notnull'] > 0 && $object->$key == '' && is_null($val['default']))
{
$error++;
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv($val['label'])), null, 'errors');

View File

@ -23,8 +23,8 @@
// $mysoc must be defined
// $id must be defined
// $paramname must be defined
// $mode must be defined (used to know the automatic BCC to add)
// $paramname may be defined
// $autocopy may be defined (used to know the automatic BCC to add)
// $trigger_name must be set (can be '')
// $actiontypecode can be set
// $object and $uobject may be defined

View File

@ -5672,11 +5672,19 @@ abstract class CommonObject
elseif ($key == 'status' && method_exists($this, 'getLibStatut')) $value=$this->getLibStatut(3);
elseif ($type == 'date')
{
$value=dol_print_date($value,'day');
if(! empty($value)) {
$value=dol_print_date($value,'day');
} else {
$value='';
}
}
elseif ($type == 'datetime')
{
$value=dol_print_date($value,'dayhour');
if(! empty($value)) {
$value=dol_print_date($value,'dayhour');
} else {
$value='';
}
}
elseif ($type == 'double')
{
@ -6734,7 +6742,7 @@ abstract class CommonObject
if (! empty($this->fields[$key]['foreignkey']) && $values[$key] == '-1') $values[$key]='';
//var_dump($key.'-'.$values[$key].'-'.($this->fields[$key]['notnull'] == 1));
if ($this->fields[$key]['notnull'] == 1 && ! isset($values[$key]))
if ($this->fields[$key]['notnull'] == 1 && ! isset($values[$key]) && is_null($val['default']))
{
$error++;
$this->errors[]=$langs->trans("ErrorFieldRequired", $this->fields[$key]['label']);

View File

@ -347,6 +347,9 @@ class Conf
$this->fournisseur->facture=new stdClass();
$this->fournisseur->facture->dir_output =$rootfordata."/fournisseur/facture";
$this->fournisseur->facture->dir_temp =$rootfordata."/fournisseur/facture/temp";
$this->supplierproposal=new stdClass();
$this->supplierproposal->dir_output=$rootfordata."/supplier_proposal";
$this->supplierproposal->dir_temp=$rootfordata."/supplier_proposal/temp";
$this->fournisseur->payment=new stdClass();
$this->fournisseur->payment->dir_output =$rootfordata."/fournisseur/payment";
$this->fournisseur->payment->dir_temp =$rootfordata."/fournisseur/payment/temp";
@ -362,6 +365,9 @@ class Conf
$this->supplier_invoice->enabled=1;
$this->supplier_invoice->dir_output=$rootfordata."/fournisseur/facture";
$this->supplier_invoice->dir_temp=$rootfordata."/fournisseur/facture/temp";
$this->supplierproposal=new stdClass();
$this->supplierproposal->dir_output=$rootfordata."/supplier_proposal";
$this->supplierproposal->dir_temp=$rootfordata."/supplier_proposal/temp";
}
}