52@phan-var-force ?array<string,mixed> $moreparams
53@phan-var-force CommonObject|Societe $object
56if (!empty($permissioncreate) && empty($permissiontoadd)) {
57 $permissiontoadd = $permissioncreate;
61if ($action ==
'builddoc' && ($permissiontoadd || !empty($usercangeneratedoc))) {
62 if (is_numeric(
GETPOST(
'model',
'alpha'))) {
63 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Model")),
null,
'errors');
67 $ret =
$object->fetch_thirdparty();
70 if (
GETPOST(
'model',
'alpha')) {
79 } elseif (!empty(
$object->fk_account)) {
83 $outputlangs = $langs;
86 $newlang =
GETPOST(
'lang_id',
'aZ09');
89 $newlang =
$object->thirdparty->default_lang;
92 $newlang =
$object->default_lang;
94 if (!empty($newlang)) {
96 $outputlangs->setDefaultLang($newlang);
100 $hidedetails = isset($hidedetails) ? $hidedetails : (
getDolGlobalString(
'MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS') ? 1 : 0);
101 $hidedesc = isset($hidedesc) ? $hidedesc : (
getDolGlobalString(
'MAIN_GENERATE_DOCUMENTS_HIDE_DESC') ? 1 : 0);
102 $hideref = isset($hideref) ? $hideref : (
getDolGlobalString(
'MAIN_GENERATE_DOCUMENTS_HIDE_REF') ? 1 : 0);
103 $moreparams = isset($moreparams) ? $moreparams :
null;
105 $result =
$object->generateDocument(
$object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
110 if (empty($donotredirect)) {
125if ($action ==
'remove_file' && $permissiontoadd) {
126 if (!empty($upload_dir)) {
127 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
132 $ret =
$object->fetch_thirdparty();
135 $langs->load(
"other");
136 $filetodelete =
GETPOST(
'file',
'alpha');
137 $file = $upload_dir.
'/'.$filetodelete;
138 $dirthumb = dirname($file).
'/thumbs/';
143 if (preg_match(
'/(\.jpg|\.jpeg|\.bmp|\.gif|\.png|\.tiff)$/i', $file, $regs)) {
144 $photo_vignette = basename(preg_replace(
'/'.$regs[0].
'/i',
'', $file).
'_small'.$regs[0]);
145 if (file_exists(
dol_osencode($dirthumb.$photo_vignette))) {
149 $photo_vignette = basename(preg_replace(
'/'.$regs[0].
'/i',
'', $file).
'_mini'.$regs[0]);
150 if (file_exists(
dol_osencode($dirthumb.$photo_vignette))) {
155 setEventMessages($langs->trans(
"FileWasRemoved", $filetodelete),
null,
'mesgs');
157 setEventMessages($langs->trans(
"ErrorFailToDeleteFile", $filetodelete),
null,
'errors');
161 $urltoredirect = $_SERVER[
'REQUEST_URI'];
162 $urltoredirect = preg_replace(
'/#builddoc$/',
'', $urltoredirect);
163 $urltoredirect = preg_replace(
'/action=remove_file&?/',
'', $urltoredirect);
165 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.