Merge github.com:Dolibarr/dolibarr into dev_fix_migration_livraison_to_delivery

This commit is contained in:
Florian HENRY 2020-10-26 10:36:08 +01:00
commit cae2bc6024
11 changed files with 324 additions and 87 deletions

214
ChangeLog
View File

@ -7,7 +7,221 @@ English Dolibarr ChangeLog
For users:
NEW: Add module "Credit transfer SEPA" to manage payment of vendors using bank credit transfer SEPA files.
NEW: Module Reception (for a more accurate management of your receptions) moved from experimental to stable.
NEW: Several security issues after a private bug bounty campaign.
NEW: #15065 Fix formatting
NEW: #15065 Put the product label in bold in the PDF templates if configured
NEW: Accountancy - Add chart of sub accounts
NEW: Accountancy - Add options to disable binding on sales, purchases & expense reports independently of the modules
NEW: Accountancy balance - Add a input to show subtotal by group
NEW: Accountancy - Move to real ledger, real journals, menu disposition
NEW: Accountancy - On transfers, select the periodicity by default
NEW: Add 2 rules for emailcollector: Message send/not sent from Dolibarr
NEW: Add a counter of number of words of pages in website module
NEW: add alert before change thirdparty in takepos
NEW: Add a page to list Stock at a given date.
NEW: Add a start date to begin binding in accountancy
NEW: Add a stat page to list popularity of products on invoices
NEW: Add calendar selection for agenda view
NEW: add class for ticket edition (pdf or odt)
NEW: Add column payment term into list of supplier invoices.
NEW: Add column quantity in product margin page
NEW: Add column vat rate in page to define accounting account on product/service
NEW: Add common list function for available app/module page
NEW: add costprice in fields of products list
NEW: ADDED IMPORT TOOL FOR CUSTOMER ORDER, PO, PROPOSAL MODULE, SUPPLIER INVOICE
NEW: Added incoterms to substitution array
NEW: Add employee in expense report binding page
NEW: Add export for various payment
NEW: add extra fields labels and values in mail on create ticket
NEW: Add extrafields support on ECM module
NEW: Add filter rules "is answer" and "is not answer" in email collector
NEW: Add focus when editing on product/stock/product.php Close #14548
NEW: add formConfirm hook on product page
NEW: add free text on each terminal of cash desk
NEW: Add function dolButtonToOpenUrlInDialogPopup() to be able to open
NEW: Add global search for customer payments and vendor payments
NEW: Add global search for miscellaneous payments
NEW: Add helper function for table headers with numbers
NEW: add hooks on stats pages
NEW: Add link to edit property from search result of website pages
NEW: Add link to reset qty on supplier dispatch page
NEW: add MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER const to remove header in email collector
NEW: Add Manufacturing Orders into the automatic ECM
NEW: add margin info in invoice list
NEW: Add mass action to set category on a list of website pages.
NEW: Add mass deletion for events
NEW: Add __MEMBER_TYPE__ substitution key
NEW: Add message in error_log after detection of SQL or script injection
NEW: Add module Credit transfer SEPA to manage payment of supplier using
NEW: Add more filters on monthly statement list
NEW: Add option TAKEPOS_CAN_FORCE_BANK_ACCOUNT_DURING_PAYMENT
NEW: Add option to define a default warehouse at user level
NEW: Add option to include products without alert in replenish
NEW: add order by lastname and firstname by default in get sales representatives
NEW: Add param to not show links when output tags
NEW: Add PDF document templates for warehouses (list of stock)
NEW: Add property cssview when declaring fields of an object
NEW: Add prospect status managment for the contact with managment of custom icon
NEW: Add public note on products. This also partially fix the #14342
NEW: Add quick dropdown menu in top right menu (MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN)
NEW: add region in export companies and contacts
NEW: add rights on margin info on invoice list
NEW: Add search param for close date on order list
NEW: add send context for ticket
NEW: Add show preview for mail attachement on form mail
NEW: add state origin for product
NEW: add State/Province origin for products
NEW: Add the workflow interaction close intervention on closing ticket
NEW: Add third order printer to TakePOS
NEW: add tracking number in list and search_all items
NEW: add two hooks printFieldListFrom and printFieldSearchParam
NEW: Add __TYPE__ substitution key
NEW: Add validation of MX domain for emails
NEW: add vcard for aderent and user
NEW: add week number for month view in agenda
NEW: Algeria data (tva and forme_juridique)
NEW: Allow click on all header numbers on commerce area
NEW: Allow to reopen interventions (green button)
NEW: Allow zero quality on supplier/vendor order line
NEW: Appearance tab in TakePOS with more visual parameters
NEW: Better currency rate editor
NEW: Calculate the virtual stock in transverse mode ( not on getEntity('commande'), ... but on getEntity('stock') )
NEW: Can add event to log into blockedlog module with a constant.
NEW: Can build vendor invoice from vendor orders
NEW: Can change a product in line of recurring invoice or contract
NEW: Can change size of logo on PDF documents
NEW: Can change VAT rate of all lines of a draft object in one step.
NEW: Can define date range of validity of a login during creation
NEW: Can disable, from edit page, the whole web site
NEW: can edit and set sales representatives directly on thirdparty card
NEW: Can edit the list of sending email profiles.
NEW: Can enable/disable users in bulk actions
NEW: Can filter on accounting system ref in export of chart of account
NEW: Can filter on container type, language and tags in the list of pages
NEW: Can force the antivirus from conf file or autoprepend ini setup.
NEW: Can hide eatby, sellby dates with option PRODUCT_DISABLE_SELLBY and PRODUCT_DISABLE_EATBY
NEW: Can import proposals, sales orders, supplier invoices
NEW: can set a dedicated SMTP config for sending email from public ticket interface
NEW: Can set tags/categories to website pages.
NEW: Can set type of price without tax per default for new sale price creation
NEW: Can use desired stock of a given warehouse for replenishment
NEW: Can use THEME_DARKMODEENABLED=2 for a preview of theme in dark mode
NEW: change thirdparty with barcode scan in takepos
NEW: Common behavior for monthly leave list view
NEW: conf to allow show full arbo in warehouse getnomurl
NEW: convert all subscription in datetime
NEW: create thirdparty customer from TAKEPOS
NEW: Date shipment from order accepts hours
NEW: Declinaison price level compatibility
NEW: Delayed payment in TakePOS
NEW: Development of module Recruitment
NEW: display date range if exist in takepos
NEW: display resiliate status in takepos for member
NEW: display stat for BOM on "object referent"/linked Object product tab
NEW: edit and update a ticket
NEW: edit or delete dispatched lines
NEW: Email configuration - Allow auto signed certificat when smtp ssl activated
NEW: enable free emails input with select2
NEW: endpoint getContacts and Clean results
NEW: Events in agenda for contact
NEW: Field to link website page to an other object
NEW: Fill ECM src object fields in dol_add_file_process
NEW: filter on progress column in task list
NEW: filter product list by country and/or state/province
NEW: format tickets sent by mail in public interface
NEW: add juridical status for Algeria
NEW: form to add customer/supplier into categories
NEW: Framework is ready for CSRF token protection on explicit GET URLs.
NEW: get all child recursively
NEW: Get contacts list of a given order
NEW: helper functions for export with phpspreadsheet
NEW: hide closed contract lines
NEW: hide label in pdf for variants
NEW: Hook on propal card
NEW: If specific help page is available, we change color of icon
NEW: Include the tag editor of page as a popup into website editor
NEW: Introduce constant FACTUREFOURN_REUSE_NOTES_ON_CREATE_FROM
NEW: Introducing new modal boxes in TakePOS
NEW: Keep takepos terminal when login/logout
NEW: Link on balance to the ledger
NEW: MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER const in email collector
NEW: manage errors on update extra fields in ticket card
NEW: mass-actions for the event list view
NEW: Module Intracomm report
NEW: More filter for "View change logs"
NEW: multicurrency total in takepos
NEW: multiselect type and date to date filter
NEW: Nature of product is now a dictionay
NEW: new line template: hidden conf to fill service dates from the last service line
NEW: PDF model storm for delivery
NEW: possibilty to group payments by mode and show their subtotal
NEW: Print payment method and change in TakePOS
NEW: Priority and transparency from external calendar events
NEW: Products Import/Export 'default warehouse' and 'use batch number' fields
NEW: Purchase price table: Added filterable table columns
NEW: rate editor for multicurrency
NEW: ref_ext field for Commande lines, order lines, Attributes and Combinations, Invoice lines, payments, order lines
NEW: remove new lines in mail on add ticket message
NEW: restrict thirdparty to customer in takepos
NEW: Allow to edit "demand reason" field though API
NEW: Rule "email to" accept wildcard *
NEW: Save filter of the project homepage
NEW: Select-able columns on customer invoice paymnet list
NEW: Select-able columns on miscellaneous payments + more data columns
NEW: Select-able columns on social taxes list
NEW: Select-able columns on supplier invoice payment list
NEW: send context and remove new lines on create ticket
NEW: set entity when creating invoice on takepos
NEW: Show available stock in TakePOS
NEW: Show category filter on lists only when user have rights to read categories
NEW: Show header number and make it clickable in warehouse arean, payment area, shipment area
NEW: Show image of user in the combo select of users
NEW: Show label on batch card
NEW: Show line number on intervention card (via MAIN_VIEW_LINE_NUMBER)
NEW: show links for select and multi-select in category extra field
NEW: Show module and permission ids on user/group rights (only admin)
NEW: Show place from events on import calender
NEW: Show references in contract form on interventions
NEW: Show tags and status in search list of website pages
NEW: Show user on external calender events (when found)
NEW: subject title with company name instead of application title in ticket message
NEW: Support for Samba4 AD
NEW: TakePOS connector compatibility with RECEIPT PRINTERS module
NEW: TakePOS Gift Receipt
NEW: TakePOS Multicurrency compatibility
NEW: The global header of a website can also have dynamic content
NEW: Third-Party Import new fields: mother company,outstanding debt limit,bank account,incoterms
NEW: Thirdparty module : box on customer/supplier tab for invoice outsantding amount late
NEW: ticket classification on create from email collector
NEW: Ticket message notifications when edited from public interface
NEW: translate classification labels in ticket
NEW: triggers create, modify, delete
NEW: VAT for Algeria
NEW: Use preselect third-party from list on new card
NEW: Vat report - Invert constant to show by default zero vat in reports
NEW: website page fields selection
NEW: Weighing Scale compatibility with TakePOS connector
NEW: When creating a user from a member linked to a thirdparty, you can choose to create if as external or internal user
NEW: Add clone functionality on miscellaneous payment
For developers:
NEW: Can use dynamic code into the 'enabled' property of DAO fields
NEW: API Can update a payment
NEW: api get member by thirdparty
NEW: API get thirdparty by barcode
NEW: API get users by email / login
NEW: fetch contact by email with REST API
NEW: field ref_ext in llx_commandedet
NEW: fields ref_ext for Attributes and Combinations
NEW: get state by REST API
NEW: get state dictionnary by REST API
NEW: Improve Product API for variant products
NEW: Oauth SCOPE for Admin SDK
NEW: Retrieve discount from invoice from API
NEW: standardizes API thirdparties by email like other object
NEW: thirdparty REST API: endpoint to set price level
NEW: Use new category API for project list view
NEW: Triggers Attributes and Attributes values
WARNING:

View File

@ -971,6 +971,7 @@ if (empty($reshook))
elseif ($action == 'add' && $usercancreate)
{
if ($socid > 0) $object->socid = GETPOST('socid', 'int');
$selectedLines = GETPOST('toselect', 'array');
$db->begin();
@ -1571,8 +1572,11 @@ if (empty($reshook))
$fk_parent_line = 0;
$num = count($lines);
for ($i = 0; $i < $num; $i++)
{
if (!in_array($lines[$i]->id, $selectedLines)) continue; // Skip unselected lines
// Don't add lines with qty 0 when coming from a shipment including all order lines
if ($srcobject->element == 'shipping' && $conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS && $lines[$i]->qty == 0) continue;
// Don't add closed lines when coming from a contract (Set constant to '0,5' to exclude also inactive lines)
@ -3623,8 +3627,6 @@ if ($action == 'create')
print '<input type="button" class="button" value="'.$langs->trans("Cancel").'" onClick="javascript:history.go(-1)">';
print '</div>';
print "</form>\n";
// Show origin lines
if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
print '<br>';
@ -3634,12 +3636,12 @@ if ($action == 'create')
print '<table class="noborder centpercent">';
$objectsrc->printOriginLinesList();
$objectsrc->printOriginLinesList('', $selectedLines);
print '</table>';
}
print '<br>';
print '</form>';
} elseif ($id > 0 || !empty($ref))
{
/*

View File

@ -473,12 +473,16 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST
} else {
$langs->load("other");
$mesg = '<div class="error">';
if ($mailfile->error)
{
if ($mailfile->error) {
$mesg .= $langs->transnoentities('ErrorFailedToSendMail', dol_escape_htmltag($from), dol_escape_htmltag($sendto));
$mesg .= '<br>'.$mailfile->error;
} else {
$mesg .= 'No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
$mesg .= $langs->transnoentities('ErrorFailedToSendMail', dol_escape_htmltag($from), dol_escape_htmltag($sendto));;
if (!empty($conf->global->MAIN_DISABLE_ALL_MAILS)) {
$mesg .= '<br>Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
} else {
$mesg .= '<br>Unkown Error, please refers to your administrator';
}
}
$mesg .= '</div>';

View File

@ -2785,9 +2785,9 @@ abstract class CommonObject
*/
public function line_max($fk_parent_line = 0)
{
// phpcs:enable
$positionfield = 'rang';
if ($this->table_element == 'bom') $positionfield = 'position';
// phpcs:enable
$positionfield = 'rang';
if ($this->table_element == 'bom_bom') $positionfield = 'position';
// Search the last rang with fk_parent_line
if ($fk_parent_line)

View File

@ -51,7 +51,6 @@ function shipping_prepare_head($object)
{
// delivery link
$object->fetchObjectLinked($object->id, $object->element);
var_dump($object->id);
if (is_array($object->linkedObjectsIds['delivery']) && count($object->linkedObjectsIds['delivery']) > 0) // If there is a delivery
{
// Take first one element of array
@ -158,11 +157,21 @@ function delivery_prepare_head($object)
$tmpobject = $object;
}
$head[$h][0] = DOL_URL_ROOT."/expedition/contact.php?id=".$tmpobject->id;
$head[$h][1] = $langs->trans("ContactsAddresses");
$head[$h][2] = 'contact';
$h++;
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
{
$objectsrc = $tmpobject;
if ($tmpobject->origin == 'commande' && $tmpobject->origin_id > 0)
{
$objectsrc = new Commande($db);
$objectsrc->fetch($tmpobject->origin_id);
}
$nbContact = count($objectsrc->liste_contact(-1, 'internal')) + count($objectsrc->liste_contact(-1, 'external'));
$head[$h][0] = DOL_URL_ROOT."/expedition/contact.php?id=".$tmpobject->id;
$head[$h][1] = $langs->trans("ContactsAddresses");
if ($nbContact > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbContact.'</span>';
$head[$h][2] = 'contact';
$h++;
}
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';

View File

@ -57,7 +57,7 @@ $backtopage = GETPOST('backtopage', 'alpha');
// Security check
$id = GETPOST('id', 'int');
if ($user->socid) $socid = $user->socid;
$result = restrictedArea($user, 'expedition', $id, 'delivery', 'livraison');
$result = restrictedArea($user, 'expedition', $id, 'delivery', 'delivery');
$object = new Delivery($db);
$extrafields = new ExtraFields($db);
@ -87,13 +87,14 @@ if ($action == 'add')
$db->begin();
$object->date_livraison = time();
$object->note = $_POST["note"];
$object->commande_id = $_POST["commande_id"];
$object->note = GETPOST("note", 'restricthtml');
$object->note_private = GETPOST("note", 'restricthtml');
$object->commande_id = GETPOST("commande_id", 'int');
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
if (!$conf->expedition_bon->enabled && !empty($conf->stock->enabled))
{
$expedition->entrepot_id = $_POST["entrepot_id"];
$expedition->entrepot_id = GETPOST('entrepot_id');
}
// On boucle sur chaque ligne de commande pour completer objet livraison
@ -276,7 +277,6 @@ if ($action == 'create') // Create. Seems to no be used
$head = delivery_prepare_head($object);
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update_extras_line">';
@ -364,7 +364,7 @@ if ($action == 'create') // Create. Seems to no be used
}
$morehtmlref .= '</div>';
$morehtmlright = $langs->trans("StatusReceipt").' : '.$object->getLibStatut(6).'<br>';
$morehtmlright = $langs->trans("StatusReceipt").' : '.$object->getLibStatut(6).'<br><br class="small">';
dol_banner_tab($expedition, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', $morehtmlright);

View File

@ -29,6 +29,7 @@
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/commonincoterm.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
if (!empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
if (!empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
@ -39,6 +40,8 @@ if (!empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/
*/
class Delivery extends CommonObject
{
use CommonIncoterm;
/**
* @var string ID to identify managed object
*/

View File

@ -31,7 +31,7 @@
*/
if (!defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE', 'Dolibarr');
if (!defined('DOL_VERSION')) define('DOL_VERSION', '13.0.0-alpha'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
if (!defined('DOL_VERSION')) define('DOL_VERSION', '13.0.0-beta'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
if (!defined('EURO')) define('EURO', chr(128));

View File

@ -2219,37 +2219,37 @@ class FactureFournisseur extends CommonInvoice
if ($user->socid) $sql .= ' AND ff.fk_soc = '.$user->socid;
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND ff.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id;
$resql = $this->db->query($sql);
if ($resql)
{
$langs->load("bills");
$now = dol_now();
$resql = $this->db->query($sql);
if ($resql)
{
$langs->load("bills");
$now = dol_now();
$response = new WorkboardResponse();
$response->warning_delay = $conf->facture->fournisseur->warning_delay / 60 / 60 / 24;
$response->label = $langs->trans("SupplierBillsToPay");
$response->labelShort = $langs->trans("StatusToPay");
$response = new WorkboardResponse();
$response->warning_delay = $conf->facture->fournisseur->warning_delay / 60 / 60 / 24;
$response->label = $langs->trans("SupplierBillsToPay");
$response->labelShort = $langs->trans("StatusToPay");
$response->url = DOL_URL_ROOT.'/fourn/facture/list.php?search_status=1&amp;mainmenu=billing&amp;leftmenu=suppliers_bills';
$response->img = img_object($langs->trans("Bills"), "bill");
$response->url = DOL_URL_ROOT.'/fourn/facture/list.php?search_status=1&amp;mainmenu=billing&amp;leftmenu=suppliers_bills';
$response->img = img_object($langs->trans("Bills"), "bill");
$facturestatic = new FactureFournisseur($this->db);
$facturestatic = new FactureFournisseur($this->db);
while ($obj = $this->db->fetch_object($resql))
{
$response->nbtodo++;
while ($obj = $this->db->fetch_object($resql))
{
$response->nbtodo++;
$facturestatic->date_echeance = $this->db->jdate($obj->datefin);
$facturestatic->statut = $obj->fk_statut;
$facturestatic->date_echeance = $this->db->jdate($obj->datefin);
$facturestatic->statut = $obj->fk_statut;
if ($facturestatic->hasDelay()) {
$response->nbtodolate++;
if ($facturestatic->hasDelay()) {
$response->nbtodolate++;
$response->url_late = DOL_URL_ROOT.'/fourn/facture/list.php?option=late&mainmenu=billing&leftmenu=suppliers_bills';
}
}
$this->db->free($resql);
return $response;
} else {
}
}
$this->db->free($resql);
return $response;
} else {
dol_print_error($this->db);
$this->error = $this->db->error();
return -1;
@ -2406,7 +2406,7 @@ class FactureFournisseur extends CommonInvoice
return $numref;
} else {
$this->error = $obj->error;
return false;
return -1;
}
}

View File

@ -57,7 +57,7 @@ if (!empty($conf->variants->enabled)) {
if (!empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
$langs->loadLangs(array('bills', 'compta', 'suppliers', 'companies', 'products', 'banks'));
$langs->loadLangs(array('bills', 'compta', 'suppliers', 'companies', 'products', 'banks', 'admin'));
if (!empty($conf->incoterm->enabled)) $langs->load('incoterm');
$id = (GETPOST('facid', 'int') ? GETPOST('facid', 'int') : GETPOST('id', 'int'));
@ -2303,54 +2303,59 @@ if ($action == 'create')
// Confirmation de la validation
if ($action == 'valid')
{
// on verifie si l'objet est en numerotation provisoire
$objectref = substr($object->ref, 1, 4);
if ($objectref == 'PROV')
// We check if number is temporary number
if (preg_match('/^[\(]?PROV/i', $object->ref) || empty($object->ref)) // empty should not happened, but when it occurs, the test save life
{
$savdate = $object->date;
$numref = $object->getNextNumRef($societe);
} else {
$numref = $object->ref;
}
$text = $langs->trans('ConfirmValidateBill', $numref);
/*if (! empty($conf->notification->enabled))
{
require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php';
$notify=new Notify($db);
$text.='<br>';
$text.=$notify->confirmMessage('BILL_SUPPLIER_VALIDATE',$object->socid, $object);
}*/
$formquestion = array();
$qualified_for_stock_change = 0;
if (empty($conf->global->STOCK_SUPPORTS_SERVICES))
if ($numref < 0)
{
$qualified_for_stock_change = $object->hasProductsOrServices(2);
} else {
$qualified_for_stock_change = $object->hasProductsOrServices(1);
setEventMessages($object->error, $object->errors, 'errors');
$action = '';
}
if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $qualified_for_stock_change)
else
{
$langs->load("stocks");
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$formproduct = new FormProduct($db);
$warehouse = new Entrepot($db);
$warehouse_array = $warehouse->list_array();
if (count($warehouse_array) == 1) {
$label = $object->type == FactureFournisseur::TYPE_CREDIT_NOTE ? $langs->trans("WarehouseForStockDecrease", current($warehouse_array)) : $langs->trans("WarehouseForStockIncrease", current($warehouse_array));
$value = '<input type="hidden" id="idwarehouse" name="idwarehouse" value="'.key($warehouse_array).'">';
$text = $langs->trans('ConfirmValidateBill', $numref);
/*if (! empty($conf->notification->enabled))
{
require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php';
$notify=new Notify($db);
$text.='<br>';
$text.=$notify->confirmMessage('BILL_SUPPLIER_VALIDATE',$object->socid, $object);
}*/
$formquestion = array();
$qualified_for_stock_change = 0;
if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
$qualified_for_stock_change = $object->hasProductsOrServices(2);
} else {
$label = $object->type == FactureFournisseur::TYPE_CREDIT_NOTE ? $langs->trans("SelectWarehouseForStockDecrease") : $langs->trans("SelectWarehouseForStockIncrease");
$value = $formproduct->selectWarehouses(GETPOST('idwarehouse') ?GETPOST('idwarehouse') : 'ifone', 'idwarehouse', '', 1);
$qualified_for_stock_change = $object->hasProductsOrServices(1);
}
$formquestion = array(
array('type' => 'other', 'name' => 'idwarehouse', 'label' => $label, 'value' => $value)
);
}
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateBill'), $text, 'confirm_valid', $formquestion, 1, 1);
if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $qualified_for_stock_change)
{
$langs->load("stocks");
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$formproduct = new FormProduct($db);
$warehouse = new Entrepot($db);
$warehouse_array = $warehouse->list_array();
if (count($warehouse_array) == 1) {
$label = $object->type == FactureFournisseur::TYPE_CREDIT_NOTE ? $langs->trans("WarehouseForStockDecrease", current($warehouse_array)) : $langs->trans("WarehouseForStockIncrease", current($warehouse_array));
$value = '<input type="hidden" id="idwarehouse" name="idwarehouse" value="'.key($warehouse_array).'">';
} else {
$label = $object->type == FactureFournisseur::TYPE_CREDIT_NOTE ? $langs->trans("SelectWarehouseForStockDecrease") : $langs->trans("SelectWarehouseForStockIncrease");
$value = $formproduct->selectWarehouses(GETPOST('idwarehouse') ?GETPOST('idwarehouse') : 'ifone', 'idwarehouse', '', 1);
}
$formquestion = array(
array('type' => 'other', 'name' => 'idwarehouse', 'label' => $label, 'value' => $value)
);
}
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateBill'), $text, 'confirm_valid', $formquestion, 1, 1);
}
}
// Confirmation edit (back to draft)

View File

@ -171,8 +171,8 @@ class WebsitePage extends CommonObject
'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-1, 'position'=>512),
//'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'index'=>1, 'position'=>1000, 'notnull'=>-1),
'object_type' => array('type' => 'varchar(255)','label' => 'ObjectType', 'enabled'=>1, 'visible'=>1, 'position'=>46, 'searchall'=>0, 'help'=>''),
'fk_object' => array('type' => 'varchar(255)','label' => 'ObjectId', 'enabled'=>1, 'visible'=>1, 'position'=>47, 'searchall'=>0, 'help'=>'')
'object_type' => array('type' => 'varchar(255)','label' => 'ObjectType', 'enabled'=>1, 'visible'=>0, 'position'=>46, 'searchall'=>0, 'help'=>''),
'fk_object' => array('type' => 'varchar(255)','label' => 'ObjectId', 'enabled'=>1, 'visible'=>0, 'position'=>47, 'searchall'=>0, 'help'=>'')
);
// END MODULEBUILDER PROPERTIES