From 861899f2723b5123654d4e7f7f3c8ba1bf18278f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Mar 2009 01:18:45 +0000 Subject: [PATCH] New: Some changes to support the type of line in entities. --- htdocs/fourn/facture/fiche.php | 152 +++++++++++++++++++++------------ 1 file changed, 97 insertions(+), 55 deletions(-) diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 9310962c5bd..7e96496118f 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -35,7 +35,7 @@ if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/project.class.php') if (!$user->rights->fournisseur->facture->lire) - accessforbidden(); +accessforbidden(); $langs->load('bills'); $langs->load('suppliers'); @@ -87,7 +87,7 @@ if ($_REQUEST['action'] == 'confirm_valid' && $_REQUEST['confirm'] == 'yes' && $ { $facturefourn=new FactureFournisseur($db); $facturefourn->fetch($_GET['facid']); - $result = $facturefourn->set_valid($user); + $result = $facturefourn->set_valid($user); } if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes') @@ -111,20 +111,20 @@ if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes') if ($_POST['action'] == 'confirm_deleteproductline' && $_POST['confirm'] == 'yes') { - if ($user->rights->fournisseur->facture->creer) - { - $facturefourn = new FactureFournisseur($db); - $facturefourn->fetch($_GET['facid']); - $facturefourn->deleteline($_GET['ligne_id']); + if ($user->rights->fournisseur->facture->creer) + { + $facturefourn = new FactureFournisseur($db); + $facturefourn->fetch($_GET['facid']); + $facturefourn->deleteline($_GET['ligne_id']); $_GET['action'] = ''; - } + } } if ($_REQUEST['action'] == 'confirm_payed' && $_REQUEST['confirm'] == 'yes' && $user->rights->fournisseur->facture->creer) { $facturefourn=new FactureFournisseur($db); $facturefourn->fetch($_GET['facid']); - $facturefourn->set_payed($user); + $facturefourn->set_payed($user); } if($_GET['action'] == 'deletepaiement') @@ -268,9 +268,9 @@ if ($_REQUEST['action'] == 'update_line') $price_base_type='TTC'; } - if ($_POST['idprod']) - { - $prod = new Product($db); + if ($_POST['idprod']) + { + $prod = new Product($db); $prod->fetch($_POST['idprod']); $label = $prod->libelle; } @@ -356,8 +356,8 @@ if ($_POST['action'] == 'classin') /* -* View -*/ + * View + */ llxHeader('','',''); @@ -504,7 +504,7 @@ else print ''.$langs->trans('DateEcheance').''; $html->select_date($fac->date_echeance,'ech','','','',"update"); - if (($fac->paye == 0) && ($fac->statut > 0) && $fac->date_echeance < ($now - $conf->facture->fournisseur->warning_delay)) print img_picto($langs->trans("Late"),"warning"); + if (($fac->paye == 0) && ($fac->statut > 0) && $fac->date_echeance < ($now - $conf->facture->fournisseur->warning_delay)) print img_picto($langs->trans("Late"),"warning"); print ''; print ''.$langs->trans('AmountHT').''.price($fac->total_ht).''; @@ -557,7 +557,7 @@ else print ''; } - print ''; + print ''; } else { @@ -573,8 +573,8 @@ else // Confirmation de la suppression d'une ligne produit if ($_GET['action'] == 'confirm_delete_line') { - $html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id.'&ligne_id='.$_GET["ligne_id"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteproductline'); - print '
'; + $html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id.'&ligne_id='.$_GET["ligne_id"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteproductline'); + print '
'; } // Clone confirmation @@ -605,8 +605,8 @@ else } /* - * Confirmation de la suppression de la facture fournisseur - */ + * Confirmation de la suppression de la facture fournisseur + */ if ($_GET['action'] == 'delete') { $html->form_confirm('fiche.php?facid='.$fac->id, $langs->trans('DeleteBill'), $langs->trans('ConfirmDeleteBill'), 'confirm_delete'); @@ -621,17 +621,17 @@ else */ print ''; - // Ref - print ''; - print "\n"; + print ''; + print "\n"; - // Ref supplier - print ''; - print "\n"; + // Ref supplier + print ''; + print "\n"; - // Societe + // Societe print ''; print ''; print ''; @@ -647,7 +647,7 @@ else print ''; print ''; // Status @@ -776,7 +776,7 @@ else /* * Lines of invoice */ - print '
'; + print '
'; print '
'.$langs->trans("Ref").''; + // Ref + print '
'.$langs->trans("Ref").''; print $html->showrefnav($fac,'facid','',1,'rowid','ref',$morehtmlref); - print '
'.$langs->trans("RefSupplier").''.$fac->ref_supplier.'
'.$langs->trans("RefSupplier").''.$fac->ref_supplier.'
'.$langs->trans('Company').''.$societe->getNomUrl(1).''.$langs->trans('OtherBills').'
'.$langs->trans('DateEcheance').''; print dol_print_date($fac->date_echeance,'daytext'); - if (($fac->paye == 0) && ($fac->statut > 0) && $fac->date_echeance < ($now - $conf->facture->fournisseur->warning_delay)) print img_picto($langs->trans("Late"),"warning"); + if (($fac->paye == 0) && ($fac->statut > 0) && $fac->date_echeance < ($now - $conf->facture->fournisseur->warning_delay)) print img_picto($langs->trans("Late"),"warning"); print '
'; $var=1; for ($i = 0 ; $i < sizeof($fac->lignes) ; $i++) @@ -915,9 +915,16 @@ else } + /* + * Form to add new line + */ + if ($fac->statut == 0 && $_GET['action'] != 'mod_ligne') { - print ''; + print ''; + print ''; print ''; print ''; print ''; @@ -928,17 +935,35 @@ else print ''; print ''; - /* Nouvelle ligne */ - $var=!$var; + // Add free products/services form print ''; print ''; print ''; + + $var=true; print ''; print ''; - print ''; print ''; print ''; - // Ajout de produits/services predefinis - if ($conf->produit->enabled) - { - print ''; - print ''; - print ''; - print ''; - $var=! $var; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - } + // Ajout de produits/services predefinis + if ($conf->produit->enabled) + { + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + print ''; + print ''; + print ''; + print ''; + $var=! $var; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } } print '
'.$langs->trans('Label').'
'; + print ''; // ancre + print $langs->trans('AddNewLine').' - '.$langs->trans("FreeZone").''.$langs->trans('VAT').''.$langs->trans('PriceUHT').''.$langs->trans('PriceUTTC').' 
'; - print ''; + + print $html->select_type_of_lines(-1,'type',1); + if ($conf->produit->enabled && $conf->service->enabled) print '
'; + + // Editor wysiwyg + if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS) + { + require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); + $doleditor=new DolEditor('label','',100,'dolibarr_details'); + $doleditor->Create(); + } + else + { + print ''; + } print '
'; - $html->select_tva('tauxtva','',$societe,$mysoc); + print ''; + //if($mysoc->tva_assuj == "0") + //print '0'; + //else + print $html->select_tva('tauxtva',$conf->defaulttx,$societe,$mysoc); print ''; print ''; @@ -954,25 +979,42 @@ else print '
'; - $html->select_produits_fournisseurs($fac->socid,'','prodfournpriceid','',$filtre); - print '  
'; + print $langs->trans("AddNewLine").' - '; + if ($conf->service->enabled) + { + print $langs->trans('RecordedProductsAndServices'); + } + else + { + print $langs->trans('RecordedProducts'); + } + print ''.$langs->trans('Qty').'  
'; + $html->select_produits_fournisseurs($fac->socid,'','prodfournpriceid','',$filtre); + print '  
';