Source is optionnal
This commit is contained in:
parent
d5ce66c5d8
commit
ac10b7398a
@ -486,13 +486,13 @@ class Commande extends CommonObject
|
|||||||
// Nettoyage parametres
|
// Nettoyage parametres
|
||||||
$this->brouillon = 1; // On positionne en mode brouillon la commande
|
$this->brouillon = 1; // On positionne en mode brouillon la commande
|
||||||
|
|
||||||
dolibarr_syslog("Commande.class::create");
|
dolibarr_syslog("Commande::create");
|
||||||
|
|
||||||
// Verification parametres
|
// Verification parametres
|
||||||
if ($this->source < 0)
|
if (! empty($conf->global->COMMANDE_REQUIRE_SOURCE) && $this->source < 0)
|
||||||
{
|
{
|
||||||
$this->error=$langs->trans("ErrorFieldRequired",$langs->trans("Source"));
|
$this->error=$langs->trans("ErrorFieldRequired",$langs->trans("Source"));
|
||||||
dolibarr_syslog("Commande.class::create ".$this->error, LOG_ERR);
|
dolibarr_syslog("Commande::create ".$this->error, LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (! $remise) $remise=0;
|
if (! $remise) $remise=0;
|
||||||
@ -503,7 +503,7 @@ class Commande extends CommonObject
|
|||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$this->error="Failed to fetch company";
|
$this->error="Failed to fetch company";
|
||||||
dolibarr_syslog("Commande.class::create ".$this->error, LOG_ERR);
|
dolibarr_syslog("Commande::create ".$this->error, LOG_ERR);
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -515,7 +515,7 @@ class Commande extends CommonObject
|
|||||||
$sql.= ' remise_absolue, remise_percent)';
|
$sql.= ' remise_absolue, remise_percent)';
|
||||||
$sql.= " VALUES ('".$this->ref."',".$this->socid.", ".$this->db->idate(mktime()).", ".$user->id.', '.$this->projetid.',';
|
$sql.= " VALUES ('".$this->ref."',".$this->socid.", ".$this->db->idate(mktime()).", ".$user->id.', '.$this->projetid.',';
|
||||||
$sql.= ' '.$this->db->idate($this->date_commande).',';
|
$sql.= ' '.$this->db->idate($this->date_commande).',';
|
||||||
$sql.= ' '.$this->source.', ';
|
$sql.= ' '.($this->source>=0?$this->source:'null').', ';
|
||||||
$sql.= " '".addslashes($this->note)."', ";
|
$sql.= " '".addslashes($this->note)."', ";
|
||||||
$sql.= " '".addslashes($this->note_public)."', ";
|
$sql.= " '".addslashes($this->note_public)."', ";
|
||||||
$sql.= " '".addslashes($this->ref_client)."', '".$this->modelpdf."', '".$this->cond_reglement_id."', '".$this->mode_reglement_id."',";
|
$sql.= " '".addslashes($this->ref_client)."', '".$this->modelpdf."', '".$this->cond_reglement_id."', '".$this->mode_reglement_id."',";
|
||||||
@ -1845,7 +1845,7 @@ class Commande extends CommonObject
|
|||||||
$label=$langs->trans('OrderSource'.$this->source);
|
$label=$langs->trans('OrderSource'.$this->source);
|
||||||
// \TODO Si libelle non trouve, on va chercher en base dans dictionnaire
|
// \TODO Si libelle non trouve, on va chercher en base dans dictionnaire
|
||||||
|
|
||||||
|
if ($label == 'OrderSource') return '';
|
||||||
return $label;
|
return $label;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2368,7 +2368,7 @@ class CommandeLigne
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->error();
|
||||||
dolibarr_syslog("CommandeLigne.class.php::insert Error ".$this->error);
|
dolibarr_syslog("CommandeLigne::insert Error ".$this->error);
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
@ -2390,7 +2390,7 @@ class CommandeLigne
|
|||||||
$sql.= ",total_ttc='".price2num($this->total_ttc)."'";
|
$sql.= ",total_ttc='".price2num($this->total_ttc)."'";
|
||||||
$sql.= " WHERE rowid = ".$this->rowid;
|
$sql.= " WHERE rowid = ".$this->rowid;
|
||||||
|
|
||||||
dolibarr_syslog("CommandeLigne.class.php::update_total sql=$sql");
|
dolibarr_syslog("CommandeLigne::update_total sql=$sql");
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
@ -2401,7 +2401,7 @@ class CommandeLigne
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->error();
|
||||||
dolibarr_syslog("CommandeLigne.class.php::update_total Error ".$this->error);
|
dolibarr_syslog("CommandeLigne::update_total Error ".$this->error);
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -163,17 +163,17 @@ if ($_POST['action'] == 'add' && $user->rights->commande->creer)
|
|||||||
// Insertion contact par defaut si defini
|
// Insertion contact par defaut si defini
|
||||||
if ($_POST["contactidp"])
|
if ($_POST["contactidp"])
|
||||||
{
|
{
|
||||||
$result=$commande->add_contact($_POST["contactidp"],'CUSTOMER','external');
|
$result=$commande->add_contact($_POST["contactidp"],'CUSTOMER','external');
|
||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg = '<div class="error">'.$langs->trans("ErrorFailedToAddContact").'</div>';
|
$mesg = '<div class="error">'.$langs->trans("ErrorFailedToAddContact").'</div>';
|
||||||
$error=1;
|
$error=1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$_GET['id'] = $commande->id;
|
$_GET['id'] = $commande->id;
|
||||||
@ -307,14 +307,14 @@ if ($_POST['action'] == 'addligne' && $user->rights->commande->creer)
|
|||||||
$date_start=$_POST['date_start'.$suffixe.'year'].'-'.$_POST['date_start'.$suffixe.'month'].'-'.$_POST['date_start'.$suffixe.'day'];
|
$date_start=$_POST['date_start'.$suffixe.'year'].'-'.$_POST['date_start'.$suffixe.'month'].'-'.$_POST['date_start'.$suffixe.'day'];
|
||||||
// If hour/minute are specified, append them
|
// If hour/minute are specified, append them
|
||||||
if (($_POST['date_start'.$suffixe.'hour']) && ($_POST['date_start'.$suffixe.'min']))
|
if (($_POST['date_start'.$suffixe.'hour']) && ($_POST['date_start'.$suffixe.'min']))
|
||||||
$date_start.=' '.$_POST['date_start'.$suffixe.'hour'].':'.$_POST['date_start'.$suffixe.'min'];
|
$date_start.=' '.$_POST['date_start'.$suffixe.'hour'].':'.$_POST['date_start'.$suffixe.'min'];
|
||||||
}
|
}
|
||||||
if ($_POST['date_end'.$suffixe.'year'] && $_POST['date_end'.$suffixe.'month'] && $_POST['date_end'.$suffixe.'day'])
|
if ($_POST['date_end'.$suffixe.'year'] && $_POST['date_end'.$suffixe.'month'] && $_POST['date_end'.$suffixe.'day'])
|
||||||
{
|
{
|
||||||
$date_end=$_POST['date_end'.$suffixe.'year'].'-'.$_POST['date_end'.$suffixe.'month'].'-'.$_POST['date_end'.$suffixe.'day'];
|
$date_end=$_POST['date_end'.$suffixe.'year'].'-'.$_POST['date_end'.$suffixe.'month'].'-'.$_POST['date_end'.$suffixe.'day'];
|
||||||
// If hour/minute are specified, append them
|
// If hour/minute are specified, append them
|
||||||
if (($_POST['date_end'.$suffixe.'hour']) && ($_POST['date_end'.$suffixe.'min']))
|
if (($_POST['date_end'.$suffixe.'hour']) && ($_POST['date_end'.$suffixe.'min']))
|
||||||
$date_end.=' '.$_POST['date_end'.$suffixe.'hour'].':'.$_POST['date_end'.$suffixe.'min'];
|
$date_end.=' '.$_POST['date_end'.$suffixe.'hour'].':'.$_POST['date_end'.$suffixe.'min'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$price_base_type = 'HT';
|
$price_base_type = 'HT';
|
||||||
@ -391,11 +391,11 @@ if ($_POST['action'] == 'addligne' && $user->rights->commande->creer)
|
|||||||
$info_bits,
|
$info_bits,
|
||||||
0,
|
0,
|
||||||
$price_base_type,
|
$price_base_type,
|
||||||
$pu_ttc,
|
$pu_ttc,
|
||||||
// Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
// Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||||
// Add the start and end dates
|
// Add the start and end dates
|
||||||
$date_start,
|
$date_start,
|
||||||
$date_end
|
$date_end
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
@ -433,14 +433,14 @@ if ($_POST['action'] == 'updateligne' && $user->rights->commande->creer && $_POS
|
|||||||
$date_start=$_POST['date_startyear'].'-'.$_POST['date_startmonth'].'-'.$_POST['date_startday'];
|
$date_start=$_POST['date_startyear'].'-'.$_POST['date_startmonth'].'-'.$_POST['date_startday'];
|
||||||
// If hour/minute are specified, append them
|
// If hour/minute are specified, append them
|
||||||
if (($_POST['date_starthour']) && ($_POST['date_startmin']))
|
if (($_POST['date_starthour']) && ($_POST['date_startmin']))
|
||||||
$date_start.=' '.$_POST['date_starthour'].':'.$_POST['date_startmin'];
|
$date_start.=' '.$_POST['date_starthour'].':'.$_POST['date_startmin'];
|
||||||
}
|
}
|
||||||
if ($_POST['date_endyear'] && $_POST['date_endmonth'] && $_POST['date_endday'])
|
if ($_POST['date_endyear'] && $_POST['date_endmonth'] && $_POST['date_endday'])
|
||||||
{
|
{
|
||||||
$date_end=$_POST['date_endyear'].'-'.$_POST['date_endmonth'].'-'.$_POST['date_endday'];
|
$date_end=$_POST['date_endyear'].'-'.$_POST['date_endmonth'].'-'.$_POST['date_endday'];
|
||||||
// If hour/minute are specified, append them
|
// If hour/minute are specified, append them
|
||||||
if (($_POST['date_endhour']) && ($_POST['date_endmin']))
|
if (($_POST['date_endhour']) && ($_POST['date_endmin']))
|
||||||
$date_end.=' '.$_POST['date_endhour'].':'.$_POST['date_endmin'];
|
$date_end.=' '.$_POST['date_endhour'].':'.$_POST['date_endmin'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define info_bits
|
// Define info_bits
|
||||||
@ -463,12 +463,12 @@ if ($_POST['action'] == 'updateligne' && $user->rights->commande->creer && $_POS
|
|||||||
$_POST['qty'],
|
$_POST['qty'],
|
||||||
$_POST['elremise_percent'],
|
$_POST['elremise_percent'],
|
||||||
$vat_rate,
|
$vat_rate,
|
||||||
'HT',
|
'HT',
|
||||||
$info_bits,
|
$info_bits,
|
||||||
// Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
// Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||||
// Add the start and end dates
|
// Add the start and end dates
|
||||||
$date_start,
|
$date_start,
|
||||||
$date_end
|
$date_end
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
@ -655,7 +655,7 @@ if ($_POST['addfile'])
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Echec transfert (fichier d<>passant la limite ?)
|
// Echec transfert (fichier d<>passant la limite ?
|
||||||
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>';
|
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>';
|
||||||
// print_r($_FILES);
|
// print_r($_FILES);
|
||||||
}
|
}
|
||||||
@ -733,9 +733,9 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['cancel'])
|
|||||||
$formmail = new FormMail($db);
|
$formmail = new FormMail($db);
|
||||||
|
|
||||||
$attachedfiles=$formmail->get_attached_files();
|
$attachedfiles=$formmail->get_attached_files();
|
||||||
$filepath = $attachedfiles['paths'];
|
$filepath = $attachedfiles['paths'];
|
||||||
$filename = $attachedfiles['names'];
|
$filename = $attachedfiles['names'];
|
||||||
$mimetype = $attachedfiles['mimes'];
|
$mimetype = $attachedfiles['mimes'];
|
||||||
|
|
||||||
// Send mail
|
// Send mail
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/lib/CMailFile.class.php');
|
require_once(DOL_DOCUMENT_ROOT.'/lib/CMailFile.class.php');
|
||||||
@ -1852,7 +1852,7 @@ else
|
|||||||
$num = $commande->ref;
|
$num = $commande->ref;
|
||||||
}
|
}
|
||||||
$url = $_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=confirm_validate&confirm=yes';
|
$url = $_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=confirm_validate&confirm=yes';
|
||||||
print 'href="#" onClick="dialogConfirm(\''.$url.'\',\''.dol_escape_js($langs->trans('ConfirmValidateOrder',$num)).'\',\''.$langs->trans("Yes").'\',\''.$langs->trans("No").'\',\'validate\')"';
|
print 'href="#" onClick="dialogConfirm(\''.$url.'\',\''.dol_escape_js($langs->trans('ConfirmValidateOrder',$num)).'\',\''.$langs->trans("Yes").'\',\''.$langs->trans("No").'\',\'validate\')"';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user