Ajout possibilité de mettre des documents sur les factures

This commit is contained in:
Laurent Destailleur 2006-06-07 22:18:30 +00:00
parent 4aa4b5682d
commit d3ad176b82
4 changed files with 70 additions and 65 deletions

View File

@ -225,7 +225,7 @@ if ($id > 0)
$head = facture_prepare_head($facture); $head = facture_prepare_head($facture);
dolibarr_fiche_head($head, 1, $langs->trans('InvoiceCustomer')); dolibarr_fiche_head($head, 'contact', $langs->trans('InvoiceCustomer'));
/* /*
* Facture synthese pour rappel * Facture synthese pour rappel

View File

@ -43,13 +43,12 @@ llxHeader();
$fac = new Facture($db); $fac = new Facture($db);
$fac->fetch($_GET["facid"]); $fac->fetch($_GET["facid"]);
$fac->info($_GET["facid"]); $fac->info($_GET["facid"]);
$soc = new Societe($db, $fac->socidp); $soc = new Societe($db, $fac->socidp);
$soc->fetch($fac->socidp); $soc->fetch($fac->socidp);
$head = facture_prepare_head($fac); $head = facture_prepare_head($fac);
$hselected = 3; dolibarr_fiche_head($head, 'info', $langs->trans("InvoiceCustomer"));
if ($conf->use_preview_tabs) $hselected++;
if ($fac->mode_reglement_code == 'PRE') $hselected++;
dolibarr_fiche_head($head, $hselected, $langs->trans("InvoiceCustomer"));
print '<table width="100%"><tr><td>'; print '<table width="100%"><tr><td>';

View File

@ -792,32 +792,35 @@ class Facture
if ($resql) if ($resql)
{ {
$this->facnumber=$numfa; $this->facnumber=$numfa;
dolibarr_syslog("Facture::set_valid() sql=$sql");
} }
else else
{ {
dolibarr_syslog("Facture::set_valid() Echec update - 10"); dolibarr_syslog("Facture::set_valid() Echec update - 10 - sql=$sql");
dolibarr_print_error($this->db); dolibarr_print_error($this->db);
$error++; $error++;
} }
// On renomme repertoire facture ($this->ref = ancienne ref, $numfa = nouvelle ref)
// afin de ne pas perdre les fichiers attachés
$facref = sanitize_string($this->ref);
$dirsource = $conf->facture->dir_output.'/'.$facref;
$dirdest = $conf->facture->dir_output.'/'.$numfa;
dolibarr_syslog("Facture::set_valid() renommage rep ".$dirsource." en ".$dirdest);
if (rename($dirsource, $dirdest))
{
dolibarr_syslog("Renommage ok");
// Suppression ancien fichier PDF dans nouveau rep
dol_delete_file($conf->facture->dir_output.'/'.$numfa.'/'.$facref.'.*');
}
/* /*
* Lit les avoirs / remises absolues en cours et les décrémente * Tope les lignes de remises fixes avec id des lignes de facture au montant négatif
*/ */
$remise_a_decrementee=$this->remise_absolue; /* TODO Toper les lignes de remises fixes avec id des lignes de facture au montant négatif.
if ($remise_a_decrementee)
{
$sql = 'SELECT rowid, fk_soc, datec, rc.amount_ht as amount, fk_user, description';
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc';
$sql.= ' WHERE rc.fk_soc ='. $this->socidp;
$sql.= ' AND fk_facture IS NULL';
$sql.= ' ORDER BY datec';
$resql = $this->db->query($sql) ;
if ($resql)
{
$nurmx = $this->db->num_rows($resql);
if ($nurmx > 0)
{
$i=0;
while ($i < $nurmx && $remise_a_decrementee && ! $error) while ($i < $nurmx && $remise_a_decrementee && ! $error)
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
@ -856,15 +859,7 @@ class Facture
$remise_a_decrementee-=min($remise_a_decrementee,$avoir); $remise_a_decrementee-=min($remise_a_decrementee,$avoir);
$i++; $i++;
} }
} */
$this->db->free($resql);
}
else
{
dolibarr_syslog('Facture::set_valid() Erreur lecture Remise');
$error++;
}
}
/* /*

View File

@ -36,17 +36,19 @@ function facture_prepare_head($fac)
$head[$h][0] = DOL_URL_ROOT.'/compta/facture.php?facid='.$fac->id; $head[$h][0] = DOL_URL_ROOT.'/compta/facture.php?facid='.$fac->id;
$head[$h][1] = $langs->trans('CardBill'); $head[$h][1] = $langs->trans('CardBill');
$hselected = $h; $head[$h][2] = 'compta';
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/contact.php?facid='.$fac->id; $head[$h][0] = DOL_URL_ROOT.'/compta/facture/contact.php?facid='.$fac->id;
$head[$h][1] = $langs->trans('BillContacts'); $head[$h][1] = $langs->trans('BillContacts');
$head[$h][2] = 'contact';
$h++; $h++;
if ($conf->use_preview_tabs) if ($conf->use_preview_tabs)
{ {
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/apercu.php?facid='.$fac->id; $head[$h][0] = DOL_URL_ROOT.'/compta/facture/apercu.php?facid='.$fac->id;
$head[$h][1] = $langs->trans('Preview'); $head[$h][1] = $langs->trans('Preview');
$head[$h][2] = 'preview';
$h++; $h++;
} }
@ -54,14 +56,23 @@ function facture_prepare_head($fac)
{ {
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$fac->id; $head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$fac->id;
$head[$h][1] = $langs->trans('StandingOrders'); $head[$h][1] = $langs->trans('StandingOrders');
$head[$h][2] = 'standingorders';
$h++; $h++;
} }
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$fac->id; $head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$fac->id;
$head[$h][1] = $langs->trans('Note'); $head[$h][1] = $langs->trans('Note');
$head[$h][2] = 'note';
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/document.php?facid='.$fac->id;
$head[$h][1] = $langs->trans('Documents');
$head[$h][2] = 'documents';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/info.php?facid='.$fac->id; $head[$h][0] = DOL_URL_ROOT.'/compta/facture/info.php?facid='.$fac->id;
$head[$h][1] = $langs->trans('Info'); $head[$h][1] = $langs->trans('Info');
$head[$h][2] = 'info';
$h++; $h++;
return $head; return $head;