Fix: Le use de validation des factures fournisseurs n'était pas renseigné, Optim: Suppression de codes inutils et remplacement de 'select' par l'appel aux methodes de l'objet approprié
This commit is contained in:
parent
ea63c23baa
commit
2111f95863
@ -23,21 +23,45 @@ require("./pre.inc.php");
|
|||||||
|
|
||||||
$acts[0] = "add";
|
$acts[0] = "add";
|
||||||
$acts[1] = "delete";
|
$acts[1] = "delete";
|
||||||
$actl[0] = "Ajouter";
|
$actl[0] = "Activer";
|
||||||
$actl[1] = "Enlever";
|
$actl[1] = "Désactiver";
|
||||||
|
|
||||||
|
$active = 1;
|
||||||
|
|
||||||
|
// Mettre ici tous les caractéristiques des dictionnaires editables
|
||||||
$tabid[1] = "llx_c_forme_juridique";
|
$tabid[1] = "llx_c_forme_juridique";
|
||||||
$tabid[2] = "llx_c_departements";
|
$tabid[2] = "llx_c_departements";
|
||||||
$tabid[3] = "llx_c_regions";
|
$tabid[3] = "llx_c_regions";
|
||||||
|
$tabid[4] = "llx_c_pays";
|
||||||
|
|
||||||
|
$tabnom[1] = "Formes juridiques";
|
||||||
|
$tabnom[2] = "Départements";
|
||||||
|
$tabnom[3] = "Régions";
|
||||||
|
$tabnom[4] = "Pays";
|
||||||
|
|
||||||
|
$tabsql[1] = "SELECT code, libelle, active FROM llx_c_forme_juridique ORDER BY active DESC, code ASC";
|
||||||
|
$tabsql[2] = "SELECT rowid, code_departement as code , nom as libelle, active FROM llx_c_departements ORDER BY active DESC, code ASC";
|
||||||
|
$tabsql[3] = "SELECT r.rowid as rowid, code_region as code , nom as libelle, p.libelle as pays, r.active FROM llx_c_regions as r, llx_c_pays as p WHERE r.fk_pays=p.rowid ORDER BY active DESC, code ASC";
|
||||||
|
$tabsql[4] = "SELECT rowid, code, libelle, active FROM llx_c_pays ORDER BY active DESC, code ASC";
|
||||||
|
|
||||||
|
// Champs à afficher
|
||||||
|
$tabfield[1] = "code,libelle";
|
||||||
|
$tabfield[2] = "code,libelle";
|
||||||
|
$tabfield[3] = "code,libelle,pays";
|
||||||
|
$tabfield[4] = "code,libelle";
|
||||||
|
|
||||||
if (! $user->admin)
|
if (! $user->admin)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
if ($user->admin)
|
|
||||||
{
|
|
||||||
if ($_GET["action"] == 'delete')
|
if ($_GET["action"] == 'delete')
|
||||||
{
|
{
|
||||||
|
if ($_GET["rowid"] >0) {
|
||||||
$sql = "UPDATE ".$tabid[$_GET["id"]]." SET active = 0 WHERE rowid=".$_GET["rowid"];
|
$sql = "UPDATE ".$tabid[$_GET["id"]]." SET active = 0 WHERE rowid=".$_GET["rowid"];
|
||||||
|
}
|
||||||
|
elseif ($_GET["code"] >0) {
|
||||||
|
$sql = "UPDATE ".$tabid[$_GET["id"]]." SET active = 0 WHERE code=".$_GET["code"];
|
||||||
|
}
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if (!$result)
|
if (!$result)
|
||||||
@ -55,66 +79,85 @@ if ($user->admin)
|
|||||||
print $db->error();
|
print $db->error();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
print_titre("Configuration des dictionnaires de données");
|
|
||||||
|
|
||||||
print '<br>';
|
|
||||||
|
|
||||||
$active = 1;
|
|
||||||
$sql = array();
|
|
||||||
if ($_GET["id"])
|
if ($_GET["id"])
|
||||||
{
|
{
|
||||||
ShowTable($db,1, $_GET["id"], $actl, $acts);
|
print_titre("Configuration des dictionnaires de données : ".$tabnom[$_GET["id"]]);
|
||||||
ShowTable($db,0, $_GET["id"], $actl, $acts);
|
print '<br>';
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<a href="dict.php?id=1">Forme Juridique</a><br>';
|
|
||||||
print '<a href="dict.php?id=2">Départements</a><br>';
|
|
||||||
print '<a href="dict.php?id=3">Régions</a><br>';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Affiche table des valeurs
|
||||||
|
$sql=$tabsql[$_GET["id"]];
|
||||||
$db->close();
|
if ($db->query($sql))
|
||||||
|
|
||||||
llxFooter();
|
|
||||||
|
|
||||||
Function ShowTable($db, $active, $id, $actl, $acts)
|
|
||||||
{
|
|
||||||
global $bc;
|
|
||||||
$sql[1] = "SELECT code, libelle, active FROM llx_c_forme_juridique WHERE active = $active ORDER BY code ASC";
|
|
||||||
$sql[2] = "SELECT rowid, code_departement as code , nom as libelle, active FROM llx_c_departements WHERE active = $active ORDER BY code ASC";
|
|
||||||
$sql[3] = "SELECT rowid, code_region as code , nom as libelle, active FROM llx_c_regions WHERE active = $active ORDER BY code ASC";
|
|
||||||
|
|
||||||
|
|
||||||
if ($db->query($sql[$id]))
|
|
||||||
{
|
{
|
||||||
$num = $db->num_rows();
|
$num = $db->num_rows();
|
||||||
$i = 0; $var=True;
|
$i = 0;
|
||||||
|
$var=True;
|
||||||
if ($num)
|
if ($num)
|
||||||
{
|
{
|
||||||
print '<table class="noborder" cellpadding="3" cellspacing="0" width="100%">';
|
print '<table class="noborder" cellpadding="3" cellspacing="0" width="100%">';
|
||||||
print '<tr class="liste_titre"><td>Code</td><td>Valeur</td><td>Type</td></tr>';
|
print '<tr class="liste_titre">';
|
||||||
|
|
||||||
|
$fieldlist=split(',',$tabfield[$_GET["id"]]);
|
||||||
|
foreach ($fieldlist as $field => $value) {
|
||||||
|
print '<td>'.ucfirst($fieldlist[$field]).'</td>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<td>Actif</td>';
|
||||||
|
print '<td>Inactif</td>';
|
||||||
|
print '</tr>';
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($i);
|
$obj = $db->fetch_object($i);
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
|
|
||||||
print "<tr $bc[$var] class=\"value\"><td width=\"10%\">\n";
|
print "<tr $bc[$var] class=\"value\">";
|
||||||
print $obj->code.'</td><td>'.$obj->libelle.'</td><td width=\"30%\">';
|
|
||||||
print '<a href="'.$PHP_SELF.'?rowid='.$obj->rowid.'&id='.$id.'&action='.$acts[$active].'">'.$actl[$active].'</a>';
|
foreach ($fieldlist as $field => $value) {
|
||||||
print "</td></tr>\n";
|
print '<td>'.$obj->$fieldlist[$field].'</td>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($obj->active) {
|
||||||
|
print '<td>';
|
||||||
|
print '<a href="'.$PHP_SELF.'?rowid='.$obj->rowid.'&code='.$obj->code.'&id='.$_GET["id"].'&action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
|
||||||
|
print "</td>";
|
||||||
|
}
|
||||||
|
else print '<td> </td>';
|
||||||
|
if (! $obj->active) {
|
||||||
|
print '<td>';
|
||||||
|
print '<a href="'.$PHP_SELF.'?rowid='.$obj->rowid.'&code='.$obj->code.'&id='.$_GET["id"].'&action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
|
||||||
|
print "</td>";
|
||||||
|
}
|
||||||
|
else print '<td> </td>';
|
||||||
|
|
||||||
|
print "</tr>\n";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
print "Erreur : $sql : ".$db->error();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print_titre("Configuration des dictionnaires de données");
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
foreach ($tabid as $i => $value) {
|
||||||
|
print '<a href="dict.php?id='.$i.'">'.$tabnom[$i].'</a> (Table '.$tabid[$i].')<br>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
$db->close();
|
||||||
|
|
||||||
|
llxFooter();
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -384,16 +384,17 @@ if ($action == 'pdf')
|
|||||||
facture_pdf_create($db, $facid);
|
facture_pdf_create($db, $facid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
*
|
*
|
||||||
* Mode creation
|
* Mode creation
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
if ($_GET["action"] == 'create')
|
if ($_GET["action"] == 'create')
|
||||||
{
|
{
|
||||||
@ -894,7 +895,7 @@ else
|
|||||||
{
|
{
|
||||||
$objp = $db->fetch_object( $i);
|
$objp = $db->fetch_object( $i);
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<TR $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
if ($objp->fk_product > 0)
|
if ($objp->fk_product > 0)
|
||||||
{
|
{
|
||||||
print '<td><a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">'.stripslashes(nl2br($objp->description)).'</a>';
|
print '<td><a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">'.stripslashes(nl2br($objp->description)).'</a>';
|
||||||
@ -908,9 +909,9 @@ else
|
|||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<TD align="right">'.$objp->tva_taux.' %</TD>';
|
print '<td align="right">'.$objp->tva_taux.' %</td>';
|
||||||
print '<TD align="right">'.price($objp->subprice)."</td>\n";
|
print '<td align="right">'.price($objp->subprice)."</td>\n";
|
||||||
print '<TD align="right">'.$objp->qty.'</TD>';
|
print '<td align="right">'.$objp->qty.'</td>';
|
||||||
if ($objp->remise_percent > 0)
|
if ($objp->remise_percent > 0)
|
||||||
{
|
{
|
||||||
print '<td align="right">'.$objp->remise_percent." %</td>\n";
|
print '<td align="right">'.$objp->remise_percent." %</td>\n";
|
||||||
@ -1322,7 +1323,6 @@ else
|
|||||||
* *
|
* *
|
||||||
* Mode Liste *
|
* Mode Liste *
|
||||||
* *
|
* *
|
||||||
* *
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
if ($page == -1)
|
if ($page == -1)
|
||||||
{
|
{
|
||||||
@ -1340,7 +1340,7 @@ else
|
|||||||
if ($sortfield == "")
|
if ($sortfield == "")
|
||||||
$sortfield="f.datef";
|
$sortfield="f.datef";
|
||||||
|
|
||||||
$sql = "SELECT s.nom,s.idp,f.facnumber,f.total,f.total_ttc,".$db->pdate("f.datef")." as df,f.paye,f.rowid as facid, f.fk_statut, sum(pf.amount) as am";
|
$sql = "SELECT s.nom,s.idp,f.facnumber,f.total,f.total_ttc,".$db->pdate("f.datef")." as df, f.paye as paye, f.rowid as facid, f.fk_statut, sum(pf.amount) as am";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f left join ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture WHERE f.fk_soc = s.idp";
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f left join ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture WHERE f.fk_soc = s.idp";
|
||||||
|
|
||||||
if ($socidp)
|
if ($socidp)
|
||||||
@ -1369,7 +1369,12 @@ else
|
|||||||
|
|
||||||
$sql .= " GROUP BY f.facnumber";
|
$sql .= " GROUP BY f.facnumber";
|
||||||
|
|
||||||
$sql .= " ORDER BY $sortfield $sortorder, f.rowid DESC ";
|
$sql .= " ORDER BY ";
|
||||||
|
$listfield=split(',',$sortfield);
|
||||||
|
foreach ($listfield as $key => $value) {
|
||||||
|
$sql.="$listfield[$key] $sortorder,";
|
||||||
|
}
|
||||||
|
$sql .= " f.rowid DESC ";
|
||||||
|
|
||||||
$sql .= $db->plimit($limit,$offset);
|
$sql .= $db->plimit($limit,$offset);
|
||||||
|
|
||||||
@ -1395,8 +1400,9 @@ else
|
|||||||
print_liste_field_titre("Montant TTC",$PHP_SELF,"f.total_ttc","","&socidp=$socidp");
|
print_liste_field_titre("Montant TTC",$PHP_SELF,"f.total_ttc","","&socidp=$socidp");
|
||||||
print '</td><td align="right">';
|
print '</td><td align="right">';
|
||||||
print_liste_field_titre("Reçu",$PHP_SELF,"am","","&socidp=$socidp");
|
print_liste_field_titre("Reçu",$PHP_SELF,"am","","&socidp=$socidp");
|
||||||
|
print '</td><td align="right">';
|
||||||
|
print_liste_field_titre("Statut",$PHP_SELF,"fk_statut,paye","","&socidp=$socidp");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="center">Status</td>';
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
if ($num > 0)
|
if ($num > 0)
|
||||||
@ -1444,14 +1450,14 @@ else
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<TD align=\"center\"><b>!!!</b></TD>\n";
|
print "<td align=\"center\"><b>!!!</b></td>\n";
|
||||||
}
|
}
|
||||||
print '<TD><a href="fiche.php?socid='.$objp->idp.'">'.$objp->nom.'</a></td>';
|
print '<td><a href="fiche.php?socid='.$objp->idp.'">'.$objp->nom.'</a></td>';
|
||||||
|
|
||||||
print "<TD align=\"right\">".price($objp->total)."</TD>";
|
|
||||||
print "<TD align=\"right\">".price($objp->total_ttc)."</TD>";
|
|
||||||
print "<TD align=\"right\">".price($objp->am)."</TD>";
|
|
||||||
|
|
||||||
|
print "<td align=\"right\">".price($objp->total)."</td>";
|
||||||
|
print "<td align=\"right\">".price($objp->total_ttc)."</td>";
|
||||||
|
print "<td align=\"right\">".price($objp->am)."</td>";
|
||||||
|
// Affiche statut de la facture
|
||||||
if (! $objp->paye)
|
if (! $objp->paye)
|
||||||
{
|
{
|
||||||
if ($objp->fk_statut == 0)
|
if ($objp->fk_statut == 0)
|
||||||
@ -1472,7 +1478,7 @@ else
|
|||||||
print '<td align="center">payée</td>';
|
print '<td align="center">payée</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</TR>\n";
|
print "</tr>\n";
|
||||||
$total+=$objp->total;
|
$total+=$objp->total;
|
||||||
$total_ttc+=$objp->total_ttc;
|
$total_ttc+=$objp->total_ttc;
|
||||||
$totalrecu+=$objp->am;
|
$totalrecu+=$objp->am;
|
||||||
@ -1482,10 +1488,10 @@ else
|
|||||||
if ($num <= $limit) {
|
if ($num <= $limit) {
|
||||||
// Print total
|
// Print total
|
||||||
print "<tr ".$bc[!$var].">";
|
print "<tr ".$bc[!$var].">";
|
||||||
print "<TD colspan=3 align=\"left\">Total : </TD>";
|
print "<td colspan=3 align=\"left\">Total : </TD>";
|
||||||
print "<TD align=\"right\"><b>".price($total)."</b></TD>";
|
print "<td align=\"right\"><b>".price($total)."</b></TD>";
|
||||||
print "<TD align=\"right\"><b>".price($total_ttc)."</b></TD>";
|
print "<td align=\"right\"><b>".price($total_ttc)."</b></TD>";
|
||||||
print "<TD align=\"right\"><b>".price($totalrecu)."</b></TD>";
|
print "<td align=\"right\"><b>".price($totalrecu)."</b></TD>";
|
||||||
print '<td align="center"> </td>';
|
print '<td align="center"> </td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -81,7 +81,7 @@ if ($_POST["action"] == 'add_paiement')
|
|||||||
// Insertion dans llx_bank
|
// Insertion dans llx_bank
|
||||||
$label = "Règlement charge";
|
$label = "Règlement charge";
|
||||||
$acc = new Account($db, $_POST["accountid"]);
|
$acc = new Account($db, $_POST["accountid"]);
|
||||||
$bank_line_id = $acc->addline($paiement->datepaye, $paiement->paiementtype, $label, $total, $paiement->num_paiement, '', $user);
|
$bank_line_id = $acc->addline($paiement->datepaye, $paiement->paiementtype, $label, -abs($total), $paiement->num_paiement, '', $user);
|
||||||
|
|
||||||
// Mise a jour fk_bank dans llx_paiementcharge. On connait ainsi le paiement qui a généré l'écriture bancaire
|
// Mise a jour fk_bank dans llx_paiementcharge. On connait ainsi le paiement qui a généré l'écriture bancaire
|
||||||
if ($bank_line_id) {
|
if ($bank_line_id) {
|
||||||
|
|||||||
@ -41,11 +41,11 @@ class FactureFourn
|
|||||||
var $db_table;
|
var $db_table;
|
||||||
var $propalid;
|
var $propalid;
|
||||||
var $lignes;
|
var $lignes;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialisation
|
* Initialisation
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Function FactureFourn($DB, $soc_idp="", $facid="")
|
Function FactureFourn($DB, $soc_idp="", $facid="")
|
||||||
{
|
{
|
||||||
$this->db = $DB ;
|
$this->db = $DB ;
|
||||||
@ -150,8 +150,9 @@ class FactureFourn
|
|||||||
$this->updateprice($this->id);
|
$this->updateprice($this->id);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
* Création d'une facture fournisseur
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Function create($user)
|
Function create($user)
|
||||||
@ -286,25 +287,6 @@ class FactureFourn
|
|||||||
print $this->db->error();
|
print $this->db->error();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
Function valid($userid, $dir)
|
|
||||||
{
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture SET fk_statut = 1, date_valid=now(), fk_user_valid=$userid";
|
|
||||||
$sql .= " WHERE rowid = $this->id AND fk_statut = 0 ;";
|
|
||||||
|
|
||||||
if ($this->db->query($sql) )
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print $this->db->error() . ' in ' . $sql;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Suppression de la facture
|
* Suppression de la facture
|
||||||
@ -338,48 +320,40 @@ class FactureFourn
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
Function set_payed($rowid)
|
|
||||||
{
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture set paye = 1 WHERE rowid = $rowid ;";
|
|
||||||
$return = $this->db->query( $sql);
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
Function set_valid($rowid, $userid)
|
|
||||||
{
|
|
||||||
global $conf;
|
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture set fk_statut = 1, fk_user_valid = $userid WHERE rowid = $rowid ;";
|
/*
|
||||||
|
* Passe une facture fournisseur a l'état validé
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
Function set_valid($userid)
|
||||||
|
{
|
||||||
|
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn set fk_statut = 1, fk_user_valid = $userid WHERE rowid = ".$this->id;
|
||||||
$result = $this->db->query( $sql);
|
$result = $this->db->query( $sql);
|
||||||
|
if (! $result) {
|
||||||
|
print "Erreur : $sql : ".$this->db->error();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$dir = $conf->facture->outputdir . "/" . $rowid;
|
|
||||||
|
|
||||||
if (! is_dir ("$dir"))
|
|
||||||
{
|
|
||||||
if (! mkdir ("$dir"))
|
|
||||||
{
|
|
||||||
print $dir;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
|
* Passe une facture fournisseur a l'état payé
|
||||||
*
|
*
|
||||||
*
|
*/
|
||||||
|
Function set_payed($userid)
|
||||||
|
{
|
||||||
|
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn set paye = 1 WHERE rowid = ".$this->id;
|
||||||
|
$result = $this->db->query( $sql);
|
||||||
|
if (! $result) {
|
||||||
|
print "Erreur : $sql : ".$this->db->error();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Function addline($facid, $desc, $pu, $qty)
|
Function addline($facid, $desc, $pu, $qty)
|
||||||
{
|
{
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."facturedet (fk_facture,description,price,qty) VALUES ($facid, '$desc', $pu, $qty) ;";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."facture_fourn_det (fk_facture,description,price,qty) VALUES ($facid, '$desc', $pu, $qty) ;";
|
||||||
$result = $this->db->query( $sql);
|
$result = $this->db->query( $sql);
|
||||||
|
|
||||||
$this->updateprice($facid);
|
$this->updateprice($facid);
|
||||||
@ -390,7 +364,7 @@ class FactureFourn
|
|||||||
*/
|
*/
|
||||||
Function updateline($rowid, $desc, $pu, $qty)
|
Function updateline($rowid, $desc, $pu, $qty)
|
||||||
{
|
{
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set description='$desc',price=$pu,qty=$qty WHERE rowid = $rowid ;";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."facture-fourn_det set description='$desc',price=$pu,qty=$qty WHERE rowid = $rowid ;";
|
||||||
$result = $this->db->query( $sql);
|
$result = $this->db->query( $sql);
|
||||||
|
|
||||||
$this->updateprice($this->id);
|
$this->updateprice($this->id);
|
||||||
@ -401,7 +375,7 @@ class FactureFourn
|
|||||||
*/
|
*/
|
||||||
Function deleteline($rowid)
|
Function deleteline($rowid)
|
||||||
{
|
{
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet WHERE rowid = $rowid;";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_det WHERE rowid = $rowid;";
|
||||||
$result = $this->db->query( $sql);
|
$result = $this->db->query( $sql);
|
||||||
|
|
||||||
$this->updateprice($this->id);
|
$this->updateprice($this->id);
|
||||||
@ -448,14 +422,6 @@ class FactureFourn
|
|||||||
Function pdf()
|
Function pdf()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
print "<hr><b>Génération du PDF</b><p>";
|
|
||||||
|
|
||||||
$command = "export DBI_DSN=\"".$GLOBALS["DBI"]."\" ";
|
|
||||||
$command .= " ; ../../scripts/facture-tex.pl --facture=$facid --pdf --ps" ;
|
|
||||||
|
|
||||||
$output = system($command);
|
|
||||||
print "<p>command : $command<br>";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,6 +22,7 @@
|
|||||||
*/
|
*/
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
require("./paiementfourn.class.php");
|
require("./paiementfourn.class.php");
|
||||||
|
require("../../facturefourn.class.php");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sécurité accés client
|
* Sécurité accés client
|
||||||
@ -36,14 +37,19 @@ $html = new Form($db);
|
|||||||
|
|
||||||
if ($action == 'valid')
|
if ($action == 'valid')
|
||||||
{
|
{
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn set fk_statut = 1 WHERE rowid = $facid ;";
|
print "ddddddddddddddd";
|
||||||
$result = $db->query( $sql);
|
$facturefourn=new FactureFourn($db);
|
||||||
|
$facturefourn->fetch($_GET["facid"]);
|
||||||
|
|
||||||
|
$facturefourn->set_valid($user->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'payed')
|
if ($action == 'payed')
|
||||||
{
|
{
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn set paye = 1 WHERE rowid = $facid ;";
|
$facturefourn=new FactureFourn($db);
|
||||||
$result = $db->query( $sql);
|
$facturefourn->fetch($_GET["facid"]);
|
||||||
|
|
||||||
|
$facturefourn->set_payed($user->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($_GET["action"] == 'deletepaiement')
|
if($_GET["action"] == 'deletepaiement')
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?PHP
|
<?PHP
|
||||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -20,14 +21,12 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
require("../../main.inc.php");
|
require("../../main.inc.php");
|
||||||
require("../../facturefourn.class.php");
|
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT."/compta/bank/account.class.php";
|
include_once DOL_DOCUMENT_ROOT."/compta/bank/account.class.php";
|
||||||
|
|
||||||
function llxHeader($head = "", $urlp = "") {
|
function llxHeader($head = "", $urlp = "") {
|
||||||
global $user, $conf;
|
global $user, $conf;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user