require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; print '<form method="post" action="' . $_SERVER["PHP_SELF"] . '">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="action" value="update">'; clearstatcache(); $var = true; print load_fiche_titre($langs->trans("Language"), '', ''); print '<br>'; print '<table summary="edit" class="noborder" width="100%">'; print '<tr class="liste_titre"><td>' . $langs->trans("Parameters") . '</td><td>' . $langs->trans("Value") . '</td>'; print '<td width="20"> </td>'; print '</tr>'; // Default language $var = !$var; print '<tr ' . $bc[$var] . '><td width="35%">' . $langs->trans("DefaultLanguage") . '</td><td>'; print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'main_lang_default', 1, 0, 0, 0, 0, 'minwidth300'); print '</td>'; print '<td width="20"> </td>'; print '</tr>'; // Multilangual GUI $var = !$var; print '<tr ' . $bc[$var] . '><td width="35%">' . $langs->trans("EnableMultilangInterface") . '</td><td>'; print $form->selectyesno('main_multilangs', $conf->global->MAIN_MULTILANGS, 1); print '</td>'; print '<td width="20"> </td>'; print '</tr>'; print '</table><br>' . "\n"; // Themes and themes options show_theme(null, 1); print '<br>'; // Liste des zone de recherche permanantes supportees
print '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td><td colspan="3">'; print $form->selectyesno('localtax1assuj_value',0,1); print '</td><tr>'; } elseif($mysoc->localtax2_assuj=="1") { print '<tr><td>'.$langs->trans("LocalTax2IsUsedES").'</td><td colspan="3">'; print $form->selectyesno('localtax2assuj_value',0,1); print '</td><tr>'; } } if ($conf->global->MAIN_MULTILANGS) { print '<tr><td>'.$langs->trans("DefaultLang").'</td><td colspan="3">'."\n"; print $formadmin->select_language(($object->default_lang?$object->default_lang:$conf->global->MAIN_LANG_DEFAULT),'default_lang',0,0,1); print '</td>'; print '</tr>'; } if ($user->rights->societe->client->voir) { // Assign a Name print '<tr>'; print '<td>'.$langs->trans("AllocateCommercial").'</td>'; print '<td colspan="3">'; $form->select_users($object->commercial_id,'commercial_id',1); print '</td></tr>'; } // Other attributes
/** * Return a string to show the box with list of available documents for object. * This also set the property $this->numoffiles * * @param string $modulepart Module the files are related to ('propal', 'facture', 'facture_fourn', 'mymodule', 'mymodule_temp', ...) * @param string $modulesubdir Existing (so sanitized) sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into subdir of module. * @param string $filedir Directory to scan * @param string $urlsource Url of origin page (for return) * @param int $genallowed Generation is allowed (1/0 or array list of templates) * @param int $delallowed Remove is allowed (1/0) * @param string $modelselected Model to preselect by default * @param string $allowgenifempty Allow generation even if list of template ($genallowed) is empty (show however a warning) * @param string $forcenomultilang Do not show language option (even if MAIN_MULTILANGS defined) * @param int $iconPDF Deprecated, see getDocumentsLink * @param int $maxfilenamelength Max length for filename shown * @param string $noform Do not output html form tags * @param string $param More param on http links * @param string $title Title to show on top of form * @param string $buttonlabel Label on submit button * @param string $codelang Default language code to use on lang combo box if multilang is enabled * @param string $morepicto Add more HTML content into cell with picto * @return string Output string with HTML array of documents (might be empty string) */ function showdocuments($modulepart, $modulesubdir, $filedir, $urlsource, $genallowed, $delallowed = 0, $modelselected = '', $allowgenifempty = 1, $forcenomultilang = 0, $iconPDF = 0, $maxfilenamelength = 28, $noform = 0, $param = '', $title = '', $buttonlabel = '', $codelang = '', $morepicto = '') { // Deprecation warning if (0 !== $iconPDF) { dol_syslog(__METHOD__ . ": passing iconPDF parameter is deprecated", LOG_WARNING); } global $langs, $conf, $user, $hookmanager; global $form, $bc; if (!is_object($form)) { $form = new Form($this->db); } include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; // For backward compatibility if (!empty($iconPDF)) { return $this->getDocumentsLink($modulepart, $modulesubdir, $filedir); } $printer = 0; if (in_array($modulepart, array('facture', 'supplier_proposal', 'propal', 'proposal', 'order', 'commande', 'expedition', 'commande_fournisseur'))) { $printer = !empty($user->rights->printing->read) && !empty($conf->printing->enabled) ? true : false; } $hookmanager->initHooks(array('formfile')); $forname = 'builddoc'; $out = ''; $var = true; $headershown = 0; $showempty = 0; $i = 0; $titletoshow = $langs->trans("Documents"); if (!empty($title)) { $titletoshow = $title; } $out .= "\n" . '<!-- Start show_document -->' . "\n"; //print 'filedir='.$filedir; // Show table if ($genallowed) { $modellist = array(); if ($modulepart == 'company') { $showempty = 1; if (is_array($genallowed)) { $modellist = $genallowed; } else { include_once DOL_DOCUMENT_ROOT . '/core/modules/societe/modules_societe.class.php'; $modellist = ModeleThirdPartyDoc::liste_modeles($this->db); } } else { if ($modulepart == 'propal') { if (is_array($genallowed)) { $modellist = $genallowed; } else { include_once DOL_DOCUMENT_ROOT . '/core/modules/propale/modules_propale.php'; $modellist = ModelePDFPropales::liste_modeles($this->db); } } else { if ($modulepart == 'supplier_proposal') { if (is_array($genallowed)) { $modellist = $genallowed; } else { include_once DOL_DOCUMENT_ROOT . '/core/modules/supplier_proposal/modules_supplier_proposal.php'; $modellist = ModelePDFSupplierProposal::liste_modeles($this->db); } } else { if ($modulepart == 'commande') { if (is_array($genallowed)) { $modellist = $genallowed; } else { include_once DOL_DOCUMENT_ROOT . '/core/modules/commande/modules_commande.php'; $modellist = ModelePDFCommandes::liste_modeles($this->db); } } elseif ($modulepart == 'expedition') { if (is_array($genallowed)) { $modellist = $genallowed; } else { include_once DOL_DOCUMENT_ROOT . '/core/modules/expedition/modules_expedition.php'; $modellist = ModelePDFExpedition::liste_modeles($this->db); } } elseif ($modulepart == 'livraison') { if (is_array($genallowed)) { $modellist = $genallowed; } else { include_once DOL_DOCUMENT_ROOT . '/core/modules/livraison/modules_livraison.php'; $modellist = ModelePDFDeliveryOrder::liste_modeles($this->db); } } else { if ($modulepart == 'ficheinter') { if (is_array($genallowed)) { $modellist = $genallowed; } else { include_once DOL_DOCUMENT_ROOT . '/core/modules/fichinter/modules_fichinter.php'; $modellist = ModelePDFFicheinter::liste_modeles($this->db); } } elseif ($modulepart == 'facture') { if (is_array($genallowed)) { $modellist = $genallowed; } else { include_once DOL_DOCUMENT_ROOT . '/core/modules/facture/modules_facture.php'; $modellist = ModelePDFFactures::liste_modeles($this->db); } } elseif ($modulepart == 'contract') { if (is_array($genallowed)) { $modellist = $genallowed; } else { include_once DOL_DOCUMENT_ROOT . '/core/modules/contract/modules_contract.php'; $modellist = ModelePDFContract::liste_modeles($this->db); } } elseif ($modulepart == 'project') { if (is_array($genallowed)) { $modellist = $genallowed; } else { include_once DOL_DOCUMENT_ROOT . '/core/modules/project/modules_project.php'; $modellist = ModelePDFProjects::liste_modeles($this->db); } } elseif ($modulepart == 'project_task') { if (is_array($genallowed)) { $modellist = $genallowed; } else { include_once DOL_DOCUMENT_ROOT . '/core/modules/project/task/modules_task.php'; $modellist = ModelePDFTask::liste_modeles($this->db); } } elseif ($modulepart == 'export') { if (is_array($genallowed)) { $modellist = $genallowed; } else { include_once DOL_DOCUMENT_ROOT . '/core/modules/export/modules_export.php'; $modellist = ModeleExports::liste_modeles($this->db); } } else { if ($modulepart == 'commande_fournisseur') { if (is_array($genallowed)) { $modellist = $genallowed; } else { include_once DOL_DOCUMENT_ROOT . '/core/modules/supplier_order/modules_commandefournisseur.php'; $modellist = ModelePDFSuppliersOrders::liste_modeles($this->db); } } else { if ($modulepart == 'facture_fournisseur') { if (is_array($genallowed)) { $modellist = $genallowed; } else { include_once DOL_DOCUMENT_ROOT . '/core/modules/supplier_invoice/modules_facturefournisseur.php'; $modellist = ModelePDFSuppliersInvoices::liste_modeles($this->db); } } else { if ($modulepart == 'remisecheque') { if (is_array($genallowed)) { $modellist = $genallowed; } else { include_once DOL_DOCUMENT_ROOT . '/core/modules/cheque/pdf/modules_chequereceipts.php'; $modellist = ModeleChequeReceipts::liste_modeles($this->db); } } elseif ($modulepart == 'donation') { if (is_array($genallowed)) { $modellist = $genallowed; } else { include_once DOL_DOCUMENT_ROOT . '/core/modules/dons/modules_don.php'; $modellist = ModeleDon::liste_modeles($this->db); } } else { if ($modulepart == 'unpaid') { $modellist = ''; } else { if ($modulepart != 'agenda') { // For normalized standard modules $file = dol_buildpath('/core/modules/' . $modulepart . '/modules_' . $modulepart . '.php', 0); if (file_exists($file)) { $res = (include_once $file); } else { $file = dol_buildpath('/' . $modulepart . '/core/modules/' . $modulepart . '/modules_' . $modulepart . '.php', 0); $res = (include_once $file); } $class = 'Modele' . ucfirst($modulepart); if (class_exists($class)) { $modellist = call_user_func($class . '::liste_modeles', $this->db); } else { dol_print_error($this->db, 'Bad value for modulepart'); return -1; } } } } } } } } } } } $headershown = 1; $buttonlabeltoshow = $buttonlabel; if (empty($buttonlabel)) { $buttonlabel = $langs->trans('Generate'); } if (empty($noform)) { $out .= '<form action="' . $urlsource . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#builddoc') . '" name="' . $forname . '" id="' . $forname . '_form" method="post">'; } $out .= '<input type="hidden" name="action" value="builddoc">'; $out .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; $out .= load_fiche_titre($titletoshow, '', ''); $out .= '<table class="liste formdoc noborder" summary="listofdocumentstable" width="100%">'; $out .= '<tr class="liste_titre">'; // Model if (!empty($modellist)) { $out .= '<th align="center" class="formdoc liste_titre maxwidthonsmartphone">'; $out .= '<span class="hideonsmartphone">' . $langs->trans('Model') . ' </span>'; if (is_array($modellist) && count($modellist) == 1) { $arraykeys = array_keys($modellist); $modelselected = $arraykeys[0]; } $out .= $form->selectarray('model', $modellist, $modelselected, $showempty, 0, 0, '', 0, 0, 0, '', ''); $out .= '</th>'; } else { $out .= '<th align="left" class="formdoc liste_titre">'; $out .= $langs->trans("Files"); $out .= '</th>'; } // Language code (if multilang) $out .= '<th align="center" class="formdoc liste_titre maxwidthonsmartphone">'; if (($allowgenifempty || is_array($modellist) && count($modellist) > 0) && $conf->global->MAIN_MULTILANGS && !$forcenomultilang && (!empty($modellist) || $showempty)) { include_once DOL_DOCUMENT_ROOT . '/core/class/html.formadmin.class.php'; $formadmin = new FormAdmin($this->db); $defaultlang = $codelang ? $codelang : $langs->getDefaultLang(); $morecss = 'maxwidth150'; if (!empty($conf->browser->phone)) { $morecss = 'maxwidth100'; } $out .= $formadmin->select_language($defaultlang, 'lang_id', 0, 0, 0, 0, 0, $morecss); } else { $out .= ' '; } $out .= '</th>'; // Button $addcolumforpicto = $delallowed || $printer || $morepicto; $out .= '<th align="center" colspan="' . ($addcolumforpicto ? '2' : '1') . '" class="formdocbutton liste_titre maxwidthonsmartphone">'; $genbutton = '<input class="button" id="' . $forname . '_generatebutton" name="' . $forname . '_generatebutton"'; $genbutton .= ' type="submit" value="' . $buttonlabel . '"'; if (!$allowgenifempty && !is_array($modellist) && empty($modellist)) { $genbutton .= ' disabled'; } $genbutton .= '>'; if ($allowgenifempty && !is_array($modellist) && empty($modellist) && empty($conf->dol_no_mouse_hover) && $modulepart != 'unpaid') { $langs->load("errors"); $genbutton .= ' ' . img_warning($langs->transnoentitiesnoconv("WarningNoDocumentModelActivated")); } if (!$allowgenifempty && !is_array($modellist) && empty($modellist) && empty($conf->dol_no_mouse_hover) && $modulepart != 'unpaid') { $genbutton = ''; } if (empty($modellist) && !$showempty && $modulepart != 'unpaid') { $genbutton = ''; } $out .= $genbutton; $out .= '</th>'; if (!empty($hookmanager->hooks['formfile'])) { foreach ($hookmanager->hooks['formfile'] as $module) { if (method_exists($module, 'formBuilddocLineOptions')) { $out .= '<th></th>'; } } } $out .= '</tr>'; // Execute hooks $parameters = array('socid' => isset($GLOBALS['socid']) ? $GLOBALS['socid'] : '', 'id' => isset($GLOBALS['id']) ? $GLOBALS['id'] : '', 'modulepart' => $modulepart); if (is_object($hookmanager)) { $reshook = $hookmanager->executeHooks('formBuilddocOptions', $parameters, $GLOBALS['object']); $out .= $hookmanager->resPrint; } } // Get list of files if (!empty($filedir)) { $file_list = dol_dir_list($filedir, 'files', 0, '', '(\\.meta|_preview\\.png)$', 'date', SORT_DESC); // Affiche en-tete tableau si non deja affiche if (!empty($file_list) && !$headershown) { $headershown = 1; $out .= '<div class="titre">' . $titletoshow . '</div>'; $out .= '<table class="border" summary="listofdocumentstable" width="100%">'; } // Loop on each file found if (is_array($file_list)) { foreach ($file_list as $file) { $var = !$var; // Define relative path for download link (depends on module) $relativepath = $file["name"]; // Cas general if ($modulesubdir) { $relativepath = $modulesubdir . "/" . $file["name"]; } // Cas propal, facture... if ($modulepart == 'export') { $relativepath = $file["name"]; } // Other case $out .= "<tr " . $bc[$var] . ">"; $documenturl = DOL_URL_ROOT . '/document.php'; if (isset($conf->global->DOL_URL_ROOT_DOCUMENT_PHP)) { $documenturl = $conf->global->DOL_URL_ROOT_DOCUMENT_PHP; } // Show file name with link to download $out .= '<td class="nowrap">'; $out .= '<a data-ajax="false" href="' . $documenturl . '?modulepart=' . $modulepart . '&file=' . urlencode($relativepath) . '"'; $mime = dol_mimetype($relativepath, '', 0); if (preg_match('/text/', $mime)) { $out .= ' target="_blank"'; } $out .= ' target="_blank">'; $out .= img_mime($file["name"], $langs->trans("File") . ': ' . $file["name"]) . ' ' . dol_trunc($file["name"], $maxfilenamelength); $out .= '</a>' . "\n"; $out .= '</td>'; // Show file size $size = !empty($file['size']) ? $file['size'] : dol_filesize($filedir . "/" . $file["name"]); $out .= '<td align="right" class="nowrap">' . dol_print_size($size) . '</td>'; // Show file date $date = !empty($file['date']) ? $file['date'] : dol_filemtime($filedir . "/" . $file["name"]); $out .= '<td align="right" class="nowrap">' . dol_print_date($date, 'dayhour', 'tzuser') . '</td>'; if ($delallowed || $printer || $morepicto) { $out .= '<td align="right">'; if ($delallowed) { $out .= '<a href="' . $urlsource . (strpos($urlsource, '?') ? '&' : '?') . 'action=remove_file&file=' . urlencode($relativepath); $out .= $param ? '&' . $param : ''; //$out.= '&modulepart='.$modulepart; // TODO obsolete ? //$out.= '&urlsource='.urlencode($urlsource); // TODO obsolete ? $out .= '">' . img_picto($langs->trans("Delete"), 'delete.png') . '</a>'; //$out.='</td>'; } if ($printer) { //$out.= '<td align="right">'; $out .= ' <a href="' . $urlsource . (strpos($urlsource, '?') ? '&' : '?') . 'action=print_file&printer=' . $modulepart . '&file=' . urlencode($relativepath); $out .= $param ? '&' . $param : ''; $out .= '">' . img_picto($langs->trans("PrintFile", $relativepath), 'printer.png') . '</a>'; } if ($morepicto) { $morepicto = preg_replace('/__FILENAMEURLENCODED__/', urlencode($relativepath), $morepicto); $out .= $morepicto; } $out .= '</td>'; } if (is_object($hookmanager)) { $parameters = array('socid' => isset($GLOBALS['socid']) ? $GLOBALS['socid'] : '', 'id' => isset($GLOBALS['id']) ? $GLOBALS['id'] : '', 'modulepart' => $modulepart, 'relativepath' => $relativepath); $res = $hookmanager->executeHooks('formBuilddocLineOptions', $parameters, $file); if (empty($res)) { $out .= $hookmanager->resPrint; // Complete line $out .= '</tr>'; } else { $out = $hookmanager->resPrint; } // Replace line } } if (count($file_list) == 0 && $headershown) { $out .= '<tr ' . $bc[0] . '><td colspan="3">' . $langs->trans("None") . '</td></tr>'; } $this->numoffiles++; } } if ($headershown) { // Affiche pied du tableau $out .= "</table>\n"; if ($genallowed) { if (empty($noform)) { $out .= '</form>' . "\n"; } } } $out .= '<!-- End show_document -->' . "\n"; //return ($i?$i:$headershown); return $out; }
/** * Show fields in insert/edit mode * * @param array $fieldlist Array of fields * @param Object $obj If we show a particular record, obj is filled with record fields * @param string $tabname Name of SQL table * @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered * @return void */ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') { global $conf, $langs, $db; global $form; global $region_id; global $elementList, $sourceList, $localtax_typeList; global $bc; $formadmin = new FormAdmin($db); $formcompany = new FormCompany($db); foreach ($fieldlist as $field => $value) { if ($fieldlist[$field] == 'country') { if (in_array('region_id', $fieldlist)) { print '<td>'; //print join(',',$fieldlist); print '</td>'; continue; } // For state page, we do not show the country input (we link to region, not country) print '<td>'; $fieldname = 'country'; print $form->select_country(!empty($obj->country_code) ? $obj->country_code : (!empty($obj->country) ? $obj->country : ''), $fieldname, '', 28, 'maxwidth300'); print '</td>'; } elseif ($fieldlist[$field] == 'country_id') { if (!in_array('country', $fieldlist)) { $country_id = !empty($obj->{$fieldlist}[$field]) ? $obj->{$fieldlist}[$field] : 0; print '<td>'; print '<input type="hidden" name="' . $fieldlist[$field] . '" value="' . $country_id . '">'; print '</td>'; } } elseif ($fieldlist[$field] == 'region') { print '<td>'; $formcompany->select_region($region_id, 'region'); print '</td>'; } elseif ($fieldlist[$field] == 'region_id') { $region_id = !empty($obj->{$fieldlist}[$field]) ? $obj->{$fieldlist}[$field] : 0; print '<td>'; print '<input type="hidden" name="' . $fieldlist[$field] . '" value="' . $region_id . '">'; print '</td>'; } elseif ($fieldlist[$field] == 'lang') { print '<td>'; print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'lang'); print '</td>'; } elseif ($fieldlist[$field] == 'type_template') { print '<td>'; print $form->selectarray('type_template', $elementList, !empty($obj->{$fieldlist}[$field]) ? $obj->{$fieldlist}[$field] : ''); print '</td>'; } elseif ($fieldlist[$field] == 'element') { print '<td>'; print $form->selectarray('element', $elementList, !empty($obj->{$fieldlist}[$field]) ? $obj->{$fieldlist}[$field] : ''); print '</td>'; } elseif ($fieldlist[$field] == 'source') { print '<td>'; print $form->selectarray('source', $sourceList, !empty($obj->{$fieldlist}[$field]) ? $obj->{$fieldlist}[$field] : ''); print '</td>'; } elseif ($fieldlist[$field] == 'type' && $tabname == MAIN_DB_PREFIX . "c_actioncomm") { print '<td>'; print 'user<input type="hidden" name="type" value="user">'; print '</td>'; } elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'fdm' || $fieldlist[$field] == 'deductible') { print '<td>'; print $form->selectyesno($fieldlist[$field], !empty($obj->{$fieldlist}[$field]) ? $obj->{$fieldlist}[$field] : '', 1); print '</td>'; } elseif (in_array($fieldlist[$field], array('nbjour', 'decalage', 'taux', 'localtax1', 'localtax2'))) { $align = "left"; if (in_array($fieldlist[$field], array('taux', 'localtax1', 'localtax2'))) { $align = "right"; } // Fields aligned on right print '<td align="' . $align . '">'; print '<input type="text" class="flat" value="' . (isset($obj->{$fieldlist}[$field]) ? $obj->{$fieldlist}[$field] : '') . '" size="3" name="' . $fieldlist[$field] . '">'; print '</td>'; } elseif (in_array($fieldlist[$field], array('libelle_facture'))) { print '<td><textarea cols="30" rows="' . ROWS_2 . '" class="flat" name="' . $fieldlist[$field] . '">' . (!empty($obj->{$fieldlist}[$field]) ? $obj->{$fieldlist}[$field] : '') . '</textarea></td>'; } elseif (in_array($fieldlist[$field], array('content'))) { if ($tabname == MAIN_DB_PREFIX . 'c_email_templates') { print '<td colspan="4"></td></tr><tr class="pair nohover"><td colspan="5">'; // To create an artificial CR for the current tr we are on } else { print '<td>'; } if ($context != 'hide') { //print '<textarea cols="3" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'</textarea>'; $doleditor = new DolEditor($fieldlist[$field], !empty($obj->{$fieldlist}[$field]) ? $obj->{$fieldlist}[$field] : '', '', 140, 'dolibarr_mailings', 'In', 0, false, true, ROWS_5, '90%'); print $doleditor->Create(1); } else { print ' '; } print '</td>'; } elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i', $fieldlist[$field])) { print '<td><input type="text" class="flat" value="' . price(!empty($obj->{$fieldlist}[$field]) ? $obj->{$fieldlist}[$field] : '') . '" size="8" name="' . $fieldlist[$field] . '"></td>'; } elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist}[$field])) { print '<td><input type="text" class="flat" value="' . (!empty($obj->{$fieldlist}[$field]) ? $obj->{$fieldlist}[$field] : '') . '" size="10" name="' . $fieldlist[$field] . '"></td>'; } elseif ($fieldlist[$field] == 'unit') { print '<td>'; $units = array('mm' => $langs->trans('SizeUnitmm'), 'cm' => $langs->trans('SizeUnitcm'), 'point' => $langs->trans('SizeUnitpoint'), 'inch' => $langs->trans('SizeUnitinch')); print $form->selectarray('unit', $units, !empty($obj->{$fieldlist}[$field]) ? $obj->{$fieldlist}[$field] : '', 0, 0, 0); print '</td>'; } elseif ($fieldlist[$field] == 'localtax1_type' || $fieldlist[$field] == 'localtax2_type') { print '<td align="center">'; print $form->selectarray($fieldlist[$field], $localtax_typeList, !empty($obj->{$fieldlist}[$field]) ? $obj->{$fieldlist}[$field] : ''); print '</td>'; } else { print '<td>'; $size = ''; if ($fieldlist[$field] == 'code') { $size = 'size="8" '; } if ($fieldlist[$field] == 'position') { $size = 'size="4" '; } if ($fieldlist[$field] == 'libelle') { $size = 'size="32" '; } if ($fieldlist[$field] == 'tracking') { $size = 'size="92" '; } if ($fieldlist[$field] == 'accountancy_code') { $size = 'size="10" '; } if ($fieldlist[$field] == 'accountancy_code_sell') { $size = 'size="10" '; } if ($fieldlist[$field] == 'accountancy_code_buy') { $size = 'size="10" '; } if ($fieldlist[$field] == 'sortorder') { $size = 'size="2" '; } print '<input type="text" ' . $size . ' class="flat" value="' . (isset($obj->{$fieldlist}[$field]) ? $obj->{$fieldlist}[$field] : '') . '" name="' . $fieldlist[$field] . '">'; print '</td>'; } } }
} print "\n</div>\n"; /* * Form to add a new translation */ if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service->creer)) { //WYSIWYG Editor require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; print '<br>'; print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="action" value="vadd">'; print '<input type="hidden" name="id" value="' . $_GET["id"] . '">'; print '<table class="border" width="100%">'; print '<tr><td valign="top" width="15%" class="fieldrequired">' . $langs->trans('Language') . '</td><td>'; print $formadmin->select_language('', 'forcelangprod', 0, $object->multilangs, 1); print '</td></tr>'; print '<tr><td valign="top" width="15%" class="fieldrequired">' . $langs->trans('Label') . '</td><td><input name="libelle" size="40"></td></tr>'; print '<tr><td valign="top" width="15%">' . $langs->trans('Description') . '</td><td>'; $doleditor = new DolEditor('desc', '', '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 3, 80); $doleditor->Create(); print '</td></tr>'; print '<tr><td valign="top" width="15%">' . $langs->trans('Note') . '</td><td>'; $doleditor = new DolEditor('note', '', '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 3, 80); $doleditor->Create(); print '</td></tr>'; print '</tr>'; print '</table>'; print '<br><div class="center">'; print '<input type="submit" class="button" value="' . $langs->trans("Save") . '">'; print ' ';
$stats = '<br>'; $stats .= ' ' . picto_from_langcode($lit->lang); $stats .= ' ' . $langs->trans('NbTerms') . ' : ' . $lit->nbTerms . '<br>'; $stats .= ' ' . picto_from_langcode($lit->lang); $stats .= ' ' . $langs->trans('NbCustomTerms') . ' : ' . $lit->nbTrans . '<br>'; } // Select lang to customize $var = !$var; print '<tr ' . $bc[$var] . '>'; print '<td colspan="2">' . $langs->trans("SelectLangToCustomize") . $stats . '</td>'; print '</tr>'; $var = !$var; print '<tr ' . $bc[$var] . '><td>'; print '<input type="text" class="flat" size="30" name="word" value="' . $word . '">'; print '</td><td>'; print $formadmin->select_language($langtosearch, 'langtosearch'); print '</td></tr>'; $var = !$var; print '<tr ' . $bc[$var] . '>'; print '<td>'; //print '<a href="" id="moreoptionslink">['.$langs->trans("MoreOptions").']</a>'; //print '<div id="moreoptions">'; print '<input type="radio" id="search_custom" name="search_option" value="custom" ' . ($search_option == 'custom' ? 'checked ' : '') . '/> '; print '<label for="search_custom">' . $langs->trans('SearchInCurrentTrans') . '</label><br>'; print '<input type="radio" id="search_official" name="search_option" value="official" ' . ($search_option == 'official' ? 'checked ' : '') . '/> '; print '<label for="search_official">' . $langs->trans('SearchInOfficialTrans') . '</label><br>'; print '<input type="radio" id="search_key" name="search_option" value="key" ' . ($search_option == 'key' ? 'checked ' : '') . '/> '; print '<label for="search_key">' . $langs->trans('SearchInKeys') . '</label><br>'; //print '</div>'; print '</td>'; print '<td>';
/** * \brief Show field * \param fieldlist Array of fields * \param obj If we show a particular record, obj is filled with record fields */ function fieldList($fieldlist, $obj = '') { global $conf, $langs, $db; global $region_id; global $elementList, $sourceList; $html = new Form($db); $formadmin = new FormAdmin($db); $formcompany = new FormCompany($db); foreach ($fieldlist as $field => $value) { if ($fieldlist[$field] == 'pays') { if (in_array('region_id', $fieldlist)) { print '<td> </td>'; continue; } // For region page, we do not show the country input print '<td>'; print $html->select_country($obj->pays_code ? $obj->pays_code : $obj->pays, 'pays'); print '</td>'; } elseif ($fieldlist[$field] == 'pays_id') { $pays_id = !empty($obj->{$fieldlist}[$field]) ? $obj->{$fieldlist}[$field] : 0; print '<input type="hidden" name="' . $fieldlist[$field] . '" value="' . $pays_id . '">'; } elseif ($fieldlist[$field] == 'region') { print '<td>'; $formcompany->select_region($region_id, 'region'); print '</td>'; } elseif ($fieldlist[$field] == 'region_id') { $region_id = $obj->{$fieldlist}[$field] ? $obj->{$fieldlist}[$field] : 0; print '<input type="hidden" name="' . $fieldlist[$field] . '" value="' . $region_id . '">'; } elseif ($fieldlist[$field] == 'lang') { print '<td>'; print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'lang'); print '</td>'; } elseif ($fieldlist[$field] == 'element') { print '<td>'; print $html->selectarray('element', $elementList, $obj->{$fieldlist}[$field]); print '</td>'; } elseif ($fieldlist[$field] == 'source') { print '<td>'; print $html->selectarray('source', $sourceList, $obj->{$fieldlist}[$field]); print '</td>'; } elseif ($fieldlist[$field] == 'type' && $tabname[$_GET["id"]] == MAIN_DB_PREFIX . "c_actioncomm") { print '<td>'; print 'user<input type="hidden" name="type" value="user">'; print '</td>'; } elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'fdm') { print '<td>'; print $html->selectyesno($fieldlist[$field], $obj->{$fieldlist}[$field], 1); print '</td>'; } elseif ($fieldlist[$field] == 'nbjour' || $fieldlist[$field] == 'decalage' || $fieldlist[$field] == 'taux') { print '<td><input type="text" class="flat" value="' . $obj->{$fieldlist}[$field] . '" size="3" name="' . $fieldlist[$field] . '"></td>'; } elseif ($fieldlist[$field] == 'libelle_facture') { print '<td><textarea cols="30" rows="' . ROWS_2 . '" class="flat" name="' . $fieldlist[$field] . '">' . $obj->{$fieldlist}[$field] . '</textarea></td>'; } elseif ($fieldlist[$field] == 'price') { print '<td><input type="text" class="flat" value="' . price($obj->{$fieldlist}[$field]) . '" size="8" name="' . $fieldlist[$field] . '"></td>'; } elseif ($fieldlist[$field] == 'code') { print '<td><input type="text" class="flat" value="' . $obj->{$fieldlist}[$field] . '" size="10" name="' . $fieldlist[$field] . '"></td>'; } elseif ($fieldlist[$field] == 'unit') { print '<td>'; print $html->selectarray('unit', array('mm', 'cm', 'point', 'inch'), $obj->{$fieldlist}[$field], 0, 0, 1); print '</td>'; } else { print '<td>'; print '<input type="text" ' . ($fieldlist[$field] == 'libelle' ? 'size="32" ' : '') . ' class="flat" value="' . $obj->{$fieldlist}[$field] . '" name="' . $fieldlist[$field] . '">'; print '</td>'; } } }
print '<table class="noborder" width="100%">'; print '<tr class="liste_titre"><td width="25%">' . $langs->trans("Parameter") . '</td><td width="25%">' . $langs->trans("DefaultValue") . '</td><td> </td><td>' . $langs->trans("PersonalValue") . '</td></tr>'; // Langue par defaut $var = !$var; print '<tr ' . $bc[$var] . '><td>' . $langs->trans("Language") . '</td>'; print '<td>'; $s = picto_from_langcode($conf->global->MAIN_LANG_DEFAULT); print $s ? $s . ' ' : ''; print $conf->global->MAIN_LANG_DEFAULT == 'auto' ? $langs->trans("AutoDetectLang") : $langs->trans("Language_" . $conf->global->MAIN_LANG_DEFAULT); print '</td>'; print '<td align="left" class="nowrap" width="20%"><input ' . $bc[$var] . ' name="check_MAIN_LANG_DEFAULT" id="check_MAIN_LANG_DEFAULT" type="checkbox" ' . (!empty($object->conf->MAIN_LANG_DEFAULT) ? " checked" : ""); print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo print '> ' . $langs->trans("UsePersonalValue") . '</td>'; print '<td>'; print $formadmin->select_language(!empty($object->conf->MAIN_LANG_DEFAULT) ? $object->conf->MAIN_LANG_DEFAULT : '', 'main_lang_default', 1, null, 0, 0, !empty($dolibarr_main_demo)); print '</td></tr>'; // Taille max des listes $var = !$var; print '<tr ' . $bc[$var] . '><td>' . $langs->trans("MaxSizeList") . '</td>'; print '<td>' . $conf->global->MAIN_SIZE_LISTE_LIMIT . '</td>'; print '<td align="left" class="nowrap" width="20%"><input ' . $bc[$var] . ' name="check_SIZE_LISTE_LIMIT" id="check_SIZE_LISTE_LIMIT" type="checkbox" ' . (!empty($object->conf->MAIN_SIZE_LISTE_LIMIT) ? " checked" : ""); print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo print '> ' . $langs->trans("UsePersonalValue") . '</td>'; print '<td><input class="flat" name="main_size_liste_limit" id="main_size_liste_limit" size="4" value="' . (!empty($object->conf->MAIN_SIZE_LISTE_LIMIT) ? $object->conf->MAIN_SIZE_LISTE_LIMIT : '') . '"></td></tr>'; print '</table><br>'; // Theme show_theme($object, $user->admin || empty($dolibarr_main_demo) ? 1 : 0, true); dol_fiche_end(); print '<div class="center">';
print '<table class="noborder" width="100%">'; print '<tr class="liste_titre"><td width="25%">'.$langs->trans("Parameter").'</td><td width="25%">'.$langs->trans("DefaultValue").'</td><td> </td><td>'.$langs->trans("PersonalValue").'</td></tr>'; // Langue par defaut $var=!$var; print '<tr '.$bc[$var].'><td>'.$langs->trans("Language").'</td>'; print '<td>'; $s=picto_from_langcode($conf->global->MAIN_LANG_DEFAULT); print $s?$s.' ':''; print ($conf->global->MAIN_LANG_DEFAULT=='auto'?$langs->trans("AutoDetectLang"):$langs->trans("Language_".$conf->global->MAIN_LANG_DEFAULT)); print '</td>'; print '<td align="left" nowrap="nowrap" width="20%"><input '.$bc[$var].' name="check_MAIN_LANG_DEFAULT" id="check_MAIN_LANG_DEFAULT" type="checkbox" '.(! empty($fuser->conf->MAIN_LANG_DEFAULT)?" checked":""); print ! empty($dolibarr_main_demo)?' disabled="disabled"':''; // Disabled for demo print '> '.$langs->trans("UsePersonalValue").'</td>'; print '<td>'; print $formadmin->select_language((! empty($fuser->conf->MAIN_LANG_DEFAULT)?$fuser->conf->MAIN_LANG_DEFAULT:''),'main_lang_default',1); print '</td></tr>'; // Taille max des listes $var=!$var; print '<tr '.$bc[$var].'><td>'.$langs->trans("MaxSizeList").'</td>'; print '<td>'.$conf->global->MAIN_SIZE_LISTE_LIMIT.'</td>'; print '<td align="left" nowrap="nowrap" width="20%"><input '.$bc[$var].' name="check_SIZE_LISTE_LIMIT" id="check_SIZE_LISTE_LIMIT" type="checkbox" '.(! empty($fuser->conf->MAIN_SIZE_LISTE_LIMIT)?" checked":""); print ! empty($dolibarr_main_demo)?' disabled="disabled"':''; // Disabled for demo print '> '.$langs->trans("UsePersonalValue").'</td>'; print '<td><input class="flat" name="main_size_liste_limit" id="main_size_liste_limit" size="4" value="' . (! empty($fuser->conf->SIZE_LISTE_LIMIT)?$fuser->conf->SIZE_LISTE_LIMIT:'') . '"></td></tr>'; print '</table><br>'; // Theme show_theme($fuser,(($user->admin || empty($dolibarr_main_demo))?1:0),true);
*/ if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service->creer)) { //WYSIWYG Editor require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php"); print '<br>'; print '<form action="" method="post">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="action" value="vadd">'; print '<input type="hidden" name="id" value="'.$_GET["id"].'">'; print '<table class="border" width="100%">'; print '<tr><td valign="top" width="15%" class="fieldrequired">'.$langs->trans('Translation').'</td><td>'; print $formadmin->select_language('','forcelangprod',0,$product->multilangs); print '</td></tr>'; print '<tr><td valign="top" width="15%" class="fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle" size="40"></td></tr>'; print '<tr><td valign="top" width="15%">'.$langs->trans('Description').'</td><td>'; $doleditor = new DolEditor('desc', '', '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 3, 80); $doleditor->Create(); print '</td></tr>'; print '<tr><td valign="top" width="15%">'.$langs->trans('Note').'</td><td>'; $doleditor = new DolEditor('note', '', '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 3, 80); $doleditor->Create(); print '</td></tr>'; print '</tr>';
print '<table class="noborder" width="100%">'; print '<tr class="liste_titre"><td width="25%">' . $langs->trans("Parameter") . '</td><td width="25%">' . $langs->trans("DefaultValue") . '</td><td> </td><td>' . $langs->trans("PersonalValue") . '</td></tr>'; // Langue par defaut $var = !$var; print '<tr ' . $bc[$var] . '><td>' . $langs->trans("Language") . '</td>'; print '<td>'; $s = picto_from_langcode($conf->global->MAIN_LANG_DEFAULT); print $s ? $s . ' ' : ''; print $conf->global->MAIN_LANG_DEFAULT == 'auto' ? $langs->trans("AutoDetectLang") : $langs->trans("Language_" . $conf->global->MAIN_LANG_DEFAULT); print '</td>'; print '<td align="left" nowrap="nowrap" width="20%"><input ' . $bc[$var] . ' name="check_MAIN_LANG_DEFAULT" type="checkbox" ' . ($fuser->conf->MAIN_LANG_DEFAULT ? " checked" : ""); print !empty($dolibarr_main_demo) ? ' disabled="true"' : ''; // Disabled for demo print '> ' . $langs->trans("UsePersonalValue") . '</td>'; print '<td>'; print $formadmin->select_language($fuser->conf->MAIN_LANG_DEFAULT, 'main_lang_default', 1); print '</td></tr>'; // Taille max des listes $var = !$var; print '<tr ' . $bc[$var] . '><td>' . $langs->trans("MaxSizeList") . '</td>'; print '<td>' . $conf->global->MAIN_SIZE_LISTE_LIMIT . '</td>'; print '<td align="left" nowrap="nowrap" width="20%"><input ' . $bc[$var] . ' name="check_SIZE_LISTE_LIMIT" type="checkbox" ' . ($fuser->conf->MAIN_SIZE_LISTE_LIMIT ? " checked" : ""); print !empty($dolibarr_main_demo) ? ' disabled="true"' : ''; // Disabled for demo print '> ' . $langs->trans("UsePersonalValue") . '</td>'; print '<td><input class="flat" name="main_size_liste_limit" size="4" value="' . $fuser->conf->SIZE_LISTE_LIMIT . '"></td></tr>'; print '</table><br>'; // Theme show_theme($fuser, empty($dolibarr_main_demo) ? 1 : 0, true); print '</div>'; print '<center>';
include_once '../core/class/html.form.class.php'; include_once '../core/class/html.formadmin.class.php'; $err = 0; // Si fichier conf existe deja et rempli, on est pas sur une premiere install, // on ne passe donc pas par la page de choix de langue if (file_exists($conffile) && isset($dolibarr_main_url_root)) { header("Location: check.php?testget=ok"); exit; } $langs->load("admin"); /* * View */ $formadmin = new FormAdmin(''); // Note: $db does not exist yet but we don't need it, so we put ''. pHeader("", "check"); // Etape suivante = check // Ask installation language print '<br><br><center>'; print '<table>'; print '<tr>'; print '<td>' . $langs->trans("DefaultLanguage") . ' : </td><td align="left">'; print $formadmin->select_language('auto', 'selectlang', 1, 0, 0, 1); print '</td>'; print '</tr>'; print '</table></center>'; print '<br><br>' . $langs->trans("SomeTranslationAreUncomplete"); // Si pas d'erreur, on affiche le bouton pour passer a l'etape suivante if ($err == 0) { pFooter(0); }
/** * Show field * * @param array $fieldlist Array of fields * @param Object $obj If we show a particular record, obj is filled with record fields * @param string $tabname Name of SQL table * @return void */ function fieldList($fieldlist, $obj = '', $tabname = '') { global $conf, $langs, $db; global $form; global $region_id; global $elementList, $sourceList; $formadmin = new FormAdmin($db); $formcompany = new FormCompany($db); foreach ($fieldlist as $field => $value) { if ($fieldlist[$field] == 'pays') { if (in_array('region_id', $fieldlist)) { print '<td> </td>'; continue; } // For region page, we do not show the country input print '<td>'; print $form->select_country(!empty($obj->pays_code) ? $obj->pays_code : (!empty($obj->pays) ? $obj->pays : ''), 'pays'); print '</td>'; } elseif ($fieldlist[$field] == 'pays_id') { $pays_id = !empty($obj->{$fieldlist}[$field]) ? $obj->{$fieldlist}[$field] : 0; print '<input type="hidden" name="' . $fieldlist[$field] . '" value="' . $pays_id . '">'; } elseif ($fieldlist[$field] == 'region') { print '<td>'; $formcompany->select_region($region_id, 'region'); print '</td>'; } elseif ($fieldlist[$field] == 'region_id') { $region_id = !empty($obj->{$fieldlist}[$field]) ? $obj->{$fieldlist}[$field] : 0; print '<input type="hidden" name="' . $fieldlist[$field] . '" value="' . $region_id . '">'; } elseif ($fieldlist[$field] == 'lang') { print '<td>'; print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'lang'); print '</td>'; } elseif ($fieldlist[$field] == 'priority') { $priority = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); print '<td>'; print $form->selectarray("priority", $priority, $obj->{$fieldlist}[$field]); print '</td>'; } elseif ($fieldlist[$field] == 'element') { print '<td>'; print $form->selectarray('element', $elementList, !empty($obj->{$fieldlist}[$field]) ? $obj->{$fieldlist}[$field] : ''); print '</td>'; } elseif ($fieldlist[$field] == 'source') { print '<td>'; print $form->selectarray('source', $sourceList, !empty($obj->{$fieldlist}[$field]) ? $obj->{$fieldlist}[$field] : ''); print '</td>'; } elseif ($fieldlist[$field] == 'type' && $tabname == MAIN_DB_PREFIX . "c_actioncomm") { print '<td>'; print 'user<input type="hidden" name="type" value="user">'; print '</td>'; } elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'fdm') { print '<td>'; print $form->selectyesno($fieldlist[$field], !empty($obj->{$fieldlist}[$field]) ? $obj->{$fieldlist}[$field] : '', 1); print '</td>'; } elseif (in_array($fieldlist[$field], array('nbjour', 'decalage', 'taux', 'localtax1', 'localtax2'))) { print '<td><input type="text" class="flat" value="' . (!empty($obj->{$fieldlist}[$field]) ? $obj->{$fieldlist}[$field] : '') . '" size="3" name="' . $fieldlist[$field] . '"></td>'; } elseif ($fieldlist[$field] == 'libelle_facture') { print '<td><textarea cols="30" rows="' . ROWS_2 . '" class="flat" name="' . $fieldlist[$field] . '">' . (!empty($obj->{$fieldlist}[$field]) ? $obj->{$fieldlist}[$field] : '') . '</textarea></td>'; } elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i', $fieldlist[$field])) { print '<td><input type="text" class="flat" value="' . price(!empty($obj->{$fieldlist}[$field]) ? $obj->{$fieldlist}[$field] : '') . '" size="8" name="' . $fieldlist[$field] . '"></td>'; } elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist}[$field])) { print '<td><input type="text" class="flat" value="' . (!empty($obj->{$fieldlist}[$field]) ? $obj->{$fieldlist}[$field] : '') . '" size="10" name="' . $fieldlist[$field] . '"></td>'; } elseif ($fieldlist[$field] == 'unit') { print '<td>'; print $form->selectarray('unit', array('mm', 'cm', 'point', 'inch'), !empty($obj->{$fieldlist}[$field]) ? $obj->{$fieldlist}[$field] : '', 0, 0, 1); print '</td>'; } else { print '<td>'; print '<input type="text" ' . ($fieldlist[$field] == 'libelle' ? 'size="32" ' : '') . ' class="flat" value="' . (isset($obj->{$fieldlist}[$field]) ? $obj->{$fieldlist}[$field] : '') . '" name="' . $fieldlist[$field] . '">'; print '</td>'; } } }
/** * Show field * * @param array $fieldlist Array of fields * @param Object $obj If we show a particular record, obj is filled with record fields * @param string $tabname Name of SQL table * @return void */ function fieldList($fieldlist, $obj = '', $tabname = '') { global $conf, $langs, $db; global $form; global $region_id; global $elementList, $sourceList, $localtax_typeList; $formadmin = new FormAdmin($db); $formcompany = new FormCompany($db); foreach ($fieldlist as $field => $value) { if ($fieldlist[$field] == 'country') { if (in_array('region_id', $fieldlist)) { print '<td> </td>'; continue; } // For region page, we do not show the country input print '<td>'; print $form->select_country(!empty($obj->country_code) ? $obj->country_code : (!empty($obj->country) ? $obj->country : ''), 'country', '', 28); print '</td>'; } elseif ($fieldlist[$field] == 'country_id') { $country_id = !empty($obj->{$fieldlist}[$field]) ? $obj->{$fieldlist}[$field] : 0; print '<input type="hidden" name="' . $fieldlist[$field] . '" value="' . $country_id . '">'; } elseif ($fieldlist[$field] == 'region') { print '<td>'; $formcompany->select_region($region_id, 'region'); print '</td>'; } elseif ($fieldlist[$field] == 'region_id') { $region_id = !empty($obj->{$fieldlist}[$field]) ? $obj->{$fieldlist}[$field] : 0; print '<input type="hidden" name="' . $fieldlist[$field] . '" value="' . $region_id . '">'; } elseif ($fieldlist[$field] == 'lang') { print '<td>'; print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'lang'); print '</td>'; } elseif ($fieldlist[$field] == 'element') { print '<td>'; print $form->selectarray('element', $elementList, !empty($obj->{$fieldlist}[$field]) ? $obj->{$fieldlist}[$field] : ''); print '</td>'; } elseif ($fieldlist[$field] == 'source') { print '<td>'; print $form->selectarray('source', $sourceList, !empty($obj->{$fieldlist}[$field]) ? $obj->{$fieldlist}[$field] : ''); print '</td>'; } elseif ($fieldlist[$field] == 'type' && $tabname == MAIN_DB_PREFIX . "c_actioncomm") { print '<td>'; print 'user<input type="hidden" name="type" value="user">'; print '</td>'; } elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'fdm' || $fieldlist[$field] == 'deductible') { print '<td>'; print $form->selectyesno($fieldlist[$field], !empty($obj->{$fieldlist}[$field]) ? $obj->{$fieldlist}[$field] : '', 1); print '</td>'; } elseif (in_array($fieldlist[$field], array('nbjour', 'decalage', 'taux', 'localtax1', 'localtax2'))) { $align = "left"; if (in_array($fieldlist[$field], array('taux', 'localtax1', 'localtax2'))) { $align = "right"; } // Fields aligned on right print '<td align="' . $align . '">'; print '<input type="text" class="flat" value="' . (isset($obj->{$fieldlist}[$field]) ? $obj->{$fieldlist}[$field] : '') . '" size="3" name="' . $fieldlist[$field] . '">'; print '</td>'; } elseif ($fieldlist[$field] == 'libelle_facture') { print '<td><textarea cols="30" rows="' . ROWS_2 . '" class="flat" name="' . $fieldlist[$field] . '">' . (!empty($obj->{$fieldlist}[$field]) ? $obj->{$fieldlist}[$field] : '') . '</textarea></td>'; } elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i', $fieldlist[$field])) { print '<td><input type="text" class="flat" value="' . price(!empty($obj->{$fieldlist}[$field]) ? $obj->{$fieldlist}[$field] : '') . '" size="8" name="' . $fieldlist[$field] . '"></td>'; } elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist}[$field])) { print '<td><input type="text" class="flat" value="' . (!empty($obj->{$fieldlist}[$field]) ? $obj->{$fieldlist}[$field] : '') . '" size="10" name="' . $fieldlist[$field] . '"></td>'; } elseif ($fieldlist[$field] == 'unit') { print '<td>'; $units = array('mm' => $langs->trans('SizeUnitmm'), 'cm' => $langs->trans('SizeUnitcm'), 'point' => $langs->trans('SizeUnitpoint'), 'inch' => $langs->trans('SizeUnitinch')); print $form->selectarray('unit', $units, !empty($obj->{$fieldlist}[$field]) ? $obj->{$fieldlist}[$field] : '', 0, 0, 0); print '</td>'; } elseif ($fieldlist[$field] == 'localtax1_type' || $fieldlist[$field] == 'localtax2_type') { print '<td align="center">'; print $form->selectarray($fieldlist[$field], $localtax_typeList, !empty($obj->{$fieldlist}[$field]) ? $obj->{$fieldlist}[$field] : ''); print '</td>'; } else { print '<td>'; $size = ''; if ($fieldlist[$field] == 'libelle') { $size = 'size="32" '; } if ($fieldlist[$field] == 'tracking') { $size = 'size="92" '; } if ($fieldlist[$field] == 'accountancy_code') { $size = 'size="10" '; } if ($fieldlist[$field] == 'accountancy_code_sell') { $size = 'size="10" '; } if ($fieldlist[$field] == 'accountancy_code_buy') { $size = 'size="10" '; } print '<input type="text" ' . $size . ' class="flat" value="' . (isset($obj->{$fieldlist}[$field]) ? $obj->{$fieldlist}[$field] : '') . '" name="' . $fieldlist[$field] . '">'; print '</td>'; } } }
/** * Return a string to show the box with list of available documents for object. * This also set the property $this->numoffiles * * @param string $modulepart propal, facture, facture_fourn, ... * @param string $filename Sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if $filedir is already complete) * @param string $filedir Directory to scan * @param string $urlsource Url of origin page (for return) * @param int $genallowed Generation is allowed (1/0 or array list of templates) * @param int $delallowed Remove is allowed (1/0) * @param string $modelselected Model to preselect by default * @param string $allowgenifempty Allow generation even if list of template ($genallowed) is empty (show however a warning) * @param string $forcenomultilang Do not show language option (even if MAIN_MULTILANGS defined) * @param int $iconPDF Show only PDF icon with link (1/0) * @param int $maxfilenamelength Max length for filename shown * @param string $noform Do not output html form tags * @param string $param More param on http links * @param string $title Title to show on top of form * @param string $buttonlabel Label on submit button * @param string $codelang Default language code to use on lang combo box if multilang is enabled * @param HookManager $hookmanager Object hookmanager with instance of external modules hook classes * @return string Output string with HTML array of documents (might be empty string) */ function showdocuments($modulepart, $filename, $filedir, $urlsource, $genallowed, $delallowed = 0, $modelselected = '', $allowgenifempty = 1, $forcenomultilang = 0, $iconPDF = 0, $maxfilenamelength = 28, $noform = 0, $param = '', $title = '', $buttonlabel = '', $codelang = '', $hookmanager = false) { // filedir = conf->...dir_ouput."/".get_exdir(id) include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; global $langs, $bc, $conf; $forname = 'builddoc'; $out = ''; $var = true; // Clean paramaters if ($iconPDF == 1) { $genallowed = ''; $delallowed = 0; $modelselected = ''; $forcenomultilang = 0; } //$filename = dol_sanitizeFileName($filename); //Must be sanitized before calling show_documents $headershown = 0; $showempty = 0; $i = 0; $titletoshow = $langs->trans("Documents"); if (!empty($title)) { $titletoshow = $title; } $out .= "\n" . '<!-- Start show_document -->' . "\n"; //print 'filedir='.$filedir; // Affiche en-tete tableau if ($genallowed) { $modellist = array(); if ($modulepart == 'company') { $showempty = 1; if (is_array($genallowed)) { $modellist = $genallowed; } else { include_once DOL_DOCUMENT_ROOT . '/core/modules/societe/modules_societe.class.php'; $modellist = ModeleThirdPartyDoc::liste_modeles($this->db); } } else { if ($modulepart == 'propal') { if (is_array($genallowed)) { $modellist = $genallowed; } else { include_once DOL_DOCUMENT_ROOT . '/core/modules/propale/modules_propale.php'; $modellist = ModelePDFPropales::liste_modeles($this->db); } } else { if ($modulepart == 'commande') { if (is_array($genallowed)) { $modellist = $genallowed; } else { include_once DOL_DOCUMENT_ROOT . '/core/modules/commande/modules_commande.php'; $modellist = ModelePDFCommandes::liste_modeles($this->db); } } elseif ($modulepart == 'expedition') { if (is_array($genallowed)) { $modellist = $genallowed; } else { include_once DOL_DOCUMENT_ROOT . '/core/modules/expedition/modules_expedition.php'; $modellist = ModelePDFExpedition::liste_modeles($this->db); } } elseif ($modulepart == 'livraison') { if (is_array($genallowed)) { $modellist = $genallowed; } else { include_once DOL_DOCUMENT_ROOT . '/core/modules/livraison/modules_livraison.php'; $modellist = ModelePDFDeliveryOrder::liste_modeles($this->db); } } else { if ($modulepart == 'ficheinter') { if (is_array($genallowed)) { $modellist = $genallowed; } else { include_once DOL_DOCUMENT_ROOT . '/core/modules/fichinter/modules_fichinter.php'; $modellist = ModelePDFFicheinter::liste_modeles($this->db); } } elseif ($modulepart == 'facture') { if (is_array($genallowed)) { $modellist = $genallowed; } else { include_once DOL_DOCUMENT_ROOT . '/core/modules/facture/modules_facture.php'; $modellist = ModelePDFFactures::liste_modeles($this->db); } } elseif ($modulepart == 'project') { if (is_array($genallowed)) { $modellist = $genallowed; } else { include_once DOL_DOCUMENT_ROOT . '/core/modules/project/modules_project.php'; $modellist = ModelePDFProjects::liste_modeles($this->db); } } elseif ($modulepart == 'export') { if (is_array($genallowed)) { $modellist = $genallowed; } else { include_once DOL_DOCUMENT_ROOT . '/core/modules/export/modules_export.php'; $modellist = ModeleExports::liste_modeles($this->db); } } else { if ($modulepart == 'commande_fournisseur') { if (is_array($genallowed)) { $modellist = $genallowed; } else { include_once DOL_DOCUMENT_ROOT . '/core/modules/supplier_order/modules_commandefournisseur.php'; $modellist = ModelePDFSuppliersOrders::liste_modeles($this->db); } } else { if ($modulepart == 'facture_fournisseur') { if (is_array($genallowed)) { $modellist = $genallowed; } else { include_once DOL_DOCUMENT_ROOT . '/core/modules/supplier_invoice/modules_facturefournisseur.php'; $modellist = ModelePDFSuppliersInvoices::liste_modeles($this->db); } } else { if ($modulepart == 'remisecheque') { if (is_array($genallowed)) { $modellist = $genallowed; } else { include_once DOL_DOCUMENT_ROOT . '/core/modules/cheque/pdf/modules_chequereceipts.php'; $modellist = ModeleChequeReceipts::liste_modeles($this->db); } } elseif ($modulepart == 'donation') { if (is_array($genallowed)) { $modellist = $genallowed; } else { include_once DOL_DOCUMENT_ROOT . '/core/modules/dons/modules_don.php'; $modellist = ModeleDon::liste_modeles($this->db); } } else { if ($modulepart == 'unpaid') { $modellist = ''; } else { // Generic feature, for external modules $file = dol_buildpath('/core/modules/' . $modulepart . '/modules_' . $modulepart . '.php', 0); if (file_exists($file)) { $res = (include_once $file); } $class = 'Modele' . ucfirst($modulepart); if (class_exists($class)) { $modellist = call_user_func($class . '::liste_modeles', $this->db); } else { dol_print_error($this->db, 'Bad value for modulepart'); return -1; } } } } } } } } } $headershown = 1; $form = new Form($this->db); $buttonlabeltoshow = $buttonlabel; if (empty($buttonlabel)) { $buttonlabel = $langs->trans('Generate'); } if (empty($noform)) { $out .= '<form action="' . $urlsource . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#builddoc') . '" name="' . $forname . '" id="' . $forname . '_form" method="post">'; } $out .= '<input type="hidden" name="action" value="builddoc">'; $out .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; $out .= '<div class="titre">' . $titletoshow . '</div>'; $out .= '<table class="liste formdoc" summary="listofdocumentstable" width="100%">'; $out .= '<tr class="liste_titre">'; // Model if (!empty($modellist)) { $out .= '<th align="center" class="formdoc liste_titre">'; $out .= $langs->trans('Model') . ' '; if (is_array($modellist) && count($modellist) == 1) { $arraykeys = array_keys($modellist); $modelselected = $arraykeys[0]; } $out .= $form->selectarray('model', $modellist, $modelselected, $showempty, 0, 0); $out .= '</th>'; } else { $out .= '<th align="left" class="formdoc liste_titre">'; $out .= $langs->trans("Files"); $out .= '</th>'; } // Language code (if multilang) $out .= '<th align="center" class="formdoc liste_titre">'; if (($allowgenifempty || is_array($modellist) && count($modellist) > 0) && $conf->global->MAIN_MULTILANGS && !$forcenomultilang) { include_once DOL_DOCUMENT_ROOT . '/core/class/html.formadmin.class.php'; $formadmin = new FormAdmin($this->db); $defaultlang = $codelang ? $codelang : $langs->getDefaultLang(); $out .= $formadmin->select_language($defaultlang); } else { $out .= ' '; } $out .= '</th>'; // Button $out .= '<th align="center" colspan="' . ($delallowed ? '2' : '1') . '" class="formdocbutton liste_titre">'; $out .= '<input class="button" id="' . $forname . '_generatebutton"'; $out .= ' type="submit" value="' . $buttonlabel . '"'; if (!$allowgenifempty && !is_array($modellist) && empty($modellist)) { $out .= ' disabled="disabled"'; } $out .= '>'; if ($allowgenifempty && !is_array($modellist) && empty($modellist) && $modulepart != 'unpaid') { $langs->load("errors"); $out .= ' ' . img_warning($langs->transnoentitiesnoconv("WarningNoDocumentModelActivated")); } $out .= '</th>'; $out .= '</tr>'; // Execute hooks $parameters = array('socid' => isset($GLOBALS['socid']) ? $GLOBALS['socid'] : '', 'id' => isset($GLOBALS['id']) ? $GLOBALS['id'] : '', 'modulepart' => $modulepart); if (is_object($hookmanager)) { $out .= $hookmanager->executeHooks('formBuilddocOptions', $parameters, $GLOBALS['object']); } } // Get list of files if ($filedir) { $png = ''; $filter = ''; if ($iconPDF == 1) { $png = '\\.png$'; $filter = $filename . '.pdf'; } $file_list = dol_dir_list($filedir, 'files', 0, $filter, '\\.meta$' . ($png ? '|' . $png : ''), 'date', SORT_DESC); // Affiche en-tete tableau si non deja affiche if (!empty($file_list) && !$headershown && !$iconPDF) { $headershown = 1; $out .= '<div class="titre">' . $titletoshow . '</div>'; $out .= '<table class="border" summary="listofdocumentstable" width="100%">'; } else { if (empty($file_list) && !empty($iconPDF)) { // For ajax treatment $out .= '<div id="gen_pdf_' . $filename . '" class="linkobject hideobject">' . img_picto('', 'refresh') . '</div>' . "\n"; } } // Loop on each file found foreach ($file_list as $file) { $var = !$var; // Define relative path for download link (depends on module) $relativepath = $file["name"]; // Cas general if ($filename) { $relativepath = $filename . "/" . $file["name"]; } // Cas propal, facture... // Autre cas if ($modulepart == 'donation') { $relativepath = get_exdir($filename, 2) . $file["name"]; } if ($modulepart == 'export') { $relativepath = $file["name"]; } if (!$iconPDF) { $out .= "<tr " . $bc[$var] . ">"; } // Show file name with link to download if (!$iconPDF) { $out .= '<td nowrap="nowrap">'; } $out .= '<a href="' . DOL_URL_ROOT . '/document.php?modulepart=' . $modulepart . '&file=' . urlencode($relativepath) . '"'; $mime = dol_mimetype($relativepath, '', 0); if (preg_match('/text/', $mime)) { $out .= ' target="_blank"'; } $out .= '>'; if (!$iconPDF) { $out .= img_mime($file["name"], $langs->trans("File") . ': ' . $file["name"]) . ' ' . dol_trunc($file["name"], $maxfilenamelength); } else { $out .= img_pdf($file["name"], 2); } $out .= '</a>' . "\n"; if (!$iconPDF) { $out .= '</td>'; // Show file size $out .= '<td align="right" nowrap="nowrap">' . dol_print_size(dol_filesize($filedir . "/" . $file["name"])) . '</td>'; // Show file date $out .= '<td align="right" nowrap="nowrap">' . dol_print_date(dol_filemtime($filedir . "/" . $file["name"]), 'dayhour') . '</td>'; } if ($delallowed) { $out .= '<td align="right">'; //$out.= '<a href="'.DOL_URL_ROOT.'/document.php?action=remove_file&modulepart='.$modulepart.'&file='.urlencode($relativepath); $out .= '<a href="' . $urlsource . '&action=remove_file&modulepart=' . $modulepart . '&file=' . urlencode($relativepath); $out .= $param ? '&' . $param : ''; $out .= '&urlsource=' . urlencode($urlsource); $out .= '">' . img_delete() . '</a></td>'; } if (!$iconPDF) { $out .= '</tr>'; } $this->numoffiles++; } } if ($headershown) { // Affiche pied du tableau $out .= "</table>\n"; if ($genallowed) { if (empty($noform)) { $out .= '</form>' . "\n"; } } } $out .= '<!-- End show_document -->' . "\n"; //return ($i?$i:$headershown); return $out; }