Uniformize code

This commit is contained in:
Laurent Destailleur 2011-04-13 12:19:38 +00:00
parent 2bff1b5aad
commit 519fd1abee
2 changed files with 34 additions and 43 deletions

View File

@ -205,6 +205,8 @@ class Account extends CommonObject
$emetteur=trim($emetteur); $emetteur=trim($emetteur);
$banque=trim($banque); $banque=trim($banque);
$now=dol_now();
if (is_numeric($oper)) // Clean oper to have a code instead of a rowid if (is_numeric($oper)) // Clean oper to have a code instead of a rowid
{ {
$sql ="SELECT code FROM ".MAIN_DB_PREFIX."c_paiement"; $sql ="SELECT code FROM ".MAIN_DB_PREFIX."c_paiement";
@ -255,7 +257,7 @@ class Account extends CommonObject
$sql.= ", fk_type"; $sql.= ", fk_type";
$sql.= ",emetteur,banque"; $sql.= ",emetteur,banque";
$sql.= ") VALUES ("; $sql.= ") VALUES (";
$sql.= "'".$this->db->idate(mktime())."'"; $sql.= "'".$this->db->idate($now)."'";
$sql.= ", '".$this->db->idate($date)."'"; $sql.= ", '".$this->db->idate($date)."'";
$sql.= ", '".$this->db->idate($datev)."'"; $sql.= ", '".$this->db->idate($datev)."'";
$sql.= ", '".$this->db->escape($label)."'"; $sql.= ", '".$this->db->escape($label)."'";

View File

@ -299,7 +299,8 @@ else
} }
} }
if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' && $user->rights->societe->supprimer) // Delete third party
if (GETPOST("action") == 'confirm_delete' && GETPOST("confirm") == 'yes' && $user->rights->societe->supprimer)
{ {
$soc->fetch($socid); $soc->fetch($socid);
$result = $soc->delete($socid); $result = $soc->delete($socid);
@ -321,9 +322,9 @@ else
/* /*
* Generate document * Generate document
*/ */
if ($_REQUEST['action'] == 'builddoc') // En get ou en post if (GETPOST('action') == 'builddoc') // En get ou en post
{ {
if (is_numeric($_REQUEST['model'])) if (is_numeric(GETPOST('model')))
{ {
$mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Model")); $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Model"));
} }
@ -397,17 +398,11 @@ if (! empty($objcanvas->template_dir))
} }
else else
{ {
// Fetch object $result=$objcanvas->fetch($socid); // Relaod object
$result=$objcanvas->fetch($socid); $objcanvas->assign_values('view'); // Assign values
if ($result > 0) $objcanvas->display_canvas('view'); // Show template
{
// Assign values
$objcanvas->assign_values('view');
// Display canvas
$objcanvas->display_canvas('view');
// TODO Move this also into template
print '<table width="100%"><tr><td valign="top" width="50%">'; print '<table width="100%"><tr><td valign="top" width="50%">';
print '<a name="builddoc"></a>'; // ancre print '<a name="builddoc"></a>'; // ancre
@ -439,12 +434,6 @@ if (! empty($objcanvas->template_dir))
// Projects list // Projects list
$result=show_projects($conf,$langs,$db,$objcanvas->control->object); $result=show_projects($conf,$langs,$db,$objcanvas->control->object);
} }
else
{
dol_htmloutput_errors($objcanvas->error,$objcanvas->errors);
}
}
} }
else else
{ {
@ -1317,7 +1306,7 @@ else
// Confirm delete third party // Confirm delete third party
if ($_GET["action"] == 'delete') if (GETPOST("action") == 'delete')
{ {
$html = new Form($db); $html = new Form($db);
$ret=$html->form_confirm($_SERVER["PHP_SELF"]."?socid=".$soc->id,$langs->trans("DeleteACompany"),$langs->trans("ConfirmDeleteCompany"),"confirm_delete",'',0,2); $ret=$html->form_confirm($_SERVER["PHP_SELF"]."?socid=".$soc->id,$langs->trans("DeleteACompany"),$langs->trans("ConfirmDeleteCompany"),"confirm_delete",'',0,2);