';
- if ($mailfile->error)
- {
- $mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto);
- $mesg.='
'.$mailfile->error;
- }
- else
- {
- $mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
- }
- $mesg.='
';
- }
- }
- }
- else
- {
- $langs->load("other");
- $mesg='';
-
- // Ref
- print '| '.$langs->trans("Ref").' | ';
- print '';
- print $html->showrefnav($commande,'ref','',1,'ref','ref');
- print ' | ';
- print '
';
-
- // Ref supplier
-/* print '| '.$langs->trans("RefSupplier")." | ";
- print ''.$commande->ref_supplier.' | ';
- print '
';
-*/
- // Fournisseur
- print '| '.$langs->trans("Supplier")." | ";
- print ''.$soc->getNomUrl(1,'supplier').' | ';
- print '
';
-
- // Statut
- print '';
- print '| '.$langs->trans("Status").' | ';
- print '';
- print $commande->getLibStatut(4);
- print " |
";
-
- // Date
- if ($commande->methode_commande_id > 0)
- {
- print '| '.$langs->trans("Date").' | ';
- if ($commande->date_commande)
- {
- print dol_print_date($commande->date_commande,"dayhourtext")."\n";
- }
- print " |
";
-
- if ($commande->methode_commande)
- {
- print '| '.$langs->trans("Method").' | '.$commande->methode_commande.' |
';
- }
- }
-
- // Author
- print '| '.$langs->trans("AuthorRequest").' | ';
- print ''.$author->getNomUrl(1).' | ';
- print '
';
-
- // Conditions de reglement par defaut
- $langs->load('bills');
- $html = new Form($db);
- print '| ';
- print '';
- print ' | ';
- if ($_GET['action'] == 'editconditions')
- {
- $html->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->cond_reglement_id,'cond_reglement_id');
- }
- else
- {
- $html->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->cond_reglement_id,'none');
- }
- print " | ";
- print '
';
-
- // Project
- if ($conf->projet->enabled)
- {
- $langs->load('projects');
- print '| ';
- print '';
- print ' | ';
- //print "$commande->id, $commande->socid, $commande->fk_project";
- if ($_GET['action'] == 'classer')
- {
- $html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socid, $commande->fk_project, 'projectid');
- }
- else
- {
- $html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socid, $commande->fk_project, 'none');
- }
- print ' | ';
- print '
';
- }
-
- // Ligne de 3 colonnes
- print '| '.$langs->trans("AmountHT").' | ';
- print ''.price($commande->total_ht).' | ';
- print ''.$langs->trans("Currency".$conf->monnaie).' |
';
-
- print '| '.$langs->trans("AmountVAT").' | '.price($commande->total_tva).' | ';
- print ''.$langs->trans("Currency".$conf->monnaie).' |
';
-
- // Amount Local Taxes
- if ($mysoc->pays_code=='ES')
- {
- if ($mysoc->localtax1_assuj=="1") //Localtax1 RE
- {
- print '| '.$langs->transcountry("AmountLT1",$mysoc->pays_code).' | ';
- print ''.price($commande->total_localtax1).' | ';
- print ''.$langs->trans("Currency".$conf->monnaie).' |
';
- }
- if ($mysoc->localtax2_assuj=="1") //Localtax2 IRPF
- {
- print '| '.$langs->transcountry("AmountLT2",$mysoc->pays_code).' | ';
- print ''.price($commande->total_localtax2).' | ';
- print ''.$langs->trans("Currency".$conf->monnaie).' |
';
- }
- }
- print '| '.$langs->trans("AmountTTC").' | '.price($commande->total_ttc).' | ';
- print ''.$langs->trans("Currency".$conf->monnaie).' |
';
-
- print "
";
-
- if ($mesg) print $mesg;
- else print '';
-
- $num = sizeof($commande->lines);
- $i = 0; $total = 0;
-
- if ($num)
- {
- print '';
- print '| '.$langs->trans('Label').' | ';
- print ''.$langs->trans('VAT').' | ';
- print ''.$langs->trans('PriceUHT').' | ';
- print ''.$langs->trans('Qty').' | ';
- print ''.$langs->trans('ReductionShort').' | ';
- print ''.$langs->trans('TotalHTShort').' | ';
- print ' | ';
- print "
\n";
- }
- $var=true;
- while ($i < $num)
- {
- $line = $commande->lines[$i];
- $var=!$var;
-
- // Show product and description
- $type=$line->product_type?$line->product_type:$line->fk_product_type;
- // Try to enhance type detection using date_start and date_end for free lines where type
- // was not saved.
- if (! empty($line->date_start)) $type=1;
- if (! empty($line->date_end)) $type=1;
-
- // Ligne en mode visu
- if ($_GET['action'] != 'editline' || $_GET['rowid'] != $line->id)
- {
- print '';
-
- // Show product and description
- print '';
- if ($line->fk_product > 0)
- {
- print ''; // ancre pour retourner sur la ligne
-
- $product_static=new ProductFournisseur($db);
- $product_static->fetch($line->fk_product);
- $text=$product_static->getNomUrl(1,'supplier');
- $text.= ' - '.$product_static->libelle;
- $description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($line->description));
- print $html->textwithtooltip($text,$description,3,'','',$i);
-
- // Show range
- print_date_range($line->date_start,$line->date_end);
-
- // Add description in form
- if ($conf->global->PRODUIT_DESC_IN_FORM) print ($line->description && $line->description!=$product_static->libelle)?' '.dol_htmlentitiesbr($line->description):'';
- }
-
- // Description - Editor wysiwyg
- if (! $line->fk_product)
- {
- if ($type==1) $text = img_object($langs->trans('Service'),'service');
- else $text = img_object($langs->trans('Product'),'product');
- print $text.' '.nl2br($line->description);
-
- // Show range
- print_date_range($line->date_start,$line->date_end);
- }
-
- print ' | ';
-
- print ''.vatrate($line->tva_tx).'% | ';
-
- print ''.price($line->subprice)." | \n";
-
- print ''.$line->qty.' | ';
-
- if ($line->remise_percent > 0)
- {
- print ''.dol_print_reduction($line->remise_percent,$langs)." | \n";
- }
- else
- {
- print ' | ';
- }
-
- print ''.price($line->total_ht).' | ';
- if ($commande->statut == 0 && $user->rights->fournisseur->commande->creer)
- {
- print 'id.'&action=editline&rowid='.$line->id.'#'.$line->id.'">';
- print img_edit();
- print ' | ';
-
- $actiondelete='delete_product_line';
- print 'id.'&action='.$actiondelete.'&lineid='.$line->id.'">';
- print img_delete();
- print ' | ';
- }
- else
- {
- print ' | | ';
- }
- print "
";
- }
-
- // Ligne en mode update
- if ($_GET["action"] == 'editline' && $user->rights->fournisseur->commande->creer && ($_GET["rowid"] == $line->id))
- {
- print "\n";
- print '\n";
- }
- $i++;
- }
-
- /*
- * Form to add new line
- */
- if ($commande->statut == 0 && $user->rights->fournisseur->commande->creer && $_GET["action"] <> 'editline')
- {
- print '';
- print '| ';
- print ''; // ancre
- print $langs->trans('AddNewLine').' - '.$langs->trans("FreeZone").' | ';
- print ''.$langs->trans('VAT').' | ';
- print ''.$langs->trans('PriceUHT').' | ';
- print ''.$langs->trans('Qty').' | ';
- print ''.$langs->trans('ReductionShort').' | ';
- print ' | ';
- print '
';
-
- // Add free products/services form
- print '';
-
- // Ajout de produits/services predefinis
- if ($conf->product->enabled || $conf->service->enabled)
- {
- print '';
- print '| ';
- print $langs->trans("AddNewLine").' - ';
- if ($conf->service->enabled)
- {
- print $langs->trans('RecordedProductsAndServices');
- }
- else
- {
- print $langs->trans('RecordedProducts');
- }
- print ' | ';
- print ''.$langs->trans('Qty').' | ';
- print ''.$langs->trans('ReductionShort').' | ';
- print ' | ';
- print '
';
-
- print '';
- }
- }
- print '
';
- print '';
-
-
- if ($_GET['action'] != 'presend')
- {
-
- /**
- * Boutons actions
- */
- if ($user->societe_id == 0 && $_GET['action'] != 'editline' && $_GET['action'] != 'delete')
- {
- print '";
- }
-
-
- print '| ';
- print ''; // ancre
-
- /*
- * Documents generes
- */
- $comfournref = dol_sanitizeFileName($commande->ref);
- $file = $conf->fournisseur->dir_output . '/commande/' . $comfournref . '/' . $comfournref . '.pdf';
- $relativepath = $comfournref.'/'.$comfournref.'.pdf';
- $filedir = $conf->fournisseur->dir_output . '/commande/' . $comfournref;
- $urlsource=$_SERVER["PHP_SELF"]."?id=".$commande->id;
- $genallowed=$user->rights->fournisseur->commande->creer;
- $delallowed=$user->rights->fournisseur->commande->supprimer;
-
- $somethingshown=$formfile->show_documents('commande_fournisseur',$comfournref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf);
-
- $object=$commande;
-
- /*
- * Linked object block
- */
- $object->load_object_linked($object->id,$object->element);
-
- foreach($object->linked_object as $linked_object => $linked_objectid)
- {
- $tmpmodule=$linked_object;
- if ($linked_object == 'invoice_supplier') $tmpmodule='fournisseur';
- if ($linked_object == 'order_supplier') $tmpmodule='fournisseur';
- if($conf->$tmpmodule->enabled && $linked_object != $object->element)
- {
- $somethingshown=$object->showLinkedObjectBlock($linked_object,$linked_objectid,$somethingshown);
- }
- }
-
-
- print ' | ';
-
- if ( $user->rights->fournisseur->commande->commander && $commande->statut == 2)
- {
- /**
- * Commander (action=commande)
- */
- print ' ';
- print '';
- }
-
- if ( $user->rights->fournisseur->commande->receptionner && ($commande->statut == 3 ||$commande->statut == 4 ))
- {
- /**
- * Receptionner (action=livraison)
- */
- print ' ';
- print '\n";
- }
-
- // List of actions on element
- /* Hidden because" available into "Log" tab
- print ' ';
- include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php');
- $formactions=new FormActions($db);
- $somethingshown=$formactions->showactions($commande,'order_supplier',$socid);
- */
-
- print ' |
';
- }
-
-
-
/*
* Action presend
*