diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index ff723866b74..d74d45598a7 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -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'); diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index fde845f6af1..18a236056b9 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -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 diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 70342919792..815b6b18bbf 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -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']); diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 82cc919346b..0ee73799bcb 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -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"; } }