53@phan-var-force ?array<string,mixed> $moreparams
54@phan-var-force CommonObject|Societe $object
55@phan-var-force int $id
58if (!empty($permissioncreate) && empty($permissiontoadd)) {
59 $permissiontoadd = $permissioncreate;
63if ($action ==
'builddoc' && ($permissiontoadd || !empty($usercangeneratedoc))) {
64 if (is_numeric(
GETPOST(
'model',
'alpha'))) {
65 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Model")),
null,
'errors');
69 $ret =
$object->fetch_thirdparty();
72 if (
GETPOST(
'model',
'alpha')) {
81 } elseif (!empty(
$object->fk_account)) {
85 $outputlangs = $langs;
88 $newlang =
GETPOST(
'lang_id',
'aZ09');
91 $newlang =
$object->thirdparty->default_lang;
94 $newlang =
$object->default_lang;
96 if (!empty($newlang)) {
98 $outputlangs->setDefaultLang($newlang);
102 $hidedetails = isset($hidedetails) ? $hidedetails : (
getDolGlobalString(
'MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS') ? 1 : 0);
103 $hidedesc = isset($hidedesc) ? $hidedesc : (
getDolGlobalString(
'MAIN_GENERATE_DOCUMENTS_HIDE_DESC') ? 1 : 0);
104 $hideref = isset($hideref) ? $hideref : (
getDolGlobalString(
'MAIN_GENERATE_DOCUMENTS_HIDE_REF') ? 1 : 0);
105 $moreparams = isset($moreparams) ? $moreparams :
null;
107 $result =
$object->generateDocument(
$object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
114 if (empty($donotredirect)) {
129if ($action ==
'remove_file' && $permissiontoadd) {
130 if (!empty($upload_dir)) {
131 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
136 $ret =
$object->fetch_thirdparty();
139 $langs->load(
"other");
140 $filetodelete =
GETPOST(
'file',
'alpha');
141 $file = $upload_dir.
'/'.$filetodelete;
142 $dirthumb = dirname($file).
'/thumbs/';
147 if (preg_match(
'/(\.jpg|\.jpeg|\.bmp|\.gif|\.png|\.tiff|\.webp|\.xpm|\.xbm|\.avif)$/i', $file, $regs)) {
148 $photo_vignette = basename(preg_replace(
'/'.$regs[0].
'/i',
'', $file).
'_small'.$regs[0]);
149 if (file_exists(
dol_osencode($dirthumb.$photo_vignette))) {
153 $photo_vignette = basename(preg_replace(
'/'.$regs[0].
'/i',
'', $file).
'_mini'.$regs[0]);
154 if (file_exists(
dol_osencode($dirthumb.$photo_vignette))) {
159 setEventMessages($langs->trans(
"FileWasRemoved", $filetodelete),
null,
'mesgs');
161 setEventMessages($langs->trans(
"ErrorFailToDeleteFile", $filetodelete),
null,
'errors');
165 $urltoredirect = $_SERVER[
'REQUEST_URI'];
166 $urltoredirect = preg_replace(
'/#builddoc$/',
'', $urltoredirect);
167 $urltoredirect = preg_replace(
'/action=remove_file&?/',
'', $urltoredirect);
169 header(
'Location: '.$urltoredirect);
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
Class to manage translations.
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_osencode($str)
Return a string encoded into OS filesystem encoding.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.