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

This commit is contained in:
Laurent Destailleur 2019-11-28 12:46:07 +01:00
commit 64f264be3d
43 changed files with 1513 additions and 1440 deletions

View File

@ -1327,6 +1327,20 @@ class Setup extends DolibarrApi
return $list; return $list;
} }
/**
* Get properties of company
*
* @url GET /company
*
* @return array|mixed Data without useless information
*
*/
public function getCompany()
{
global $mysoc;
return $this->_cleanObjectDatas($mysoc);
}
/** /**
* Do a test of integrity for files and setup. * Do a test of integrity for files and setup.

View File

@ -157,9 +157,7 @@ if ($result)
$newcardbutton = ''; $newcardbutton = '';
if ($user->rights->banque->modifier) if ($user->rights->banque->modifier)
{ {
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans('MenuNewVariousPayment').'</span>'; $newcardbutton .= dolGetButtonTitle($langs->trans('MenuNewVariousPayment'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create');
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
} }
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
@ -306,7 +304,7 @@ if ($result)
} }
// Debit // Debit
print "<td class=\"right\">"; print '<td class="nowrap right">';
if ($obj->sens == 0) if ($obj->sens == 0)
{ {
print price($obj->amount); print price($obj->amount);
@ -317,7 +315,7 @@ if ($result)
print "</td>"; print "</td>";
// Credit // Credit
print "<td class=\"right\">"; print '<td class="nowrap right">';
if ($obj->sens == 1) if ($obj->sens == 1)
{ {
print price($obj->amount); print price($obj->amount);
@ -325,17 +323,16 @@ if ($result)
} }
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='total_cred'; if (! $i) $totalarray['pos'][$totalarray['nbfield']]='total_cred';
print "</td>"; print '</td>' ;
print '<td></td>';
print "<td></td>"; if (! $i) $totalarray['nbfield']++;
print "</tr>\n";
$i++; $i++;
} }
$colspan = 4;
if (!empty($conf->banque->enabled)) $colspan++;
if (!empty($conf->accounting->enabled)) $colspan++;
// Show total line // Show total line
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';

View File

@ -171,9 +171,7 @@ if ($resql)
$newcardbutton = ''; $newcardbutton = '';
if ($user->rights->tax->charges->creer) if ($user->rights->tax->charges->creer)
{ {
$newcardbutton = '<a class="butActionNew" href="'.DOL_URL_ROOT.'/compta/sociales/card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans('MenuNewSocialContribution').'</span>'; $newcardbutton .= dolGetButtonTitle($langs->trans('MenuNewSocialContribution'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/sociales/card.php?action=create');
$newcardbutton .= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton .= '</a>';
} }
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
@ -267,15 +265,16 @@ if ($resql)
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Ref // Ref
print '<td width="60">'; print "<td>".$chargesociale_static->getNomUrl(1, '20')."</td>\n";
print $chargesociale_static->getNomUrl(1, '20'); if (! $i) $totalarray['nbfield']++;
print '</td>';
// Label // Label
print '<td>'.dol_trunc($obj->label, 42).'</td>'; print "<td>".dol_trunc($obj->label, 42)."</td>\n";
if (! $i) $totalarray['nbfield']++;
// Type // Type
print '<td>'.$obj->type_label.'</td>'; print "<td>".$obj->type_label."</td>\n";
if (! $i) $totalarray['nbfield']++;
// Date end period // Date end period
print '<td align="center">'; print '<td align="center">';
@ -287,21 +286,26 @@ if ($resql)
{ {
print '&nbsp;'; print '&nbsp;';
} }
print '</td>'; print "</td>\n";
if (! $i) $totalarray['nbfield']++;
// Amount // Amount
print '<td class="right" width="100">'.price($obj->amount).'</td>'; print '<td class="nowrap right">'.price($obj->amount).'</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='totalttcfield'; if (! $i) $totalarray['pos'][$totalarray['nbfield']]='totalttcfield';
$totalarray['val']['totalttcfield'] += $obj->amount; $totalarray['val']['totalttcfield'] += $obj->amount;
// Due date // Due date
print '<td width="110" align="center">'.dol_print_date($db->jdate($obj->date_ech), 'day').'</td>'; print '<td width="110" align="center">'.dol_print_date($db->jdate($obj->date_ech), 'day').'</td>';
if (! $i) $totalarray['nbfield']++;
print '<td class="nowrap right">'.$chargesociale_static->LibStatut($obj->paye, 5, $obj->alreadypayed).'</td>'; print '<td class="nowrap right">'.$chargesociale_static->LibStatut($obj->paye, 5, $obj->alreadypayed).'</td>';
if (! $i) $totalarray['nbfield']++;
print '<td></td>'; print '<td></td>';
if (! $i) $totalarray['nbfield']++;
print '</tr>'; print '</tr>';
$i++; $i++;
} }

View File

@ -557,7 +557,7 @@ class ExtraFields
} }
else else
{ {
print dol_print_error($this->db); dol_print_error($this->db);
return -1; return -1;
} }
} }
@ -813,7 +813,7 @@ class ExtraFields
else else
{ {
$this->db->rollback(); $this->db->rollback();
print dol_print_error($this->db); dol_print_error($this->db);
return -1; return -1;
} }
} }

View File

@ -702,9 +702,9 @@ function modulehelp_prepare_head($object)
$h++; $h++;
} }
complete_head_from_modules($conf, $langs, null, $head, $h, 'modulehelp_admin'); complete_head_from_modules($conf, $langs, $object, $head, $h, 'modulehelp_admin');
complete_head_from_modules($conf, $langs, null, $head, $h, 'modulehelp_admin', 'remove'); complete_head_from_modules($conf, $langs, $object, $head, $h, 'modulehelp_admin', 'remove');
return $head; return $head;

View File

@ -281,7 +281,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
imagepng($imgThumb, $imgThumbName, $newquality); imagepng($imgThumb, $imgThumbName, $newquality);
break; break;
case 4: // Bmp case 4: // Bmp
image2wbmp($imgThumb, $imgThumbName); imagewbmp($imgThumb, $imgThumbName);
break; break;
} }
@ -584,7 +584,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
// Not supported by PHP GD // Not supported by PHP GD
break; break;
case IMAGETYPE_WBMP: // 15 case IMAGETYPE_WBMP: // 15
image2wbmp($imgThumb, $imgThumbName); imagewbmp($imgThumb, $imgThumbName);
break; break;
} }

View File

@ -1990,11 +1990,11 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
} }
/** /**
* @param task $task Task the task object * @param Task $task the task object
* @param label $label bool|string true = auto, false = dont display, string = replace output * @param bool|string $label true = auto, false = dont display, string = replace output
* @param progressNumber $progressNumber bool|string true = auto, false = dont display, string = replace output * @param bool|string $progressNumber true = auto, false = dont display, string = replace output
* @param hideOnProgressNull $hideOnProgressNull bool hide if progress is null * @param bool $hideOnProgressNull hide if progress is null
* @param spaced $spaced bool used to add space at bottom (made by css) * @param bool $spaced used to add space at bottom (made by css)
* @return string * @return string
* @see getTaskProgressBadge() * @see getTaskProgressBadge()
*/ */
@ -2113,9 +2113,9 @@ function getTaskProgressView($task, $label = true, $progressNumber = true, $hide
return $out; return $out;
} }
/** /**
* @param task $task Task the task object * @param Task $task the task object
* @param label $label string empty = auto (progress), string = replace output * @param string $label empty = auto (progress), string = replace output
* @param tooltip $tooltip string empty = auto , string = replace output * @param string $tooltip empty = auto , string = replace output
* @return string * @return string
* @see getTaskProgressView() * @see getTaskProgressView()
*/ */

View File

@ -261,7 +261,7 @@ class pdf_standard extends CommonStickerGenerator
// List of values to scan for a replacement // List of values to scan for a replacement
$substitutionarray = array ( $substitutionarray = array (
'__ID__'=>$object->rowid, '__ID__' => $object->id,
'__LOGIN__'=>$object->login, '__LOGIN__'=>$object->login,
'__FIRSTNAME__'=>$object->firstname, '__FIRSTNAME__'=>$object->firstname,
'__LASTNAME__'=>$object->lastname, '__LASTNAME__'=>$object->lastname,

View File

@ -630,7 +630,7 @@ if (($action != 'create' && $action != 'add') && !$error) {
$db->free($resql); $db->free($resql);
} else { } else {
print dol_print_error($db); dol_print_error($db);
} }
} }

View File

@ -355,10 +355,10 @@ else
$formconfirm = ''; $formconfirm = '';
// Confirm delete third party // Confirm delete warehouse
if ($action == 'delete') if ($action == 'delete')
{ {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("DeleteAWarehouse"), $langs->trans("ConfirmDeleteWarehouse", $object->libelle), "confirm_delete", '', 0, 2); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("DeleteAWarehouse"), $langs->trans("ConfirmDeleteWarehouse", $object->label), "confirm_delete", '', 0, 2);
} }
// Call Hook formConfirm // Call Hook formConfirm
@ -389,10 +389,10 @@ else
print '<table class="border centpercent">'; print '<table class="border centpercent">';
// Parent entrepot // Parent entrepot
$e = new Entrepot($db); $parentwarehouse = new Entrepot($db);
if(!empty($object->fk_parent) && $e->fetch($object->fk_parent) > 0) { if(!empty($object->fk_parent) && $parentwarehouse->fetch($object->fk_parent) > 0) {
print '<tr><td>'.$langs->trans("ParentWarehouse").'</td><td>'; print '<tr><td>'.$langs->trans("ParentWarehouse").'</td><td>';
print $e->getNomUrl(3); print $parentwarehouse->getNomUrl(3);
print '</td></tr>'; print '</td></tr>';
} }
@ -668,7 +668,7 @@ else
print '<table class="border centpercent">'; print '<table class="border centpercent">';
// Ref // Ref
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Ref").'</td><td><input name="libelle" size="20" value="'.$object->libelle.'"></td></tr>'; print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Ref").'</td><td><input name="libelle" size="20" value="'.$object->label.'"></td></tr>';
print '<tr><td>'.$langs->trans("LocationSummary").'</td><td><input name="lieu" size="40" value="'.$object->lieu.'"></td></tr>'; print '<tr><td>'.$langs->trans("LocationSummary").'</td><td><input name="lieu" size="40" value="'.$object->lieu.'"></td></tr>';

View File

@ -53,9 +53,13 @@ class Entrepot extends CommonObject
/** /**
* @var string Label * @var string Label
* @deprecated * @deprecated
* @see $label
*/ */
public $libelle; public $libelle;
/**
* @var string Label
*/
public $label; public $label;
/** /**
@ -64,6 +68,10 @@ class Entrepot extends CommonObject
public $description; public $description;
public $statut; public $statut;
/**
* @var string Place
*/
public $lieu; public $lieu;
/** /**
@ -82,11 +90,13 @@ class Entrepot extends CommonObject
public $town; public $town;
/** /**
* @var int ID * @var int ID of parent
*/ */
public $fk_parent; public $fk_parent;
// List of short language codes for status /**
* @var array List of short language codes for status
*/
public $statuts = array(); public $statuts = array();
/** /**

View File

@ -781,7 +781,7 @@ if ($resql)
print $reception->getNomUrl(1); print $reception->getNomUrl(1);
$filename = dol_sanitizeFileName($reception->ref); $filename = dol_sanitizeFileName($reception->ref);
$filedir = $conf->reception->dir_output.'/'.dol_sanitizeFileName($reception->ref); $filedir = $conf->reception->dir_output.'/'.dol_sanitizeFileName($reception->ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$reception->rowid; $urlsource = $_SERVER['PHP_SELF'].'?id='.$reception->id;
print $formfile->getDocumentsLink($reception->element, $filename, $filedir); print $formfile->getDocumentsLink($reception->element, $filename, $filedir);
print "</td>\n"; print "</td>\n";

View File

@ -150,9 +150,7 @@ if ($result)
$newcardbutton=''; $newcardbutton='';
if (! empty($user->rights->salaries->write)) if (! empty($user->rights->salaries->write))
{ {
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/salaries/card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans('NewSalaryPayment').'</span>'; $newcardbutton .= dolGetButtonTitle($langs->trans('NewSalaryPayment'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/salaries/card.php?action=create');
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
} }
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
@ -234,14 +232,24 @@ if ($result)
// Ref // Ref
print "<td>".$salstatic->getNomUrl(1)."</td>\n"; print "<td>".$salstatic->getNomUrl(1)."</td>\n";
if (! $i) $totalarray['nbfield']++;
// Employee // Employee
print "<td>".$userstatic->getNomUrl(1)."</td>\n"; print "<td>".$userstatic->getNomUrl(1)."</td>\n";
if (! $i) $totalarray['nbfield']++;
// Label payment // Label payment
print "<td>".dol_trunc($obj->label, 40)."</td>\n"; print "<td>".dol_trunc($obj->label, 40)."</td>\n";
if (! $i) $totalarray['nbfield']++;
// Date payment // Date payment
print '<td align="center">'.dol_print_date($db->jdate($obj->datep), 'day')."</td>\n"; print '<td align="center">'.dol_print_date($db->jdate($obj->datep), 'day')."</td>\n";
if (! $i) $totalarray['nbfield']++;
// Type // Type
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'</td>'; print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'</td>';
if (! $i) $totalarray['nbfield']++;
// Account // Account
if (! empty($conf->banque->enabled)) if (! empty($conf->banque->enabled))
{ {
@ -267,22 +275,26 @@ if ($result)
} }
else print '&nbsp;'; else print '&nbsp;';
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++;
} }
// Amount
print '<td class="right">'.price($obj->amount).'</td>';
print '<td></td>';
print "</tr>\n";
$total = $total + $obj->amount; // Amount
print '<td class="nowrap right">'.price($obj->amount).'</td>';
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='totalttcfield';
$totalarray['val']['totalttcfield'] += $obj->amount;
print '<td></td>';
if (! $i) $totalarray['nbfield']++;
print "</tr>\n";
$i++; $i++;
} }
$colspan=5; // Show total line
if (! empty($conf->banque->enabled)) $colspan++; include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
print '<tr class="liste_total"><td colspan="'.$colspan.'" class="liste_total">'.$langs->trans("Total").'</td>';
print '<td class="liste_total right">'.price($total)."</td>";
print "<td></td></tr>";
print "</table>"; print "</table>";
print '</div>'; print '</div>';

View File

@ -405,7 +405,7 @@ class SupplierProposal extends CommonObject
*/ */
public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $price_base_type = 'HT', $pu_ttc = 0, $info_bits = 0, $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $array_option = 0, $ref_supplier = '', $fk_unit = '', $origin = '', $origin_id = 0, $pu_ht_devise = 0, $date_start = 0, $date_end = 0) public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $price_base_type = 'HT', $pu_ttc = 0, $info_bits = 0, $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $array_option = 0, $ref_supplier = '', $fk_unit = '', $origin = '', $origin_id = 0, $pu_ht_devise = 0, $date_start = 0, $date_end = 0)
{ {
global $mysoc, $conf; global $mysoc, $conf, $langs;
dol_syslog(get_class($this)."::addline supplier_proposalid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_except=$remise_percent, price_base_type=$price_base_type, pu_ttc=$pu_ttc, info_bits=$info_bits, type=$type"); dol_syslog(get_class($this)."::addline supplier_proposalid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_except=$remise_percent, price_base_type=$price_base_type, pu_ttc=$pu_ttc, info_bits=$info_bits, type=$type");
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';

View File

@ -642,7 +642,7 @@ if ($resql)
print '</td>'; print '</td>';
// Warning // Warning
$warnornote = ''; $warnornote = '';
if ($obj->fk_statut == 1 && $db->jdate($obj->date_valid) < ($now - $conf->supplier_proposal->warning_delay)) $warnornote .= img_warning($langs->trans("Late")); //if ($obj->fk_statut == 1 && $db->jdate($obj->date_valid) < ($now - $conf->supplier_proposal->warning_delay)) $warnornote .= img_warning($langs->trans("Late"));
if (!empty($obj->note_private)) if (!empty($obj->note_private))
{ {
$warnornote .= ($warnornote ? ' ' : ''); $warnornote .= ($warnornote ? ' ' : '');

View File

@ -1,75 +0,0 @@
<?php
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018 SuperAdmin
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file takepos/admin/about.php
* \ingroup takepos
* \brief About page of module TakePos.
*/
require '../../main.inc.php'; // Load $user and permissions
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once '../lib/takepos.lib.php';
// Translations
$langs->loadLangs(array("errors","admin","cashdesk"));
// Access control
if (! $user->admin) {
accessforbidden();
}
// Parameters
$action = GETPOST('action', 'alpha');
$backtopage = GETPOST('backtopage', 'alpha');
/*
* Actions
*/
// None
/*
* View
*/
$form = new Form($db);
$page_name = "TakePosAbout";
llxHeader('', $langs->trans($page_name));
// Subheader
$linkback = '<a href="'.($backtopage?$backtopage:DOL_URL_ROOT.'/admin/modules.php').'">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans($page_name), $linkback, 'object_takepos@takepos');
// Configuration header
$head = takeposAdminPrepareHead();
dol_fiche_head($head, 'about', '', 0, 'takepos@takepos');
dol_include_once('/takepos/core/modules/modTakePos.class.php');
$tmpmodule = new modTakePos($db);
print $tmpmodule->getDescLong();
// Page end
dol_fiche_end();
llxFooter();
$db->close();

View File

@ -0,0 +1 @@

View File

@ -364,6 +364,116 @@ class Users extends DolibarrApi
return 1; return 1;
} }
/**
* List Groups
*
* Return an array with a list of Groups
*
* @url GET /groups
*
* @param string $sortfield Sort field
* @param string $sortorder Sort order
* @param int $limit Limit for list
* @param int $page Page number
* @param string $group_ids Groups ids filter field. Example: '1' or '1,2,3' {@pattern /^[0-9,]*$/i}
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
* @return array Array of User objects
*/
public function listGroups($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $group_ids = 0, $sqlfilters = '')
{
global $db, $conf;
$obj_ret = array();
if (!DolibarrApiAccess::$user->rights->user->group_advance->read) {
throw new RestException(401, "You are not allowed to read list of groups");
}
// case of external user, $societe param is ignored and replaced by user's socid
//$socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : $societe;
$sql = "SELECT t.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."usergroup as t";
$sql .= ' WHERE t.entity IN ('.getEntity('user').')';
if ($group_ids) $sql .= " AND t.rowid IN (".$group_ids.")";
// Add sql filters
if ($sqlfilters)
{
if (!DolibarrApi::_checkFilters($sqlfilters))
{
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
$sql .= $db->order($sortfield, $sortorder);
if ($limit) {
if ($page < 0)
{
$page = 0;
}
$offset = $limit * $page;
$sql .= $db->plimit($limit + 1, $offset);
}
$result = $db->query($sql);
if ($result)
{
$i = 0;
$num = $db->num_rows($result);
$min = min($num, ($limit <= 0 ? $num : $limit));
while ($i < $min)
{
$obj = $db->fetch_object($result);
$group_static = new UserGroup($this->db);
if ($group_static->fetch($obj->rowid)) {
$obj_ret[] = $this->_cleanObjectDatas($group_static);
}
$i++;
}
}
else {
throw new RestException(503, 'Error when retrieve Group list : '.$db->lasterror());
}
if (!count($obj_ret)) {
throw new RestException(404, 'No Group found');
}
return $obj_ret;
}
/**
* Get properties of an group object
*
* Return an array with group informations
*
* @url GET /groups/{group}
*
* @param int $group ID of group
* @param int $load_members Load members list or not {@min 0} {@max 1}
* @return array Array of User objects
*/
public function infoGroups($group, $load_members = 0)
{
global $db, $conf;
if (!DolibarrApiAccess::$user->rights->user->group_advance->read) {
throw new RestException(401, "You are not allowed to read groups");
}
$group_static = new UserGroup($this->db);
$result = $group_static->fetch($group, '', $load_members);
if (!$result)
{
throw new RestException(404, 'Group not found');
}
return $this->_cleanObjectDatas($group_static);
}
/** /**
* Delete account * Delete account
* *