Massive update

This commit is contained in:
Rodolphe Quiedeville 2002-04-30 10:57:25 +00:00
parent e1dc4600ee
commit dc3607d385
2 changed files with 272 additions and 0 deletions

134
htdocs/product/index.php3 Normal file
View File

@ -0,0 +1,134 @@
<?PHP
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* $Id$
* $Source$
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
require("./pre.inc.php3");
llxHeader();
$bc[0]="bgcolor=\"#90c090\"";
$bc[1]="bgcolor=\"#b0e0b0\"";
$db = new Db();
if ($sortfield == "") {
$sortfield="lower(p.label),p.price";
}
if ($sortorder == "") {
$sortorder="ASC";
}
if ($action == 'update') {
$sql = "UPDATE llx_product SET description='$desc' where rowid = $rowid";
$db->query($sql);
}
$yn["t"] = "oui";
$yn["f"] = "non";
if ($page == -1) { $page = 0 ; }
$limit = 26;
$offset = $limit * $page ;
$pageprev = $page - 1;
$pagenext = $page + 1;
print "<a href=\"$PHP_SELF\">Liste</a><P>";
if ($rowid) {
$sql = "SELECT p.rowid, p.label, p.price, p.description, p.duration,p.ref FROM llx_product as p";
$sql .= " WHERE p.rowid = $rowid;";
if ( $db->query($sql) ) {
$num = $db->num_rows();
$i = 0;
print "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
print "<TR bgcolor=\"orange\">";
print "<TD>Réf</TD>";
print "<TD><a href=\"$PHP_SELF?sortfield=lower(p.label)&sortorder=ASC\">Nom</a></td>";
print "</TR>\n";
$var=True;
if ( $num ) {
$objp = $db->fetch_object(0);
$var=!$var;
print "<TR $bc[$var]>";
print "<TD><a href=\"$PHP_SELF?rowid=$objp->rowid\">$objp->ref</a></TD>\n";
print "<TD>$objp->label</TD></tr>\n";
print "<tr><td>prix</td><TD>$objp->price</td></tr>\n";
print "<tr><td>duree</td><TD>$objp->duration</td></tr>\n";
print "<tr><td>desc</td><td>".nl2br($objp->description)."</td></tr>";
$i++;
}
print "</TABLE>";
$db->free();
print "<hr><form action=\"$PHP_SELF?rowid=$rowid\" method=\"post\">\n";
print "<input type=\"hidden\" name=\"action\" value=\"update\">";
print "<textarea name=\"desc\" rows=\"12\" cols=\"40\">";
print nl2br($objp->description);
print "</textarea><br>";
print "<input type=\"submit\">";
print "</form>";
}
} else {
$sql = "SELECT p.rowid, p.label, p.price, p.duration,p.ref FROM llx_product as p";
$sql .= " ORDER BY $sortfield $sortorder ";
$sql .= $db->plimit( $limit ,$offset);
if ( $db->query($sql) ) {
$num = $db->num_rows();
$i = 0;
print "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
print "<TR bgcolor=\"orange\">";
print "<TD>Réf</TD>";
print "<TD><a href=\"$PHP_SELF?sortfield=lower(p.label)&sortorder=ASC\">Nom</a></td>";
print "<TD align=\"right\">Prix</TD>";
print "<TD align=\"right\">Durée</TD>";
print "</TR>\n";
$var=True;
while ($i < $num) {
$objp = $db->fetch_object( $i);
$var=!$var;
print "<TR $bc[$var]>";
print "<TD><a href=\"$PHP_SELF?rowid=$objp->rowid\">$objp->ref</a></TD>\n";
print "<TD>$objp->label</TD>\n";
print '<TD align="right">'.price($objp->price).'</TD>';
print "<TD align=\"right\">$objp->duration</TD>\n";
print "</TR>\n";
$i++;
}
print "</TABLE>";
$db->free();
}
}
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>

138
htdocs/product/pre.inc.php3 Normal file
View File

@ -0,0 +1,138 @@
<?PHP
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* $Id$
* $Source$
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
require("../main.inc.php3");
function llxHeader($head = "", $urlp = "") {
global $PREFIX, $user;
print "<HTML>\n<HEAD>$head\n</HEAD>\n";
?>
<BODY BGCOLOR="#c0c0c0" TOPMARGIN="0" BOTTOMMARGIN="0" LEFTMARGIN="0" RIGHTMARGIN="0" MARGINHEIGHT="0" MARGINWIDTH="0">
<?PHP
print "<TABLE border=\"0\" width=\"100%\">\n";
print "<TR bgcolor=\"".$GLOBALS["TOPBAR_BGCOLOR"]."\">";
print "<TD width=\"20%\" bgcolor=\"#e0e0e0\"><B>" . $GLOBALS["MAIN_TITLE"] . "</B></TD>";
print "<TD width=\"20%\" bgcolor=\"#e0e0e0\" align=\"center\"><A href=\"".$urlp."../tech/\">Technique</A></TD>";
print "<TD width=\"20%\" align=\"center\"><A href=\"".$urlp."../comm/\">Commercial</A></TD>";
print "<TD width=\"20%\" bgcolor=\"#e0e0e0\" align=\"center\"><A href=\"".$urlp."../compta/\">Compta</A></TD>";
print "<TD width=\"20%\" bgcolor=\"#e0e0e0\" align=\"center\"><A href=\"".$urlp."../stats/\">Stats</A></TD>";
print "</TR></TABLE>\n";
print "<TABLE border=\"1\" width=\"100%\" cellpadding=\"0\">";
print "<TR><TD valign=\"top\" align=\"right\">";
print "<TABLE border=\"1\" cellspacing=\"0\" width=\"100%\" cellpadding=\"3\">";
print "<TR><TD valign=\"top\" align=\"right\">";
print "<center><b>" . $GLOBALS["dbname"] . " - " . $user->code ."</B></center>";
print "<A href=\"".$urlp."../\">Accueil</A><br>";
print "<A href=\"".$urlp."bookmark.php3\">Bookmark</A>";
print "</td></tr>";
print "<tr><td valign=\"top\" align=\"right\">";
print "<CENTER><A href=\"".$urlp."index.php3\">Societe</A></CENTER>\n";
print "<A href=\"".$urlp."contact.php3\">Contact</A><BR>\n";
print "</TD></TR>";
print "<TR><TD valign=\"top\" align=\"right\">";
print "<div align=\"center\"><A href=\"".$urlp."actioncomm.php3\">Actions</A></div>\n";
print "<A href=\"".$urlp."actioncomm.php3?type=9\">Factures</A><BR>\n";
print "<A href=\"".$urlp."actioncomm.php3?type=5\">Propal FE</A><BR>\n";
print "<A href=\"".$urlp."actioncomm.php3?type=11\">Cl&ocirc;ture</A><p>\n";
print "</TD></TR>";
/*
*
*/
print "<TR><TD valign=\"top\" align=\"right\">";
print '<div align="center"><A href="'.$urlp.'propal.php3">Propal</A></div>';
print "</TD></TR>";
/*
*
*/
print "<TR><TD valign=\"top\" align=\"right\">";
print '<div align="center"><A href="'.$urlp.'../compta/\">Factures</A></div>';
print "</TD></TR>";
/*
*
*/
print "<TR><TD valign=\"top\" align=\"right\">";
print '<div align="center"><A href="'.$urlp.'product.php3">Produits</A></div>';
print "</td></tr>";
/*
*
*/
print "<tr><td align=\"right\" valign=\"top\">";
print "<A href=\"projet/\">Projets</A><BR>\n";
print "</td></tr>";
print "<tr><td align=\"right\" valign=\"top\">";
print "<A href=\"".$urlp."stats/\">Stats</A><BR>\n";
print "</td></tr>";
print "<tr><td align=\"right\" valign=\"top\">";
print "<CENTER><A href=\"".$urlp."index.php3\">Societes</A></CENTER>\n";
print "<form action=\"index.php3\">";
print '<input type="hidden" name="mode" value="search">';
print '<input type="hidden" name="mode-search" value="soc">';
print '<input type="text" name="socname" size="8">&nbsp;';
print "<input type=\"submit\" value=\"go\">";
print "</form>";
print "<CENTER><A href=\"".$urlp."contact.php3\">Contacts</A></CENTER>\n";
print "<form action=\"".$urlp."contact.php3\">";
print '<input type="hidden" name="mode" value="search">';
print '<input type="hidden" name="mode-search" value="contact">';
print "<input type=\"text\" name=\"contactname\" size=\"8\">&nbsp;";
print "<input type=\"submit\" value=\"go\">";
print "</form>";
print "<form action=\"index.php3\">";
print "Soc : <input type=\"text\" name=\"socid\" size=\"5\">";
print "<input type=\"submit\" value=\"id\">";
print "</form>";
print "</td></tr>";
print "</table>";
print "</td>";
print "<TD valign=\"top\" width=\"85%\">\n";
}
function llxFooter($foot='') {
print "</TD></TR>";
/*
*
*/
print "</TABLE>\n";
print "$foot</BODY></HTML>";
}
/*
* $Id$
* $Source$
*/
?>