Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
4b3d84cf02
@ -129,6 +129,75 @@ class Documents extends DolibarrApi
|
||||
return array('filename'=>$filename, 'content'=>base64_encode($file_content), 'encoding'=>'MIME base64 (base64_encode php function, http://php.net/manual/en/function.base64-encode.php)' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the list of documents of an element
|
||||
*
|
||||
* @param string $modulepart Name of module or area concerned ('facture', 'project', 'member', ...)
|
||||
* @param int $id ID of element
|
||||
* @param string $ref Ref of element
|
||||
* @return array Array of documents with path
|
||||
*
|
||||
* @throws RestException
|
||||
*
|
||||
* @url GET list
|
||||
*/
|
||||
function getDocumentsListByElement($modulepart, $id=0, $ref='')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if (empty($modulepart)) {
|
||||
throw new RestException(400, 'bad value for parameter modulepart');
|
||||
}
|
||||
|
||||
if (empty($id) && empty($ref)) {
|
||||
throw new RestException(400, 'bad value for parameter id or ref');
|
||||
}
|
||||
|
||||
$id = (empty($id)?0:$id);
|
||||
|
||||
if ($modulepart == 'societe' || $modulepart == 'thirdparty')
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->societe->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$object = new Societe($this->db);
|
||||
$result=$object->fetch($id, $ref);
|
||||
if ( ! $result ) {
|
||||
throw new RestException(404, 'Thirdparty not found');
|
||||
}
|
||||
|
||||
$upload_dir = $conf->societe->multidir_output[$object->entity] . "/" . $object->id;
|
||||
}
|
||||
else if ($modulepart == 'adherent' || $modulepart == 'member')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
|
||||
if (!DolibarrApiAccess::$user->rights->adherent->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$object = new Adherent($this->db);
|
||||
$result=$object->fetch($id, $ref);
|
||||
if ( ! $result ) {
|
||||
throw new RestException(404, 'Member not found');
|
||||
}
|
||||
|
||||
$upload_dir = $conf->adherent->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'member');
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.');
|
||||
}
|
||||
|
||||
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||
if (empty($filearray)) {
|
||||
throw new RestException(404, 'Modulepart '.$modulepart.' with Id '.$object->id.(! empty($object->Ref)?' and Ref '.$object->ref:'').' does not have any documents.');
|
||||
}
|
||||
|
||||
return $filearray;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a document.
|
||||
|
||||
@ -44,6 +44,7 @@ print '<td align="left">'.$langs->trans("Position");
|
||||
print '<span class="nowrap"><img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/1downarrow.png" alt="" title="A-Z" class="imgdown"></span>';
|
||||
print '</td>';
|
||||
print '<td>'.$langs->trans("Label").'</td>';
|
||||
print '<td>'.$langs->trans("TranslationString").'</td>';
|
||||
print '<td>'.$langs->trans("AttributeCode").'</td>';
|
||||
print '<td>'.$langs->trans("Type").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Size").'</td>';
|
||||
@ -71,6 +72,7 @@ if (count($extrafields->attribute_type))
|
||||
print '<tr class="oddeven">';
|
||||
print "<td>".$extrafields->attribute_pos[$key]."</td>\n";
|
||||
print "<td>".$extrafields->attribute_label[$key]."</td>\n"; // We don't translate here, we want admin to know what is the key not translated value
|
||||
print "<td>".$langs->trans($extrafields->attribute_label[$key])."</td>\n";
|
||||
print "<td>".$key."</td>\n";
|
||||
print "<td>".$type2label[$extrafields->attribute_type[$key]]."</td>\n";
|
||||
print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n";
|
||||
|
||||
@ -481,7 +481,7 @@ class Expedition extends CommonObject
|
||||
// Check parameters
|
||||
if (empty($id) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1;
|
||||
|
||||
$sql = "SELECT e.rowid, e.ref, e.fk_soc as socid, e.date_creation, e.ref_customer, e.ref_ext, e.ref_int, e.fk_user_author, e.fk_statut";
|
||||
$sql = "SELECT e.rowid, e.ref, e.fk_soc as socid, e.date_creation, e.ref_customer, e.ref_ext, e.ref_int, e.fk_user_author, e.fk_statut, e.billed";
|
||||
$sql.= ", e.weight, e.weight_units, e.size, e.size_units, e.width, e.height";
|
||||
$sql.= ", e.date_expedition as date_expedition, e.model_pdf, e.fk_address, e.date_delivery";
|
||||
$sql.= ", e.fk_shipping_method, e.tracking_number";
|
||||
@ -525,7 +525,7 @@ class Expedition extends CommonObject
|
||||
$this->tracking_number = $obj->tracking_number;
|
||||
$this->origin = ($obj->origin?$obj->origin:'commande'); // For compatibility
|
||||
$this->origin_id = $obj->origin_id;
|
||||
$this->billed = ($obj->fk_statut==2?1:0);
|
||||
$this->billed = $obj->billed;
|
||||
|
||||
$this->trueWeight = $obj->weight;
|
||||
$this->weight_units = $obj->weight_units;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user