Fixed: Bad url link

This commit is contained in:
Laurent Destailleur 2014-12-10 21:14:59 +01:00
parent 99e5715f28
commit b681885542

View File

@ -73,7 +73,7 @@ $date_endy = dol_mktime(23, 59, 59, $_REQUEST["date_end_delymonth"], $_REQUEST["
if ($action == 'create') { if ($action == 'create') {
if (is_array($selected) == false) { if (is_array($selected) == false) {
$mesgs = array ( $mesgs = array (
'<div class="error">' . $langs->trans('Error_OrderNotChecked') . '</div>' '<div class="error">' . $langs->trans('Error_OrderNotChecked') . '</div>'
); );
} else { } else {
$origin = GETPOST('origin'); $origin = GETPOST('origin');
@ -91,11 +91,11 @@ $hookmanager->initHooks(array('orderstoinvoicesupplier'));
*/ */
if (($action == 'create' || $action == 'add') && empty($mesgs)) { if (($action == 'create' || $action == 'add') && empty($mesgs)) {
require_once DOL_DOCUMENT_ROOT . '/core/lib/fourn.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/fourn.lib.php';
if (! empty($conf->projet->enabled)) if (! empty($conf->projet->enabled))
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
$langs->load('bills'); $langs->load('bills');
$langs->load('products'); $langs->load('products');
$langs->load('main'); $langs->load('main');
@ -103,7 +103,7 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) {
$orders_id = $_GET['orders_to_invoice']; $orders_id = $_GET['orders_to_invoice'];
$n = count($orders_id); $n = count($orders_id);
$i = 0; $i = 0;
$originid = $orders_id[0]; $originid = $orders_id[0];
$_GET['originid'] = $orders_id[0]; $_GET['originid'] = $orders_id[0];
} }
@ -111,30 +111,30 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) {
$orders_id = $_POST['orders_to_invoice']; $orders_id = $_POST['orders_to_invoice'];
$nn = count($orders_id); $nn = count($orders_id);
$ii = 0; $ii = 0;
$originid = $orders_id[0]; $originid = $orders_id[0];
$_POST['originid'] = $orders_id[0]; $_POST['originid'] = $orders_id[0];
} }
$projectid = GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : 0; $projectid = GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : 0;
$lineid = GETPOST('lineid', 'int'); $lineid = GETPOST('lineid', 'int');
$userid = GETPOST('userid', 'int'); $userid = GETPOST('userid', 'int');
$search_ref = GETPOST('sf_ref') ? GETPOST('sf_ref') : GETPOST('search_ref'); $search_ref = GETPOST('sf_ref') ? GETPOST('sf_ref') : GETPOST('search_ref');
// Security check // Security check
if ($user->societe_id) if ($user->societe_id)
$socid = $user->societe_id; $socid = $user->societe_id;
$result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture'); $result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture');
$usehm = $conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE; $usehm = $conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE;
$object = new FactureFournisseur($db); $object = new FactureFournisseur($db);
// Insert new invoice in database // Insert new invoice in database
if ($action == 'add' && $user->rights->fournisseur->facture->creer) { if ($action == 'add' && $user->rights->fournisseur->facture->creer) {
$object->socid = GETPOST('socid'); $object->socid = GETPOST('socid');
$db->begin(); $db->begin();
$error = 0; $error = 0;
// Standard or deposit or proforma invoice // Standard or deposit or proforma invoice
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
if (empty($datefacture)) { if (empty($datefacture)) {
@ -154,17 +154,17 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) {
$projectid = GETPOST('projectid'); $projectid = GETPOST('projectid');
if ($projectid > 0) if ($projectid > 0)
$object->fk_project = $projectid; $object->fk_project = $projectid;
// Auto calculation of date due if not filled by user // Auto calculation of date due if not filled by user
if (empty($object->date_echeance)) if (empty($object->date_echeance))
$object->date_echeance = $object->calculate_date_lim_reglement(); $object->date_echeance = $object->calculate_date_lim_reglement();
if ($_POST['origin'] && $_POST['originid']) { if ($_POST['origin'] && $_POST['originid']) {
$object->origin = $_POST['origin']; $object->origin = $_POST['origin'];
$object->origin_id = $orders_id[$ii]; $object->origin_id = $orders_id[$ii];
$object->linked_objects = $orders_id; $object->linked_objects = $orders_id;
$id = $object->create($user); $id = $object->create($user);
if ($id > 0) { if ($id > 0) {
foreach ( $orders_id as $origin => $origin_id ) { foreach ( $orders_id as $origin => $origin_id ) {
$origin_id = (! empty($origin_id) ? $origin_id : $object->origin_id); $origin_id = (! empty($origin_id) ? $origin_id : $object->origin_id);
@ -180,14 +180,14 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) {
$sql .= ", " . $id; $sql .= ", " . $id;
$sql .= ", '" . $object->element . "'"; $sql .= ", '" . $object->element . "'";
$sql .= ")"; $sql .= ")";
if ($db->query($sql)) { if ($db->query($sql)) {
$db->commit(); $db->commit();
} else { } else {
$db->rollback(); $db->rollback();
} }
} }
while ( $ii < $nn ) { while ( $ii < $nn ) {
$objectsrc = new CommandeFournisseur($db); $objectsrc = new CommandeFournisseur($db);
dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines"); dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines");
@ -202,10 +202,10 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) {
$num = count($lines); $num = count($lines);
for($i = 0; $i < $num; $i ++) { for($i = 0; $i < $num; $i ++) {
$desc = ($lines[$i]->desc ? $lines[$i]->desc : $lines[$i]->libelle); $desc = ($lines[$i]->desc ? $lines[$i]->desc : $lines[$i]->libelle);
$desc = ($lines[$i]->desc ? $lines[$i]->desc : $lines[$i]->libelle); $desc = ($lines[$i]->desc ? $lines[$i]->desc : $lines[$i]->libelle);
$product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0); $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
// Dates // Dates
// TODO mutualiser // TODO mutualiser
$date_start = $lines[$i]->date_debut_prevue; $date_start = $lines[$i]->date_debut_prevue;
@ -218,14 +218,14 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) {
$date_end = $lines[$i]->date_fin_reel; $date_end = $lines[$i]->date_fin_reel;
if ($lines[$i]->date_end) if ($lines[$i]->date_end)
$date_end = $lines[$i]->date_end; $date_end = $lines[$i]->date_end;
// Reset fk_parent_line for no child products and special product // Reset fk_parent_line for no child products and special product
if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) { if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
$fk_parent_line = 0; $fk_parent_line = 0;
} }
// FIXME Missing $lines[$i]->ref_supplier and $lines[$i]->label into addline and updateline methods. They are filled when coming from order for example. // FIXME Missing $lines[$i]->ref_supplier and $lines[$i]->label into addline and updateline methods. They are filled when coming from order for example.
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->qty, $lines[$i]->fk_product, $lines[$i]->remise_percent, $date_start, $date_end, 0, $lines[$i]->info_bits, 'HT', $product_type); $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->qty, $lines[$i]->fk_product, $lines[$i]->remise_percent, $date_start, $date_end, 0, $lines[$i]->info_bits, 'HT', $product_type);
if ($result > 0) { if ($result > 0) {
$lineid = $result; $lineid = $result;
} else { } else {
@ -250,11 +250,11 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) {
} }
} }
} }
// End of object creation, we show it // End of object creation, we show it
if ($id > 0 && ! $error) { if ($id > 0 && ! $error) {
$db->commit(); $db->commit();
header('Location: ' . DOL_URL_ROOT . '/fourn/facture/fiche.php?facid=' . $id); header('Location: ' . DOL_URL_ROOT . '/fourn/facture/card.php?facid=' . $id);
exit(); exit();
} else { } else {
$db->rollback(); $db->rollback();
@ -277,10 +277,10 @@ $companystatic = new Societe($db);
// Mode creation // Mode creation
if ($action == 'create' && empty($mesgs)) { if ($action == 'create' && empty($mesgs)) {
llxHeader(); llxHeader();
print_fiche_titre($langs->trans('NewBill')); print_fiche_titre($langs->trans('NewBill'));
$soc = new Societe($db); $soc = new Societe($db);
if ($socid) if ($socid)
$res = $soc->fetch($socid); $res = $soc->fetch($socid);
@ -289,7 +289,7 @@ if ($action == 'create' && empty($mesgs)) {
$mode_reglement_id = $soc->mode_reglement_id; $mode_reglement_id = $soc->mode_reglement_id;
} }
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE) ? - 1 : ''; $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE) ? - 1 : '';
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">'; print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
@ -300,21 +300,21 @@ if ($action == 'create' && empty($mesgs)) {
print '<input type="hidden" name="origin" value="' . GETPOST('origin') . '">'; print '<input type="hidden" name="origin" value="' . GETPOST('origin') . '">';
print '<input type="hidden" name="originid" value="' . GETPOST('originid') . '">'; print '<input type="hidden" name="originid" value="' . GETPOST('originid') . '">';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref // Ref
print '<tr><td class="fieldrequired">' . $langs->trans('Ref') . '</td><td colspan="2">' . $langs->trans('Draft') . '</td></tr>'; print '<tr><td class="fieldrequired">' . $langs->trans('Ref') . '</td><td colspan="2">' . $langs->trans('Draft') . '</td></tr>';
// Ref supplier // Ref supplier
print '<tr><td class="fieldrequired">' . $langs->trans('RefSupplier') . '</td><td><input name="ref_supplier" value="' . (isset($_POST['ref_supplier']) ? $_POST['ref_supplier'] : '') . '" type="text"></td>'; print '<tr><td class="fieldrequired">' . $langs->trans('RefSupplier') . '</td><td><input name="ref_supplier" value="' . (isset($_POST['ref_supplier']) ? $_POST['ref_supplier'] : '') . '" type="text"></td>';
print '</tr>'; print '</tr>';
// Third party // Third party
print '<tr><td class="fieldrequired">' . $langs->trans('Customer') . '</td><td colspan="2">'; print '<tr><td class="fieldrequired">' . $langs->trans('Customer') . '</td><td colspan="2">';
print $soc->getNomUrl(1); print $soc->getNomUrl(1);
print '<input type="hidden" name="socid" value="' . $soc->id . '">'; print '<input type="hidden" name="socid" value="' . $soc->id . '">';
print '</td>'; print '</td>';
print '</tr>' . "\n"; print '</tr>' . "\n";
// Date invoice // Date invoice
print '<tr><td class="fieldrequired">' . $langs->trans('Date') . '</td><td colspan="2">'; print '<tr><td class="fieldrequired">' . $langs->trans('Date') . '</td><td colspan="2">';
$html->select_date('', '', '', '', '', "add", 1, 1); $html->select_date('', '', '', '', '', "add", 1, 1);
@ -330,13 +330,13 @@ if ($action == 'create' && empty($mesgs)) {
// Project // Project
if (! empty($conf->projet->enabled)) { if (! empty($conf->projet->enabled)) {
$formproject = new FormProjets($db); $formproject = new FormProjets($db);
$langs->load('projects'); $langs->load('projects');
print '<tr><td>' . $langs->trans('Project') . '</td><td colspan="2">'; print '<tr><td>' . $langs->trans('Project') . '</td><td colspan="2">';
$formproject->select_projects($soc->id, $projectid, 'projectid'); $formproject->select_projects($soc->id, $projectid, 'projectid');
print '</td></tr>'; print '</td></tr>';
} }
$objectsrc = new CommandeFournisseur($db); $objectsrc = new CommandeFournisseur($db);
$listoforders = array (); $listoforders = array ();
foreach ( $selected as $sel ) { foreach ( $selected as $sel ) {
@ -345,30 +345,30 @@ if ($action == 'create' && empty($mesgs)) {
$listoforders[] = $objectsrc->ref; $listoforders[] = $objectsrc->ref;
} }
} }
// Other attributes // Other attributes
$parameters = array ( $parameters = array (
'objectsrc' => $objectsrc, 'objectsrc' => $objectsrc,
'idsrc' => $listoforders, 'idsrc' => $listoforders,
'colspan' => ' colspan="3"' 'colspan' => ' colspan="3"'
); );
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
// Modele PDF // Modele PDF
print '<tr><td>' . $langs->trans('Model') . '</td>'; print '<tr><td>' . $langs->trans('Model') . '</td>';
print '<td>'; print '<td>';
$liste = ModelePDFSuppliersInvoices::liste_modeles($db); $liste = ModelePDFSuppliersInvoices::liste_modeles($db);
print $html->selectarray('model', $liste, $conf->global->INVOICE_SUPPLIER_ADDON_PDF); print $html->selectarray('model', $liste, $conf->global->INVOICE_SUPPLIER_ADDON_PDF);
print "</td></tr>"; print "</td></tr>";
// Public note // Public note
print '<tr>'; print '<tr>';
print '<td class="border" valign="top">' . $langs->trans('NotePublic') . '</td>'; print '<td class="border" valign="top">' . $langs->trans('NotePublic') . '</td>';
print '<td valign="top" colspan="2">'; print '<td valign="top" colspan="2">';
print '<textarea name="note_public" wrap="soft" cols="70" rows="' . ROWS_3 . '">'; print '<textarea name="note_public" wrap="soft" cols="70" rows="' . ROWS_3 . '">';
print $langs->trans("Orders") . ": " . implode(', ', $listoforders); print $langs->trans("Orders") . ": " . implode(', ', $listoforders);
print '</textarea></td></tr>'; print '</textarea></td></tr>';
// Private note // Private note
if (empty($user->societe_id)) { if (empty($user->societe_id)) {
@ -376,22 +376,22 @@ if ($action == 'create' && empty($mesgs)) {
print '<td class="border" valign="top">' . $langs->trans('NotePrivate') . '</td>'; print '<td class="border" valign="top">' . $langs->trans('NotePrivate') . '</td>';
print '<td valign="top" colspan="2">'; print '<td valign="top" colspan="2">';
print '<textarea name="note" wrap="soft" cols="70" rows="' . ROWS_3 . '">'; print '<textarea name="note" wrap="soft" cols="70" rows="' . ROWS_3 . '">';
print '</textarea></td></tr>'; print '</textarea></td></tr>';
} }
print '</table>'; print '</table>';
while ( $i < $n ) { while ( $i < $n ) {
print '<input type="hidden" name="orders_to_invoice[]" value="' . $orders_id[$i] . '">'; print '<input type="hidden" name="orders_to_invoice[]" value="' . $orders_id[$i] . '">';
$i ++; $i ++;
} }
// Button "Create Draft" // Button "Create Draft"
print '<br><center><input type="submit" class="button" name="bouton" value="' . $langs->trans('CreateDraft') . '" /></center>'; print '<br><center><input type="submit" class="button" name="bouton" value="' . $langs->trans('CreateDraft') . '" /></center>';
print "</form>\n"; print "</form>\n";
print '</td></tr>'; print '</td></tr>';
print "</table>\n"; print "</table>\n";
} }
@ -411,7 +411,7 @@ if (($action != 'create' && $action != 'add') || ! empty($mesgs)) {
}); });
</script> </script>
<?php <?php
$sql = 'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_supplier,'; $sql = 'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_supplier,';
$sql .= ' c.date_valid, c.date_commande, c.date_livraison, c.fk_statut'; $sql .= ' c.date_valid, c.date_commande, c.date_livraison, c.fk_statut';
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'societe as s'; $sql .= ' FROM ' . MAIN_DB_PREFIX . 'societe as s';
@ -420,13 +420,13 @@ if (($action != 'create' && $action != 'add') || ! empty($mesgs)) {
$sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
$sql .= ' WHERE c.entity = ' . $conf->entity; $sql .= ' WHERE c.entity = ' . $conf->entity;
$sql .= ' AND c.fk_soc = s.rowid'; $sql .= ' AND c.fk_soc = s.rowid';
// Show orders with status validated, shipping started and delivered (well any order we can bill) // Show orders with status validated, shipping started and delivered (well any order we can bill)
$sql .= " AND c.fk_statut IN (5)"; $sql .= " AND c.fk_statut IN (5)";
// Find order that are not already invoiced // Find order that are not already invoiced
$sql .= " AND c.rowid NOT IN (SELECT fk_source FROM " . MAIN_DB_PREFIX . "element_element WHERE targettype='invoice_supplier')"; $sql .= " AND c.rowid NOT IN (SELECT fk_source FROM " . MAIN_DB_PREFIX . "element_element WHERE targettype='invoice_supplier')";
if ($socid) if ($socid)
$sql .= ' AND s.rowid = ' . $socid; $sql .= ' AND s.rowid = ' . $socid;
if (! $user->rights->societe->client->voir && ! $socid) if (! $user->rights->societe->client->voir && ! $socid)
@ -437,20 +437,20 @@ if (($action != 'create' && $action != 'add') || ! empty($mesgs)) {
if ($sall) { if ($sall) {
$sql .= " AND (c.ref LIKE '%" . $db->escape($sall) . "%' OR c.note LIKE '%" . $db->escape($sall) . "%')"; $sql .= " AND (c.ref LIKE '%" . $db->escape($sall) . "%' OR c.note LIKE '%" . $db->escape($sall) . "%')";
} }
// Date filter // Date filter
if ($date_start && $date_end) if ($date_start && $date_end)
$sql .= " AND c.date_commande >= '" . $db->idate($date_start) . "' AND c.date_commande <= '" . $db->idate($date_end) . "'"; $sql .= " AND c.date_commande >= '" . $db->idate($date_start) . "' AND c.date_commande <= '" . $db->idate($date_end) . "'";
if ($date_starty && $date_endy) if ($date_starty && $date_endy)
$sql .= " AND c.date_livraison >= '" . $db->idate($date_starty) . "' AND c.date_livraison <= '" . $db->idate($date_endy) . "'"; $sql .= " AND c.date_livraison >= '" . $db->idate($date_starty) . "' AND c.date_livraison <= '" . $db->idate($date_endy) . "'";
if (! empty($sref_client)) { if (! empty($sref_client)) {
$sql .= ' AND c.ref_supplier LIKE \'%' . $db->escape($sref_client) . '%\''; $sql .= ' AND c.ref_supplier LIKE \'%' . $db->escape($sref_client) . '%\'';
} }
$sql .= ' ORDER BY ' . $sortfield . ' ' . $sortorder; $sql .= ' ORDER BY ' . $sortfield . ' ' . $sortorder;
dol_syslog('fourn/commande/ordertoinvoice.php sql=' . $sql); dol_syslog('fourn/commande/ordertoinvoice.php sql=' . $sql);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) { if ($resql) {
if ($socid) { if ($socid) {
$soc = new Societe($db); $soc = new Societe($db);
@ -463,14 +463,14 @@ if (($action != 'create' && $action != 'add') || ! empty($mesgs)) {
$i = 0; $i = 0;
$period = $html->select_date($date_start, 'date_start', 0, 0, 1, '', 1, 0, 1) . ' - ' . $html->select_date($date_end, 'date_end', 0, 0, 1, '', 1, 0, 1); $period = $html->select_date($date_start, 'date_start', 0, 0, 1, '', 1, 0, 1) . ' - ' . $html->select_date($date_end, 'date_end', 0, 0, 1, '', 1, 0, 1);
$periodely = $html->select_date($date_starty, 'date_start_dely', 0, 0, 1, '', 1, 0, 1) . ' - ' . $html->select_date($date_endy, 'date_end_dely', 0, 0, 1, '', 1, 0, 1); $periodely = $html->select_date($date_starty, 'date_start_dely', 0, 0, 1, '', 1, 0, 1) . ' - ' . $html->select_date($date_endy, 'date_end_dely', 0, 0, 1, '', 1, 0, 1);
if (! empty($socid)) { if (! empty($socid)) {
// Company // Company
$companystatic->id = $socid; $companystatic->id = $socid;
$companystatic->nom = $soc->nom; $companystatic->nom = $soc->nom;
print '<h3>' . $companystatic->getNomUrl(1, 'customer') . '</h3>'; print '<h3>' . $companystatic->getNomUrl(1, 'customer') . '</h3>';
} }
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans('Ref'), 'orderstoinvoice.php', 'c.ref', '', '&amp;socid=' . $socid, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans('Ref'), 'orderstoinvoice.php', 'c.ref', '', '&amp;socid=' . $socid, '', $sortfield, $sortorder);
@ -480,7 +480,7 @@ if (($action != 'create' && $action != 'add') || ! empty($mesgs)) {
print_liste_field_titre($langs->trans('Status'), '', '', '', '', 'align="right"'); print_liste_field_titre($langs->trans('Status'), '', '', '', '', 'align="right"');
print_liste_field_titre($langs->trans('GenerateBill'), '', '', '', '', 'align="center"'); print_liste_field_titre($langs->trans('GenerateBill'), '', '', '', '', 'align="center"');
print '</tr>'; print '</tr>';
// Lignes des champs de filtre // Lignes des champs de filtre
print '<form method="get" action="orderstoinvoice.php">'; print '<form method="get" action="orderstoinvoice.php">';
print '<input type="hidden" name="socid" value="' . $socid . '">'; print '<input type="hidden" name="socid" value="' . $socid . '">';
@ -492,48 +492,48 @@ if (($action != 'create' && $action != 'add') || ! empty($mesgs)) {
// print '<td class="liste_titre">'; // print '<td class="liste_titre">';
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" size="10" name="sref_client" value="' . $sref_client . '">'; print '<input class="flat" type="text" size="10" name="sref_client" value="' . $sref_client . '">';
// DATE ORDER // DATE ORDER
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre" align="center">';
print $period; print $period;
print '</td>'; print '</td>';
// DATE DELIVERY // DATE DELIVERY
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre" align="center">';
print $periodely; print $periodely;
print '</td>'; print '</td>';
// SEARCH BUTTON // SEARCH BUTTON
print '</td><td align="right" class="liste_titre">'; print '</td><td align="right" class="liste_titre">';
print '<input type="image" class="liste_titre" name="button_search" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">'; print '<input type="image" class="liste_titre" name="button_search" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
// ALL/NONE // ALL/NONE
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre" align="center">';
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
print '<a href="#" id="checkall">' . $langs->trans("All") . '</a> / <a href="#" id="checknone">' . $langs->trans("None") . '</a>'; print '<a href="#" id="checkall">' . $langs->trans("All") . '</a> / <a href="#" id="checknone">' . $langs->trans("None") . '</a>';
print '</td>'; print '</td>';
print '</td></tr>'; print '</td></tr>';
print '</form>'; print '</form>';
print '<form name="orders2invoice" action="orderstoinvoice.php" method="GET">'; print '<form name="orders2invoice" action="orderstoinvoice.php" method="GET">';
$var = True; $var = True;
$generic_commande = new CommandeFournisseur($db); $generic_commande = new CommandeFournisseur($db);
while ( $i < $num ) { while ( $i < $num ) {
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
$var = ! $var; $var = ! $var;
print '<tr ' . $bc[$var] . '>'; print '<tr ' . $bc[$var] . '>';
print '<td class="nowrap">'; print '<td class="nowrap">';
$generic_commande->id = $objp->rowid; $generic_commande->id = $objp->rowid;
$generic_commande->ref = $objp->ref; $generic_commande->ref = $objp->ref;
print '<table class="nobordernopadding"><tr class="nocellnopadd">'; print '<table class="nobordernopadding"><tr class="nocellnopadd">';
print '<td class="nobordernopadding nowrap">'; print '<td class="nobordernopadding nowrap">';
print $generic_commande->getNomUrl(1, $objp->fk_statut); print $generic_commande->getNomUrl(1, $objp->fk_statut);
print '</td>'; print '</td>';
print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">'; print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">';
$filename = dol_sanitizeFileName($objp->ref); $filename = dol_sanitizeFileName($objp->ref);
$filedir = $conf->fournisseur->commande->dir_output . '/' . dol_sanitizeFileName($objp->ref); $filedir = $conf->fournisseur->commande->dir_output . '/' . dol_sanitizeFileName($objp->ref);
@ -541,35 +541,35 @@ if (($action != 'create' && $action != 'add') || ! empty($mesgs)) {
print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir); print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir);
print '</td></tr></table>'; print '</td></tr></table>';
print '</td>'; print '</td>';
print '<td>' . $objp->ref_supplier . '</td>'; print '<td>' . $objp->ref_supplier . '</td>';
// Order date // Order date
print '<td align="center" nowrap>'; print '<td align="center" nowrap>';
print dol_print_date($db->jdate($objp->date_commande), 'day'); print dol_print_date($db->jdate($objp->date_commande), 'day');
print '</td>'; print '</td>';
// Delivery date // Delivery date
print '<td align="center" nowrap>'; print '<td align="center" nowrap>';
print dol_print_date($db->jdate($objp->date_livraison), 'day'); print dol_print_date($db->jdate($objp->date_livraison), 'day');
print '</td>'; print '</td>';
// Statut // Statut
print '<td align="right" class="nowrap">' . $generic_commande->LibStatut($objp->fk_statut, 5) . '</td>'; print '<td align="right" class="nowrap">' . $generic_commande->LibStatut($objp->fk_statut, 5) . '</td>';
// Checkbox // Checkbox
print '<td align="center">'; print '<td align="center">';
print '<input class="flat checkformerge" type="checkbox" name="orders_to_invoice[]" value="' . $objp->rowid . '">'; print '<input class="flat checkformerge" type="checkbox" name="orders_to_invoice[]" value="' . $objp->rowid . '">';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
$total = $total + $objp->price; $total = $total + $objp->price;
$subtotal = $subtotal + $objp->price; $subtotal = $subtotal + $objp->price;
$i ++; $i ++;
} }
print '</table>'; print '</table>';
/* /*
* Boutons actions * Boutons actions
*/ */