2
0
forked from Wavyzz/dolibarr

Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur
2018-02-12 03:21:48 +01:00
3 changed files with 47 additions and 5 deletions

View File

@@ -67,13 +67,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)
{

View File

@@ -1511,9 +1511,11 @@ else
// Title line for service
$cursorline=1;
while ($cursorline <= $nbofservices)
print '<div id="contrat-lines-container" data-contractid="'.$object->id.'" data-element="'.$object->element.'" >';
while ($cursorline <= $nbofservices)
{
print '<form name="update" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="post">';
print '<div id="contrat-line-container'.$object->lines[$cursorline-1]->id.'" data-contratlineid = "'.$object->lines[$cursorline-1]->id.'" data-element="'.$object->lines[$cursorline-1]->element.'" >';
print '<form name="update" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="updateline">';
print '<input type="hidden" name="elrowid" value="'.$object->lines[$cursorline-1]->id.'">';
@@ -2027,9 +2029,10 @@ else
print '</form>';
}
print '</div>';
$cursorline++;
}
print '</div>';
// Form to add new line
if ($user->rights->contrat->creer && ($object->statut == 0))

View File

@@ -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