Qual: Uniformize code

This commit is contained in:
Laurent Destailleur 2010-04-05 01:25:44 +00:00
parent 2dd4f080f0
commit da9b20d058
3 changed files with 82 additions and 65 deletions

View File

@ -47,6 +47,12 @@ $donation_date=dol_mktime(12, 0 , 0, $_POST["remonth"], $_POST["reday"], $_POST[
if ($_POST["action"] == 'update') if ($_POST["action"] == 'update')
{ {
if (! empty($_POST['cancel']))
{
Header("Location: fiche.php?rowid=".$_POST["rowid"]);
exit;
}
$error=0; $error=0;
if (! $_POST["amount"] > 0) if (! $_POST["amount"] > 0)
@ -94,6 +100,12 @@ if ($_POST["action"] == 'update')
if ($_POST["action"] == 'add') if ($_POST["action"] == 'add')
{ {
if (! empty($_POST['cancel']))
{
Header("Location: index.php");
exit;
}
$error=0; $error=0;
if (! $_POST["amount"] > 0) if (! $_POST["amount"] > 0)
@ -273,8 +285,8 @@ if ($_GET["action"] == 'create')
print "<tr>".'<td>'.$langs->trans("Country").'</td><td><input type="text" name="pays" value="'.$_POST["pays"].'" size="40"></td></tr>'; print "<tr>".'<td>'.$langs->trans("Country").'</td><td><input type="text" name="pays" value="'.$_POST["pays"].'" size="40"></td></tr>';
print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" value="'.$_POST["email"].'" size="40"></td></tr>'; print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" value="'.$_POST["email"].'" size="40"></td></tr>';
print "<tr>".'<td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="amount" value="'.$_POST["amount"].'" size="10"> '.$langs->trans("Currency".$conf->monnaie).'</td></tr>'; print "<tr>".'<td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="amount" value="'.$_POST["amount"].'" size="10"> '.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
print "<tr>".'<td colspan="3" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></td></tr>';
print "</table>\n"; print "</table>\n";
print '<br><center><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'"> &nbsp; &nbsp; <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></center>';
print "</form>\n"; print "</form>\n";
} }
@ -292,11 +304,11 @@ if ($_GET["rowid"] && $_GET["action"] == 'edit')
$h=0; $h=0;
$head[$h][0] = DOL_URL_ROOT."/compta/dons/fiche.php?rowid=".$_GET["rowid"]; $head[$h][0] = DOL_URL_ROOT."/compta/dons/fiche.php?rowid=".$_GET["rowid"];
$head[$h][1] = $langs->trans("Donation"); $head[$h][1] = $langs->trans("Card");
$hselected=$h; $hselected=$h;
$h++; $h++;
dol_fiche_head($head, $hselected, $langs->trans("Ref")); dol_fiche_head($head, $hselected, $langs->trans("Donation"), 0, 'generic');
print '<form name="update" action="fiche.php" method="post">'; print '<form name="update" action="fiche.php" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -353,9 +365,10 @@ if ($_GET["rowid"] && $_GET["action"] == 'edit')
print "<tr>".'<td>'.$langs->trans("Status").'</td><td>'.$don->getLibStatut(4).'</td></tr>'; print "<tr>".'<td>'.$langs->trans("Status").'</td><td>'.$don->getLibStatut(4).'</td></tr>';
print "<tr>".'<td colspan="3" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></td></tr>';
print "</table>\n"; print "</table>\n";
print '<br><center><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'"> &nbsp; &nbsp; <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></center>';
print "</form>\n"; print "</form>\n";
print "</div>\n"; print "</div>\n";
@ -380,7 +393,7 @@ if ($_GET["rowid"] && $_GET["action"] != 'edit')
$hselected=$h; $hselected=$h;
$h++; $h++;
dol_fiche_head($head, $hselected, $langs->trans("Donation")); dol_fiche_head($head, $hselected, $langs->trans("Donation"), 0, 'generic');
print "<form action=\"fiche.php\" method=\"post\">"; print "<form action=\"fiche.php\" method=\"post\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';

View File

@ -50,7 +50,7 @@ $pagenext = $page + 1;
llxHeader('',$langs->trans("Donations"),'EN:Module_Donations|FR:Module_Dons|ES:M&oacute;dulo_Subvenciones'); llxHeader('',$langs->trans("Donations"),'EN:Module_Donations|FR:Module_Dons|ES:M&oacute;dulo_Subvenciones');
$donstatic=new Don($db); $donationstatic=new Don($db);
// Genere requete de liste des dons // Genere requete de liste des dons
$sql = "SELECT d.rowid, ".$db->pdate("d.datedon")." as datedon, d.prenom, d.nom, d.societe,"; $sql = "SELECT d.rowid, ".$db->pdate("d.datedon")." as datedon, d.prenom, d.nom, d.societe,";
@ -62,7 +62,8 @@ if ($statut >= 0)
{ {
$sql .= " AND d.fk_statut = ".$statut; $sql .= " AND d.fk_statut = ".$statut;
} }
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit, $offset); $sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($conf->liste_limit, $offset);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
@ -101,7 +102,9 @@ if ($result)
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$var=!$var; $var=!$var;
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
print "<td><a href=\"fiche.php?rowid=$objp->rowid\">".$objp->rowid."</a></td>\n"; $donationstatic->id=$objp->rowid;
$donationstatic->ref=$objp->rowid;
print "<td>".$donationstatic->getNomUrl(1)."</td>\n";
print "<td>".stripslashes($objp->prenom)."</td>\n"; print "<td>".stripslashes($objp->prenom)."</td>\n";
print "<td>".stripslashes($objp->nom)."</td>\n"; print "<td>".stripslashes($objp->nom)."</td>\n";
print "<td>".stripslashes($objp->societe)."</td>\n"; print "<td>".stripslashes($objp->societe)."</td>\n";
@ -110,7 +113,7 @@ if ($result)
print "<td>$objp->projet</td>\n"; print "<td>$objp->projet</td>\n";
} }
print '<td align="right">'.price($objp->amount).'</td>'; print '<td align="right">'.price($objp->amount).'</td>';
print '<td align="right">'.$donstatic->LibStatut($objp->statut,5).'</td>'; print '<td align="right">'.$donationstatic->LibStatut($objp->statut,5).'</td>';
print "</tr>"; print "</tr>";
$i++; $i++;

View File

@ -196,12 +196,13 @@ insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`,
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `usertype`, position, entity) values ('$conf->propal->enabled', 'auguria', 'left', 1800__+MAX_llx_menu__, 'accountancy', '', 6__+MAX_llx_menu__, '/compta/propal.php', 'Prop', 0, 'propal', '$user->rights->propale->lire', '', 2, 2, __ENTITY__); insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `usertype`, position, entity) values ('$conf->propal->enabled', 'auguria', 'left', 1800__+MAX_llx_menu__, 'accountancy', '', 6__+MAX_llx_menu__, '/compta/propal.php', 'Prop', 0, 'propal', '$user->rights->propale->lire', '', 2, 2, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `usertype`, position, entity) values ('$conf->commande->enabled', 'auguria', 'left', 1900__+MAX_llx_menu__, 'accountancy', '', 6__+MAX_llx_menu__, '/compta/commande/liste.php?leftmenu=orders&status=3&afacturer=1', 'MenuOrdersToBill', 0, 'orders', '$user->rights->commande->lire', '', 0, 3, __ENTITY__); insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `usertype`, position, entity) values ('$conf->commande->enabled', 'auguria', 'left', 1900__+MAX_llx_menu__, 'accountancy', '', 6__+MAX_llx_menu__, '/compta/commande/liste.php?leftmenu=orders&status=3&afacturer=1', 'MenuOrdersToBill', 0, 'orders', '$user->rights->commande->lire', '', 0, 3, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `usertype`, position, entity) values ('$conf->don->enabled', 'auguria', 'left', 2000__+MAX_llx_menu__, 'accountancy', '', 6__+MAX_llx_menu__, '/compta/dons/index.php?leftmenu=donations&mainmenu=accountancy', 'Donations', 0, 'donations', '$user->rights->don->lire', '', 2, 4, __ENTITY__); insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `usertype`, position, entity) values ('$conf->don->enabled', 'auguria', 'left', 2000__+MAX_llx_menu__, 'accountancy', '', 6__+MAX_llx_menu__, '/compta/dons/index.php?leftmenu=donations&mainmenu=accountancy', 'Donations', 0, 'donations', '$user->rights->don->lire', '', 2, 4, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `usertype`, position, entity) values ('$conf->don->enabled', 'auguria', 'left', 2001__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/compta/dons/fiche.php?action=create', 'NewDonation', 1, 'donations', '$user->rights->don->creer', '', 2, 0, __ENTITY__); insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `usertype`, position, entity) values ('$conf->don->enabled && $leftmenu=="donations"', 'auguria', 'left', 2001__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/compta/dons/fiche.php?leftmenu=donations&mainmenu=accountancy&action=create', 'NewDonation', 1, 'donations', '$user->rights->don->creer', '', 2, 0, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `usertype`, position, entity) values ('$conf->don->enabled', 'auguria', 'left', 2002__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/compta/dons/liste.php?action=create', 'List', 1, 'donations', '$user->rights->don->lire', '', 2, 1, __ENTITY__); insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `usertype`, position, entity) values ('$conf->don->enabled && $leftmenu=="donations"', 'auguria', 'left', 2002__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/compta/dons/liste.php?leftmenu=donations&mainmenu=accountancy', 'List', 1, 'donations', '$user->rights->don->lire', '', 2, 1, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `usertype`, position, entity) values ('$conf->don->enabled', 'auguria', 'left', 2003__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/compta/dons/stats.php', 'Statistics', 1, 'donations', '$user->rights->don->lire', '', 2, 2, __ENTITY__); insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `usertype`, position, entity) values ('$conf->don->enabled && $leftmenu=="donations"', 'auguria', 'left', 2003__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/compta/dons/stats.php?leftmenu=donations&mainmenu=accountancy', 'Statistics', 1, 'donations', '$user->rights->don->lire', '', 2, 2, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `usertype`, position, entity) values ('$conf->deplacement->enabled', 'auguria', 'left', 2100__+MAX_llx_menu__, 'accountancy', '', 6__+MAX_llx_menu__, '/compta/deplacement/index.php?leftmenu=tripsandexpenses', 'TripsAndExpenses', 0, 'trips', '$user->rights->deplacement->lire', '', 0, 5, __ENTITY__); insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `usertype`, position, entity) values ('$conf->deplacement->enabled', 'auguria', 'left', 2100__+MAX_llx_menu__, 'accountancy', '', 6__+MAX_llx_menu__, '/compta/deplacement/index.php?leftmenu=tripsandexpenses', 'TripsAndExpenses', 0, 'trips', '$user->rights->deplacement->lire', '', 0, 5, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `usertype`, position, entity) values ('$conf->deplacement->enabled', 'auguria', 'left', 2101__+MAX_llx_menu__, 'accountancy', '', 2100__+MAX_llx_menu__, '/compta/deplacement/fiche.php?action=create&leftmenu=tripsandexpenses', 'New', 1, 'trips', '$user->rights->deplacement->creer', '', 0, 1, __ENTITY__); insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `usertype`, position, entity) values ('$conf->deplacement->enabled && $leftmenu=="tripsandexpenses"', 'auguria', 'left', 2101__+MAX_llx_menu__, 'accountancy', '', 2100__+MAX_llx_menu__, '/compta/deplacement/fiche.php?action=create&leftmenu=tripsandexpenses', 'New', 1, 'trips', '$user->rights->deplacement->creer', '', 0, 1, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `usertype`, position, entity) values ('$conf->deplacement->enabled', 'auguria', 'left', 2102__+MAX_llx_menu__, 'accountancy', '', 2100__+MAX_llx_menu__, '/compta/deplacement/index.php?leftmenu=tripsandexpenses', 'List', 1, 'trips', '$user->rights->deplacement->lire', '', 0, 2, __ENTITY__); insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `usertype`, position, entity) values ('$conf->deplacement->enabled && $leftmenu=="tripsandexpenses"', 'auguria', 'left', 2102__+MAX_llx_menu__, 'accountancy', '', 2100__+MAX_llx_menu__, '/compta/deplacement/index.php?leftmenu=tripsandexpenses', 'List', 1, 'trips', '$user->rights->deplacement->lire', '', 0, 2, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `usertype`, position, entity) values ('$conf->deplacement->enabled && $leftmenu=="tripsandexpenses"', 'auguria', 'left', 2103__+MAX_llx_menu__, 'accountancy', '', 2100__+MAX_llx_menu__, '/compta/deplacement/stats/index.php?leftmenu=tripsandexpenses', 'Statistics', 1, 'trips', '$user->rights->deplacement->lire', '', 0, 2, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `usertype`, position, entity) values ('$conf->tax->enabled', 'auguria', 'left', 2200__+MAX_llx_menu__, 'accountancy', '', 6__+MAX_llx_menu__, '/compta/charges/index.php?leftmenu=tax&mainmenu=accountancy', 'MenuTaxAndDividends', 0, 'compta', '$user->rights->tax->charges->lire', '', 0, 6, __ENTITY__); insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `usertype`, position, entity) values ('$conf->tax->enabled', 'auguria', 'left', 2200__+MAX_llx_menu__, 'accountancy', '', 6__+MAX_llx_menu__, '/compta/charges/index.php?leftmenu=tax&mainmenu=accountancy', 'MenuTaxAndDividends', 0, 'compta', '$user->rights->tax->charges->lire', '', 0, 6, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `usertype`, position, entity) values ('$conf->tax->enabled', 'auguria', 'left', 2201__+MAX_llx_menu__, 'accountancy', '', 2200__+MAX_llx_menu__, '/compta/sociales/index.php?leftmenu=tax_social', 'SocialContributions', 1, '', '$user->rights->tax->charges->lire', '', 0, 1, __ENTITY__); insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `usertype`, position, entity) values ('$conf->tax->enabled', 'auguria', 'left', 2201__+MAX_llx_menu__, 'accountancy', '', 2200__+MAX_llx_menu__, '/compta/sociales/index.php?leftmenu=tax_social', 'SocialContributions', 1, '', '$user->rights->tax->charges->lire', '', 0, 1, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `usertype`, position, entity) values ('$conf->tax->enabled', 'auguria', 'left', 2202__+MAX_llx_menu__, 'accountancy', '', 2201__+MAX_llx_menu__, '/compta/sociales/charges.php?leftmenu=tax_social&action=create', 'MenuNewSocialContribution', 2, '', '$user->rights->tax->charges->creer', '', 0, 2, __ENTITY__); insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `usertype`, position, entity) values ('$conf->tax->enabled', 'auguria', 'left', 2202__+MAX_llx_menu__, 'accountancy', '', 2201__+MAX_llx_menu__, '/compta/sociales/charges.php?leftmenu=tax_social&action=create', 'MenuNewSocialContribution', 2, '', '$user->rights->tax->charges->creer', '', 0, 2, __ENTITY__);