diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index c65c1fde57f..90240e4cd2b 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -605,8 +605,9 @@ if ($object->id > 0) $sql2.= ' WHERE c.fk_soc = s.rowid'; $sql2.= " AND c.entity IN (".getEntity('commande_fournisseur').")"; $sql2.= ' AND s.rowid = '.$object->id; - // Show orders with status validated, shipping started and delivered (well any order we can bill) - $sql2.= " AND c.fk_statut IN (5)"; + // Show orders with status validated, shipping started and delivered (even if any order we can bill) + //$sql2.= " AND c.fk_statut IN (".CommandeFournisseur::STATUS_ORDERSENT.", ".CommandeFournisseur::STATUS_RECEIVED_PARTIALLY.", ".CommandeFournisseur::STATUS_RECEIVED_COMPLETELY.")"; + $sql2.= " AND c.fk_statut IN (".CommandeFournisseur::STATUS_RECEIVED_COMPLETELY.")"; $sql2.= " AND c.billed = 0"; // Find order that are not already invoiced // just need to check received status because we have the billed status now @@ -826,7 +827,7 @@ if ($object->id > 0) { if (! empty($orders2invoice) && $orders2invoice > 0) { - if ($object->status == 1) + if ($object->status == 1) // Company is open { print '
'; } @@ -835,7 +836,7 @@ if ($object->id > 0) print ''; } } - else print ''; + else print ''; } // Add action diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 1f6baa158da..829b82a6903 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2494,11 +2494,18 @@ elseif (! empty($object->id)) { print 'id.'&action=classifybilled">'.$langs->trans("ClassifyBilled").''; } - elseif (!empty($object->linkedObjectsIds['invoice_supplier'])) + else { - if ($user->rights->fournisseur->facture->creer) + if (!empty($object->linkedObjectsIds['invoice_supplier'])) { - print 'id.'&action=classifybilled">'.$langs->trans("ClassifyBilled").''; + if ($user->rights->fournisseur->facture->creer) + { + print 'id.'&action=classifybilled">'.$langs->trans("ClassifyBilled").''; + } + } + else + { + print ''.$langs->trans("ClassifyBilled").''; } } } diff --git a/htdocs/fourn/commande/orderstoinvoice.php b/htdocs/fourn/commande/orderstoinvoice.php index 093e0fd331b..75a78087366 100644 --- a/htdocs/fourn/commande/orderstoinvoice.php +++ b/htdocs/fourn/commande/orderstoinvoice.php @@ -73,18 +73,27 @@ $date_endy = dol_mktime(23, 59, 59, $_REQUEST["date_end_delymonth"], $_REQUEST[" $extrafields = new ExtraFields($db); + // fetch optionals attributes and labels $extralabels=$extrafields->fetch_name_optionals_label('facture_fourn'); if ($action == 'create') { - if (! is_array($selected)) + if (! GETPOST('createbill')) { - $error++; - setEventMessages($langs->trans('Error_OrderNotChecked'), null, 'errors'); - } else { - $origin = GETPOST('origin'); - $originid = GETPOST('originid'); + $action = ''; + } + else + { + if (! is_array($selected)) + { + //$error++; + setEventMessages($langs->trans('Error_OrderNotChecked'), null, 'errors'); + $action = ''; + } else { + $origin = GETPOST('origin', 'alpha'); + $originid = GETPOST('originid', 'int'); + } } } @@ -286,7 +295,6 @@ if (($action == 'create' || $action == 'add') && ! $error) { $html = new Form($db); $htmlother = new FormOther($db); $formfile = new FormFile($db); -$companystatic = new Societe($db); // Mode creation if ($action == 'create' && !$error) { @@ -324,6 +332,8 @@ if ($action == 'create' && !$error) { print ''; print ''; print ''; + print ''; + print '| ' . $langs->trans('RefSupplier') . ' | '; print ' | ||||
| ' . $langs->trans('Customer') . ' | '; - print $soc->getNomUrl(1); - print ''; - print ' | '; - print '||||
| ' . $langs->trans('Date') . ' | '; print $html->selectDate('', '', '', '', '', "add", 1, 1); @@ -387,18 +390,19 @@ if ($action == 'create' && !$error) { // Public note print ' | ||||
| ' . $langs->trans('NotePublic') . ' | '; - print ''; + print ' | ' . $langs->trans('NotePublic') . ' | '; + print ''; print ' | ||
| ' . $langs->trans('NotePrivate') . ' | '; - print ''; + print ' | ' . $langs->trans('NotePrivate') . ' | '; + print ''; print ' | ||