diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index 922f1285b3c..0bede00d86d 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -1,6 +1,7 @@ * Copyright (C) 2016-2019 Alexandre Spangaro + * Copyright (C) 2019 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -50,6 +51,7 @@ $hookmanager->initHooks(array('accountancyindex')); llxHeader('', $langs->trans("AccountancyArea")); print load_fiche_titre($langs->trans("AccountancyArea"), '', 'title_accountancy'); +//dol_fiche_head(); $step = 0; @@ -175,6 +177,7 @@ else { print $langs->trans("Module10Desc")."
\n"; } +//dol_fiche_end(); // End of page llxFooter(); diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index bc728067b5f..c7db3c560af 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -670,7 +670,7 @@ if (empty($reshook)) } $qty = GETPOST('qty' . $predef); - $remise_percent = GETPOST('remise_percent' . $predef); + $remise_percent = (GETPOST('remise_percent'.$predef) != '' ? GETPOST('remise_percent'.$predef) : 0); // Extrafields $extrafieldsline = new ExtraFields($db); diff --git a/htdocs/core/class/link.class.php b/htdocs/core/class/link.class.php index a5242c597c4..6557a3be91e 100644 --- a/htdocs/core/class/link.class.php +++ b/htdocs/core/class/link.class.php @@ -334,6 +334,7 @@ class Link extends CommonObject if($this->db->num_rows($resql) > 0) { $obj = $this->db->fetch_object($resql); + $this->id=$obj->rowid; $this->entity = $obj->entity; $this->datea = $this->db->jdate($obj->datea); $this->url = $obj->url; diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 2f6c474e632..da7b2918ec7 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -826,7 +826,7 @@ function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatel } else { - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } $db->free($result); } 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 66b48164a9e..a014f819d35 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2502,11 +2502,18 @@ elseif (! empty($object->id)) { print ''.$langs->trans("ClassifyBilled").''; } - elseif (!empty($object->linkedObjectsIds['invoice_supplier'])) + else { - if ($user->rights->fournisseur->facture->creer) + if (!empty($object->linkedObjectsIds['invoice_supplier'])) { - print ''.$langs->trans("ClassifyBilled").''; + if ($user->rights->fournisseur->facture->creer) + { + print ''.$langs->trans("ClassifyBilled").''; + } + } + else + { + print ''.$langs->trans("ClassifyBilled").''; } } } diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index b1f34e5730a..7af71f7a344 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -1093,7 +1093,7 @@ if ($resql) // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation @@ -1158,6 +1158,8 @@ if ($resql) elseif ($totalarray['totalttcfield'] == $i) print ''.price($totalarray['totalttc']).''; else print ''; } + + print ''; } diff --git a/htdocs/fourn/commande/orderstoinvoice.php b/htdocs/fourn/commande/orderstoinvoice.php index 6775e9f9b65..6d808934a7b 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 ''; // Ref @@ -333,13 +343,6 @@ if ($action == 'create' && !$error) { print ''; print ''; - // Third party - print ''; - print '' . "\n"; - // Date invoice print ''; - print ''; - print ''; + print ''; + // Private note if (empty($user->societe_id)) { print ''; - print ''; - print ''; + print ''; @@ -406,10 +410,10 @@ if ($action == 'create' && !$error) { print '
' . $langs->trans('RefSupplier') . '
' . $langs->trans('Customer') . ''; - print $soc->getNomUrl(1); - 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 '' . $langs->trans('NotePublic') . ''; print '
' . $langs->trans('NotePrivate') . ''; + print '' . $langs->trans('NotePrivate') . ''; print '
'; - while ( $i < $n ) { + while ($i < $n) { print ''; - $i ++; + $i++; } // Button "Create Draft" @@ -465,10 +469,16 @@ if (($action != 'create' && $action != 'add') && !$error) { } // Date filter - if ($date_start && $date_end) - $sql .= " AND c.date_commande >= '" . $db->idate($date_start) . "' AND c.date_commande <= '" . $db->idate($date_end) . "'"; - if ($date_starty && $date_endy) - $sql .= " AND c.date_livraison >= '" . $db->idate($date_starty) . "' AND c.date_livraison <= '" . $db->idate($date_endy) . "'"; + //$sql.= dolSqlDateFilter("c.date_commande", GETPOST("date_startday", 'int'), GETPOST("date_startmonth", 'int'), GETPOST("date_startyear", 'int')); + //$sql.= dolSqlDateFilter("c.date_livraison", $search_deliveryday, $search_deliverymonth, $search_deliveryyear); + if ($date_start) + $sql .= " AND c.date_commande >= '" . $db->idate($date_start) . "'"; + if ($date_end) + $sql .= " AND c.date_commande <= '" . $db->idate($date_end) . "'"; + if ($date_starty) + $sql .= " AND c.date_livraison >= '" . $db->idate($date_starty) . "'"; + if ($date_endy) + $sql .= " AND c.date_livraison <= '" . $db->idate($date_endy) . "'"; if (! empty($sref_client)) { $sql .= natural_search('c.ref_supplier', $sref_client); @@ -484,21 +494,21 @@ if (($action != 'create' && $action != 'add') && !$error) { } $title = $langs->trans('ListOfSupplierOrders'); $title .= ' - ' . $langs->trans('StatusOrderReceivedAllShort'); + $title .= ' - ' . $soc->getNomUrl(1, 'supplier'); + $num = $db->num_rows($resql); + print load_fiche_titre($title); + $i = 0; $period = $html->selectDate($date_start, 'date_start', 0, 0, 1, '', 1, 0) . ' - ' . $html->selectDate($date_end, 'date_end', 0, 0, 1, '', 1, 0); $periodely = $html->selectDate($date_starty, 'date_start_dely', 0, 0, 1, '', 1, 0) . ' - ' . $html->selectDate($date_endy, 'date_end_dely', 0, 0, 1, '', 1, 0); - if (! empty($socid)) { - // Company - $companystatic->id = $socid; - $companystatic->nom = $soc->nom; - print '

' . $companystatic->getNomUrl(1, 'customer') . '

'; - } - print '
'; + print ''; print ''; + + print ''; print ''; print_liste_field_titre('Ref', 'orderstoinvoice.php', 'c.ref', '', '&socid=' . $socid, '', $sortfield, $sortorder); @@ -511,10 +521,12 @@ if (($action != 'create' && $action != 'add') && !$error) { // Fields title search print ''; + print ''; + // print '
'; // REF print ''; print ''; print ''; print ''; @@ -604,7 +616,7 @@ if (($action != 'create' && $action != 'add') && !$error) { print ''; print '
'; // print ''.$langs->trans("GoBack").''; - print ''; + print ''; print ''; print ''; diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index 8e985a793b3..25859ce11d8 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -154,7 +154,7 @@ OptionToSetOrderBilledNotEnabled=Option from module Workflow, to set order to 'B IfValidateInvoiceIsNoOrderStayUnbilled=If invoice validation is 'No', the order will remain to status 'Unbilled' until the invoice is validated. CloseReceivedSupplierOrdersAutomatically=Close order to status "%s" automatically if all products are received. SetShippingMode=Set shipping mode - +WithReceptionFinished=With reception finished #### supplier orders status StatusSupplierOrderCanceledShort=Canceled StatusSupplierOrderDraftShort=Draft @@ -181,4 +181,4 @@ StatusSupplierOrderToBill=Delivered StatusSupplierOrderApproved=Approved StatusSupplierOrderRefused=Refused StatusSupplierOrderReceivedPartially=Partially received -StatusSupplierOrderReceivedAll=All products received \ No newline at end of file +StatusSupplierOrderReceivedAll=All products received diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 497f46919fd..a2bd9d39fe7 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -514,7 +514,7 @@ while ($i < min($num, $limit)) // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index c7083efc455..672f17ca81b 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -320,8 +320,10 @@ if ($action == "delete") { $resql1 = $db->query($sql); $sql = "DELETE FROM " . MAIN_DB_PREFIX . "facturedet where fk_facture = ".$placeid; $resql2 = $db->query($sql); + $sql="UPDATE ".MAIN_DB_PREFIX."facture set fk_soc=".$conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]}." where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'"; + $resql3 = $db->query($sql); - if ($resql1 && $resql2) + if ($resql1 && $resql2 && $resql3) { $db->commit(); }