Fix: Error management if date is empty
This commit is contained in:
parent
db77b43f9c
commit
a7e7450dd7
@ -41,6 +41,9 @@ $langs->load("bills");
|
|||||||
$langs->load("orders");
|
$langs->load("orders");
|
||||||
$langs->load("deliveries");
|
$langs->load("deliveries");
|
||||||
|
|
||||||
|
$action=GETPOST('action');
|
||||||
|
$mesg=GETPOST('mesg');
|
||||||
|
|
||||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||||
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
|
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
|
||||||
$hookmanager=new HookManager($db);
|
$hookmanager=new HookManager($db);
|
||||||
@ -64,9 +67,10 @@ print_fiche_titre($langs->trans("NewProp"));
|
|||||||
|
|
||||||
$form=new Form($db);
|
$form=new Form($db);
|
||||||
|
|
||||||
|
dol_htmloutput_mesg($mesg);
|
||||||
|
|
||||||
// Add new proposal
|
// Add new proposal
|
||||||
if ($_GET["action"] == 'create')
|
if ($action == 'create')
|
||||||
{
|
{
|
||||||
$soc = new Societe($db);
|
$soc = new Societe($db);
|
||||||
$result=$soc->fetch($_GET["socid"]);
|
$result=$soc->fetch($_GET["socid"]);
|
||||||
@ -341,7 +345,7 @@ if ($_GET["action"] == 'create')
|
|||||||
print "</form>";
|
print "</form>";
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->close();
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
|
$db->close();
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -216,9 +216,20 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->propale
|
|||||||
|
|
||||||
if ($_POST['action'] == 'setdate')
|
if ($_POST['action'] == 'setdate')
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$datep=dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||||
$result=$object->set_date($user,dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']));
|
|
||||||
if ($result < 0) dol_print_error($db,$object->error);
|
if (empty($datep))
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")).'</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$object->fetch($id);
|
||||||
|
$result=$object->set_date($user,$datep);
|
||||||
|
if ($result < 0) dol_print_error($db,$object->error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ($_POST['action'] == 'setecheance')
|
if ($_POST['action'] == 'setecheance')
|
||||||
{
|
{
|
||||||
@ -250,127 +261,141 @@ if ($_POST['action'] == 'set_ref_client' && $user->rights->propale->creer)
|
|||||||
// Create proposal
|
// Create proposal
|
||||||
if ($_POST['action'] == 'add' && $user->rights->propale->creer)
|
if ($_POST['action'] == 'add' && $user->rights->propale->creer)
|
||||||
{
|
{
|
||||||
$object->socid=$_POST['socid'];
|
$object->socid=$socid;
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
|
||||||
$db->begin();
|
$datep=dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||||
|
$date_delivery=dol_mktime(12, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year']);
|
||||||
|
|
||||||
// Si on a selectionne une propal a copier, on realise la copie
|
if (empty($datep))
|
||||||
if($_POST['createmode']=='copy' && $_POST['copie_propal'])
|
|
||||||
{
|
{
|
||||||
if ($object->fetch($_POST['copie_propal']) > 0)
|
$error++;
|
||||||
{
|
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")).'</div>';
|
||||||
$object->ref = $_POST['ref'];
|
header("Location: ".DOL_URL_ROOT.'/comm/addpropal.php?socid='.$socid.'&action=create&mesg='.urlencode($mesg));
|
||||||
$object->datep = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
exit;
|
||||||
$object->date_livraison = dol_mktime(12, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year']);
|
|
||||||
$object->availability_id = $_POST['availability_id'];
|
|
||||||
$object->demand_reason_id = $_POST['demand_reason_id'];
|
|
||||||
$object->fk_delivery_address = $_POST['fk_address'];
|
|
||||||
$object->duree_validite = $_POST['duree_validite'];
|
|
||||||
$object->cond_reglement_id = $_POST['cond_reglement_id'];
|
|
||||||
$object->mode_reglement_id = $_POST['mode_reglement_id'];
|
|
||||||
$object->remise_percent = $_POST['remise_percent'];
|
|
||||||
$object->remise_absolue = $_POST['remise_absolue'];
|
|
||||||
$object->socid = $_POST['socid'];
|
|
||||||
$object->contactid = $_POST['contactidp'];
|
|
||||||
$object->fk_project = $_POST['projectid'];
|
|
||||||
$object->modelpdf = $_POST['model'];
|
|
||||||
$object->author = $user->id; // deprecated
|
|
||||||
$object->note = $_POST['note'];
|
|
||||||
$object->statut = 0;
|
|
||||||
|
|
||||||
$id = $object->create_from($user);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$mesg = '<div class="error">'.$langs->trans("ErrorFailedToCopyProposal",$_POST['copie_propal']).'</div>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$object->ref = $_POST['ref'];
|
|
||||||
$object->ref_client = $_POST['ref_client'];
|
|
||||||
$object->datep = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
|
||||||
$object->date_livraison = dol_mktime(12, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year']);
|
|
||||||
$object->availability_id = $_POST['availability_id'];
|
|
||||||
$object->demand_reason_id = $_POST['demand_reason_id'];
|
|
||||||
$object->fk_delivery_address = $_POST['fk_address'];
|
|
||||||
$object->duree_validite = $_POST['duree_validite'];
|
|
||||||
$object->cond_reglement_id = $_POST['cond_reglement_id'];
|
|
||||||
$object->mode_reglement_id = $_POST['mode_reglement_id'];
|
|
||||||
|
|
||||||
$object->contactid = $_POST['contactidp'];
|
|
||||||
$object->fk_project = $_POST['projectid'];
|
|
||||||
$object->modelpdf = $_POST['model'];
|
|
||||||
$object->author = $user->id; // deprecated
|
|
||||||
$object->note = $_POST['note'];
|
|
||||||
|
|
||||||
$object->origin = $_POST['origin'];
|
|
||||||
$object->origin_id = $_POST['originid'];
|
|
||||||
|
|
||||||
for ($i = 1 ; $i <= $conf->global->PRODUCT_SHOW_WHEN_CREATE; $i++)
|
|
||||||
{
|
|
||||||
if ($_POST['idprod'.$i])
|
|
||||||
{
|
|
||||||
$xid = 'idprod'.$i;
|
|
||||||
$xqty = 'qty'.$i;
|
|
||||||
$xremise = 'remise'.$i;
|
|
||||||
$object->add_product($_POST[$xid],$_POST[$xqty],$_POST[$xremise]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$id = $object->create($user);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id > 0)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$error=0;
|
$db->begin();
|
||||||
|
|
||||||
// Insertion contact par defaut si defini
|
// Si on a selectionne une propal a copier, on realise la copie
|
||||||
if ($_POST["contactidp"])
|
if($_POST['createmode']=='copy' && $_POST['copie_propal'])
|
||||||
{
|
{
|
||||||
$result=$object->add_contact($_POST["contactidp"],'CUSTOMER','external');
|
if ($object->fetch($_POST['copie_propal']) > 0)
|
||||||
|
{
|
||||||
|
$object->ref = $_POST['ref'];
|
||||||
|
$object->datep = $datep;
|
||||||
|
$object->date_livraison = $date_delivery;
|
||||||
|
$object->availability_id = $_POST['availability_id'];
|
||||||
|
$object->demand_reason_id = $_POST['demand_reason_id'];
|
||||||
|
$object->fk_delivery_address = $_POST['fk_address'];
|
||||||
|
$object->duree_validite = $_POST['duree_validite'];
|
||||||
|
$object->cond_reglement_id = $_POST['cond_reglement_id'];
|
||||||
|
$object->mode_reglement_id = $_POST['mode_reglement_id'];
|
||||||
|
$object->remise_percent = $_POST['remise_percent'];
|
||||||
|
$object->remise_absolue = $_POST['remise_absolue'];
|
||||||
|
$object->socid = $_POST['socid'];
|
||||||
|
$object->contactid = $_POST['contactidp'];
|
||||||
|
$object->fk_project = $_POST['projectid'];
|
||||||
|
$object->modelpdf = $_POST['model'];
|
||||||
|
$object->author = $user->id; // deprecated
|
||||||
|
$object->note = $_POST['note'];
|
||||||
|
$object->statut = 0;
|
||||||
|
|
||||||
if ($result > 0)
|
$id = $object->create_from($user);
|
||||||
{
|
}
|
||||||
$error=0;
|
else
|
||||||
}
|
{
|
||||||
else
|
$mesg = '<div class="error">'.$langs->trans("ErrorFailedToCopyProposal",$_POST['copie_propal']).'</div>';
|
||||||
{
|
}
|
||||||
$mesg = '<div class="error">'.$langs->trans("ErrorFailedToAddContact").'</div>';
|
}
|
||||||
$error=1;
|
else
|
||||||
}
|
{
|
||||||
}
|
$object->ref = $_POST['ref'];
|
||||||
|
$object->ref_client = $_POST['ref_client'];
|
||||||
|
$object->datep = $datep;
|
||||||
|
$object->date_livraison = $date_delivery;
|
||||||
|
$object->availability_id = $_POST['availability_id'];
|
||||||
|
$object->demand_reason_id = $_POST['demand_reason_id'];
|
||||||
|
$object->fk_delivery_address = $_POST['fk_address'];
|
||||||
|
$object->duree_validite = $_POST['duree_validite'];
|
||||||
|
$object->cond_reglement_id = $_POST['cond_reglement_id'];
|
||||||
|
$object->mode_reglement_id = $_POST['mode_reglement_id'];
|
||||||
|
|
||||||
if (! $error)
|
$object->contactid = $_POST['contactidp'];
|
||||||
{
|
$object->fk_project = $_POST['projectid'];
|
||||||
$db->commit();
|
$object->modelpdf = $_POST['model'];
|
||||||
|
$object->author = $user->id; // deprecated
|
||||||
|
$object->note = $_POST['note'];
|
||||||
|
|
||||||
// Define output language
|
$object->origin = $_POST['origin'];
|
||||||
$outputlangs = $langs;
|
$object->origin_id = $_POST['originid'];
|
||||||
$newlang='';
|
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
|
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
|
||||||
if (! empty($newlang))
|
|
||||||
{
|
|
||||||
$outputlangs = new Translate("",$conf);
|
|
||||||
$outputlangs->setDefaultLang($newlang);
|
|
||||||
}
|
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager);
|
|
||||||
|
|
||||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
|
for ($i = 1 ; $i <= $conf->global->PRODUCT_SHOW_WHEN_CREATE; $i++)
|
||||||
exit;
|
{
|
||||||
}
|
if ($_POST['idprod'.$i])
|
||||||
else
|
{
|
||||||
{
|
$xid = 'idprod'.$i;
|
||||||
$db->rollback();
|
$xqty = 'qty'.$i;
|
||||||
}
|
$xremise = 'remise'.$i;
|
||||||
}
|
$object->add_product($_POST[$xid],$_POST[$xqty],$_POST[$xremise]);
|
||||||
else
|
}
|
||||||
{
|
}
|
||||||
dol_print_error($db,$object->error);
|
|
||||||
$db->rollback();
|
$id = $object->create($user);
|
||||||
exit;
|
}
|
||||||
|
|
||||||
|
if ($id > 0)
|
||||||
|
{
|
||||||
|
$error=0;
|
||||||
|
|
||||||
|
// Insertion contact par defaut si defini
|
||||||
|
if ($_POST["contactidp"])
|
||||||
|
{
|
||||||
|
$result=$object->add_contact($_POST["contactidp"],'CUSTOMER','external');
|
||||||
|
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
$error=0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$mesg = '<div class="error">'.$langs->trans("ErrorFailedToAddContact").'</div>';
|
||||||
|
$error=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$db->commit();
|
||||||
|
|
||||||
|
// Define output language
|
||||||
|
$outputlangs = $langs;
|
||||||
|
$newlang='';
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
||||||
|
if (! empty($newlang))
|
||||||
|
{
|
||||||
|
$outputlangs = new Translate("",$conf);
|
||||||
|
$outputlangs->setDefaultLang($newlang);
|
||||||
|
}
|
||||||
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager);
|
||||||
|
|
||||||
|
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$db->rollback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($db,$object->error);
|
||||||
|
$db->rollback();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -607,11 +632,9 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile']
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Go back to draft
|
||||||
if ($action == 'modif' && $user->rights->propale->creer)
|
if ($action == 'modif' && $user->rights->propale->creer)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
* Repasse la propale en mode brouillon
|
|
||||||
*/
|
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
$object->set_draft($user);
|
$object->set_draft($user);
|
||||||
|
|||||||
@ -612,7 +612,7 @@ class Propal extends CommonObject
|
|||||||
if (empty($this->availability_id)) $this->availability_id=0;
|
if (empty($this->availability_id)) $this->availability_id=0;
|
||||||
if (empty($this->demand_reason_id)) $this->demand_reason_id=0;
|
if (empty($this->demand_reason_id)) $this->demand_reason_id=0;
|
||||||
|
|
||||||
dol_syslog("Propal::Create");
|
dol_syslog(get_class($this)."::create");
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
$soc = new Societe($this->db);
|
$soc = new Societe($this->db);
|
||||||
@ -620,9 +620,15 @@ class Propal extends CommonObject
|
|||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$this->error="Failed to fetch company";
|
$this->error="Failed to fetch company";
|
||||||
dol_syslog("Propal::create ".$this->error, LOG_ERR);
|
dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR);
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
|
if (empty($this->datep))
|
||||||
|
{
|
||||||
|
$this->error="Date of proposal is required";
|
||||||
|
dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR);
|
||||||
|
return -4;
|
||||||
|
}
|
||||||
if (! empty($this->ref))
|
if (! empty($this->ref))
|
||||||
{
|
{
|
||||||
$result=$this->verifyNumRef(); // Check ref is not yet used
|
$result=$this->verifyNumRef(); // Check ref is not yet used
|
||||||
@ -683,7 +689,7 @@ class Propal extends CommonObject
|
|||||||
$sql.= ", ".$conf->entity;
|
$sql.= ", ".$conf->entity;
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
dol_syslog("Propal::create sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -694,7 +700,7 @@ class Propal extends CommonObject
|
|||||||
if (empty($this->ref)) $this->ref='(PROV'.$this->id.')';
|
if (empty($this->ref)) $this->ref='(PROV'.$this->id.')';
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."propal SET ref='".$this->ref."' WHERE rowid=".$this->id;
|
$sql = 'UPDATE '.MAIN_DB_PREFIX."propal SET ref='".$this->ref."' WHERE rowid=".$this->id;
|
||||||
|
|
||||||
dol_syslog("Propal::create sql=".$sql);
|
dol_syslog(get_class($this)."::create sql=".$sql);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if (! $resql) $error++;
|
if (! $resql) $error++;
|
||||||
|
|
||||||
@ -805,13 +811,13 @@ class Propal extends CommonObject
|
|||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
dol_syslog("Propal::Create done id=".$this->id);
|
dol_syslog(get_class($this)."::create done id=".$this->id);
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->error();
|
||||||
dol_syslog("Propal::Create -2 ".$this->error, LOG_ERR);
|
dol_syslog(get_class($this)."::create -2 ".$this->error, LOG_ERR);
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
@ -819,7 +825,7 @@ class Propal extends CommonObject
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->error();
|
||||||
dol_syslog("Propal::Create -1 ".$this->error, LOG_ERR);
|
dol_syslog(get_class($this)."::create -1 ".$this->error, LOG_ERR);
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1201,9 +1207,16 @@ class Propal extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function set_date($user, $date)
|
function set_date($user, $date)
|
||||||
{
|
{
|
||||||
if ($user->rights->propale->creer)
|
if (empty($date))
|
||||||
{
|
{
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET datep = ".$this->db->idate($date);
|
$this->error='ErrorBadParameter';
|
||||||
|
dol_syslog(get_class($this)."::set_date ".$this->error, LOG_ERR);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($user->rights->propale->creer)
|
||||||
|
{
|
||||||
|
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET datep = '".$this->db->idate($date)."'";
|
||||||
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
|
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::set_date sql=".$sql);
|
dol_syslog(get_class($this)."::set_date sql=".$sql);
|
||||||
@ -1231,9 +1244,9 @@ class Propal extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function set_echeance($user, $date_fin_validite)
|
function set_echeance($user, $date_fin_validite)
|
||||||
{
|
{
|
||||||
if ($user->rights->propale->creer)
|
if ($user->rights->propale->creer)
|
||||||
{
|
{
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fin_validite = ".$this->db->idate($date_fin_validite);
|
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fin_validite = ".($date_fin_validite!=''?"'".$this->db->idate($date_fin_validite)."'":'null');
|
||||||
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
|
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
|
||||||
if ($this->db->query($sql) )
|
if ($this->db->query($sql) )
|
||||||
{
|
{
|
||||||
@ -1243,7 +1256,7 @@ class Propal extends CommonObject
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->error();
|
||||||
dol_syslog("Propal::set_echeance Erreur SQL".$this->error, LOG_ERR);
|
dol_syslog(get_class($this)."::set_echeance Erreur SQL".$this->error, LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1261,7 +1274,7 @@ class Propal extends CommonObject
|
|||||||
if ($user->rights->propale->creer)
|
if ($user->rights->propale->creer)
|
||||||
{
|
{
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal ";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."propal ";
|
||||||
$sql.= " SET date_livraison = ".($date_livraison!=''?$this->db->idate($date_livraison):'null');
|
$sql.= " SET date_livraison = ".($date_livraison!=''?"'".$this->db->idate($date_livraison)."'":'null');
|
||||||
$sql.= " WHERE rowid = ".$this->id;
|
$sql.= " WHERE rowid = ".$this->id;
|
||||||
|
|
||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
@ -1272,7 +1285,7 @@ class Propal extends CommonObject
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->error();
|
||||||
dol_syslog("Propal::set_date_livraison Erreur SQL");
|
dol_syslog(get_class($this)."::set_date_livraison Erreur SQL");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1465,8 +1478,8 @@ class Propal extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close the commercial proposal
|
* Close the commercial proposal
|
||||||
*
|
*
|
||||||
@ -1478,23 +1491,23 @@ class Propal extends CommonObject
|
|||||||
function reopen($user, $statut, $note)
|
function reopen($user, $statut, $note)
|
||||||
{
|
{
|
||||||
global $langs,$conf;
|
global $langs,$conf;
|
||||||
|
|
||||||
$this->statut = $statut;
|
$this->statut = $statut;
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."propal";
|
||||||
$sql.= " SET fk_statut = ".$statut.", note = '".$this->db->escape($note)."', date_cloture=".$this->db->idate(mktime()).", fk_user_cloture=".$user->id;
|
$sql.= " SET fk_statut = ".$statut.", note = '".$this->db->escape($note)."', date_cloture=".$this->db->idate(mktime()).", fk_user_cloture=".$user->id;
|
||||||
$sql.= " WHERE rowid = ".$this->id;
|
$sql.= " WHERE rowid = ".$this->id;
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close the commercial proposal
|
* Close the commercial proposal
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user