Task #8618
This commit is contained in:
parent
bca7312d3d
commit
af4fabc531
@ -982,6 +982,8 @@ class FactureFournisseur extends Facture
|
||||
{
|
||||
global $user,$langs,$conf;
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
// Charge tableau des produits prodids
|
||||
$prodids = array();
|
||||
|
||||
@ -1007,7 +1009,7 @@ class FactureFournisseur extends Facture
|
||||
$this->ref = 'SPECIMEN';
|
||||
$this->specimen=1;
|
||||
$this->socid = 1;
|
||||
$this->date = time();
|
||||
$this->date = $now;
|
||||
$this->date_lim_reglement=$this->date+3600*24*30;
|
||||
$this->cond_reglement_code = 'RECEP';
|
||||
$this->mode_reglement_code = 'CHQ';
|
||||
|
||||
@ -155,17 +155,32 @@ if($_GET['action'] == 'deletepaiement')
|
||||
|
||||
if ($_POST['action'] == 'update' && ! $_POST['cancel'])
|
||||
{
|
||||
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||
$error=0;
|
||||
|
||||
$date = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||
$date_echeance = dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']);
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn set ';
|
||||
$sql .= " facnumber='".addslashes(trim($_POST['facnumber']))."'";
|
||||
$sql .= ", libelle='".addslashes(trim($_POST['libelle']))."'";
|
||||
$sql .= ", note='".$_POST['note']."'";
|
||||
$sql .= ", datef = '".$db->idate($datefacture)."'";
|
||||
$sql .= ", date_lim_reglement = '".$db->idate($date_echeance)."'";
|
||||
$sql .= ' WHERE rowid = '.$_GET['facid'].' ;';
|
||||
$result = $db->query($sql);
|
||||
if (! $date)
|
||||
{
|
||||
$msg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("DateEch"));
|
||||
$error++;
|
||||
}
|
||||
if ($date_echeance && $date_echeance < $date)
|
||||
{
|
||||
$date_echeance = $date;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn set ';
|
||||
$sql .= " facnumber='".$db->escape(trim($_POST['facnumber']))."'";
|
||||
$sql .= ", libelle='".$db->escape(trim($_POST['libelle']))."'";
|
||||
$sql .= ", note='".$db->escape($_POST['note'])."'";
|
||||
$sql .= ", datef = '".$db->idate($date)."'";
|
||||
$sql .= ", date_lim_reglement = '".$db->idate($date_echeance)."'";
|
||||
$sql .= ' WHERE rowid = '.$_GET['facid'].' ;';
|
||||
$result = $db->query($sql);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Action creation
|
||||
@ -399,7 +414,7 @@ if ($_POST['action'] == 'classin')
|
||||
{
|
||||
$facture = new FactureFournisseur($db,'',$_GET['facid']);
|
||||
$facture->fetch($_GET['facid']);
|
||||
$facture->setProject($_POST['projectid']);
|
||||
$result=$facture->setProject($_POST['projectid']);
|
||||
}
|
||||
|
||||
|
||||
@ -1288,35 +1303,37 @@ else
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
if ($_GET['action'] != 'edit')
|
||||
{
|
||||
print '<table width="100%"><tr><td width="50%" valign="top">';
|
||||
print '<a name="builddoc"></a>'; // ancre
|
||||
|
||||
print '<table width="100%"><tr><td width="50%" valign="top">';
|
||||
print '<a name="builddoc"></a>'; // ancre
|
||||
/*
|
||||
* Documents generes
|
||||
*/
|
||||
|
||||
/*
|
||||
* Documents generes
|
||||
*/
|
||||
$facfournref=dol_sanitizeFileName($fac->ref);
|
||||
$file=$conf->fournisseur->dir_output.'/facture/'. $facfournref . '/' . $facfournref . '.pdf';
|
||||
$relativepath = $facfournref.'/'.$facfournref.'.pdf';
|
||||
$filedir = $conf->fournisseur->dir_output . '/facture/' . $facfournref;
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?facid='.$fac->id;
|
||||
$genallowed=$user->rights->fournisseur->facture->creer;
|
||||
$delallowed=$user->rights->fournisseur->facture->supprimer;
|
||||
|
||||
$facfournref=dol_sanitizeFileName($fac->ref);
|
||||
$file=$conf->fournisseur->dir_output.'/facture/'. $facfournref . '/' . $facfournref . '.pdf';
|
||||
$relativepath = $facfournref.'/'.$facfournref.'.pdf';
|
||||
$filedir = $conf->fournisseur->dir_output . '/facture/' . $facfournref;
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?facid='.$fac->id;
|
||||
$genallowed=$user->rights->fournisseur->facture->creer;
|
||||
$delallowed=$user->rights->fournisseur->facture->supprimer;
|
||||
$somethingshown=$formfile->show_documents('facture_fournisseur',$facfournref,$filedir,$urlsource,$genallowed,$delallowed,$facture->modelpdf);
|
||||
|
||||
$somethingshown=$formfile->show_documents('facture_fournisseur',$facfournref,$filedir,$urlsource,$genallowed,$delallowed,$facture->modelpdf);
|
||||
print '</td><td valign="top" width="50%">';
|
||||
print '<br>';
|
||||
|
||||
print '</td><td valign="top" width="50%">';
|
||||
print '<br>';
|
||||
// List of actions on element
|
||||
/*
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php');
|
||||
$formactions=new FormActions($db);
|
||||
$somethingshown=$formactions->showactions($fac,'invoice_supplier',$socid);
|
||||
*/
|
||||
|
||||
// List of actions on element
|
||||
/*
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php');
|
||||
$formactions=new FormActions($db);
|
||||
$somethingshown=$formactions->showactions($fac,'invoice_supplier',$socid);
|
||||
*/
|
||||
|
||||
print '</td></tr></table>';
|
||||
print '</td></tr></table>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -152,7 +152,7 @@ function facture_pdf_create($db, $object, $message, $modele, $outputlangs)
|
||||
// Positionne modele sur le nom du modele a utiliser
|
||||
if (! dol_strlen($modele))
|
||||
{
|
||||
if ($conf->global->FACTURE_ADDON_PDF)
|
||||
if (! empty($conf->global->FACTURE_ADDON_PDF))
|
||||
{
|
||||
$modele = $conf->global->FACTURE_ADDON_PDF;
|
||||
}
|
||||
|
||||
@ -80,8 +80,9 @@ function supplier_invoice_pdf_create($db, $object, $model, $outputlangs)
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("Error")." ".$langs->trans("Error_INVOICE_SUPPLIER_ADDON_PDF_NotDefined");
|
||||
return 0;
|
||||
$model = 'canelle';
|
||||
//print $langs->trans("Error")." ".$langs->trans("Error_INVOICE_SUPPLIER_ADDON_PDF_NotDefined");
|
||||
//return 0;
|
||||
}
|
||||
}
|
||||
// Charge le modele
|
||||
|
||||
@ -108,7 +108,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
$outputlangs->load("companies");
|
||||
$outputlangs->load("bills");
|
||||
$outputlangs->load("products");
|
||||
|
||||
|
||||
if ($conf->fournisseur->dir_output.'/facture')
|
||||
{
|
||||
$deja_regle = "";
|
||||
@ -614,10 +614,10 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
|
||||
$posy+=6;
|
||||
$pdf->SetXY(100,$posy);
|
||||
if ($object->date_facture)
|
||||
if ($object->date)
|
||||
{
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->date_facture,"day",false,$outputlangs,true), '', 'R');
|
||||
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->date,"day",false,$outputlangs,true), '', 'R');
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user