Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
6a2c3e9fe3
@ -15,10 +15,15 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Luracast\Restler\RestException;
|
use Luracast\Restler\RestException;
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/api_members.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/product/class/api_products.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/societe/class/api_contacts.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/societe/class/api_thirdparties.class.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API class for categories
|
* API class for categories
|
||||||
@ -335,4 +340,61 @@ class Categories extends DolibarrApi
|
|||||||
}
|
}
|
||||||
return $category;
|
return $category;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list of objects in a category.
|
||||||
|
*
|
||||||
|
* @param int $id ID of category
|
||||||
|
* @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact')
|
||||||
|
* @param int $onlyids Return only ids of objects (consume less memory)
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*
|
||||||
|
* @url GET {id}/objects
|
||||||
|
*/
|
||||||
|
public function getObjects($id, $type, $onlyids = 0)
|
||||||
|
{
|
||||||
|
dol_syslog("getObjects($id, $type, $onlyids)", LOG_DEBUG);
|
||||||
|
|
||||||
|
if (! DolibarrApiAccess::$user->rights->categorie->lire) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($type))
|
||||||
|
{
|
||||||
|
throw new RestException(500, 'The "type" parameter is required.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->category->fetch($id);
|
||||||
|
if (! $result) {
|
||||||
|
throw new RestException(404, 'category not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! DolibarrApi::_checkAccessToResource('category', $this->category->id)) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->category->getObjectsInCateg($type, $onlyids);
|
||||||
|
|
||||||
|
if ($result < 0) {
|
||||||
|
throw new RestException(503, 'Error when retrieving objects list : '.$this->category->error);
|
||||||
|
}
|
||||||
|
|
||||||
|
$objects = $result;
|
||||||
|
$cleaned_objects = array();
|
||||||
|
if ($type == 'member') {
|
||||||
|
$objects_api = new Members();
|
||||||
|
} elseif ($type == 'customer' || $type == 'supplier') {
|
||||||
|
$objects_api = new Thirdparties();
|
||||||
|
} elseif ($type == 'product') {
|
||||||
|
$objects_api = new Products();
|
||||||
|
} elseif ($type == 'contact') {
|
||||||
|
$objects_api = new Contacts();
|
||||||
|
}
|
||||||
|
foreach ($objects as $obj) {
|
||||||
|
$cleaned_objects[] = $objects_api->_cleanObjectDatas($obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $cleaned_objects;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -146,6 +146,8 @@ $fieldstosearchall = array(
|
|||||||
'p.email'=>'EMail',
|
'p.email'=>'EMail',
|
||||||
's.nom'=>"ThirdParty",
|
's.nom'=>"ThirdParty",
|
||||||
'p.phone'=>"Phone",
|
'p.phone'=>"Phone",
|
||||||
|
'p.note_public'=>"NotePublic",
|
||||||
|
'p.note_private'=>"NotePrivate",
|
||||||
);
|
);
|
||||||
|
|
||||||
// Definition of fields for list
|
// Definition of fields for list
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
|
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
|
||||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||||
|
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -57,11 +58,11 @@ class mod_bom_advanced extends ModeleNumRefboms
|
|||||||
*/
|
*/
|
||||||
public function info()
|
public function info()
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs, $db;
|
||||||
|
|
||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
|
|
||||||
$form = new Form($this->db);
|
$form = new Form($db);
|
||||||
|
|
||||||
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
|
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
|
||||||
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
|
/* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
|
||||||
|
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -51,11 +52,11 @@ class mod_chequereceipt_thyme extends ModeleNumRefChequeReceipts
|
|||||||
*/
|
*/
|
||||||
public function info()
|
public function info()
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs, $db;
|
||||||
|
|
||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
|
|
||||||
$form = new Form($this->db);
|
$form = new Form($db);
|
||||||
|
|
||||||
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
|
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
|
||||||
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
|
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
|
||||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||||
|
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -57,11 +58,11 @@ class mod_commande_saphir extends ModeleNumRefCommandes
|
|||||||
*/
|
*/
|
||||||
public function info()
|
public function info()
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs, $db;
|
||||||
|
|
||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
|
|
||||||
$form = new Form($this->db);
|
$form = new Form($db);
|
||||||
|
|
||||||
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
|
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
|
||||||
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
/* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||||
|
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -61,11 +62,11 @@ class mod_contract_magre extends ModelNumRefContracts
|
|||||||
*/
|
*/
|
||||||
public function info()
|
public function info()
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs, $db;
|
||||||
|
|
||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
|
|
||||||
$form = new Form($this->db);
|
$form = new Form($db);
|
||||||
|
|
||||||
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
|
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
|
||||||
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
/* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||||
|
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -59,11 +60,11 @@ class mod_expedition_ribera extends ModelNumRefExpedition
|
|||||||
*/
|
*/
|
||||||
public function info()
|
public function info()
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs, $db;
|
||||||
|
|
||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
|
|
||||||
$form = new Form($this->db);
|
$form = new Form($db);
|
||||||
|
|
||||||
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
|
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
|
||||||
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||||
|
|||||||
@ -33,7 +33,7 @@ set_time_limit(0);
|
|||||||
class ExportCsv extends ModeleExports
|
class ExportCsv extends ModeleExports
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var int ID
|
* @var string ID ex: csv, tsv, excel...
|
||||||
*/
|
*/
|
||||||
public $id;
|
public $id;
|
||||||
|
|
||||||
|
|||||||
@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
|||||||
class ExportExcel extends ModeleExports
|
class ExportExcel extends ModeleExports
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var int ID
|
* @var string ID
|
||||||
*/
|
*/
|
||||||
public $id;
|
public $id;
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
|||||||
class ExportExcel2007 extends ExportExcel
|
class ExportExcel2007 extends ExportExcel
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var int ID
|
* @var string ID
|
||||||
*/
|
*/
|
||||||
public $id;
|
public $id;
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,7 @@ use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
|||||||
class ExportExcel2007new extends ModeleExports
|
class ExportExcel2007new extends ModeleExports
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var int ID
|
* @var string ID
|
||||||
*/
|
*/
|
||||||
public $id;
|
public $id;
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/export/modules_export.php';
|
|||||||
class ExportTsv extends ModeleExports
|
class ExportTsv extends ModeleExports
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var int ID
|
* @var string ID
|
||||||
*/
|
*/
|
||||||
public $id;
|
public $id;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user