Example #1
0
    $langtodelete = GETPOST('langdel', 'alpha');
    if ($object->delMultiLangs($langtodelete, $user) > 0) {
        $action = '';
    } else {
        $action = 'edit';
        setEventMessages($object->error, $object->errors, 'errors');
    }
}
$object = new Product($db);
$result = $object->fetch($id, $ref);
/*
 * View
 */
llxHeader("", "", $langs->trans("Translation"));
$form = new Form($db);
$formadmin = new FormAdmin($db);
$head = product_prepare_head($object);
$titre = $langs->trans("CardProduct" . $object->type);
$picto = $object->type == Product::TYPE_SERVICE ? 'service' : 'product';
if ($action == 'edit') {
    //WYSIWYG Editor
    require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
    print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
    print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
    print '<input type="hidden" name="action" value="vedit">';
    print '<input type="hidden" name="id" value="' . $object->id . '">';
    dol_fiche_head($head, 'translation', $titre, 0, $picto);
    dol_banner_tab($object, 'ref', '', $user->societe_id ? 0 : 1, 'ref');
    if (!empty($object->multilangs)) {
        foreach ($object->multilangs as $key => $value) {
            $s = picto_from_langcode($key);
Example #2
0
$result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
if ($user->id != $id && !$canreaduser) {
    accessforbidden();
}
$dirtop = "../core/menus/standard";
$dirleft = "../core/menus/standard";
// Charge utilisateur edite
$object = new User($db);
$object->fetch($id);
$object->getrights();
// Liste des zone de recherche permanentes supportees
$searchform = array("main_searchform_societe", "main_searchform_contact", "main_searchform_produitservice");
$searchformconst = array($conf->global->MAIN_SEARCHFORM_SOCIETE, $conf->global->MAIN_SEARCHFORM_CONTACT, $conf->global->MAIN_SEARCHFORM_PRODUITSERVICE);
$searchformtitle = array($langs->trans("Companies"), $langs->trans("Contacts"), $langs->trans("ProductsAndServices"));
$form = new Form($db);
$formadmin = new FormAdmin($db);
/*
 * Actions
 */
if ($action == 'update' && ($caneditfield || !empty($user->admin))) {
    if (!$_POST["cancel"]) {
        $tabparam = array();
        if ($_POST["check_MAIN_LANG_DEFAULT"] == "on") {
            $tabparam["MAIN_LANG_DEFAULT"] = $_POST["main_lang_default"];
        } else {
            $tabparam["MAIN_LANG_DEFAULT"] = '';
        }
        if ($_POST["check_SIZE_LISTE_LIMIT"] == "on") {
            $tabparam["MAIN_SIZE_LISTE_LIMIT"] = $_POST["main_size_liste_limit"];
        } else {
            $tabparam["MAIN_SIZE_LISTE_LIMIT"] = '';
Example #3
0
    if ($resql) {
        $db->commit();
        setEventMessages($langs->trans("MenuDeleted"), null, 'mesgs');
        header("Location: " . DOL_URL_ROOT . '/admin/menus/index.php?menu_handler=' . $menu_handler);
        exit;
    } else {
        $db->rollback();
        $reload = 0;
        $action = '';
    }
}
/*
 * View
 */
$form = new Form($db);
$formadmin = new FormAdmin($db);
$arrayofjs = array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js');
$arrayofcss = array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css');
llxHeader('', $langs->trans("Menus"), '', '', 0, 0, $arrayofjs, $arrayofcss);
print load_fiche_titre($langs->trans("Menus"), '', 'title_setup');
$h = 0;
$head[$h][0] = DOL_URL_ROOT . "/admin/menus.php";
$head[$h][1] = $langs->trans("MenuHandlers");
$head[$h][2] = 'handler';
$h++;
$head[$h][0] = DOL_URL_ROOT . "/admin/menus/index.php";
$head[$h][1] = $langs->trans("MenuAdmin");
$head[$h][2] = 'editor';
$h++;
$head[$h][0] = DOL_URL_ROOT . "/admin/menus/other.php";
$head[$h][1] = $langs->trans("Miscellaneous");
/**
 *	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>&nbsp;</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>';
        }
    }
}
Example #5
0
/**
 *	\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>&nbsp;</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>';
        }
    }
}
Example #6
0
        $this->db->commit();
        llxHeader();
        setEventMessage($langs->trans("MenuDeleted"));
        llxFooter();
        exit;
    } else {
        $this->db->rollback();
        $reload = 0;
        $_GET["action"] = '';
    }
}
/*
 * View
 */
$form = new Form($db);
$formadmin = new FormAdmin($db);
llxHeader('', $langs->trans("Menu"));
if ($action == 'create') {
    print '<script type="text/javascript" language="javascript">
    jQuery(document).ready(function() {
    	function init_topleft()
    	{
    		if (jQuery("#topleft").val() == \'top\')
    		{
				jQuery("#menuId").prop("disabled", true);
	    		jQuery("#menuId").val(\'\');
			}
    		else
    		{
				jQuery("#menuId").removeAttr("disabled");
    		}
Example #7
0
    if (isset($_POST["MAIN_USE_PREVIEW_TABS"])) {
        dolibarr_set_const($db, "MAIN_USE_PREVIEW_TABS", $_POST["MAIN_USE_PREVIEW_TABS"], 'chaine', 0, '', $conf->entity);
    }
    $_SESSION["mainmenu"] = "";
    // Le gestionnaire de menu a pu changer
    header("Location: " . $_SERVER["PHP_SELF"] . "?mainmenu=home&leftmenu=setup");
    exit;
}
/*
 * View
 */
$wikihelp = 'EN:First_setup|FR:Premiers_param&eacute;trages|ES:Primeras_configuraciones';
llxHeader('', $langs->trans("Setup"), $wikihelp);
$form = new Form($db);
$formother = new FormOther($db);
$formadmin = new FormAdmin($db);
print load_fiche_titre($langs->trans("GUISetup"), '', 'title_setup');
print $langs->trans("DisplayDesc") . "<br>\n";
print "<br>\n";
if ($action == 'edit') {
    //WYSIWYG Editor
    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>';
Example #8
0
	else
	{
		$db->rollback();

		$reload = 0;
		$_GET["action"]='';
	}
}


/*
 * View
 */

$html=new Form($db);
$htmladmin=new FormAdmin($db);
$arrayofjs=array('/admin/menus/menu.js.php?lang='.$langs->defaultlang);

llxHeader('',$langs->trans("Menus"),'','',0,0,$arrayofjs);


print_fiche_titre($langs->trans("Menus"),'','setup');

print $langs->trans("MenusEditorDesc")."<br>\n";
print "<br>\n";

if ($mesg) print '<div class="ok">'.$mesg.'.</div><br>';


$h = 0;
Example #9
0
$result = restrictedArea($user, 'user', $id, '', $feature2);
if ($user->id != $id && !$canreaduser) {
    accessforbidden();
}
$dirtop = "../includes/menus/standard";
$dirleft = "../includes/menus/standard";
// Charge utilisateur edite
$fuser = new User($db);
$fuser->fetch($id);
$fuser->getrights();
// Liste des zone de recherche permanentes supportees
$searchform = array("main_searchform_societe", "main_searchform_contact", "main_searchform_produitservice");
$searchformconst = array($conf->global->MAIN_SEARCHFORM_SOCIETE, $conf->global->MAIN_SEARCHFORM_CONTACT, $conf->global->MAIN_SEARCHFORM_PRODUITSERVICE);
$searchformtitle = array($langs->trans("Companies"), $langs->trans("Contacts"), $langs->trans("ProductsAndServices"));
$html = new Form($db);
$formadmin = new FormAdmin($db);
/*
 * Actions
 */
if ($_POST["action"] == 'update' && ($caneditfield || $user->admin)) {
    if ($_POST["cancel"]) {
        $_GET["id"] = $_POST["id"];
    } else {
        $tabparam = array();
        if ($_POST["check_MAIN_LANG_DEFAULT"] == "on") {
            $tabparam["MAIN_LANG_DEFAULT"] = $_POST["main_lang_default"];
        } else {
            $tabparam["MAIN_LANG_DEFAULT"] = '';
        }
        $tabparam["MAIN_MENU_STANDARD"] = $_POST["MAIN_MENU_STANDARD"];
        if ($_POST["check_SIZE_LISTE_LIMIT"] == "on") {
 */
include_once 'inc.php';
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) {
Example #11
0
 /**
  * testFactureCreate
  *
  * @return int
  */
 public function testSelectPaperFormat()
 {
     global $conf, $user, $langs, $db;
     $conf = $this->savconf;
     $user = $this->savuser;
     $langs = $this->savlangs;
     $db = $this->savdb;
     $localobject = new FormAdmin($this->savdb);
     $result = $localobject->select_paper_format('', 'paperformat_id', 'A4');
     $this->assertEquals($result, '<select class="flat" id="paperformat_id" name="paperformat_id"><option value="EUA4">Format A4 - 210x297 mm</option></select>');
     print __METHOD__ . " result=" . $result . "\n";
     return $result;
 }
Example #12
0
    exit;
} else {
    if ($action == 'disable_pdfsecurity') {
        dolibarr_del_const($db, "PDF_SECURITY_ENCRYPTION", $conf->entity);
        header("Location: " . $_SERVER["PHP_SELF"] . "?mainmenu=home&leftmenu=setup");
        exit;
    }
}
/*
 * View
 */
$wikihelp = 'EN:First_setup|FR:Premiers_param&eacute;trages|ES:Primeras_configuraciones';
llxHeader('', $langs->trans("Setup"), $wikihelp);
$form = new Form($db);
$formother = new FormOther($db);
$formadmin = new FormAdmin($db);
print_fiche_titre($langs->trans("PDF"), '', 'title_setup');
print $langs->trans("PDFDesc") . "<br>\n";
print "<br>\n";
$noCountryCode = empty($mysoc->country_code) ? true : false;
if ($action == 'edit') {
    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();
    // Misc options
    print_fiche_titre($langs->trans("DictionaryPaperFormat"), '', '') . '<br>';
    $var = true;
    print '<table summary="more" class="noborder" width="100%">';
    print '<tr class="liste_titre"><td>' . $langs->trans("Parameter") . '</td><td width="200px">' . $langs->trans("Value") . '</td></tr>';
    $selected = $conf->global->MAIN_PDF_FORMAT;
Example #13
0
                }
            }
        }
    }
    if (!$error) {
        $db->close();
        // We make a header redirect because we need to change menu NOW.
        header("Location: " . $_SERVER["PHP_SELF"]);
        exit;
    }
}
/*
 * View
 */
$form = new Form($db);
$formadmin = new FormAdmin($db);
$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
llxHeader('', $langs->trans("Setup"), $wikihelp);
print_fiche_titre($langs->trans("Menus"), '', 'title_setup');
$h = 0;
$head[$h][0] = DOL_URL_ROOT . "/admin/menus.php";
$head[$h][1] = $langs->trans("MenuHandlers");
$head[$h][2] = 'handler';
$h++;
$head[$h][0] = DOL_URL_ROOT . "/admin/menus/index.php";
$head[$h][1] = $langs->trans("MenuAdmin");
$head[$h][2] = 'editor';
$h++;
$head[$h][0] = DOL_URL_ROOT . "/admin/menus/other.php";
$head[$h][1] = $langs->trans("Miscellaneous");
$head[$h][2] = 'misc';
Example #14
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>&nbsp;</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>';
        }
    }
}
 */
$page_name = "LostInTranslationSetup";
llxHeader('', $langs->trans($page_name), '', '', 0, 0, array('/lostintranslation/js/lostintranslation.js'), array('/lostintranslation/css/lostintranslation.css'));
// Subheader
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
print_fiche_titre($langs->trans($page_name), $linkback);
// Configuration header
$head = lostintranslationAdminPrepareHead();
dol_fiche_head($head, 'settings', $langs->trans("Module104855Name"), 0, "lostintranslation@lostintranslation");
// If customlangs folder is not writeable, module can't be used
if (!$lit->isFolderWriteable()) {
    echo $langs->trans('CustomFolderNotWriteable');
} else {
    // Setup page goes here
    $form = new Form($db);
    $formadmin = new FormAdmin($db);
    $var = false;
    print '<form method="POST" action="' . $_SERVER['PHP_SELF'] . '">';
    print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
    print '<input type="hidden" name="action" value="search_word">';
    print '<table class="noborder" width="100%">';
    print '<tr class="liste_titre">';
    print '<td>' . $langs->trans("Parameters") . '</td>' . "\n";
    print '<td align="center">&nbsp;</td>';
    print '</tr>';
    $stats = '';
    if (!empty($lit)) {
        $stats = '<br>';
        $stats .= '&nbsp;&nbsp;' . picto_from_langcode($lit->lang);
        $stats .= ' ' . $langs->trans('NbTerms') . ' : ' . $lit->nbTerms . '<br>';
        $stats .= '&nbsp;&nbsp;' . picto_from_langcode($lit->lang);
Example #16
0
			$result=run_sql($fullpath,1,'',1,$key);
		}
	}

	// We make a header redirect because we need to change menu NOW.
	header("Location: ".$_SERVER["PHP_SELF"]);
	exit;
}


/*
 * View
 */

$html=new Form($db);
$htmladmin=new FormAdmin($db);

$wikihelp='EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
llxHeader('',$langs->trans("Setup"),$wikihelp);

print_fiche_titre($langs->trans("Menus"),'','setup');

print $langs->trans("MenusDesc")."<br>\n";
print "<br>\n";

$h = 0;

$head[$h][0] = DOL_URL_ROOT."/admin/menus.php";
$head[$h][1] = $langs->trans("MenuHandlers");
$head[$h][2] = 'handler';
$h++;
Example #17
0
 /**
  *      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 .= '&nbsp;';
         }
         $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 . '&amp;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, '?') ? '&amp;' : '?') . 'action=remove_file&amp;file=' . urlencode($relativepath);
                         $out .= $param ? '&amp;' . $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 .= '&nbsp;<a href="' . $urlsource . (strpos($urlsource, '?') ? '&amp;' : '?') . 'action=print_file&amp;printer=' . $modulepart . '&amp;file=' . urlencode($relativepath);
                         $out .= $param ? '&amp;' . $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;
 }
Example #18
0
$dirtop = "../core/menus/standard";
$dirleft = "../core/menus/standard";

// Charge utilisateur edite
$fuser = new User($db);
$fuser->fetch($id);
$fuser->getrights();

// Liste des zone de recherche permanentes supportees
$searchform=array("main_searchform_societe","main_searchform_contact","main_searchform_produitservice");
$searchformconst=array($conf->global->MAIN_SEARCHFORM_SOCIETE,$conf->global->MAIN_SEARCHFORM_CONTACT,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE);
$searchformtitle=array($langs->trans("Companies"),$langs->trans("Contacts"),$langs->trans("ProductsAndServices"));

$form = new Form($db);
$formadmin=new FormAdmin($db);


/*
 * Actions
 */
if ($action == 'update' && ($caneditfield  || $user->admin))
{
    if (! $_POST["cancel"])
    {
        $tabparam=array();

        if ($_POST["check_MAIN_LANG_DEFAULT"]=="on") $tabparam["MAIN_LANG_DEFAULT"]=$_POST["main_lang_default"];
        else $tabparam["MAIN_LANG_DEFAULT"]='';

        $tabparam["MAIN_MENU_STANDARD"]=$_POST["MAIN_MENU_STANDARD"];
Example #19
0
/**
 *	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 '&nbsp;';
            }
            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>';
        }
    }
}
Example #20
0
		$mesg = '<div class="error">'.$product->error.'</div>';
	}
}

$product = new Product($db);
$result = $product->fetch($id,$ref);


/*
 * View
 */

llxHeader("","",$langs->trans("Translation"));

$form = new Form($db);
$formadmin=new FormAdmin($db);

$head=product_prepare_head($product, $user);
$titre=$langs->trans("CardProduct".$product->type);
$picto=($product->type==1?'service':'product');
dol_fiche_head($head, 'translation', $titre, 0, $picto);

if (! empty($mesg)) {
	dol_htmloutput_mesg($mesg);
}

print '<table class="border" width="100%">';

// Reference
print '<tr>';
print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="2">';
Example #21
0


/*
 *  View
 */

// fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label('company');

$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('',$langs->trans("ThirdParty"),$help_url);

$form = new Form($db);
$formfile = new FormFile($db);
$formadmin = new FormAdmin($db);
$formcompany = new FormCompany($db);

$countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';


if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
{
    // -----------------------------------------
    // When used with CANVAS
    // -----------------------------------------
    if (empty($object->error) && $socid)
 	{
	     $object = new Societe($db);
	     $object->load($socid);
 	}
Example #22
0
 /**
  *      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 .= '&nbsp;';
         }
         $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 . '&amp;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&amp;modulepart='.$modulepart.'&amp;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;
 }