From 8847293527a098c5de27a544073f1137dca85c38 Mon Sep 17 00:00:00 2001 From: John Date: Thu, 8 Feb 2018 12:25:30 +0100 Subject: [PATCH 1/5] Add new html containers and somme html5 data-* for contract card. --- htdocs/contrat/card.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index ae1178adf9a..aedb8f639a7 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1499,8 +1499,10 @@ else // Title line for service $cursorline=1; + print '
'; while ($cursorline <= $nbofservices) { + print '
'; print '
'; print ''; print ''; @@ -2015,10 +2017,12 @@ else print '
'; } - + + print '
'; $cursorline++; } - + print '
'; + // Form to add new line if ($user->rights->contrat->creer && ($object->statut == 0)) { From 424fc4cd13067908c37dc5984291b191f5580ce6 Mon Sep 17 00:00:00 2001 From: Romain DESCHAMPS Date: Fri, 9 Feb 2018 09:11:47 +0100 Subject: [PATCH 2/5] add missing links in supplier card boxes --- htdocs/fourn/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 6096ff03f9f..453cb6068ad 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -325,7 +325,7 @@ if ($object->id > 0) $outstandingTotal=$tmp['total_ht']; $outstandingTotalIncTax=$tmp['total_ttc']; $text=$langs->trans("OverAllSupplierProposals"); - $link=''; + $link=DOL_URL_ROOT.'/supplier_proposal/list.php?socid='.$object->id; $icon='bill'; if ($link) $boxstat.=''; $boxstat.='
'; @@ -343,7 +343,7 @@ if ($object->id > 0) $outstandingTotal=$tmp['total_ht']; $outstandingTotalIncTax=$tmp['total_ttc']; $text=$langs->trans("OverAllOrders"); - $link=''; + $link=DOL_URL_ROOT.'/fourn/commande/list.php?socid='.$object->id; $icon='bill'; if ($link) $boxstat.=''; $boxstat.='
'; @@ -361,7 +361,7 @@ if ($object->id > 0) $outstandingTotalIncTax=$tmp['total_ttc']; $text=$langs->trans("OverAllInvoices"); - $link=''; + $link=DOL_URL_ROOT.'/fourn/facture/list.php?socid='.$object->id; $icon='bill'; if ($link) $boxstat.=''; $boxstat.='
'; From 207a4a8dc4934bb38faf33041d08caf09dd21036 Mon Sep 17 00:00:00 2001 From: Romain DESCHAMPS Date: Fri, 9 Feb 2018 09:14:34 +0100 Subject: [PATCH 3/5] add missing links in cust. card boxes --- htdocs/comm/card.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 6dfd05354d8..81443f04d62 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -568,7 +568,7 @@ if ($object->id > 0) $outstandingTotal=$tmp['total_ht']; $outstandingTotalIncTax=$tmp['total_ttc']; $text=$langs->trans("OverAllProposals"); - $link=''; + $link=DOL_URL_ROOT.'/comm/propal/list.php?socid='.$object->id; $icon='bill'; if ($link) $boxstat.=''; $boxstat.='
'; @@ -580,13 +580,13 @@ if ($object->id > 0) if (! empty($conf->commande->enabled)) { - // Box proposals + // Box commandes $tmp = $object->getOutstandingOrders(); $outstandingOpened=$tmp['opened']; $outstandingTotal=$tmp['total_ht']; $outstandingTotalIncTax=$tmp['total_ttc']; $text=$langs->trans("OverAllOrders"); - $link=''; + $link=DOL_URL_ROOT.'/commande/list.php?socid='.$object->id; $icon='bill'; if ($link) $boxstat.=''; $boxstat.='
'; @@ -598,12 +598,13 @@ if ($object->id > 0) if (! empty($conf->facture->enabled)) { + // Box factures $tmp = $object->getOutstandingBills(); $outstandingOpened=$tmp['opened']; $outstandingTotal=$tmp['total_ht']; $outstandingTotalIncTax=$tmp['total_ttc']; $text=$langs->trans("OverAllInvoices"); - $link=''; + $link=DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id; $icon='bill'; if ($link) $boxstat.=''; $boxstat.='
'; From 6fb08dcc53b3f64c016a66909685487b1416eb7e Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Fri, 9 Feb 2018 11:50:33 +0100 Subject: [PATCH 4/5] NEW doActions on categorycard --- htdocs/categories/viewcat.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 1c6186d5df4..6d85b170bc7 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -66,13 +66,14 @@ $extrafields = new ExtraFields($db); $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array array -$hookmanager->initHooks(array('categorycard')); +$hookmanager->initHooks(array('categorycard','globalcard')); /* * Actions */ - +$parameters=array(); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks // Remove element from category if ($id > 0 && $removeelem > 0) { From b48d369258fea70f62f7956a0887bb14be2595cc Mon Sep 17 00:00:00 2001 From: Ysandor Date: Sat, 10 Feb 2018 20:38:53 +0100 Subject: [PATCH 5/5] add the possibility to remove a category from a thirdparty I don't know if there is a good reason for not proposing to unlink a thirdparty from a category but if it is not the case here is a piece of code allowing to remove a category that works for me and seems general enough to be useful to other people. The new function is inspired from the addCategory function. PS : This is the first time i'm trying to contribute on github so don't hesitate to tell me if I did something wrong. --- .../societe/class/api_thirdparties.class.php | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 7326d99e2b7..6910f5d6dc3 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -552,7 +552,45 @@ class Thirdparties extends DolibarrApi return $this->company; } + /** + * Delete category to a thirdparty + * + * @param int $id Id of thirdparty + * @param array $request_data Request datas + * + * @return mixed + * + * @url POST {id}/deleteCategory + */ + function deleteCategory($id, $request_data = NULL) { + if (!isset($request_data["category_id"])) + throw new RestException(400, "category_id field missing"); + $category_id = $request_data["category_id"]; + if(! DolibarrApiAccess::$user->rights->societe->creer) { + throw new RestException(401); + } + + $result = $this->company->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Thirdparty not found'); + } + $category = new Categorie($this->db); + $result = $category->fetch($category_id); + if( ! $result ) { + throw new RestException(404, 'category not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('societe',$this->company->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + if( ! DolibarrApi::_checkAccessToResource('category',$category->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + $category->del_type($this->company,'customer'); + return $this->company; + } /** * Get outstanding proposals of thirdparty