diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php
index 9dd7435c95c..e74e9f8ee8d 100644
--- a/htdocs/fourn/facture/card.php
+++ b/htdocs/fourn/facture/card.php
@@ -2100,188 +2100,6 @@ else
$num=count($object->lines);
- /*
- $var=1;
- for ($i = 0; $i < $num; $i++)
- {
- if ($i == 0)
- {
- print '
| '.$langs->trans('Label').' | ';
- print ''.$langs->trans('VAT').' | ';
- print ''.$langs->trans('PriceUHT').' | ';
- print ''.$langs->trans('PriceUTTC').' | ';
- print ''.$langs->trans('Qty').' | ';
- print ''.$langs->trans('ReductionShort').' | ';
- print ''.$langs->trans('TotalHTShort').' | ';
- print ''.$langs->trans('TotalTTCShort').' | ';
- print ' | ';
- print ' | ';
- print '
';
- }
-
- // Show product and description
- $type=(! empty($object->lines[$i]->product_type)?$object->lines[$i]->product_type:(! empty($object->lines[$i]->fk_product_type)?$object->lines[$i]->fk_product_type:0));
- // Try to enhance type detection using date_start and date_end for free lines where type was not saved.
- $date_start='';
- $date_end='';
- if (! empty($object->lines[$i]->date_start))
- {
- $date_start=$object->lines[$i]->date_start;
- $type=1;
- }
- if (! empty($object->lines[$i]->date_end))
- {
- $date_end=$object->lines[$i]->date_end;
- $type=1;
- }
-
- $var=!$var;
-
- // Edit line
- if ($object->statut == 0 && $action == 'editline' && $_GET['lineid'] == $object->lines[$i]->rowid)
- {
- print '';
-
- // Show product and description
- print '';
-
- print '';
-
- if ((! empty($conf->product->enabled) || ! empty($conf->service->enabled)) && $object->lines[$i]->fk_product > 0)
- {
- print '';
- $product_static=new ProductFournisseur($db);
- $product_static->fetch($object->lines[$i]->fk_product);
- $text=$product_static->getNomUrl(1);
- $text.= ' - '.$product_static->libelle;
- print $text;
- print ' ';
- }
- else
- {
- $forceall=1; // For suppliers, we always show all types
- print $form->select_type_of_lines($object->lines[$i]->product_type,'type',1,0,$forceall);
- if ($forceall || (! empty($conf->product->enabled) && ! empty($conf->service->enabled))
- || (empty($conf->product->enabled) && empty($conf->service->enabled))) print ' ';
- }
-
- if (is_object($hookmanager))
- {
- $parameters=array('fk_parent_line'=>$line->fk_parent_line, 'line'=>$object->lines[$i],'var'=>$var,'num'=>$num,'i'=>$i);
- $reshook=$hookmanager->executeHooks('formEditProductOptions',$parameters,$object,$action);
- }
-
- $nbrows=ROWS_2;
- if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
- $doleditor=new DolEditor('desc',$object->lines[$i]->description,'',128,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_DETAILS,$nbrows,70);
- $doleditor->Create();
- print ' | ';
-
- // VAT
- print '';
- print $form->load_tva('tauxtva',$object->lines[$i]->tva_tx,$societe,$mysoc);
- print ' | ';
-
- // Unit price
- print ' | ';
-
- print ' | ';
-
- print ' | ';
-
- print '% | ';
-
- print ' | ';
-
- print ' | ';
-
- print '';
- print '
| ';
-
- print '
';
- }
- else // Affichage simple de la ligne
- {
- print '';
-
- // Show product and description
- print '';
- if ($object->lines[$i]->fk_product)
- {
- print ''; // ancre pour retourner sur la ligne
-
- $product_static=new ProductFournisseur($db);
- $product_static->fetch($object->lines[$i]->fk_product);
- $text=$product_static->getNomUrl(1);
- $text.= ' - '.$product_static->libelle;
- $description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($object->lines[$i]->description));
- print $form->textwithtooltip($text,$description,3,'','',$i);
-
- // Show range
- print_date_range($date_start,$date_end);
-
- // Add description in form
- if (! empty($conf->global->PRODUIT_DESC_IN_FORM)) print ($object->lines[$i]->description && $object->lines[$i]->description!=$product_static->libelle)?' '.dol_htmlentitiesbr($object->lines[$i]->description):'';
- }
-
- // Description - Editor wysiwyg
- if (! $object->lines[$i]->fk_product)
- {
- if ($type==1) $text = img_object($langs->trans('Service'),'service');
- else $text = img_object($langs->trans('Product'),'product');
- print $text.' '.nl2br($object->lines[$i]->description);
-
- // Show range
- print_date_range($date_start,$date_end);
- }
-
- if (is_object($hookmanager))
- {
- $parameters=array('fk_parent_line'=>$line->fk_parent_line, 'line'=>$object->lines[$i],'var'=>$var,'num'=>$num,'i'=>$i);
- $reshook=$hookmanager->executeHooks('formViewProductSupplierOptions',$parameters,$object,$action);
- }
- print ' | ';
-
- // VAT
- print ''.vatrate($object->lines[$i]->tva_tx, true, $object->lines[$i]->info_bits).' | ';
-
- // Unit price
- print ''.price($object->lines[$i]->pu_ht,'MU').' | ';
-
- print ''.($object->lines[$i]->pu_ttc?price($object->lines[$i]->pu_ttc,'MU'):' ').' | ';
-
- print ''.$object->lines[$i]->qty.' | ';
-
- print ''.(($object->lines[$i]->remise_percent > 0)?$object->lines[$i]->remise_percent.'%':'').' | ';
-
- print ''.price($object->lines[$i]->total_ht).' | ';
-
- print ''.price($object->lines[$i]->total_ttc).' | ';
-
- if (is_object($hookmanager))
- {
- $parameters=array('line'=>$object->lines[$i],'num'=>$num,'i'=>$i);
- $reshook=$hookmanager->executeHooks('printObjectLine',$parameters,$object,$action);
- }
-
- print '';
- if ($object->statut == 0) print 'id.'&action=editline&etat=0&lineid='.$object->lines[$i]->rowid.'">'.img_edit().'';
- else print ' ';
- print ' | ';
-
- print '';
- if ($object->statut == 0)
- {
- print 'id.'&action=confirm_delete_line&lineid='.$object->lines[$i]->rowid.'">'.img_delete().'';
- }
- else print ' ';
- print ' | ';
-
- print '
';
- }
-
- }
-*/
// Form to add new line
if ($object->statut == FactureFournisseur::STATUS_DRAFT && $user->rights->fournisseur->facture->creer)
{
@@ -2313,135 +2131,137 @@ else
print '';
- $parameters = array();
- $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
- // modified by hook
- if (empty($reshook)) {
-
- // Modify a validated invoice with no payments
- if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $action != 'edit' && $object->getSommePaiement() == 0 && $user->rights->fournisseur->facture->creer)
+ $parameters = array();
+ $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
+ // modified by hook
+ if (empty($reshook))
{
- print '
'.$langs->trans('Modify').'';
+
+ // Modify a validated invoice with no payments
+ if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $action != 'edit' && $object->getSommePaiement() == 0 && $user->rights->fournisseur->facture->creer)
+ {
+ print '
'.$langs->trans('Modify').'';
+ }
+
+ // Reopen a standard paid invoice
+ if (($object->type == FactureFournisseur::TYPE_STANDARD || $object->type == FactureFournisseur::TYPE_REPLACEMENT) && ($object->statut == 2 || $object->statut == 3)) // A paid invoice (partially or completely)
+ {
+ if (! $facidnext && $object->close_code != 'replaced') // Not replaced by another invoice
+ {
+ print '
'.$langs->trans('ReOpen').'';
+ }
+ else
+ {
+ print '
'.$langs->trans('ReOpen').'';
+ }
+ }
+
+ // Send by mail
+ if (($object->statut == FactureFournisseur::STATUS_VALIDATED || $object->statut == FactureFournisseur::STATUS_CLOSED))
+ {
+ if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->fournisseur->supplier_invoice_advance->send)
+ {
+ print '
'.$langs->trans('SendByMail').'';
+ }
+ else print '
'.$langs->trans('SendByMail').'';
+ }
+
+
+ // Make payments
+ if ($action != 'edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0)
+ {
+ print '
'.$langs->trans('DoPayment').''; // must use facid because id is for payment id not invoice
+ }
+
+ // Classify paid
+ if ($action != 'edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0)
+ {
+ print '
id.'&action=paid"';
+ print '>'.$langs->trans('ClassifyPaid').'';
+
+ //print '
id.'&action=paid">'.$langs->trans('ClassifyPaid').'';
+ }
+
+ // Validate
+ if ($action != 'edit' && $object->statut == FactureFournisseur::STATUS_DRAFT)
+ {
+ if (count($object->lines))
+ {
+ if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->facture->creer))
+ || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->supplier_invoice_advance->validate)))
+ {
+ print '
id.'&action=valid"';
+ print '>'.$langs->trans('Validate').'';
+ }
+ else
+ {
+ print '
'.$langs->trans('Validate').'';
+ }
+ }
+ }
+
+ // Clone
+ if ($action != 'edit' && $user->rights->fournisseur->facture->creer)
+ {
+ print '
id.'&action=clone&socid='.$object->socid.'">'.$langs->trans('ToClone').'';
+ }
+
+ // Delete
+ if ($action != 'edit' && $user->rights->fournisseur->facture->supprimer)
+ {
+ print '
id.'&action=delete">'.$langs->trans('Delete').'';
+ }
+ print '
';
+ print '
';
+
+ if ($action != 'edit')
+ {
+ print '';
+ //print '
';
+ //print ''; // ancre
+
+ /*
+ * Documents generes
+ */
+
+ $ref=dol_sanitizeFileName($object->ref);
+ $subdir = get_exdir($object->id,2,0,0,$object,'invoice_supplier').$ref;
+ $filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2,0,0,$object,'invoice_supplier').$ref;
+ $urlsource=$_SERVER['PHP_SELF'].'?id='.$object->id;
+ $genallowed=$user->rights->fournisseur->facture->creer;
+ $delallowed=$user->rights->fournisseur->facture->supprimer;
+ $modelpdf=(! empty($object->modelpdf)?$object->modelpdf:(empty($conf->global->INVOICE_SUPPLIER_ADDON_PDF)?'':$conf->global->INVOICE_SUPPLIER_ADDON_PDF));
+
+ print $formfile->showdocuments('facture_fournisseur',$subdir,$filedir,$urlsource,$genallowed,$delallowed,$modelpdf,1,0,0,40,0,'','','',$societe->default_lang);
+ $somethingshown=$formfile->numoffiles;
+
+ // Linked object block
+ $somethingshown = $form->showLinkedObjectBlock($object);
+
+ // Show links to link elements
+ $linktoelem = $form->showLinkToObjectBlock($object,array('supplier_order'));
+ if ($linktoelem) print ' '.$linktoelem;
+
+
+ print ' | ';
+ //print ' ';
+
+ // List of actions on element
+ include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
+ $formactions=new FormActions($db);
+ $somethingshown=$formactions->showactions($object,'invoice_supplier',$socid);
+
+ print '';
+ //print ' |
';
+ }
}
-
- // Reopen a standard paid invoice
- if (($object->type == FactureFournisseur::TYPE_STANDARD || $object->type == FactureFournisseur::TYPE_REPLACEMENT) && ($object->statut == 2 || $object->statut == 3)) // A paid invoice (partially or completely)
- {
- if (! $facidnext && $object->close_code != 'replaced') // Not replaced by another invoice
- {
- print '
'.$langs->trans('ReOpen').'';
- }
- else
- {
- print '
'.$langs->trans('ReOpen').'';
- }
- }
-
- // Send by mail
- if (($object->statut == FactureFournisseur::STATUS_VALIDATED || $object->statut == FactureFournisseur::STATUS_CLOSED))
- {
- if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->fournisseur->supplier_invoice_advance->send)
- {
- print '
'.$langs->trans('SendByMail').'';
- }
- else print '
'.$langs->trans('SendByMail').'';
- }
-
-
- // Make payments
- if ($action != 'edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0)
- {
- print '
'.$langs->trans('DoPayment').''; // must use facid because id is for payment id not invoice
- }
-
- // Classify paid
- if ($action != 'edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0)
- {
- print '
id.'&action=paid"';
- print '>'.$langs->trans('ClassifyPaid').'';
-
- //print '
id.'&action=paid">'.$langs->trans('ClassifyPaid').'';
- }
-
- // Validate
- if ($action != 'edit' && $object->statut == FactureFournisseur::STATUS_DRAFT)
- {
- if (count($object->lines))
- {
- if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->facture->creer))
- || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->supplier_invoice_advance->validate)))
- {
- print '
id.'&action=valid"';
- print '>'.$langs->trans('Validate').'';
- }
- else
- {
- print '
'.$langs->trans('Validate').'';
- }
- }
- }
-
- // Clone
- if ($action != 'edit' && $user->rights->fournisseur->facture->creer)
- {
- print '
id.'&action=clone&socid='.$object->socid.'">'.$langs->trans('ToClone').'';
- }
-
- // Delete
- if ($action != 'edit' && $user->rights->fournisseur->facture->supprimer)
- {
- print '
id.'&action=delete">'.$langs->trans('Delete').'';
- }
- print '
';
- print '
';
-
- if ($action != 'edit')
- {
- print '
';
- //print '
';
- //print ''; // ancre
-
- /*
- * Documents generes
- */
-
- $ref=dol_sanitizeFileName($object->ref);
- $subdir = get_exdir($object->id,2,0,0,$object,'invoice_supplier').$ref;
- $filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2,0,0,$object,'invoice_supplier').$ref;
- $urlsource=$_SERVER['PHP_SELF'].'?id='.$object->id;
- $genallowed=$user->rights->fournisseur->facture->creer;
- $delallowed=$user->rights->fournisseur->facture->supprimer;
- $modelpdf=(! empty($object->modelpdf)?$object->modelpdf:(empty($conf->global->INVOICE_SUPPLIER_ADDON_PDF)?'':$conf->global->INVOICE_SUPPLIER_ADDON_PDF));
-
- print $formfile->showdocuments('facture_fournisseur',$subdir,$filedir,$urlsource,$genallowed,$delallowed,$modelpdf,1,0,0,40,0,'','','',$societe->default_lang);
- $somethingshown=$formfile->numoffiles;
-
- // Linked object block
- $somethingshown = $form->showLinkedObjectBlock($object);
-
- // Show links to link elements
- $linktoelem = $form->showLinkToObjectBlock($object,array('supplier_order'));
- if ($linktoelem) print ' '.$linktoelem;
-
-
- print ' | ';
- //print ' ';
-
- // List of actions on element
- include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
- $formactions=new FormActions($db);
- $somethingshown=$formactions->showactions($object,'invoice_supplier',$socid);
-
- print '';
- //print ' |
';
- }
- }
}
+
/*
* Show mail form
- */
+ */
if (GETPOST('modelselected')) {
$action = 'presend';
}