Update of /cvsroot/tutos/tutos/php/invoice
In directory sc8-pr-cvs1:/tmp/cvs-serv31154/php/invoice
Modified Files:
invoice.pinc invoice_new.php invoice_show.php
Log Message:
using table field sizes
Index: invoice.pinc
===================================================================
RCS file: /cvsroot/tutos/tutos/php/invoice/invoice.pinc,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- invoice.pinc 29 Nov 2002 08:56:56 -0000 1.25
+++ invoice.pinc 30 Nov 2002 19:04:47 -0000 1.26
@@ -109,7 +109,7 @@
$this->items = $r->get($pos, "items");
$this->itype = $r->get($pos, "ityp");
$this->pos = $r->get($pos, "pos");
- $this->description = $r->get($pos, "description");
+ $this->description = StripSlashes($r->get($pos, "description"));
$this->sum_single = $r->get($pos, "sum_single");
$this->currency = $r->get($pos, "currency");
if ($this->currency == "" ) {
@@ -334,17 +334,16 @@
$this->customer_id = $r->get($pos, "customer");
$this->customer = getObject($this->dbconn,$this->customer_id);
- $this->datesent[0] = new DateTime($r->get($pos, "d_sent0"));
- $this->datesent[1] = new DateTime($r->get($pos, "d_sent1"));
- $this->datesent[2] = new DateTime($r->get($pos, "d_sent2"));
- $this->datedue[0] = new DateTime($r->get($pos, "d_due0"));
- $this->datedue[1] = new DateTime($r->get($pos, "d_due1"));
- $this->datedue[2] = new DateTime($r->get($pos, "d_due2"));
- $this->datefinish = new DateTime($r->get($pos, "d_finish"));
+ $this->datesent[0] = $r->getDateTime($pos, "d_sent0");
+ $this->datesent[1] = $r->getDateTime($pos, "d_sent1");
+ $this->datesent[2] = $r->getDateTime($pos, "d_sent2");
+ $this->datedue[0] = $r->getDateTime($pos, "d_due0");
+ $this->datedue[1] = $r->getDateTime($pos, "d_due1");
+ $this->datedue[2] = $r->getDateTime($pos, "d_due2");
+ $this->datefinish = $r->getDateTime($pos, "d_finish");
$this->creator = new tutos_address($this->dbconn);
$this->creator->read($r->get($pos, "creator"));
- $this->creation = new DateTime($r->get($pos, "creation"));
$this->pos = array();
parent::read_result($r,$pos);
@@ -571,13 +570,13 @@
* Save Resource to DB
*/
function save() {
- global $tutos,$current_user;
+ global $tutos,$current_user,$table;
$msg = "";
$q = new query($this->dbconn);
$q->setTable($this->tablename);
- $q->addFV("name",$this->name,"STRING");
+ $q->addFV("name",$this->name,"STRING",$table['invoice']['name'][size]);
$q->addFV("state",$this->state,"INT");
$q->addFV("link_id",$this->link_id,"INT");
$q->addFV("accountant",$this->accountant,"INT");
Index: invoice_new.php
===================================================================
RCS file: /cvsroot/tutos/tutos/php/invoice/invoice_new.php,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- invoice_new.php 5 Nov 2002 19:47:11 -0000 1.20
+++ invoice_new.php 30 Nov 2002 19:04:47 -0000 1.21
@@ -97,37 +97,37 @@
* display the form
*/
Function info() {
- global $lang,$tutos;
+ global $lang,$tutos,$table;
- echo "<FORM name=\"invadd\" ACTION=\"invoice_ins.php\" method=\"POST\">\n";
+ echo "<form name=\"invadd\" action=\"invoice_ins.php\" method=\"post\">\n";
if ($this->obj->id > 0 ) {
$this->addHidden("id",$this->obj->id);
}
echo $this->DataTableStart();
echo "<tr>\n";
- echo " <th COLSPAN=9>". sprintf($lang['Showing'],$lang[$this->obj->getType()])."</th>\n";
+ echo " <th colspan=\"9\">". sprintf($lang['Showing'],$lang[$this->obj->getType()])."</th>\n";
echo "</tr>\n";
if ($this->obj->id > 0 ) {
echo "<tr>\n";
- echo " <td COLSPAN=5>". sprintf ($lang['InvoiceCreation'],$this->obj->creator->getLink(),$this->obj->creation->getDateTime()) ."</td>\n";
- echo " <td COLSPAN=4 ALIGN=right>". acl_link($this->obj) ."</td>\n";
+ echo " <td colspan=\"5\">". sprintf ($lang['InvoiceCreation'],$this->obj->creator->getLink(),$this->obj->creation->getDateTime()) ."</td>\n";
+ echo " <td colspan=\"4\" align=\"right\">". acl_link($this->obj) ."</td>\n";
echo "</tr>\n";
}
echo "<tr>\n";
echo $this->showfieldc($lang['Accountant'],1,"accountant");
- echo " <td COLSPAN=8>\n";
+ echo " <td colspan=\"8\">\n";
if ( $this->obj->change_ok() ) {
- echo " <SELECT NAME=\"accountant\">\n";
+ echo " <select name=\"accountant\">\n";
$this->obj->creator->read_locs_data();
- echo " <OPTION VALUE=\"". $this->obj->creator->id ."\">". $this->obj->creator->getFullName() ."</OPTION>\n";
+ echo " <option value=\"". $this->obj->creator->id ."\">". $this->obj->creator->getFullName() ."</option>\n";
@reset($this->obj->creator->location);
while ( list ($j,$l) = @each ($this->obj->creator->location) ) {
if ( is_object($l->company) ) {
- echo " <OPTION VALUE=\"". $l->id ."\">". $l->company->getFullName() ."</OPTION>\n";
+ echo " <option value=\"". $l->id ."\">". $l->company->getFullName() ."</option>\n";
}
}
- echo " </SELECT>\n";
+ echo " </select>\n";
} else {
echo $this->obj->acc->getLink();
$this->addHidden("accountant",$this->obj->accountant);
@@ -143,7 +143,7 @@
echo "automatic";
$this->addHidden("name",$this->obj->name);
} else {
- echo " <input size=\"30\" maxlength=\"30\" name=\"name\" value=\"". $this->obj->name ."\">";
+ echo " <input size=\"". min($table['invoice']['name'][size],30) ."\" maxlength=\"".$table['invoice']['name'][size]."\" name=\"name\" value=\"". $this->obj->name ."\">";
}
} else {
echo $this->obj->getLink();
@@ -317,13 +317,13 @@
* prepare
*/
Function prepare() {
- global $msg,$HTTP_GET_VARS,$lang, $tutos;
+ global $msg,$lang, $tutos;
$this->obj = new invoice($this->dbconn);
$this->name = $lang['Invoice'];
- if ( isset($HTTP_GET_VARS['id']) ) {
- $this->obj->read($HTTP_GET_VARS['id']);
+ if ( isset($_GET['id']) ) {
+ $this->obj->read($_GET['id']);
if ($i->id == -1) {
$msg .= sprintf($lang['Err0040'],$lang[$i->getType()]) . "<BR>";
$this->stop = true;
@@ -333,15 +333,15 @@
} else {
$this->name = $lang['InvoiceCreate'];
}
- if ( isset($HTTP_GET_VARS['state']) ) {
- $this->obj->state = $HTTP_GET_VARS['state'];
+ if ( isset($_GET['state']) ) {
+ $this->obj->state = $_GET['state'];
}
- if ( isset($HTTP_GET_VARS['name']) ) {
- $this->obj->name = UrlDecode(Stripslashes($HTTP_GET_VARS['name']));
+ if ( isset($_GET['name']) ) {
+ $this->obj->name = UrlDecode(Stripslashes($_GET['name']));
}
- if ( isset($HTTP_GET_VARS['link_id']) ) {
- $this->obj->link_id = $HTTP_GET_VARS['link_id'];
+ if ( isset($_GET['link_id']) ) {
+ $this->obj->link_id = $_GET['link_id'];
if ( $this->obj->id == -1 ) {
$this->obj->read_ref();
if ( $this->obj->ref->getType() == "product" ) {
Index: invoice_show.php
===================================================================
RCS file: /cvsroot/tutos/tutos/php/invoice/invoice_show.php,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- invoice_show.php 10 Nov 2002 13:24:46 -0000 1.18
+++ invoice_show.php 30 Nov 2002 19:04:47 -0000 1.19
@@ -27,20 +27,20 @@
global $lang;
$f->read_ref();
- echo "<TR>\n";
+ echo "<tr>\n";
if ( $f->ref != -1 ) {
- echo " <TD ALIGN=right VALIGN=top>". $f->ref->getLink(sprintf("%04d",$f->pos)) ."</TD>";
+ echo " <td align=\"right\" valign=\"top\">". $f->ref->getLink(sprintf("%04d",$f->pos)) ."</td>";
} else {
- echo " <TD ALIGN=right VALIGN=top>". sprintf("%04d",$f->pos) ."</TD>";
+ echo " <td align=\"right\" valign=\"top\">". sprintf("%04d",$f->pos) ."</td>";
}
- echo " <TD ALIGN=right VALIGN=top>". number_format($f->items,2,$lang['DecPoint'],$lang['ThousandPoint']) ." </TD>";
- echo " <TD ALIGN=right VALIGN=top>". $f->itype ." </TD>";
- echo " <TD VALIGN=top><PRE>". $f->description ."</PRE></TD>";
- echo " <TD ALIGN=right VALIGN=top>". number_format($f->sum_single ,2,$lang['DecPoint'],$lang['ThousandPoint']) ."</TD>";
- echo " <TD ALIGN=right VALIGN=top>". number_format($f->tax ,2,$lang['DecPoint'],$lang['ThousandPoint']) ."</TD>";
- echo " <TD ALIGN=right VALIGN=top>". number_format($f->getTotal(),2,$lang['DecPoint'],$lang['ThousandPoint']) ."</TD>";
- echo " <TD ALIGN=left VALIGN=top> ". $f->currency ."</TD>";
- echo "</TR>\n";
+ echo " <td align=\"right\" valign=\"top\">". number_format($f->items,2,$lang['DecPoint'],$lang['ThousandPoint']) ." </td>";
+ echo " <td align=\"right\" valign=\"top\">". $f->itype ." </td>";
+ echo " <td valign=\"top\"><pre>". $f->description ."</pre></td>";
+ echo " <td align=\"right\" valign=\"top\">". number_format($f->sum_single ,2,$lang['DecPoint'],$lang['ThousandPoint']) ."</td>";
+ echo " <td align=\"right\" valign=\"top\">". number_format($f->tax ,2,$lang['DecPoint'],$lang['ThousandPoint']) ."</td>";
+ echo " <td align=\"right\" valign=\"top\">". number_format($f->getTotal(),2,$lang['DecPoint'],$lang['ThousandPoint']) ."</td>";
+ echo " <td align=\"left\" valign=\"top\"> ". $f->currency ."</td>";
+ echo "</tr>\n";
}
/**
@@ -63,101 +63,101 @@
return;
}
echo $this->DataTableStart();
- echo "<TR>\n";
- echo " <TH COLSPAN=8>". sprintf($lang['Showing'],$lang[$this->obj->getType()]) ."</TH>\n";
- echo "</TR>\n";
- echo "<TR>\n";
- echo " <TD COLSPAN=8>". $lang['createdby'] ." ". $this->obj->creator->getLink();
- echo " ". $lang['atDateTime'] ." ". $this->obj->creation->getLinkDateTime() ."</TD>\n";
- echo "</TR>\n";
+ echo "<tr>\n";
+ echo " <th colspan=\"8\">". sprintf($lang['Showing'],$lang[$this->obj->getType()]) ."</th>\n";
+ echo "</tr>\n";
+ echo "<tr>\n";
+ echo " <td colspan=\"8\">". $lang['createdby'] ." ". $this->obj->creator->getLink();
+ echo " ". $lang['atDateTime'] ." ". $this->obj->creation->getLinkDateTime() ."</td>\n";
+ echo "</tr>\n";
- echo "<TR>\n";
+ echo "<tr>\n";
echo $this->showfieldc($lang['Accountant']);
if ( $this->obj->acc->getType() == "location" ) {
- echo "<TD COLSPAN=7>". $this->obj->acc->company->getLink() ."</TD>\n";
+ echo "<td colspan=\"7\">". $this->obj->acc->company->getLink() ."</td>\n";
} else {
- echo "<TD COLSPAN=7>". $this->obj->acc->getLink() ."</TD>\n";
+ echo "<td colspan=\"7\">". $this->obj->acc->getLink() ."</td>\n";
}
- echo "</TR>\n";
+ echo "</tr>\n";
- echo "<TR>\n";
+ echo "<tr>\n";
echo $this->showfieldc($lang['InvoiceName']);
- echo "<TD COLSPAN=3>". $this->obj->name ."</TD>\n";
+ echo $this->showdata(myentities($this->obj->name),3);
echo $this->showfieldc($lang['InvoiceState']);
- echo "<TD COLSPAN=3>". $lang['InvoiceStates'][$this->obj->state] ."</TD>\n";
- echo "</TR>\n";
+ echo $this->showdata($lang['InvoiceStates'][$this->obj->state],3);
+ echo "</tr>\n";
- echo "<TR>\n";
+ echo "<tr>\n";
echo $this->showfieldc($lang['InvoiceCustomer']);
if (is_object($this->obj->customer) ) {
- echo "<TD COLSPAN=7>". $this->obj->customer->getLink() ."</TD>\n";
+ echo $this->showdata($this->obj->customer->getLink(),7);
} else {
- echo "<TD COLSPAN=7>". $lang['HistoryDeleted'] ."</TD>\n";
+ echo $this->showdata($lang['HistoryDeleted'],7);
}
- echo "</TR>\n";
+ echo "</tr>\n";
if ( $this->obj->ref != -1 ) {
- echo "<TR>\n";
+ echo "<tr>\n";
echo $this->showfieldc($lang[$this->obj->ref->getType()],0);
- echo " <TD COLSPAN=7 VALIGN=top>". $this->obj->ref->getLink() ."</TD>";
- echo "</TR>\n";
+ echo $this->showdata($this->obj->ref->getLink(),7);
+ echo "</tr>\n";
}
if ( ($this->obj->datesent[0]->notime != 1) or ($this->obj->datedue[0]->notime != 1) ) {
- echo "<TR>\n";
+ echo "<tr>\n";
echo $this->showfieldc($lang['InvDateSent'][0]);
- echo "<TD COLSPAN=3>". $this->obj->datesent[0]->getDate() ." </TD>\n";
+ echo $this->showdata($this->obj->datesent[0]->getDate(),3);
echo $this->showfieldc($lang['InvDateDue'][0]);
- echo "<TD COLSPAN=3>". $this->obj->datedue[0]->getDate() ." </TD>\n";
- echo "</TR>\n";
+ echo $this->showdata($this->obj->datedue[0]->getDate(),3);
+ echo "</tr>\n";
}
if ( $this->obj->datesent[1]->notime != 1 ) {
- echo "<TR>\n";
+ echo "<tr>\n";
echo $this->showfieldc($lang['InvDateSent'][1]);
- echo "<TD COLSPAN=3>". $this->obj->datesent[1]->getDate() ." </TD>\n";
+ echo $this->showdata($this->obj->datesent[1]->getDate(),3);
echo $this->showfieldc($lang['InvDateDue'][1]);
- echo "<TD COLSPAN=3>". $this->obj->datedue[1]->getDate() ." </TD>\n";
- echo "</TR>\n";
+ echo $this->showdata($this->obj->datedue[1]->getDate(),3);
+ echo "</tr>\n";
}
if ( $this->obj->datesent[2]->notime != 1 ) {
- echo "<TR>\n";
+ echo "<tr>\n";
echo $this->showfieldc($lang['InvDateSent'][2]);
- echo "<TD COLSPAN=3>". $this->obj->datesent[2]->getDate() ." </TD>\n";
+ echo $this->showdata($this->obj->datesent[2]->getDate(),3);
echo $this->showfieldc($lang['InvDateDue'][2]);
- echo "<TD COLSPAN=3>". $this->obj->datedue[2]->getDate() ." </TD>\n";
- echo "</TR>\n";
+ echo $this->showdata($this->obj->datedue[2]->getDate(),3);
+ echo "</tr>\n";
}
if ( $this->obj->state == 7 ) {
- echo "<TR>\n";
+ echo "<tr>\n";
echo $this->showfieldc($lang['InvDatePayed']);
- echo "<TD COLSPAN=7>". $this->obj->datefinish->getDate() ." </TD>\n";
- echo "</TR>\n";
+ echo $this->showdata($this->obj->datefinish->getDate(),7);
+ echo "</tr>\n";
}
if ( $this->obj->state == 8 ) {
- echo "<TR>\n";
+ echo "<tr>\n";
echo $this->showfieldc($lang['InvDateCancel']);
- echo "<TD COLSPAN=7>". $this->obj->datefinish->getDate() ." </TD>\n";
- echo "</TR>\n";
+ echo $this->showdata($this->obj->datefinish->getDate(),7);
+ echo "</tr>\n";
}
- echo "<TR>\n";
- echo "<TH>". $lang['InvPosPos'] ."</TH>\n";
- echo "<TH>". $lang['InvPosItems'] ."</TH>\n";
- echo "<TH>". $lang['InvPosIType'] ."</TH>\n";
- echo "<TH>". $lang['InvPosDesc'] ."</TH>\n";
- echo "<TH>". $lang['InvPosSingle'] ."</TH>\n";
- echo "<TH>". $lang['InvPosTax'] ."</TH>\n";
- echo "<TH>". $lang['InvPosSum'] ."</TH>\n";
- echo "<TH>". $lang['Currency'] ."</TH>\n";
- echo "</TR>\n";
+ echo "<tr>\n";
+ echo "<th>". $lang['InvPosPos'] ."</th>\n";
+ echo "<th>". $lang['InvPosItems'] ."</th>\n";
+ echo "<th>". $lang['InvPosIType'] ."</th>\n";
+ echo "<th>". $lang['InvPosDesc'] ."</th>\n";
+ echo "<th>". $lang['InvPosSingle'] ."</th>\n";
+ echo "<th>". $lang['InvPosTax'] ."</th>\n";
+ echo "<th>". $lang['InvPosSum'] ."</th>\n";
+ echo "<th>". $lang['Currency'] ."</th>\n";
+ echo "</tr>\n";
@reset($this->obj->pos);
if ( count($this->obj->pos) == 0 ) {
- echo "<TR>\n";
- echo "<TD COLSPAN=8 CLASS=warn>".$lang['Err0048']."</TD>\n";
- echo "</TR>\n";
+ echo "<tr>\n";
+ echo "<td colspan=\"8\" class=\"warn\">".$lang['Err0048']."</td>\n";
+ echo "</tr>\n";
}
@reset($tutos[currencies]);
while( list ($i,$c) = @each ($tutos[currencies])) {
@@ -170,19 +170,19 @@
$sum[$f->currency] += $f->getTotal();
unset($f);
}
- echo "<TR>";
- echo "<TD COLSPAN=6> </TD>\n";
- echo "<TD COLSPAN=2> ";
+ echo "<tr>";
+ echo "<td colspan=\"6\"> </td>\n";
+ echo "<td colspan=\"2\"> ";
@reset($tutos[currencies]);
$pre = "";
while( list ($i,$c) = @each ($tutos[currencies])) {
if ( $sum[$c] != 0 ) {
echo $pre . number_format($sum[$c],2,$lang['DecPoint'],$lang['ThousandPoint']) ." ". $c;
- $pre = "<BR>\n";
+ $pre = "<br>\n";
}
}
- echo "</TD>\n";
- echo "</TR>";
+ echo "</td>\n";
+ echo "</tr>";
# References to modules
show_module_infolists($this->user,$this->obj,8,$this->format);
@@ -195,30 +195,30 @@
Function navigate() {
global $lang, $tutos;
- echo "<TR><TD>";
+ echo "<tr><td>";
if ( ($this->obj->id > 0) && $this->obj->mod_ok() ) {
echo menulink("invoice/invoice_new.php?id=". $this->obj->id ,$lang['Modify'],sprintf($lang['InvModInfo'],$this->obj->getFullname())) ." <BR>";
}
- echo "<BR>\n";
+ echo "<br>\n";
if ( ($this->obj->id > 0) && $this->obj->see_ok() ) {
if ( function_exists( 'pdf_open_file' ) ) {
- echo menulink($this->obj->getUrl() ."&format=pdf",$lang['InvDocument'],$lang['InvDocumentI']) ." <BR>";
+ echo menulink($this->obj->getUrl() ."&format=pdf",$lang['InvDocument'],$lang['InvDocumentI']) ." <br>";
}
}
- echo "</TD></TR>";
+ echo "</td></tr>";
}
/**
* prepare
*/
Function prepare() {
- global $msg,$HTTP_GET_VARS,$lang, $tutos;
+ global $msg,$lang, $tutos;
$this->name = $lang['Invoice'];
$this->obj = new invoice($this->dbconn);
- if ( isset($HTTP_GET_VARS['id']) ) {
- $this->obj->read($HTTP_GET_VARS['id']);
+ if ( isset($_GET['id']) ) {
+ $this->obj->read($_GET['id']);
}
if ( ! $this->obj->see_ok() ) {
$msg .= sprintf($lang['Err0022'],$lang[$i->getType()]);
|