46if (!empty($permissioncreate) && empty($permissiontoadd)) {
47 $permissiontoadd = $permissioncreate;
51if ($action ==
'builddoc' && ($permissiontoadd || !empty($usercangeneretedoc))) {
52 if (is_numeric(
GETPOST(
'model',
'alpha'))) {
53 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Model")),
null,
'errors');
57 $ret =
$object->fetch_thirdparty();
65 if (
GETPOST(
'model',
'alpha')) {
74 } elseif (!empty(
$object->fk_account)) {
78 $outputlangs = $langs;
82 $newlang =
GETPOST(
'lang_id',
'aZ09');
85 $newlang =
$object->thirdparty->default_lang;
88 $newlang =
$object->default_lang;
90 if (!empty($newlang)) {
92 $outputlangs->setDefaultLang($newlang);
96 if (empty($hidedetails)) {
99 if (empty($hidedesc)) {
102 if (empty($hideref)) {
105 if (empty($moreparams)) {
109 $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)$/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);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...