29 require
'../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
35 $langs->loadLangs(array(
"companies",
"other"));
37 $action =
GETPOST(
'action',
'aZ09');
46 $socid = $user->socid;
51 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
52 $sortfield =
GETPOST(
"sortfield",
'alpha');
53 $sortorder =
GETPOST(
"sortorder",
'alpha');
55 if (empty($page) || $page == -1) { $page = 0; }
56 $offset = $limit * $page;
57 $pageprev = $page - 1;
58 $pagenext = $page + 1;
60 if (!empty($conf->global->MAIN_DOC_SORT_FIELD)) { $sortfield = $conf->global->MAIN_DOC_SORT_FIELD; }
61 if (!empty($conf->global->MAIN_DOC_SORT_ORDER)) { $sortorder = $conf->global->MAIN_DOC_SORT_ORDER; }
63 if (!$sortorder) $sortorder =
"ASC";
64 if (!$sortfield) $sortfield =
"position_name";
67 if ($id > 0 || !empty($ref))
69 $result = $object->fetch($id, $ref);
71 $upload_dir = $conf->societe->multidir_output[$object->entity].
"/".$object->id;
72 $courrier_dir = $conf->societe->multidir_output[$object->entity].
"/courrier/".
get_exdir($object->id, 0, 0, 0, $object,
'thirdparty');
76 $hookmanager->initHooks(array(
'thirdpartydocument',
'globalcard'));
84 include_once DOL_DOCUMENT_ROOT.
'/core/actions_linkedfiles.inc.php';
91 $form =
new Form($db);
93 $title = $langs->trans(
"ThirdParty").
' - '.$langs->trans(
"Files");
94 if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match(
'/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title = $object->name.
' - '.$langs->trans(
"Files");
95 $help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
103 if (!empty($conf->notification->enabled)) $langs->load(
"mails");
106 $form =
new Form($db);
112 $filearray =
dol_dir_list($upload_dir,
"files", 0,
'',
'(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) ==
'desc' ?SORT_DESC:SORT_ASC), 1);
114 foreach ($filearray as $key => $file)
116 $totalsize += $file[
'size'];
119 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
121 dol_banner_tab($object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom');
123 print '<div class="fichecenter">';
125 print '<div class="underbanner clearboth"></div>';
126 print '<table class="border tableforfield centpercent">';
129 if (!empty($conf->global->SOCIETE_USEPREFIX))
131 print '<tr><td class="titlefield">'.$langs->trans(
'Prefix').
'</td><td colspan="3">'.$object->prefix_comm.
'</td></tr>';
136 print '<tr><td class="titlefield">';
137 print $langs->trans(
'CustomerCode').
'</td><td colspan="3">';
138 print $object->code_client;
139 $tmpcheck = $object->check_codeclient();
140 if ($tmpcheck != 0 && $tmpcheck != -5) {
141 print ' <font class="error">('.$langs->trans(
"WrongCustomerCode").
')</font>';
146 if ($object->fournisseur)
148 print '<tr><td class="titlefield">';
149 print $langs->trans(
'SupplierCode').
'</td><td colspan="3">';
150 print $object->code_fournisseur;
151 $tmpcheck = $object->check_codefournisseur();
152 if ($tmpcheck != 0 && $tmpcheck != -5) {
153 print ' <font class="error">('.$langs->trans(
"WrongSupplierCode").
')</font>';
159 print '<tr><td class="titlefield">'.$langs->trans(
"NbOfAttachedFiles").
'</td><td colspan="3">'.count($filearray).
'</td></tr>';
162 print '<tr><td>'.$langs->trans(
"TotalSizeOfAttachedFiles").
'</td><td colspan="3">'.
dol_print_size($totalsize, 1, 1).
'</td></tr>';
170 $modulepart =
'societe';
171 $permission = $user->rights->societe->creer;
172 $permtoedit = $user->rights->societe->creer;
173 $param =
'&id='.$object->id;
174 include_once DOL_DOCUMENT_ROOT.
'/core/tpl/document_actions_post_headers.tpl.php';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
Class to manage third parties objects (customers, suppliers, prospects...)
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart= '')
Return a path to have a the directory according to object where files are stored. ...
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0)
Scan a directory and return a list of files/directories.
societe_prepare_head(Societe $object)
Return array of tabs to used on pages for third parties cards.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
dol_print_size($size, $shortvalue=0, $shortunit=0)
Return string with formated size.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_banner_tab($object, $paramid, $morehtml= '', $shownav=1, $fieldid= 'rowid', $fieldref= 'ref', $morehtmlref= '', $moreparam= '', $nodbprefix=0, $morehtmlleft= '', $morehtmlstatus= '', $onlybanner=0, $morehtmlright= '')
Show tab footer of a card.