';
+ /*
+ // Ref bis
+ $morehtmlref.=$form->editfieldkey("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->mymodule->creer, 'string', '', 0, 1);
+ $morehtmlref.=$form->editfieldval("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->mymodule->creer, 'string', '', null, null, '', 1);
+ // Thirdparty
+ $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1);
+ // Project
+ if (! empty($conf->projet->enabled))
+ {
+ $langs->load("projects");
+ $morehtmlref.='
'.$langs->trans('Project') . ' ';
+ if ($user->rights->mymodule->creer)
+ {
+ if ($action != 'classify')
+ {
+ $morehtmlref.='
' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : ';
+ if ($action == 'classify') {
+ //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
+ $morehtmlref.='
';
+ } else {
+ $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
+ }
+ }
+ } else {
+ if (! empty($object->fk_project)) {
+ $proj = new Project($db);
+ $proj->fetch($object->fk_project);
+ $morehtmlref.='
';
+ $morehtmlref.=$proj->ref;
+ $morehtmlref.='';
+ } else {
+ $morehtmlref.='';
+ }
+ }
+ }
+ */
+ $morehtmlref.='
';
+
+
+ dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
+
+
+ print ''."\n";
- $parameters=array();
- $reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
- if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
-
- if (empty($reshook))
- {
- if ($user->rights->mymodule->write)
- {
- print '
'."\n";
- }
-
- if ($user->rights->mymodule->delete)
- {
- print '
'."\n";
- }
+ // Buttons for actions
+ if ($action != 'presend' && $action != 'editline') {
+ print '
'."\n";
+ $parameters=array();
+ $reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
+ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+
+ if (empty($reshook))
+ {
+ if ($user->rights->mymodule->write)
+ {
+ print '
'."\n";
+ }
+
+ if ($user->rights->mymodule->delete)
+ {
+ print '
'."\n";
+ }
+ }
+ print '
'."\n";
}
- print '
'."\n";
+
+ // Select mail models is same action as presend
+ if (GETPOST('modelselected')) {
+ $action = 'presend';
+ }
+
+ if ($action != 'presend')
+ {
+ print '';
+ print '
'; // ancre
+ // Documents
+ $comref = dol_sanitizeFileName($object->ref);
+ $relativepath = $comref . '/' . $comref . '.pdf';
+ $filedir = $conf->mymodule->dir_output . '/' . $comref;
+ $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
+ $genallowed = $user->rights->mymodule->creer;
+ $delallowed = $user->rights->mymodule->supprimer;
+ print $formfile->showdocuments('mymodule', $comref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
+
+
+ // Show links to link elements
+ $linktoelem = $form->showLinkToObjectBlock($object, null, array('order'));
+ $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
+
+
+ print '
';
+
+ // List of actions on element
+ include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
+ $formactions = new FormActions($db);
+ $somethingshown = $formactions->showactions($object, 'order', $socid);
+
+ print '
';
+ }
+
- // Example 2 : Adding links to objects
- // Show links to link elements
- //$linktoelem = $form->showLinkToObjectBlock($object, null, array('skeleton'));
- //$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
+ /*
+ * Action presend
+ */
+ /*
+ if ($action == 'presend')
+ {
+ $object->fetch_projet();
+ $ref = dol_sanitizeFileName($object->ref);
+ include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
+ $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
+ $file = $fileparams['fullname'];
+
+ // Define output language
+ $outputlangs = $langs;
+ $newlang = '';
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
+ $newlang = $_REQUEST['lang_id'];
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang))
+ $newlang = $object->thirdparty->default_lang;
+
+ if (!empty($newlang))
+ {
+ $outputlangs = new Translate('', $conf);
+ $outputlangs->setDefaultLang($newlang);
+ $outputlangs->load('commercial');
+ }
+
+ // Build document if it not exists
+ if (! $file || ! is_readable($file)) {
+ $result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
+ if ($result <= 0) {
+ dol_print_error($db, $object->error, $object->errors);
+ exit();
+ }
+ $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
+ $file = $fileparams['fullname'];
+ }
+
+ print '