diff --git a/ChangeLog b/ChangeLog index 0f568ff5359..030650d5863 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,7 +15,7 @@ NEW: Add option to disable globaly some notifications emails. NEW: #18326 Workflow: Close order on shipment closing. NEW: #18401 Add __NEWREF__ subtitute to get new object reference. NEW: #18403 Add __URL_SHIPMENT__ substitute to get the URL of a shipment -NEW: #18689 REST API module: add api key generate / modify right. +NEW: #18689 REST API module: add api key generate / modify pemrission. NEW: #18663 Make "L'Annuaire des Entreprises" the default provider for SIREN verification for French thirdparties. NEW: #18046 Add tags on ticket/categories NEW: #18326 Workflow: Close order on shipment closing. @@ -123,6 +123,7 @@ NEW: Introduce method hasRight NEW: Can use textarea field into a confirm popup. NEW: Can use the result_mode of mysqli driver. Save memory for list count NEW: #18319 REST API - Shipment: Add 'close' action / endpoint / POST method. +NEW: Add API /approve and /makeOrder for purchase orders. NEW: add action trigger for member excluded NEW: add option MAIN_IBAN_IS_NEVER_MANDATORY, MAIN_IBAN_NOT_MANDATORY, PROPAL_NOT_BILLABLE, PROPAL_REOPEN_UNSIGNED_ONLY, PROPOSAL_ARE_NOT_BILLABLE, TICKETS_MESSAGE_FORCE_MAIL NEW: Add code codebar column on serial/lot structure diff --git a/htdocs/admin/dolistore/css/dolistore.css b/htdocs/admin/dolistore/css/dolistore.css index fb4dc2d5bb1..3d8f163caf2 100644 --- a/htdocs/admin/dolistore/css/dolistore.css +++ b/htdocs/admin/dolistore/css/dolistore.css @@ -1,6 +1,5 @@ div.divsearchfield { - float: left; margin: 4px 12px 4px 2px; padding-left: 2px; } diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index f720e411717..29d2335a0f9 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -535,11 +535,11 @@ if ($mode == 'common' || $mode == 'commonkanban') { //$moreforfilter .= '
'; - $moreforfilter .= ' {
+ * "closeopenorder": 1,
+ * "comment": "",
+ * "lines": [{
+ * "id": 14,
+ * "fk_product": 112,
+ * "qty": 18,
+ * "warehouse": 1,
+ * "price": 114,
+ * "comment": "",
+ * "eatby": 0,
+ * "sellby": 0,
+ * "batch": 0,
+ * "notrigger": 0
+ * }]
+ * }
+ *
+ * @param int $id Order ID
+ * @param integer $closeopenorder Close order if everything is received {@required false}
+ * @param string $comment Comment {@required false}
+ * @param array $lines Array of product dispatches
+ *
+ * @url POST {id}/receive
+ *
+ * @return array
+ * FIXME An error 403 is returned if the request has an empty body.
+ * Error message: "Forbidden: Content type `text/plain` is not supported."
+ *
+ */
+ public function receiveOrder($id, $closeopenorder, $comment, $lines)
+ {
+ if (empty(DolibarrApiAccess::$user->rights->fournisseur->commande->creer) && empty(DolibarrApiAccess::$user->rights->supplier_order->creer)) {
+ throw new RestException(401);
+ }
+ $result = $this->order->fetch($id);
+ if (!$result) {
+ throw new RestException(404, 'Order not found');
+ }
+
+ if (!DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, 'commande_fournisseur', 'commande')) {
+ throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
+ }
+
+ foreach ($lines as $line) {
+ $lineObj =(object) $line;
+
+ $result=$this->order->dispatchProduct(DolibarrApiAccess::$user,
+ $lineObj->fk_product,
+ $lineObj->qty,
+ $lineObj->warehouse,
+ $lineObj->price,
+ $lineObj->comment,
+ $lineObj->eatby,
+ $lineObj->sellby,
+ $lineObj->batch,
+ $lineObj->id,
+ $lineObj->notrigger);
+
+ if ($result < 0) {
+ throw new RestException(500, 'Error dispatch order line '.$line->id.': '.$this->order->error);
+ }
+ }
+
+ $result = $this->order->calcAndSetStatusDispatch(DolibarrApiAccess::$user, $closeopenorder, $comment);
+
+ if ($result == 0) {
+ throw new RestException(304, 'Error nothing done. May be object is already dispatched');
+ }
+ if ($result < 0) {
+ throw new RestException(500, 'Error when receivce order: '.$this->order->error);
+ }
+
+ return array(
+ 'success' => array(
+ 'code' => 200,
+ 'message' => 'Order received (Ref='.$this->order->ref.')'
+ )
+ );
+ }
+
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Clean sensible object datas
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index e8a64b3f72b..47daec0851b 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -343,7 +343,7 @@ StepNb=Step %s
FindPackageFromWebSite=Find a package that provides the features you need (for example on the official web site %s).
DownloadPackageFromWebSite=Download package (for example from the official web site %s).
UnpackPackageInDolibarrRoot=Unpack/unzip the packaged files into your Dolibarr server directory: %s
-UnpackPackageInModulesRoot=To deploy/install an external module, unpack/unzip the packaged files into the server directory dedicated to external modules: