--- /tmp/dsg/dolibarr/htdocs/core/tpl/github_19.0.3_admin_extrafields_add.tpl.php +++ /tmp/dsg/dolibarr/htdocs/core/tpl/client_admin_extrafields_add.tpl.php @@ -31 +31,2 @@ -if (empty($conf) || !is_object($conf)) { +if (empty($conf) || !is_object($conf)) +{ @@ -39,2 +39,0 @@ -$listofexamplesforlink = 'Societe:societe/class/societe.class.php
Contact:contact/class/contact.class.php
Product:product/class/product.class.php
Project:projet/class/project.class.php'; - @@ -44,20 +43,22 @@ -"; +} @@ -152,3 +100,5 @@ -// For to attach a new file -if ((!empty($conf->use_javascript_ajax) && !getDolGlobalString('MAIN_ECM_DISABLE_JS')) || !empty($section)) { - if ((empty($section) || $section == -1) && ($module != 'medias')) { +// To attach new file +if ((!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) || !empty($section)) +{ + if ((empty($section) || $section == -1) && ($module != 'medias')) + { @@ -156,2 +106,2 @@ - + }); + @@ -164,2 +114 @@ - $sectiondir = GETPOST('file', 'alpha') ? GETPOST('file', 'alpha') : GETPOST('section_dir', 'alpha'); - + $sectiondir = GETPOST('file', 'alpha') ?GETPOST('file', 'alpha') : GETPOST('section_dir', 'alpha'); @@ -168,5 +117,4 @@ - $formfile = new FormFile($db); - print $formfile->form_attach_new_file($_SERVER["PHP_SELF"], 'none', 0, ($section ? $section : -1), $permtoupload, 48, null, '', 0, '', 0, $nameforformuserfile, '', $sectiondir, empty($formalreadyopen) ? 0 : $formalreadyopen, 0, 0, 1); -} else { - print ' '; -} + $formfile = new FormFile($db); + $formfile->form_attach_new_file($_SERVER["PHP_SELF"], 'none', 0, ($section ? $section : -1), $permtoupload, 48, null, '', 0, '', 0, $nameforformuserfile, '', $sectiondir); +} +else print ' '; @@ -189,2 +137,3 @@ -if ($action == 'delete_section') { - print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.$section, $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection', $ecmdir->label), 'confirm_deletesection', '', '', 1); +if ($action == 'delete_section') +{ + print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.$section, $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection', $ecmdir->label), 'confirm_deletesection', '', '', 1); @@ -194,2 +143,3 @@ -// Ask confirmation to build webp images -if ($action == 'confirmconvertimgwebp') { + +if (empty($action) || $action == 'editfile' || $action == 'file_manager' || preg_match('/refresh/i', $action) || $action == 'delete') +{ @@ -198,78 +148 @@ - $section_dir=GETPOST('section_dir', 'alpha'); - $section=GETPOST('section', 'alpha'); - $file=GETPOST('filetoregenerate', 'alpha'); - $form = new Form($db); - $formquestion['section_dir']=array('type'=>'hidden', 'value'=>$section_dir, 'name'=>'section_dir'); - $formquestion['section']=array('type'=>'hidden', 'value'=>$section, 'name'=>'section'); - $formquestion['filetoregenerate']=array('type'=>'hidden', 'value'=>$file, 'name'=>'filetoregenerate'); - if ($module == 'medias') { - $formquestion['website']=array('type'=>'hidden', 'value'=>$website->ref, 'name'=>'website'); - } - $param = ''; - if (!empty($sortfield)) { - $param .= '&sortfield='.urlencode($sortfield); - } - if (!empty($sortorder)) { - $param .= '&sortorder='.urlencode($sortorder); - } - print $form->formconfirm($_SERVER["PHP_SELF"].($param ? '?'.$param : ''), empty($file) ? $langs->trans('ConfirmImgWebpCreation') : $langs->trans('ConfirmChosenImgWebpCreation'), empty($file) ? $langs->trans('ConfirmGenerateImgWebp') : $langs->trans('ConfirmGenerateChosenImgWebp', basename($file)), 'convertimgwebp', $formquestion, "yes", 1); - $action = 'file_manager'; -} - -// Duplicate images into .webp -if ($action == 'convertimgwebp' && $permtoadd) { - $file = GETPOST('filetoregenerate', 'alpha'); - - if ($module == 'medias') { - $imagefolder = $conf->website->dir_output.'/'.$websitekey.'/medias/'.dol_sanitizePathName(GETPOST('section_dir', 'alpha')); - } else { - $imagefolder = $conf->ecm->dir_output.'/'.dol_sanitizePathName(GETPOST('section_dir', 'alpha')); - } - - include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; - - if (!empty($file)) { - $filelist = array(); - $filelist[]["fullname"] = dol_osencode($imagefolder.'/'.$file); // get $imagefolder.'/'.$file infos - } else { - $regeximgext = getListOfPossibleImageExt(); - - $filelist = dol_dir_list($imagefolder, "files", 0, $regeximgext); - } - - $nbconverted = 0; - - foreach ($filelist as $filename) { - $filepath = $filename['fullname']; - if (!(substr_compare($filepath, 'webp', -strlen('webp')) === 0)) { - if (!empty($file) || !dol_is_file($filepathnoext.'.webp')) { // If file does not exists yet - if (image_format_supported($filepath) == 1) { - $filepathnoext = preg_replace("/\.[a-z0-9]+$/i", "", $filepath); - $result = dol_imageResizeOrCrop($filepath, 0, 0, 0, 0, 0, $filepathnoext.'.webp', 90); - if (!dol_is_file($result)) { - $error++; - setEventMessages($result, null, 'errors'); - } else { - $nbconverted++; - } - } - } - } - if ($error) { - break; - } - } - if (!$error) { - if (!empty($file)) { - setEventMessages($langs->trans('SucessConvertChosenImgWebp'), null); - } else { - setEventMessages($langs->trans('SucessConvertImgWebp'), null); - } - } - $action = 'file_manager'; -} - -if (empty($action) || $action == 'editfile' || $action == 'file_manager' || preg_match('/refresh/i', $action) || $action == 'delete') { - $langs->load("ecm"); - - print ''."\n"; + print '
'."\n"; @@ -279,2 +152,2 @@ - print ''; - } - - print ''; - } else { - // Show filtree when ajax is disabled (rare) - print ''; - } + $htmltooltip = $langs->trans("ECMAreaDesc2"); + + if (!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) + { + // Show the link to "Root" + if ($showroot) + { + print ''; + } + + print ''; + } + else // Show file tree when ajax is disabled (rare) + { + print ''; + } @@ -348,0 +217 @@ + @@ -350,9 +219 @@ -if (empty($url)) { // autoset $url but it is better to have it defined before (for example by ecm/index.php, ecm/index_medias.php, website/index.php) - if (!empty($module) && $module == 'medias' && !GETPOST('website')) { - $url = DOL_URL_ROOT.'/ecm/index_medias.php'; - } elseif (GETPOSTISSET('website')) { - $url = DOL_URL_ROOT.'/website/index.php'; - } else { - $url = DOL_URL_ROOT.'/ecm/index.php'; - } -} +if (empty($url)) $url = DOL_URL_ROOT.'/ecm/index.php'; @@ -372 +233,2 @@ -if (!empty($conf->use_javascript_ajax) && !getDolGlobalString('MAIN_ECM_DISABLE_JS')) { // Show filtree when ajax is enabled +if (!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) // Show filtree when ajax is enabled +{ @@ -378,3 +240 @@ - if (GETPOST('section_dir', 'alpha')) { - $preopened = GETPOST('section_dir', 'alpha'); - } + if (GETPOST('section_dir', 'alpha')) { $preopened = GETPOST('section_dir', 'alpha'); } --- /tmp/dsg/dolibarr/htdocs/core/tpl/github_19.0.3_list_print_total.tpl.php +++ /tmp/dsg/dolibarr/htdocs/core/tpl/client_list_print_total.tpl.php @@ -2 +1,0 @@ - @@ -4 +3 @@ -if (!empty($totalarray['totalizable']) && is_array($totalarray['totalizable'])) { +if (is_array($totalarray['totalizable'])) { @@ -7 +6 @@ - $totalarray['val'][$keytotalizable] = isset($valtotalizable['total']) ? $valtotalizable['total'] : 0; + $totalarray['val'][$keytotalizable] = $valtotalizable['total']; @@ -11 +10,2 @@ -if (isset($totalarray['pos'])) { +if (isset($totalarray['pos'])) +{ @@ -14 +14,2 @@ - while ($i < $totalarray['nbfield']) { + while ($i < $totalarray['nbfield']) + { @@ -16,4 +17,7 @@ - if (!empty($totalarray['pos'][$i])) { - // if $totalarray['type'] not present we consider it as number - if (empty($totalarray['type'][$i])) { - $totalarray['type'][$i] = 'real'; + if (!empty($totalarray['pos'][$i])) print ''; + else + { + if ($i == 1) + { + if ($num < $limit) print ''; + else print ''; @@ -21,38 +25 @@ - switch ($totalarray['type'][$i]) { - case 'duration': - print ''; - break; - case 'string': // This type is no more used. type is now varchar(x) - print ''; - break; - case 'stock': - print ''; - break; - default: - print ''; - break; - } - } else { - if ($i == 1) { - if (is_null($limit) || $num < $limit) { - print ''; - } else { - print ''; - } - } else { - print ''; - } + else print ''; --- /tmp/dsg/dolibarr/htdocs/core/tpl/github_19.0.3_login.tpl.php +++ /tmp/dsg/dolibarr/htdocs/core/tpl/client_login.tpl.php @@ -2,2 +2,2 @@ -/* Copyright (C) 2009-2015 Regis Houssin - * Copyright (C) 2011-2022 Laurent Destailleur +/* Copyright (C) 2009-2015 Regis Houssin + * Copyright (C) 2011-2013 Laurent Destailleur @@ -19 +19 @@ -// Need global variable $urllogo, $title and $titletruedolibarrversion to be defined by caller (like dol_loginfunction in security2.lib.php) +// Need global variable $title to be defined by caller (like dol_loginfunction) @@ -21,5 +21 @@ -// $titletruedolibarrversion must be defined - -if (!defined('NOBROWSERNOTIF')) { - define('NOBROWSERNOTIF', 1); -} + @@ -29,10 +25,4 @@ - print "Error, template page can't be called as URL"; - exit; -} - -// DDOS protection -$size = (empty($_SERVER['CONTENT_LENGTH']) ? 0 : (int) $_SERVER['CONTENT_LENGTH']); -if ($size > 10000) { - $langs->loadLangs(array("errors", "install")); - httponly_accessforbidden('
'.$langs->trans("ErrorRequestTooLarge").'.
'.$langs->trans("ClickHereToGoToApp").'
', 413, 1); -} + print "Error, template page can't be called as URL"; + exit; +} + @@ -42 +31,0 @@ - @@ -44,16 +33,7 @@ - -if (GETPOST('dol_hide_topmenu')) { - $conf->dol_hide_topmenu = 1; -} -if (GETPOST('dol_hide_leftmenu')) { - $conf->dol_hide_leftmenu = 1; -} -if (GETPOST('dol_optimize_smallscreen')) { - $conf->dol_optimize_smallscreen = 1; -} -if (GETPOST('dol_no_mouse_hover')) { - $conf->dol_no_mouse_hover = 1; -} -if (GETPOST('dol_use_jmobile')) { - $conf->dol_use_jmobile = 1; -} +header("Content-type: text/html; charset=".$conf->file->character_set_client); + +if (GETPOST('dol_hide_topmenu')) $conf->dol_hide_topmenu = 1; +if (GETPOST('dol_hide_leftmenu')) $conf->dol_hide_leftmenu = 1; +if (GETPOST('dol_optimize_smallscreen')) $conf->dol_optimize_smallscreen = 1; +if (GETPOST('dol_no_mouse_hover')) $conf->dol_no_mouse_hover = 1; +if (GETPOST('dol_use_jmobile')) $conf->dol_use_jmobile = 1; @@ -62,22 +42,5 @@ -if (!empty($conf->dol_use_jmobile)) { - $conf->use_javascript_ajax = 1; -} - -$php_self = empty($php_self) ? dol_escape_htmltag($_SERVER['PHP_SELF']) : $php_self; -if (!empty($_SERVER["QUERY_STRING"]) && dol_escape_htmltag($_SERVER["QUERY_STRING"])) { - $php_self .= '?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]); -} -if (!preg_match('/mainmenu=/', $php_self)) { - $php_self .= (preg_match('/\?/', $php_self) ? '&' : '?').'mainmenu=home'; -} -if (preg_match('/'.preg_quote('core/modules/oauth', '/').'/', $php_self)) { - $php_self = DOL_URL_ROOT.'/index.php?mainmenu=home'; -} -$php_self = preg_replace('/(\?|&|&)action=[^&]+/', '\1', $php_self); -$php_self = preg_replace('/(\?|&|&)actionlogin=[^&]+/', '\1', $php_self); -$php_self = preg_replace('/(\?|&|&)afteroauthloginreturn=[^&]+/', '\1', $php_self); -$php_self = preg_replace('/(\?|&|&)username=[^&]*/', '\1', $php_self); -$php_self = preg_replace('/(\?|&|&)entity=\d+/', '\1', $php_self); -$php_self = preg_replace('/(\?|&|&)massaction=[^&]+/', '\1', $php_self); -$php_self = preg_replace('/(\?|&|&)token=[^&]+/', '\1', $php_self); -$php_self = preg_replace('/(&)+/', '&', $php_self); +if (!empty($conf->dol_use_jmobile)) $conf->use_javascript_ajax = 1; + +$php_self = dol_escape_htmltag($_SERVER['PHP_SELF']); +$php_self .= dol_escape_htmltag($_SERVER["QUERY_STRING"]) ? '?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]) : ''; +if (!preg_match('/mainmenu=/', $php_self)) $php_self .= (preg_match('/\?/', $php_self) ? '&' : '?').'mainmenu=home'; @@ -90,8 +53 @@ - -// We display application title instead Login term -if (getDolGlobalString('MAIN_APPLICATION_TITLE')) { - $titleofloginpage = $conf->global->MAIN_APPLICATION_TITLE; -} else { - $titleofloginpage = $langs->trans('Login'); -} -$titleofloginpage .= ' @ '.$titletruedolibarrversion; // $titletruedolibarrversion is defined by dol_loginfunction in security2.lib.php. We must keep the @, some tools use it to know it is login page and find true dolibarr version. +$titleofloginpage = $langs->trans('Login').' @ '.$titletruedolibarrversion; // $titletruedolibarrversion is defined by dol_loginfunction in security2.lib.php. We must keep the @, some tools use it to know it is login page and find true dolibarr version. @@ -100,8 +56,4 @@ -if (!preg_match('/'.constant('DOL_APPLICATION_TITLE').'/', $title)) { - $disablenofollow = 0; -} -if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { - $disablenofollow = 0; -} - -top_htmlhead('', $titleofloginpage, 0, 0, $arrayofjs, array(), 1, $disablenofollow); +if (!preg_match('/'.constant('DOL_APPLICATION_TITLE').'/', $title)) $disablenofollow = 0; +if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $disablenofollow = 0; + +print top_htmlhead('', $titleofloginpage, 0, 0, $arrayofjs, array(), 0, $disablenofollow); @@ -111,4 +63,2 @@ -if (!isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) { - $conf->global->THEME_ELDY_TOPMENU_BACK1 = $colorbackhmenu1; -} -$colorbackhmenu1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (!getDolGlobalString('THEME_ELDY_TOPMENU_BACK1') ? $colorbackhmenu1 : $conf->global->THEME_ELDY_TOPMENU_BACK1) : (empty($user->conf->THEME_ELDY_TOPMENU_BACK1) ? $colorbackhmenu1 : $user->conf->THEME_ELDY_TOPMENU_BACK1); +if (!isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) $conf->global->THEME_ELDY_TOPMENU_BACK1 = $colorbackhmenu1; +$colorbackhmenu1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TOPMENU_BACK1) ? $colorbackhmenu1 : $conf->global->THEME_ELDY_TOPMENU_BACK1) : (empty($user->conf->THEME_ELDY_TOPMENU_BACK1) ? $colorbackhmenu1 : $user->conf->THEME_ELDY_TOPMENU_BACK1); @@ -119,3 +69,4 @@ -if (getDolGlobalString('ADD_UNSPLASH_LOGIN_BACKGROUND')) { - // For example $conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND = 'https://source.unsplash.com/random'?> - +if (!empty($conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND)) { + // For example $conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND = 'https://source.unsplash.com/random' + ?> + @@ -125 +76 @@ - > + global->MAIN_LOGIN_BACKGROUND) ? '' : ' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; background-image: url(\''.DOL_URL_ROOT.'/viewimage.php?cache=1&noalt=1&modulepart=mycompany&file=logos/'.urlencode($conf->global->MAIN_LOGIN_BACKGROUND).'\')"'; ?>> @@ -131 +82 @@ - - '.$langs->trans('AddLineOnPosition').' : '; - } - - if (is_object($hookmanager) && empty($senderissupplier)) { + if (is_object($hookmanager) && empty($senderissupplier)) + { @@ -388 +307,2 @@ - if (is_object($hookmanager) && !empty($senderissupplier)) { + if (is_object($hookmanager) && !empty($senderissupplier)) + { @@ -395 +315,4 @@ - if (isModEnabled("product") || isModEnabled("service")) { + if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { + if (!empty($conf->variants->enabled)) { + echo '
'; + } @@ -397,3 +319,0 @@ - if (isModEnabled('variants')) { - echo '
'; - } @@ -404,4 +324,2 @@ - $enabled = (getDolGlobalString('FCKEDITOR_ENABLE_DETAILS') ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); - if (getDolGlobalString('MAIN_INPUT_DESC_HEIGHT')) { - $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT; - } + $enabled = (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); + if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT; @@ -409,4 +327,2 @@ - if (getDolGlobalString('FCKEDITOR_ENABLE_DETAILS_FULL')) { - $toolbarname = 'dolibarr_notes'; - } - $doleditor = new DolEditor('dp_desc', GETPOST('dp_desc', 'restricthtml'), '', (!getDolGlobalString('MAIN_DOLEDITOR_HEIGHT') ? 100 : $conf->global->MAIN_DOLEDITOR_HEIGHT), $toolbarname, '', false, true, $enabled, $nbrows, '98%'); + if (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname = 'dolibarr_notes'; + $doleditor = new DolEditor('dp_desc', GETPOST('dp_desc', 'none'), '', (empty($conf->global->MAIN_DOLEDITOR_HEIGHT) ? 100 : $conf->global->MAIN_DOLEDITOR_HEIGHT), $toolbarname, '', false, true, $enabled, $nbrows, '98%'); @@ -415 +331,2 @@ - if (isModEnabled("service") && ($object->element == 'facturerec' || $object->element == 'invoice_supplier_rec')) { + if (!empty($conf->service->enabled) && $object->element == 'facturerec') + { @@ -418,4 +334,0 @@ - if (getDolGlobalString('INVOICE_REC_DATE_TO_YES')) { - $line->date_start_fill = 1; - $line->date_end_fill = 1; - } @@ -428,9 +340,0 @@ - if (is_object($objectline)) { - $temps = $objectline->showOptionals($extrafields, 'create', array(), '', '', 1, 'line'); - - if (!empty($temps)) { - print '
'; - print $temps; - print '
'; - } - } @@ -438,5 +342,6 @@ - if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier' || $object->element == 'invoice_supplier_rec') { // We must have same test in printObjectLines - $coldisplay++; ?> -
- element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines + { + $coldisplay++; + ?> + + tva_assuj == "0") { - echo ''.vatrate(0, true); - } else { - echo $form->load_tva('tva_tx', (GETPOSTISSET("tva_tx") ? GETPOST("tva_tx", 'alpha', 2) : -1), $seller, $buyer, 0, 0, '', false, 1); - } + if ($seller->tva_assuj == "0") echo ''.vatrate(0, true); + else echo $form->load_tva('tva_tx', (isset($_POST["tva_tx"]) ?GETPOST("tva_tx", 'alpha', 2) : -1), $seller, $buyer, 0, 0, '', false, 1); @@ -454 +356 @@ - "> + "> @@ -458,2 +360,3 @@ - if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) { - $coldisplay++; ?> + if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { + $coldisplay++; + ?> @@ -461 +364 @@ - "> + "> @@ -465,2 +368,3 @@ - if (!empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) { - $coldisplay++; ?> + if (!empty($inputalsopricewithtax)) { + $coldisplay++; + ?> @@ -468 +372 @@ - "> + "> @@ -474,3 +378 @@ - + @@ -494 +395 @@ - if (isset($this->situation_cycle_ref) && $this->situation_cycle_ref) { + if ($this->situation_cycle_ref) { @@ -496 +397 @@ - print ''; + print ''; @@ -501,2 +402,3 @@ - if ($user->hasRight('margins', 'creer')) { - $coldisplay++; ?> + if (!empty($user->rights->margins->creer)) { + $coldisplay++; + ?> @@ -505,2 +407,2 @@ - - + product->enabled) || !empty($conf->service->enabled)) { ?> + @@ -509 +411 @@ - "> + "> @@ -512,2 +414,3 @@ - if (getDolGlobalString('DISPLAY_MARGIN_RATES')) { - echo ''; + if (!empty($conf->global->DISPLAY_MARGIN_RATES)) + { + echo ''; @@ -516,2 +419,3 @@ - if (getDolGlobalString('DISPLAY_MARK_RATES')) { - echo ''; + if (!empty($conf->global->DISPLAY_MARK_RATES)) + { + echo ''; @@ -525 +429 @@ - + @@ -530,26 +434,13 @@ -if ((isModEnabled("service") || ($object->element == 'contrat')) && $dateSelector && GETPOST('type') != '0') { // We show date field if required - print ''."\n"; - if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER')) { - print ''; - } - print ''."\n"; + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { print ''; } + print ''; - print ''."\n"; + print 'jQuery("#date_endmin").val("'.$conf->global->MAIN_DEFAULT_DATE_END_MIN.'");'; + } + } + print ''; + print ''; + print ''."\n"; @@ -614 +483,2 @@ -if (!empty($usemargins) && $user->hasRight('margins', 'creer')) { +if (!empty($usemargins) && $user->rights->margins->creer) +{ @@ -619 +489 @@ - if (getDolGlobalString('DISPLAY_MARGIN_RATES')) { ?> + if (!empty($conf->global->DISPLAY_MARGIN_RATES)) { ?> @@ -621 +491 @@ - return checkFreeLine(e, "np_marginRate"); + return checkFreeLine(e, "np_marginRate"); @@ -625 +495 @@ - if (getDolGlobalString('DISPLAY_MARK_RATES')) { ?> + if (!empty($conf->global->DISPLAY_MARK_RATES)) { ?> @@ -627 +497 @@ - return checkFreeLine(e, "np_markRate"); + return checkFreeLine(e, "np_markRate"); @@ -630 +500,2 @@ - } ?> + } + ?> @@ -636,41 +507,41 @@ - var buying_price = $("input[name='buying_price']:first"); - var remise = $("input[name='remise_percent']:first"); - - var rate = $("input[name='"+npRate+"']:first"); - if (rate.val() == '') - return true; - - if (! $.isNumeric(rate.val().replace(',','.'))) - { - alert('trans("rateMustBeNumeric")); ?>'); - e.stopPropagation(); - setTimeout(function () { rate.focus() }, 50); - return false; - } - if (npRate == "np_markRate" && rate.val() >= 100) - { - alert('trans("markRateShouldBeLesserThan100")); ?>'); - e.stopPropagation(); - setTimeout(function () { rate.focus() }, 50); - return false; - } - - var price = 0; - remisejs=price2numjs(remise.val()); - - if (remisejs != 100) // If a discount not 100 or no discount - { - if (remisejs == '') remisejs=0; - - bpjs=price2numjs(buying_price.val()); - ratejs=price2numjs(rate.val()); - - if (npRate == "np_marginRate") - price = ((bpjs * (1 + ratejs / 100)) / (1 - remisejs / 100)); - else if (npRate == "np_markRate") - price = ((bpjs / (1 - ratejs / 100)) / (1 - remisejs / 100)); - } - - $("input[name='price_ht']:first").val(price); // TODO Must use a function like php price to have here a formated value - - return true; + var buying_price = $("input[name='buying_price']:first"); + var remise = $("input[name='remise_percent']:first"); + + var rate = $("input[name='"+npRate+"']:first"); + if (rate.val() == '') + return true; + + if (! $.isNumeric(rate.val().replace(',','.'))) + { + alert('trans("rateMustBeNumeric")); ?>'); + e.stopPropagation(); + setTimeout(function () { rate.focus() }, 50); + return false; + } + if (npRate == "np_markRate" && rate.val() >= 100) + { + alert('trans("markRateShouldBeLesserThan100")); ?>'); + e.stopPropagation(); + setTimeout(function () { rate.focus() }, 50); + return false; + } + + var price = 0; + remisejs=price2numjs(remise.val()); + + if (remisejs != 100) // If a discount not 100 or no discount + { + if (remisejs == '') remisejs=0; + + bpjs=price2numjs(buying_price.val()); + ratejs=price2numjs(rate.val()); + + if (npRate == "np_marginRate") + price = ((bpjs * (1 + ratejs / 100)) / (1 - remisejs / 100)); + else if (npRate == "np_markRate") + price = ((bpjs / (1 - ratejs / 100)) / (1 - remisejs / 100)); + } + + $("input[name='price_ht']:first").val(price); // TODO Must use a function like php price to have here a formated value + + return true; @@ -690 +560,0 @@ - jQuery("#multicurrency_price_ht").val(''); @@ -698 +567,0 @@ - jQuery("#multicurrency_price_ht").val(''); @@ -703 +572 @@ - if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#multicurrency_subprice").val() != '') { + if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') { @@ -708,7 +576,0 @@ - jQuery("#multicurrency_price_ht").keyup(function(event) { - // console.log(event.which); // discard event tag and arrows - if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#multicurrency_price_ht").val() != '') { - jQuery("#price_ht").val(''); - jQuery("#price_ttc").val(''); - } - }); @@ -717 +579 @@ - setforfree(); + setforfree(); @@ -721,26 +583,23 @@ - setforfree(); - - if (jQuery('#select_type').val() >= 0) { - console.log("Set focus on description field"); - /* this focus code works on a standard textarea but not if field was replaced with CKEDITOR */ - jQuery('#dp_desc').focus(); - /* this focus code works for CKEDITOR */ - if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined") { - var editor = CKEDITOR.instances['dp_desc']; - if (editor) { - editor.focus(); - } - } - } - - console.log("Hide/show date according to product type"); - if (jQuery('#select_type').val() == '0') - { - jQuery('#trlinefordates').hide(); - jQuery('.divlinefordates').hide(); - } - else - { - jQuery('#trlinefordates').show(); - jQuery('.divlinefordates').show(); - } + setforfree(); + if (jQuery('#select_type').val() >= 0) + { + /* focus work on a standard textarea but not if field was replaced with CKEDITOR */ + jQuery('#dp_desc').focus(); + /* focus if CKEDITOR */ + if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined") + { + var editor = CKEDITOR.instances['dp_desc']; + if (editor) { editor.focus(); } + } + } + console.log("Hide/show date according to product type"); + if (jQuery('#select_type').val() == '0') + { + jQuery('#trlinefordates').hide(); + jQuery('.divlinefordates').hide(); + } + else + { + jQuery('#trlinefordates').show(); + jQuery('.divlinefordates').show(); + } @@ -750,3 +609,3 @@ - console.log("click prod_entry_mode_predef"); - setforpredef(); - jQuery('#trlinefordates').show(); + console.log("click prod_entry_mode_predef"); + setforpredef(); + jQuery('#trlinefordates').show(); @@ -760,15 +619,2 @@ - - if (in_array($this->table_element_line, array('propaldet', 'commandedet', 'facturedet'))) { ?> - $("#date_start, #date_end").focusout(function() { - let type = $(this).attr('type'); - let mandatoryP = $(this).attr('mandatoryperiod'); - if (type == 1 && mandatoryP == 1) { - if ($(this).val() == '' && !$(this).hasClass('inputmandatory')) { - $(this).addClass('inputmandatory'); - }else{ - $(this).removeClass('inputmandatory'); - } - } - }); - + ?> + @@ -778,3 +624,3 @@ - console.log("objectline_create.tpl Call method change() after change on #idprod or #idprodfournprice (senderissupplier=). this.val = "+$(this).val()); - - setforpredef(); // TODO Keep vat combo visible and set it to first entry into list that match result of get_default_tva(product) + console.log("Call method change() after change on #idprod or #idprodfournprice. this.val = "+$(this).val()); + + setforpredef(); // TODO Keep vat combo visible and set it to first entry into list that match result of get_default_tva @@ -785 +631,2 @@ - if (!getDolGlobalString('MAIN_DISABLE_EDIT_PREDEF_PRICEHT') && empty($senderissupplier)) { + if (empty($conf->global->MAIN_DISABLE_EDIT_PREDEF_PRICEHT) && empty($senderissupplier)) + { @@ -788,0 +636 @@ + //console.log(pbq); @@ -792 +640 @@ - console.log("objectline_create.tpl We are in a price per qty context, we do not call ajax/product, init of fields is done few lines later"); + console.log("We are in a price per qty context, we do not call ajax/product, init of fields is done few lines later"); @@ -794 +642 @@ - + global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { ?> @@ -797,2 +645,2 @@ - // Get the price for the product and display it - console.log("Load unit price and set it into #price_ht or #price_ttc for product id="+$(this).val()+" socid=socid; ?>"); + // Get the HT price for the product and display it + console.log("Load unit price without tax and set it into #price_ht for product id="+$(this).val()+" socid=socid; ?>"); @@ -800 +648 @@ - { 'id': $(this).val(), 'socid': socid; ?>, 'token': '', 'addalsovatforthirdpartyid': 1 }, + { 'id': $(this).val(), 'socid': socid; ?> }, @@ -802,105 +650,2 @@ - console.log("objectline_create.tpl Load unit price ends, we got value ht="+data.price_ht+" ttc="+data.price_ttc+" pricebasetype="+data.pricebasetype); - - $('#date_start').removeAttr('type'); - $('#date_end').removeAttr('type'); - $('#date_start').attr('type', data.type); - $('#date_end').attr('type', data.type); - - $('#date_start').removeAttr('mandatoryperiod'); - $('#date_end').removeAttr('mandatoryperiod'); - $('#date_start').attr('mandatoryperiod', data.mandatory_period); - $('#date_end').attr('mandatoryperiod', data.mandatory_period); - - // service and we setted mandatory_period to true - if (data.mandatory_period == 1 && data.type == 1) { - jQuery('#date_start').addClass('inputmandatory'); - jQuery('#date_end').addClass('inputmandatory'); - } else { - jQuery('#date_start').removeClass('inputmandatory'); - jQuery('#date_end').removeClass('inputmandatory'); - } - - if ( == 1 && data.pricebasetype == 'TTC' && ) { - console.log("objectline_create.tpl set content of price_ttc"); - jQuery("#price_ttc").val(data.price_ttc); - } else { - console.log("objectline_create.tpl set content of price_ht"); - jQuery("#price_ht").val(data.price_ht); - } - - var tva_tx = data.tva_tx; - var default_vat_code = data.default_vat_code; - - // Now set the VAT - var stringforvatrateselection = tva_tx; - if (typeof default_vat_code != 'undefined' && default_vat_code != null && default_vat_code != '') { - stringforvatrateselection = stringforvatrateselection+' ('+default_vat_code+')'; - - console.log("MAIN_SALETAX_AUTOSWITCH_I_CS_FOR_INDIA is on so we check if we need to autoswith the vat code"); - console.log("mysoc->country_code=country_code; ?> thirdparty->country_code=thirdparty->country_code; ?>"); - new_default_vat_code = default_vat_code; - country_code == 'IN' && !empty($object->thirdparty) && $object->thirdparty->country_code == 'IN' && $mysoc->state_code == $object->thirdparty->state_code) { - // We are in India and states are same, we revert the vat code "I-x" into "CS-x" - ?> - console.log("Countries are both IN and states are same, so we revert I into CS in default_vat_code="+default_vat_code); - new_default_vat_code = default_vat_code.replace(/^I\-/, 'C+S-'); - country_code == 'IN' && !empty($object->thirdparty) && $object->thirdparty->country_code == 'IN' && $mysoc->state_code != $object->thirdparty->state_code) { - // We are in India and states differs, we revert the vat code "CS-x" into "I-x" - ?> - console.log("Countries are both IN and states differs, so we revert CS into I in default_vat_code="+default_vat_code); - new_default_vat_code = default_vat_code.replace(/^C\+S\-/, 'I-'); - - if (new_default_vat_code != default_vat_code && jQuery('#tva_tx option:contains("'+new_default_vat_code+'")').val()) { - console.log("We found en entry into VAT with new default_vat_code, we will use it"); - stringforvatrateselection = jQuery('#tva_tx option:contains("'+new_default_vat_code+'")').val(); - } - - } - // Set vat rate if field is an input box - $('#tva_tx').val(tva_tx); - // Set vat rate by selecting the combo - //$('#tva_tx option').val(tva_tx); // This is bugged, it replaces the vat key of all options - $('#tva_tx option').removeAttr('selected'); - console.log("stringforvatrateselection="+stringforvatrateselection+" -> value of option label for this key="+$('#tva_tx option[value="'+stringforvatrateselection+'"]').val()); - $('#tva_tx option[value="'+stringforvatrateselection+'"]').prop('selected', true); - - - var proddesc = data.desc_trans; - - var proddesc = data.desc; - - console.log("objectline_create.tpl Load desciption into text area : "+proddesc); - - if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined") - { - var editor = CKEDITOR.instances['dp_desc']; - if (editor) { - editor.setData(proddesc); - } - } - - jQuery('#dp_desc').text(proddesc); - - - - jQuery.each(data.array_options, function( key, value ) { - jQuery('div[class*="det'+key.replace('options_','_extras_')+'"] > #'+key).val(value); - }); - + console.log("Load unit price end, we got value "+data.price_ht); + jQuery("#price_ht").val(data.price_ht); @@ -914,2 +659,4 @@ - if (!empty($usemargins) && $user->hasRight('margins', 'creer')) { - $langs->load('stocks'); ?> + if (!empty($usemargins) && $user->rights->margins->creer) + { + $langs->load('stocks'); + ?> @@ -923,2 +670 @@ - var token = ''; // For AJAX Call we use old 'token' and not 'newtoken' - $.post('/fourn/ajax/getSupplierPrices.php?bestpricefirst=1', { 'idprod': $(this).val(), 'token': token }, function(data) { + $.post('/fourn/ajax/getSupplierPrices.php?bestpricefirst=1', { 'idprod': $(this).val() }, function(data) { @@ -935,10 +681,5 @@ - if (isset($conf->global->MARGIN_TYPE)) { - if (getDolGlobalString('MARGIN_TYPE') == '1') { - print 'bestsupplierprice'; - } - if (getDolGlobalString('MARGIN_TYPE') == 'pmp') { - print 'pmp'; - } - if (getDolGlobalString('MARGIN_TYPE') == 'costprice') { - print 'costprice'; - } + if (isset($conf->global->MARGIN_TYPE)) + { + if ($conf->global->MARGIN_TYPE == '1') print 'bestsupplierprice'; + if ($conf->global->MARGIN_TYPE == 'pmp') print 'pmp'; + if ($conf->global->MARGIN_TYPE == 'costprice') print 'costprice'; @@ -946 +687 @@ - console.log("objectline_create.tpl we will set the field for margin. defaultbuyprice="+defaultbuyprice); + console.log("we will set the field for margin. defaultbuyprice="+defaultbuyprice); @@ -983 +724 @@ - options += ''; + options += ''; @@ -1024,161 +765,32 @@ - - /* To process customer price per quantity (PRODUIT_CUSTOMER_PRICES_BY_QTY works only if combo product is not an ajax after x key pressed) */ - var pbq = parseInt($('option:selected', this).attr('data-pbq')); // When select is done from HTML select - if (isNaN(pbq)) { pbq = jQuery('#idprod').attr('data-pbq'); } // When select is done from HTML input with autocomplete - var pbqup = parseFloat($('option:selected', this).attr('data-pbqup')); - if (isNaN(pbqup)) { pbqup = jQuery('#idprod').attr('data-pbqup'); } - var pbqbase = $('option:selected', this).attr('data-pbqbase'); - if (isNaN(pbqbase)) { pbqbase = jQuery('#idprod').attr('data-pbqbase'); } - var pbqqty = parseFloat($('option:selected', this).attr('data-pbqqty')); - if (isNaN(pbqqty)) { pbqqty = jQuery('#idprod').attr('data-pbqqty'); } - var pbqpercent = parseFloat($('option:selected', this).attr('data-pbqpercent')); - if (isNaN(pbqpercent)) { pbqpercent = jQuery('#idprod').attr('data-pbqpercent'); } - - if ((jQuery('#idprod').val() > 0) && ! isNaN(pbq) && pbq > 0) - { - var pbqupht = pbqup; /* TODO support of price per qty TTC not yet available */ - - console.log("We choose a price by quanty price_by_qty id = "+pbq+" price_by_qty upht = "+pbqupht+" price_by_qty qty = "+pbqqty+" price_by_qty percent = "+pbqpercent); - jQuery("#pbq").val(pbq); - jQuery("#price_ht").val(pbqupht); - if (jQuery("#qty").val() < pbqqty) - { - jQuery("#qty").val(pbqqty); - } - if (jQuery("#remise_percent").val() < pbqpercent) - { - jQuery("#remise_percent").val(pbqpercent); - } - } else { jQuery("#pbq").val(''); } - - - - // Deal with supplier ref price (idprodfournprice = int) - if (jQuery('#idprodfournprice').val() > 0) - { - console.log("objectline_create.tpl #idprodfournprice is an ID > 0, so we set some properties into page"); - - var up = parseFloat($('option:selected', this).attr('data-up')); // When select is done from HTML select - if (isNaN(up)) { up = parseFloat(jQuery('#idprodfournprice').attr('data-up'));} // When select is done from HTML input with ajax autocomplete - - var up_locale = $('option:selected', this).attr('data-up-locale'); // When select is done from HTML select - if (typeof up_locale === 'undefined') { up_locale = jQuery('#idprodfournprice').attr('data-up-locale');} // When select is done from HTML input with ajax autocomplete - - var qty = parseFloat($('option:selected', this).attr('data-qty')); - if (isNaN(qty)) { qty = parseFloat(jQuery('#idprodfournprice').attr('data-qty'));} - - var discount = parseFloat($('option:selected', this).attr('data-discount')); - if (isNaN(discount)) { discount = parseFloat(jQuery('#idprodfournprice').attr('data-discount'));} - - var tva_tx = parseFloat($('option:selected', this).attr('data-tvatx')); // When select is done from HTML select - if (isNaN(tva_tx)) { tva_tx = parseFloat(jQuery('#idprodfournprice').attr('data-tvatx'));} // When select is done from HTML input with ajax autocomplete - - var default_vat_code = $('option:selected', this).attr('data-default-vat-code'); // When select is done from HTML select - if (typeof default_vat_code === 'undefined') { default_vat_code = jQuery('#idprodfournprice').attr('data-default-vat-code');} // When select is done from HTML input with ajax autocomplete - - var stringforvatrateselection = tva_tx; - if (typeof default_vat_code != 'undefined' && default_vat_code != null && default_vat_code != '') { - stringforvatrateselection = stringforvatrateselection+' ('+default_vat_code+')'; - } - - var supplier_ref = $('option:selected', this).attr('data-supplier-ref'); // When select is done from HTML select - if (typeof supplier_ref === 'undefined') { supplier_ref = jQuery('#idprodfournprice').attr('data-supplier-ref');} // When select is done from HTML input with ajax autocomplete - - console.log("objectline_create.tpl We find supplier price : up = "+up+", up_locale = "+up_locale+", supplier_ref = "+supplier_ref+" qty = "+qty+", tva_tx = "+tva_tx+", default_vat_code = "+default_vat_code+", stringforvatrateselection="+stringforvatrateselection+", discount = "+discount+" for product supplier ref id = "+jQuery('#idprodfournprice').val()); - - if (typeof up_locale === 'undefined') { - jQuery("#price_ht").val(up); - } else { - jQuery("#price_ht").val(up_locale); - } - - // Set supplier_ref - $('#fourn_ref').val(supplier_ref); - // Set vat rate if field is an input box - $('#tva_tx').val(tva_tx); - // Set vat rate by selecting the combo - //$('#tva_tx option').val(tva_tx); // This is bugged, it replaces the vat key of all options - $('#tva_tx option').removeAttr('selected'); - console.log("stringforvatrateselection="+stringforvatrateselection+" -> value of option label for this key="+$('#tva_tx option[value="'+stringforvatrateselection+'"]').val()); - $('#tva_tx option[value="'+stringforvatrateselection+'"]').prop('selected', true); - - if (jQuery("#qty").val() < qty) { - jQuery("#qty").val(qty); - } - if (jQuery("#remise_percent").val() < discount) { - jQuery("#remise_percent").val(discount); - } - - - var description = $('option:selected', this).attr('data-description'); - if (typeof description == 'undefined') { description = jQuery('#idprodfournprice').attr('data-description'); } - - console.log("Load desciption into text area : "+description); - - if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined") - { - var editor = CKEDITOR.instances['dp_desc']; - if (editor) { - editor.setData(description); - } - } - - jQuery('#dp_desc').text(description); - - } else if (jQuery('#idprodfournprice').length > 0) { - console.log("objectline_create.tpl #idprodfournprice is not an int but is a string so we set only few properties into page"); - - var tva_tx = parseFloat($('option:selected', this).attr('data-tvatx')); // When select is done from HTML select - if (isNaN(tva_tx)) { tva_tx = parseFloat(jQuery('#idprodfournprice').attr('data-tvatx'));} // When select is done from HTML input with ajax autocomplete - - var default_vat_code = $('option:selected', this).attr('data-default-vat-code'); // When select is done from HTML select - if (typeof default_vat_code === 'undefined') { default_vat_code = jQuery('#idprodfournprice').attr('data-default-vat-code');} // When select is done from HTML input with ajax autocomplete - - var stringforvatrateselection = tva_tx; - if (typeof default_vat_code != 'undefined' && default_vat_code != null && default_vat_code != '') { - stringforvatrateselection = stringforvatrateselection+' ('+default_vat_code+')'; - } - - console.log("objectline_create.tpl We find data for price : tva_tx = "+tva_tx+", default_vat_code = "+default_vat_code+", stringforvatrateselection="+stringforvatrateselection+" for product id = "+jQuery('#idprodfournprice').val()); - - // Set vat rate if field is an input box - $('#tva_tx').val(tva_tx); - // Set vat rate by selecting the combo - //$('#tva_tx option').val(tva_tx); // This is bugged, it replaces the vat key of all options - $('#tva_tx option').removeAttr('selected'); - console.log("stringforvatrateselection="+stringforvatrateselection+" -> value of option label for this key="+$('#tva_tx option[value="'+stringforvatrateselection+'"]').val()); - $('#tva_tx option[value="'+stringforvatrateselection+'"]').prop('selected', true); - - if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined") - { - var editor = CKEDITOR.instances['dp_desc']; - if (editor) { - editor.setData(''); - } - } - - jQuery('#dp_desc').text(''); - - } - + /* To process customer price per quantity (CUSTOMER_PRICE_PER_QTY works only if combo product is not an ajax after x key pressed) */ + var pbq = parseInt($('option:selected', this).attr('data-pbq')); // When select is done from HTML select + if (isNaN(pbq)) { pbq = jQuery('#idprod').attr('data-pbq'); } // When select is done from HTML input with autocomplete + var pbqup = parseFloat($('option:selected', this).attr('data-pbqup')); + if (isNaN(pbqup)) { pbqup = jQuery('#idprod').attr('data-pbqup'); } + var pbqbase = $('option:selected', this).attr('data-pbqbase'); + if (isNaN(pbqbase)) { pbqbase = jQuery('#idprod').attr('data-pbqbase'); } + var pbqqty = parseFloat($('option:selected', this).attr('data-pbqqty')); + if (isNaN(pbqqty)) { pbqqty = jQuery('#idprod').attr('data-pbqqty'); } + var pbqpercent = parseFloat($('option:selected', this).attr('data-pbqpercent')); + if (isNaN(pbqpercent)) { pbqpercent = jQuery('#idprod').attr('data-pbqpercent'); } + + if ((jQuery('#idprod').val() > 0 || jQuery('#idprodfournprice').val()) && ! isNaN(pbq) && pbq > 0) + { + var pbqupht = pbqup; /* TODO support of price per qty TTC not yet available */ + + console.log("We choose a price by quanty price_by_qty id = "+pbq+" price_by_qty upht = "+pbqupht+" price_by_qty qty = "+pbqqty+" price_by_qty percent = "+pbqpercent); + jQuery("#pbq").val(pbq); + jQuery("#price_ht").val(pbqupht); + if (jQuery("#qty").val() < pbqqty) + { + jQuery("#qty").val(pbqqty); + } + if (jQuery("#remise_percent").val() < pbqpercent) + { + jQuery("#remise_percent").val(pbqpercent); + } + } + else + { + jQuery("#pbq").val(''); + } @@ -1200 +812 @@ - + @@ -1205 +817 @@ - /* Function to set fields visibility after selecting a free product */ + /* Function to set fields from choice */ @@ -1207 +819 @@ - console.log("objectline_create.tpl::setforfree. We show most fields"); + console.log("Call setforfree. We show most fields"); @@ -1212 +824 @@ - jQuery("#price_ht, #multicurrency_price_ht, #price_ttc, #multicurrency_price_ttc, #fourn_ref, #tva_tx, #buying_price, #title_fourn_ref, #title_vat, #title_up_ht, #title_up_ht_currency, #title_up_ttc, #title_up_ttc_currency").show(); + jQuery("#price_ht, #multicurrency_price_ht, #price_ttc, #price_ttc, #fourn_ref, #tva_tx, #buying_price, #title_fourn_ref, #title_vat, #title_up_ht, #title_up_ht_currency, #title_up_ttc, #title_up_ttc_currency").show(); @@ -1216 +827,0 @@ - @@ -1218 +829 @@ - console.log("objectline_create.tpl::setforpredef We hide some fields, show dates"); + console.log("Call setforpredef. We hide some fields and show dates"); @@ -1222 +833 @@ - + global->MAIN_DISABLE_EDIT_PREDEF_PRICEHT)) { ?> @@ -1227 +838 @@ - //jQuery("#price_ht").val('').hide(); + jQuery("#price_ht").val('').hide(); @@ -1231,11 +842 @@ - - jQuery("#price_ttc").val('').show(); - jQuery("#multicurrency_price_ttc").val('').show(); - jQuery("#title_up_ttc, #title_up_ttc_currency").show(); - - jQuery("#price_ttc").val('').hide(); - jQuery("#multicurrency_price_ttc").val('').hide(); - jQuery("#title_up_ttc, #title_up_ttc_currency").hide(); - - /* jQuery("#tva_tx, #title_vat").hide(); */ - /* jQuery("#title_fourn_ref").hide(); */ + jQuery("#price_ttc, #fourn_ref, #tva_tx, #title_fourn_ref, #title_vat, #title_up_ttc, #title_up_ttc_currency").hide(); --- /tmp/dsg/dolibarr/htdocs/core/tpl/github_19.0.3_objectline_edit.tpl.php +++ /tmp/dsg/dolibarr/htdocs/core/tpl/client_objectline_edit.tpl.php @@ -3 +3 @@ - * Copyright (C) 2010-2022 Laurent Destailleur + * Copyright (C) 2010-2012 Laurent Destailleur @@ -9 +8,0 @@ - * Copyright (C) 2022 OpenDSI @@ -33 +31,0 @@ - * $canchangeproduct (0 by default, 1 to allow to change the product if it is a predefined product) @@ -37 +35,2 @@ -if (empty($object) || !is_object($object)) { +if (empty($object) || !is_object($object)) +{ @@ -44,20 +43,8 @@ -if (isModEnabled('margin') && !empty($object->element) && in_array($object->element, array('facture', 'facturerec', 'propal', 'commande'))) { - $usemargins = 1; -} - -global $forceall, $senderissupplier, $inputalsopricewithtax, $canchangeproduct; -if (empty($dateSelector)) { - $dateSelector = 0; -} -if (empty($forceall)) { - $forceall = 0; -} -if (empty($senderissupplier)) { - $senderissupplier = 0; -} -if (empty($inputalsopricewithtax)) { - $inputalsopricewithtax = 0; -} -if (empty($canchangeproduct)) { - $canchangeproduct = 0; -} +if (!empty($conf->margin->enabled) && !empty($object->element) && in_array($object->element, array('facture', 'facturerec', 'propal', 'commande'))) $usemargins = 1; + +global $forceall, $senderissupplier, $inputalsopricewithtax; +if (empty($dateSelector)) $dateSelector = 0; +if (empty($forceall)) $forceall = 0; +if (empty($senderissupplier)) $senderissupplier = 0; +if (empty($inputalsopricewithtax)) $inputalsopricewithtax = 0; + @@ -67,14 +54,3 @@ -if (!empty($inputalsopricewithtax)) { - $colspan++; // We add 1 if col total ttc -} -if (in_array($object->element, array('propal', 'supplier_proposal', 'facture', 'facturerec', 'invoice', 'commande', 'order', 'order_supplier', 'invoice_supplier', 'invoice_supplier_rec'))) { - $colspan++; // With this, there is a column move button -} -if (isModEnabled("multicurrency") && $object->multicurrency_code != $conf->currency) { - $colspan += 2; -} -if (isModEnabled('asset') && $object->element == 'invoice_supplier') { - $colspan++; -} - - +if (!empty($inputalsopricewithtax)) $colspan++; // We add 1 if col total ttc +if (in_array($object->element, array('propal', 'supplier_proposal', 'facture', 'facturerec', 'invoice', 'commande', 'order', 'order_supplier', 'invoice_supplier'))) $colspan++; // With this, there is a column move button +if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) $colspan += 2; @@ -87,2 +63,2 @@ - - +global->MAIN_VIEW_LINE_NUMBER)) { ?> + @@ -93 +69 @@ - + if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines + { + $coldisplay++; + ?> + @@ -203,4 +142,2 @@ - print ''; - } - - // VAT Rate + } + @@ -208,4 +145,2 @@ - if (!$situationinvoicelinewithparent) { - print ''; + if ($line->fk_prev_id == null) { + print ''; @@ -217,4 +152,2 @@ - print ''; + } + + if ($inputalsopricewithtax) + { @@ -225,13 +164,2 @@ - print ''; - } - - if (!empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) { - $coldisplay++; - $upinctax = isset($line->pu_ttc) ? $line->pu_ttc : null; - if (getDolGlobalInt('MAIN_UNIT_PRICE_WITH_TAX_IS_FOR_ALL_TAXES')) { - $upinctax = price2num($line->total_ttc / $line->qty, 'MU'); - } - print ''; + print ''; @@ -301,5 +211,7 @@ - - if (!empty($usemargins)) { - if ($user->hasRight('margins', 'creer')) { - $coldisplay++; ?> - '; - } else { - echo ''; - } + if ($line->subprice < 0) + echo ''; + else + echo ''; @@ -327,2 +238,3 @@ - if (getDolGlobalString('DISPLAY_MARK_RATES')) { - $mark_rate = (GETPOSTISSET("np_markRate") ? GETPOST("np_markRate", 'alpha', 2) : price($line->marque_tx)); + elseif (!empty($conf->global->DISPLAY_MARK_RATES)) + { + $mark_rate = (isset($_POST["np_markRate"]) ?GETPOST("np_markRate", 'alpha', 2) : price($line->marque_tx)); @@ -330,5 +242,4 @@ - if ($line->subprice < 0) { - echo ''; - } else { - echo ''; - } + if ($line->subprice < 0) + echo ''; + else + echo ''; @@ -343,2 +254,2 @@ - ">
- "> + ">
+ "> @@ -348 +259,9 @@ -product_type == 1 && $dateSelector) { ?> +showOptionals($extrafields, 'edit', array('class'=>'tredited', 'colspan'=>$coldisplay), '', '', 1); +} +?> + +service->enabled) && $line->product_type == 1 && $dateSelector) { ?> @@ -350 +269 @@ - + global->MAIN_VIEW_LINE_NUMBER)) { ?> @@ -353 +272 @@ - '; @@ -88 +65 @@ -print ''; +print ''; @@ -91,3 +68 @@ -if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) { - print ''; -} +if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) print ''; @@ -95,3 +70 @@ -if (!empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) { - print ''; -} +if ($inputalsopricewithtax) print ''; @@ -100 +73 @@ -print ''; +print ''; @@ -102,3 +75,3 @@ -// Unit -if (getDolGlobalString('PRODUCT_USE_UNITS')) { - print ''; +if ($conf->global->PRODUCT_USE_UNITS) +{ + print ''; @@ -108,18 +81 @@ -print ''; +print ''; @@ -128,3 +84,3 @@ -if (isset($this->situation_cycle_ref) && $this->situation_cycle_ref) { - print ''; - print ''; +if ($this->situation_cycle_ref) { + print ''; + print ''; @@ -133,5 +89,6 @@ -// Purchase price -if ($usemargins && isModEnabled('margin') && empty($user->socid)) { - if ($user->hasRight('margins', 'creer')) { - if (getDolGlobalString('MARGIN_TYPE') == "1") { - print ''; +if ($usemargins && !empty($conf->margin->enabled) && empty($user->socid)) +{ + if (!empty($user->rights->margins->creer)) + { + if ($conf->global->MARGIN_TYPE == "1") { + print ''; @@ -139 +96 @@ - print ''; + print ''; @@ -143,12 +100,2 @@ - if (getDolGlobalString('DISPLAY_MARGIN_RATES') && $user->hasRight('margins', 'liretous')) { - print ''; + if (!empty($conf->global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) { + print ''; @@ -156,2 +103,2 @@ - if (getDolGlobalString('DISPLAY_MARK_RATES') && $user->hasRight('margins', 'liretous')) { - print ''; + if (!empty($conf->global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous) { + print ''; @@ -162 +109 @@ -print ''; +print ''; @@ -165,3 +112 @@ -if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) { - print ''; -} +if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) print ''; @@ -169,3 +114 @@ -if ($outputalsopricetotalwithtax) { - print ''; -} +if ($outputalsopricetotalwithtax) print ''; @@ -173,3 +116 @@ -if (isModEnabled('asset') && $object->element == 'invoice_supplier') { - print ''; -} +print ''; // No width to allow autodim @@ -177 +118 @@ -print ''; // No width to allow autodim +print ''; @@ -179 +120 @@ -print ''; +print ''; @@ -181,4 +122,3 @@ -print ''; - -if ($action == 'selectlines') { - print ''; --- /tmp/dsg/dolibarr/htdocs/core/tpl/github_19.0.3_objectline_view.tpl.php +++ /tmp/dsg/dolibarr/htdocs/core/tpl/client_objectline_view.tpl.php @@ -9 +8,0 @@ - * Copyright (C) 2022 OpenDSI @@ -43 +42,2 @@ -if (empty($object) || !is_object($object)) { +if (empty($object) || !is_object($object)) +{ @@ -52,19 +52,7 @@ -if (isModEnabled('margin') && !empty($object->element) && in_array($object->element, array('facture', 'facturerec', 'propal', 'commande'))) { - $usemargins = 1; -} - -if (empty($dateSelector)) { - $dateSelector = 0; -} -if (empty($forceall)) { - $forceall = 0; -} -if (empty($senderissupplier)) { - $senderissupplier = 0; -} -if (empty($inputalsopricewithtax)) { - $inputalsopricewithtax = 0; -} -if (empty($outputalsopricetotalwithtax)) { - $outputalsopricetotalwithtax = 0; -} +if (!empty($conf->margin->enabled) && !empty($object->element) && in_array($object->element, array('facture', 'facturerec', 'propal', 'commande'))) $usemargins = 1; + +if (empty($dateSelector)) $dateSelector = 0; +if (empty($forceall)) $forceall = 0; +if (empty($senderissupplier)) $senderissupplier = 0; +if (empty($inputalsopricewithtax)) $inputalsopricewithtax = 0; +if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax = 0; @@ -78,8 +66,2 @@ -$sign = 1; -if (getDolGlobalString('INVOICE_POSITIVE_CREDIT_NOTE_SCREEN') && in_array($object->element, array('facture', 'invoice_supplier')) && $object->type == $object::TYPE_CREDIT_NOTE) { - $sign = -1; -} - - -$coldisplay = 0; -?> + +$coldisplay = 0; ?> @@ -88,2 +70,2 @@ - - +global->MAIN_VIEW_LINE_NUMBER)) { ?> + @@ -94 +76 @@ - print ''; + print ''; @@ -97,7 +79,3 @@ - if ($line->description == '(DEPOSIT)') { - $txt = $langs->trans("Deposit"); - } elseif ($line->description == '(EXCESS RECEIVED)') { - $txt = $langs->trans("ExcessReceived"); - } elseif ($line->description == '(EXCESS PAID)') { - $txt = $langs->trans("ExcessPaid"); - } + if ($line->description == '(DEPOSIT)') $txt = $langs->trans("Deposit"); + elseif ($line->description == '(EXCESS RECEIVED)') $txt = $langs->trans("ExcessReceived"); + elseif ($line->description == '(EXCESS PAID)') $txt = $langs->trans("ExcessPaid"); @@ -107,3 +85,4 @@ - if ($line->description) { - if ($line->description == '(CREDIT_NOTE)' && $line->fk_remise_except > 0) { - include_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; + if ($line->description) + { + if ($line->description == '(CREDIT_NOTE)' && $line->fk_remise_except > 0) + { @@ -112,3 +91,4 @@ - print($txt ? ' - ' : '').$langs->transnoentities("DiscountFromCreditNote", $discount->getNomUrl(0)); - } elseif ($line->description == '(DEPOSIT)' && $line->fk_remise_except > 0) { - include_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; + print ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromCreditNote", $discount->getNomUrl(0)); + } + elseif ($line->description == '(DEPOSIT)' && $line->fk_remise_except > 0) + { @@ -117 +97 @@ - print($txt ? ' - ' : '').$langs->transnoentities("DiscountFromDeposit", $discount->getNomUrl(0)); + print ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromDeposit", $discount->getNomUrl(0)); @@ -119,5 +99,5 @@ - if (getDolGlobalString('INVOICE_ADD_DEPOSIT_DATE')) { - print ' ('.dol_print_date($discount->datec).')'; - } - } elseif ($line->description == '(EXCESS RECEIVED)' && $objp->fk_remise_except > 0) { - include_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; + if (!empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) + print ' ('.dol_print_date($discount->datec).')'; + } + elseif ($line->description == '(EXCESS RECEIVED)' && $objp->fk_remise_except > 0) + { @@ -126,3 +106,4 @@ - print($txt ? ' - ' : '').$langs->transnoentities("DiscountFromExcessReceived", $discount->getNomUrl(0)); - } elseif ($line->description == '(EXCESS PAID)' && $objp->fk_remise_except > 0) { - include_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; + print ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromExcessReceived", $discount->getNomUrl(0)); + } + elseif ($line->description == '(EXCESS PAID)' && $objp->fk_remise_except > 0) + { @@ -131,18 +112,18 @@ - print($txt ? ' - ' : '').$langs->transnoentities("DiscountFromExcessPaid", $discount->getNomUrl(0)); - } else { - print($txt ? ' - ' : '').dol_htmlentitiesbr($line->description); - } - } -} else { - $format = (getDolGlobalString('MAIN_USE_HOURMIN_IN_DATE_RANGE') ? 'dayhour' : 'day'); - - if ($line->fk_product > 0) { - if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { - print (!empty($line->fk_parent_line) ? img_picto('', 'rightarrow') : '') . $text; - if (!getDolGlobalInt('PRODUIT_DESC_IN_FORM')) { - print $form->textwithpicto('', $description); - } - } else { - print $form->textwithtooltip($text, $description, 3, 0, '', $i, 0, (!empty($line->fk_parent_line) ? img_picto('', 'rightarrow') : '')); - } - } else { + print ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromExcessPaid", $discount->getNomUrl(0)); + } + else + { + print ($txt ? ' - ' : '').dol_htmlentitiesbr($line->description); + } + } +} +else +{ + $format = $conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE ? 'dayhour' : 'day'; + + if ($line->fk_product > 0) + { + print $form->textwithtooltip($text, $description, 3, '', '', $i, 0, (!empty($line->fk_parent_line) ?img_picto('', 'rightarrow') : '')); + } + else + { @@ -150,5 +131,2 @@ - if ($type == 1) { - $text = img_object($langs->trans('Service'), 'service'); - } else { - $text = img_object($langs->trans('Product'), 'product'); - } + if ($type == 1) $text = img_object($langs->trans('Service'), 'service'); + else $text = img_object($langs->trans('Product'), 'product'); @@ -158 +136 @@ - print $form->textwithtooltip($text, dol_htmlentitiesbr($line->description), 3, 0, '', $i, 0, (!empty($line->fk_parent_line) ? img_picto('', 'rightarrow') : '')); + print $form->textwithtooltip($text, dol_htmlentitiesbr($line->description), 3, '', '', $i, 0, (!empty($line->fk_parent_line) ?img_picto('', 'rightarrow') : '')); @@ -160,3 +138 @@ - if (!empty($line->fk_parent_line)) { - print img_picto('', 'rightarrow'); - } + if (!empty($line->fk_parent_line)) print img_picto('', 'rightarrow'); @@ -166 +142,2 @@ - } else { + } + else { @@ -173,48 +150,10 @@ - if ($line->element == 'facturedetrec' || $line->element == 'invoice_supplier_det_rec') { - if ($line->element == 'invoice_supplier_det_rec' && $line->product_type != Product::TYPE_PRODUCT) { - $line->date_start_fill = $line->date_start; - $line->date_end_fill = $line->date_end; - } - if ($line->date_start_fill || $line->date_end_fill) { - print '
'; - } - if ($line->date_start_fill) { - print ''.$langs->trans('AutoFillDateFromShort').': '.yn($line->date_start_fill); - } - if ($line->date_start_fill && $line->date_end_fill) { - print ' - '; - } - if ($line->date_end_fill) { - print ''.$langs->trans('AutoFillDateToShort').': '.yn($line->date_end_fill); - } - if ($line->date_start_fill || $line->date_end_fill) { - print '
'; - } - } else { - if ($line->date_start || $line->date_end) { - print '
'.get_date_range($line->date_start, $line->date_end, $format).'
'; - } - - if (!$line->date_start || !$line->date_end) { - // show warning under line - // we need to fetch product associated to line for some test - if ($object->element == 'propal' || $object->element == 'order' || $object->element == 'facture' || $object->element == 'propal_supplier' || $object->element == 'supplier_proposal' || $object->element == 'commande') { - $res = $line->fetch_product(); - if ($res > 0) { - if ($line->product->isService() && $line->product->isMandatoryPeriod()) { - print '
'.$langs->trans("mandatoryPeriodNeedTobeSet").'
'; - } - } - } - } - - // If we show the lines in a context to create a recurring sale invoice - if (basename($_SERVER["PHP_SELF"]) == 'card-rec.php') { - $default_start_fill = getDolGlobalInt('INVOICEREC_SET_AUTOFILL_DATE_START'); - $default_end_fill = getDolGlobalInt('INVOICEREC_SET_AUTOFILL_DATE_END'); - print '
'; - print ''.$langs->trans('AutoFillDateFromShort').': '.yn($default_start_fill); - print ' - '; - print ''.$langs->trans('AutoFillDateToShort').': '.yn($default_end_fill); - print '
'; - } + if ($line->element == 'facturedetrec') { + if ($line->date_start_fill || $line->date_end_fill) print '
'; + if ($line->date_start_fill) print $langs->trans('AutoFillDateFromShort').': '.yn($line->date_start_fill); + if ($line->date_start_fill && $line->date_end_fill) print ' - '; + if ($line->date_end_fill) print $langs->trans('AutoFillDateToShort').': '.yn($line->date_end_fill); + if ($line->date_start_fill || $line->date_end_fill) print '
'; + } + else { + if ($line->date_start || $line->date_end) print '
'.get_date_range($line->date_start, $line->date_end, $format).'
'; + //print get_date_range($line->date_start, $line->date_end, $format); @@ -224,23 +163,9 @@ - if ($line->fk_product > 0 && getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) { - if ($line->element == 'facturedetrec') { - print (!empty($line->description) && $line->description != $line->product_label) ? (($line->date_start_fill || $line->date_end_fill) ? '' : '
').'
'.dol_htmlentitiesbr($line->description) : ''; - } elseif ($line->element == 'invoice_supplier_det_rec') { - print (!empty($line->description) && $line->description != $line->label) ? (($line->date_start || $line->date_end) ? '' : '
').'
'.dol_htmlentitiesbr($line->description) : ''; - } else { - print (!empty($line->description) && $line->description != $line->product_label) ? (($line->date_start || $line->date_end) ? '' : '
').'
'.dol_htmlentitiesbr($line->description) : ''; - } - } - - // Line extrafield - if (!empty($extrafields)) { - $temps = $line->showOptionals($extrafields, 'view', array(), '', '', 1, 'line'); - if (!empty($temps)) { - print '
'; - print $temps; - print '
'; - } - } -} - -if ($user->hasRight('fournisseur', 'lire') && isset($line->fk_fournprice) && $line->fk_fournprice > 0 && !getDolGlobalString('SUPPLIER_HIDE_SUPPLIER_OBJECTLINES')) { - require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; + if ($line->fk_product > 0 && !empty($conf->global->PRODUIT_DESC_IN_FORM)) + { + print (!empty($line->description) && $line->description != $line->product_label) ? '
'.dol_htmlentitiesbr($line->description) : ''; + } +} + +if ($user->rights->fournisseur->lire && $line->fk_fournprice > 0) +{ + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; @@ -252 +177,2 @@ - if ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer')) { // change required right here + if ($user->rights->produit->creer || $user->rights->service->creer) // change required right here + { @@ -254 +180,3 @@ - } else { + } + else + { @@ -259 +187,2 @@ -if (isModEnabled('accounting') && !empty($line->fk_accounting_account) && $line->fk_accounting_account > 0) { +if (!empty($conf->accounting->enabled) && $line->fk_accounting_account > 0) +{ @@ -266,2 +195,2 @@ -// Vendor price ref -if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier' || $object->element == 'invoice_supplier_rec') { // We must have same test in printObjectLines +if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines +{ @@ -269,39 +198,3 @@ - print($line->ref_fourn ? $line->ref_fourn : $line->ref_supplier); - print ''; -} - -$tooltiponprice = ''; -$tooltiponpriceend = ''; -if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { - $tooltiponprice = $langs->transcountry("TotalHT", $mysoc->country_code).'='.price($line->total_ht); - $tooltiponprice .= '
'.$langs->transcountry("TotalVAT", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'='.price($line->total_tva); - if (is_object($object->thirdparty)) { - if ($senderissupplier) { - $seller = $object->thirdparty; - $buyer = $mysoc; - } else { - $seller = $mysoc; - $buyer = $object->thirdparty; - } - - if ($mysoc->useLocalTax(1)) { - if (($seller->country_code == $buyer->country_code) || $line->total_localtax1 || $seller->useLocalTax(1)) { - $tooltiponprice .= '
'.$langs->transcountry("TotalLT1", $seller->country_code).'='.price($line->total_localtax1); - } else { - $tooltiponprice .= '
'.$langs->transcountry("TotalLT1", $seller->country_code).'='.$langs->trans($senderissupplier ? "NotUsedForThisVendor" : "NotUsedForThisCustomer").''; - } - } - if ($mysoc->useLocalTax(2)) { - if ((isset($seller->country_code) && isset($buyer->thirdparty->country_code) && $seller->country_code == $buyer->thirdparty->country_code) || $line->total_localtax2 || $seller->useLocalTax(2)) { - $tooltiponprice .= '
'.$langs->transcountry("TotalLT2", $seller->country_code).'='.price($line->total_localtax2); - } else { - $tooltiponprice .= '
'.$langs->transcountry("TotalLT2", $seller->country_code).'='.$langs->trans($senderissupplier ? "NotUsedForThisVendor" : "NotUsedForThisCustomer").''; - } - } - } - $tooltiponprice .= '
'.$langs->transcountry("TotalTTC", $mysoc->country_code).'='.price($line->total_ttc); - - $tooltiponprice = ''; - $tooltiponpriceend = ''; -} - + print ($line->ref_fourn ? $line->ref_fourn : $line->ref_supplier); + print ''; +} @@ -312,13 +205,4 @@ -if (price2num($line->tva_tx)) { - $positiverates .= ($positiverates ? '/' : '').price2num($line->tva_tx); -} -if (price2num($line->total_localtax1)) { - $positiverates .= ($positiverates ? '/' : '').price2num($line->localtax1_tx); -} -if (price2num($line->total_localtax2)) { - $positiverates .= ($positiverates ? '/' : '').price2num($line->localtax2_tx); -} -if (empty($positiverates)) { - $positiverates = '0'; -} -print $tooltiponprice; +if (price2num($line->tva_tx)) $positiverates .= ($positiverates ? '/' : '').price2num($line->tva_tx); +if (price2num($line->total_localtax1)) $positiverates .= ($positiverates ? '/' : '').price2num($line->localtax1_tx); +if (price2num($line->total_localtax2)) $positiverates .= ($positiverates ? '/' : '').price2num($line->localtax2_tx); +if (empty($positiverates)) $positiverates = '0'; @@ -326 +210 @@ -print $tooltiponpriceend; +//print vatrate($line->tva_tx.($line->vat_src_code?(' ('.$line->vat_src_code.')'):''), '%', $line->info_bits); @@ -329,4 +213,4 @@ -
- -multicurrency_code != $conf->currency) { ?> - + + +multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { ?> + @@ -335,8 +219,2 @@ -if (!empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) { ?> - +if ($inputalsopricewithtax) { ?> + @@ -345 +223 @@ - '; -} - -if ($usemargins && isModEnabled('margin') && empty($user->socid)) { - if ($user->hasRight('margins', 'creer')) { ?> + print ''; +} + +if ($usemargins && !empty($conf->margin->enabled) && empty($user->socid)) +{ + if (!empty($user->rights->margins->creer)) { ?> @@ -392,2 +271,2 @@ - if (getDolGlobalString('DISPLAY_MARGIN_RATES') && $user->hasRight('margins', 'liretous')) { ?> - + if (!empty($conf->global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) { ?> + @@ -395,6 +274,4 @@ - if (getDolGlobalString('DISPLAY_MARK_RATES') && $user->hasRight('margins', 'liretous')) {?> - - global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous) {?> + + total_ht); - print $tooltiponpriceend; - print ''; - if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) { - print ''; - $coldisplay++; - } -} - -// Price inc tax -if ($outputalsopricetotalwithtax) { - print ''; - $coldisplay++; -} - -if ($this->statut == 0 && !empty($object_rights->creer) && $action != 'selectlines') { - $situationinvoicelinewithparent = 0; - if (isset($line->fk_prev_id) && in_array($object->element, array('facture', 'facturedet'))) { - if ($object->type == $object::TYPE_SITUATION) { // The constant TYPE_SITUATION exists only for object invoice - // Set constant to disallow editing during a situation cycle - $situationinvoicelinewithparent = 1; - } - } - - // Asset info - if (isModEnabled('asset') && $object->element == 'invoice_supplier') { - print ''; - } - - // Edit picto + if ($mysoc->useLocalTax(2)) { + if (($mysoc->country_code == $object->thirdparty->country_code) || $object->thirdparty->useLocalTax(2)) { + $tooltiponprice .= '
'.$langs->transcountry("TotalLT2", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'='.price($line->total_localtax2); + } else { + $tooltiponprice .= '
'.$langs->transcountry("TotalLT2", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'='.$langs->trans("NotUsedForThisCustomer").''; + } + } + } + $tooltiponprice .= '
'.$langs->transcountry("TotalTTC", $mysoc->country_code).'='.price($line->total_ttc); + + print ''; + } + print price($line->total_ht); + if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + print ''; + } + print ''; + if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { + print '
'; + $coldisplay++; + } +} +if ($outputalsopricetotalwithtax) { + print ''; + $coldisplay++; +} + +if ($this->statut == 0 && ($object_rights->creer) && $action != 'selectlines') { @@ -472 +328 @@ - id; ?>"> + id.'#line_'.$line->id; ?>"> @@ -477 +332,0 @@ - // Delete picto @@ -480,2 +335,2 @@ - if (!$situationinvoicelinewithparent && empty($disableremove)) { // For situation invoice, deletion is not possible if there is a parent company. - print 'id.'">'; + if (($line->fk_prev_id == null) && empty($disableremove)) { //La suppression n'est autorisée que si il n'y a pas de ligne dans une précédente situation + print 'id.'">'; @@ -487,2 +342 @@ - // Move up-down picto - if ($num > 1 && $conf->browser->layout != 'phone' && ((property_exists($this, 'situation_counter') && $this->situation_counter == 1) || empty($this->situation_cycle_ref)) && empty($disablemove)) { + if ($num > 1 && $conf->browser->layout != 'phone' && ($this->situation_counter == 1 || !$this->situation_cycle_ref) && empty($disablemove)) { @@ -492 +346 @@ - id; ?>"> + id; ?>"> @@ -497 +351 @@ - id; ?>"> + id; ?>"> @@ -502 +356 @@ - } else { + } else { @@ -507,6 +361,2 @@ - $colspan = 3; - if (isModEnabled('asset') && $object->element == 'invoice_supplier') { - $colspan++; - } - print ''; - $coldisplay = $coldisplay + $colspan; + print ''; + $coldisplay = $coldisplay + 3; @@ -520,0 +371,6 @@ +//Line extrafield +if (!empty($extrafields)) +{ + print $line->showOptionals($extrafields, 'view', array('style'=>'class="drag drop oddeven"', 'colspan'=>$coldisplay), '', '', 1); +} + --- /tmp/dsg/dolibarr/htdocs/core/tpl/github_19.0.3_onlinepaymentlinks.tpl.php +++ /tmp/dsg/dolibarr/htdocs/core/tpl/client_onlinepaymentlinks.tpl.php @@ -19 +19,2 @@ -if (empty($conf) || !is_object($conf)) { +if (empty($conf) || !is_object($conf)) +{ @@ -30 +31 @@ -print img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnFreeAmount", $servicename).':
'; +print img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnFreeAmount", $servicename).':
'; @@ -32,4 +33,4 @@ - -if (isModEnabled('commande')) { - print '
'; - print img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnOrder", $servicename).':
'; +if (!empty($conf->commande->enabled)) +{ + print '
'; + print img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnOrder", $servicename).':
'; @@ -37,15 +38,15 @@ - if (getDolGlobalString('PAYMENT_SECURITY_TOKEN') && getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) { - $langs->load("orders"); - print '
'; - print ''; - - print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Order")).': '; - print ''; - print ''; - if (GETPOST('generate_order_ref', 'alpha')) { - $url = getOnlinePaymentUrl(0, 'order', GETPOST('generate_order_ref', 'alpha')); - print ''."\n"; - } - print ''; + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) + { + $langs->load("orders"); + print '
'; + print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Order")).': '; + print ''; + print ''; + if (GETPOST('generate_order_ref', 'alpha')) + { + print '
-> '; + $url = getOnlinePaymentUrl(0, 'order', GETPOST('generate_order_ref', 'alpha')); + print $url; + print "
\n"; + } + print ''; @@ -55,3 +56,4 @@ -if (isModEnabled('facture')) { - print '
'; - print img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnInvoice", $servicename).':
'; +if (!empty($conf->facture->enabled)) +{ + print '
'; + print img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnInvoice", $servicename).':
'; @@ -59,15 +61,15 @@ - if (getDolGlobalString('PAYMENT_SECURITY_TOKEN') && getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) { - $langs->load("bills"); - print '
'; - print ''; - - print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Invoice")).': '; - print ''; - print ''; - if (GETPOST('generate_invoice_ref', 'alpha')) { - $url = getOnlinePaymentUrl(0, 'invoice', GETPOST('generate_invoice_ref', 'alpha')); - print ''."\n"; - } - print ''; + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) + { + $langs->load("bills"); + print '
'; + print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Invoice")).': '; + print ''; + print ''; + if (GETPOST('generate_invoice_ref', 'alpha')) + { + print '
-> '; + $url = getOnlinePaymentUrl(0, 'invoice', GETPOST('generate_invoice_ref', 'alpha')); + print $url; + print "
\n"; + } + print ''; @@ -77,3 +79,4 @@ -if (isModEnabled('contrat')) { - print '
'; - print img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnContractLine", $servicename).':
'; +if (!empty($conf->contrat->enabled)) +{ + print '
'; + print img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnContractLine", $servicename).':
'; @@ -81,15 +84,15 @@ - if (getDolGlobalString('PAYMENT_SECURITY_TOKEN') && getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) { - $langs->load("contracts"); - print '
'; - print ''; - - print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("ContractLine")).': '; - print ''; - print ''; - if (GETPOST('generate_contract_ref')) { - $url = getOnlinePaymentUrl(0, 'contractline', GETPOST('generate_contract_ref', 'alpha')); - print ''."\n"; - } - print ''; + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) + { + $langs->load("contracts"); + print '
'; + print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("ContractLine")).': '; + print ''; + print ''; + if (GETPOST('generate_contract_ref')) + { + print '
-> '; + $url = getOnlinePaymentUrl(0, 'contractline', GETPOST('generate_contract_ref', 'alpha')); + print $url; + print "
\n"; + } + print ''; @@ -99,3 +102,4 @@ -if (isModEnabled('adherent')) { - print '
'; - print img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnMemberSubscription", $servicename).':
'; +if (!empty($conf->adherent->enabled)) +{ + print '
'; + print img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnMemberSubscription", $servicename).':
'; @@ -103,15 +107,15 @@ - if (getDolGlobalString('PAYMENT_SECURITY_TOKEN') && getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) { - $langs->load("members"); - print '
'; - print ''; - - print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Member")).': '; - print ''; - print ''; - if (GETPOST('generate_member_ref')) { - $url = getOnlinePaymentUrl(0, 'membersubscription', GETPOST('generate_member_ref', 'alpha')); - print ''."\n"; - } - print ''; + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) + { + $langs->load("members"); + print '
'; + print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Member")).': '; + print ''; + print ''; + if (GETPOST('generate_member_ref')) + { + print '
-> '; + $url = getOnlinePaymentUrl(0, 'membersubscription', GETPOST('generate_member_ref', 'alpha')); + print $url; + print "
\n"; + } + print ''; @@ -121,3 +125,4 @@ -if (isModEnabled('don')) { - print '
'; - print img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnDonation", $servicename).':
'; +if (!empty($conf->don->enabled)) +{ + print '
'; + print img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnDonation", $servicename).':
'; @@ -125,15 +130,15 @@ - if (getDolGlobalString('PAYMENT_SECURITY_TOKEN') && getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) { - $langs->load("members"); - print '
'; - print ''; - - print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Don")).': '; - print ''; - print ''; - if (GETPOST('generate_donation_ref')) { - print ''."\n"; - } - print ''; + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) + { + $langs->load("members"); + print '
'; + print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Don")).': '; + print ''; + print ''; + if (GETPOST('generate_donation_ref')) + { + print '
-> '; + $url = getOnlinePaymentUrl(0, 'donation', GETPOST('generate_donation_ref', 'alpha')); + print $url; + print "
\n"; + } + print ''; @@ -144,5 +149,16 @@ -$constname = 'PAYMENT_SECURITY_TOKEN'; - -// Add button to autosuggest a key -include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; -print dolJSToSetRandomPassword($constname); +if (!empty($conf->use_javascript_ajax)) +{ + print "\n".''; +} --- /tmp/dsg/dolibarr/htdocs/core/tpl/github_19.0.3_originproductline.tpl.php +++ /tmp/dsg/dolibarr/htdocs/core/tpl/client_originproductline.tpl.php @@ -3,2 +3 @@ - * Copyright (C) 2017 Charlie Benke - * Copyright (C) 2022 Gauthier VERDOL +/* Copyright (C) 2017 Charlie Benke @@ -21 +20,2 @@ -if (empty($conf) || !is_object($conf)) { +if (empty($conf) || !is_object($conf)) +{ @@ -30,8 +30,7 @@ -print '
'; -print ''; -print ''; -print ''; -print ''; -if (isModEnabled("multicurrency")) { - print ''; -} +print ''; +print ''; +print ''; +print ''; +print ''; +if (!empty($conf->multicurrency->enabled)) + print ''; @@ -39,4 +38,3 @@ -print ''; -if (getDolGlobalString('PRODUCT_USE_UNITS')) { - print ''; -} +print ''; +if ($conf->global->PRODUCT_USE_UNITS) + print ''; @@ -44,2 +42 @@ -print ''; -print ''; +print ''; @@ -48,3 +45 @@ -if (!empty($selectedLines) && !in_array($this->tpl['id'], $selectedLines)) { - $selected = 0; -} +if (!empty($selectedLines) && !in_array($this->tpl['id'], $selectedLines)) $selected = 0; --- /tmp/dsg/dolibarr/htdocs/core/tpl/github_19.0.3_passwordforgotten.tpl.php +++ /tmp/dsg/dolibarr/htdocs/core/tpl/client_passwordforgotten.tpl.php @@ -19,4 +18,0 @@ -if (!defined('NOBROWSERNOTIF')) { - define('NOBROWSERNOTIF', 1); -} - @@ -24 +20,2 @@ -if (empty($conf) || !is_object($conf)) { +if (empty($conf) || !is_object($conf)) +{ @@ -29,6 +25,0 @@ -// DDOS protection -$size = (int) ($_SERVER['CONTENT_LENGTH'] ?? 0); -if ($size > 10000) { - $langs->loadLangs(array("errors", "install")); - httponly_accessforbidden('
'.$langs->trans("ErrorRequestTooLarge").'
'.$langs->trans("ClickHereToGoToApp").'
', 413, 1); -} @@ -39,16 +30,7 @@ - -if (GETPOST('dol_hide_topmenu')) { - $conf->dol_hide_topmenu = 1; -} -if (GETPOST('dol_hide_leftmenu')) { - $conf->dol_hide_leftmenu = 1; -} -if (GETPOST('dol_optimize_smallscreen')) { - $conf->dol_optimize_smallscreen = 1; -} -if (GETPOST('dol_no_mouse_hover')) { - $conf->dol_no_mouse_hover = 1; -} -if (GETPOST('dol_use_jmobile')) { - $conf->dol_use_jmobile = 1; -} +header("Content-type: text/html; charset=".$conf->file->character_set_client); + +if (GETPOST('dol_hide_topmenu')) $conf->dol_hide_topmenu = 1; +if (GETPOST('dol_hide_leftmenu')) $conf->dol_hide_leftmenu = 1; +if (GETPOST('dol_optimize_smallscreen')) $conf->dol_optimize_smallscreen = 1; +if (GETPOST('dol_no_mouse_hover')) $conf->dol_no_mouse_hover = 1; +if (GETPOST('dol_use_jmobile')) $conf->dol_use_jmobile = 1; @@ -57,3 +39 @@ -if (!empty($conf->dol_use_jmobile)) { - $conf->use_javascript_ajax = 1; -} +if (!empty($conf->dol_use_jmobile)) $conf->use_javascript_ajax = 1; @@ -67,12 +47 @@ -// Javascript code on logon page only to detect user tz, dst_observed, dst_first, dst_second -$arrayofjs = array(); - -$disablenofollow = 1; -if (!preg_match('/'.constant('DOL_APPLICATION_TITLE').'/', $title)) { - $disablenofollow = 0; -} -if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { - $disablenofollow = 0; -} - -top_htmlhead('', $titleofpage, 0, 0, $arrayofjs, array(), 1, $disablenofollow); +print top_htmlhead('', $titleofpage); @@ -82,4 +51,2 @@ -if (!isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) { - $conf->global->THEME_ELDY_TOPMENU_BACK1 = $colorbackhmenu1; -} -$colorbackhmenu1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (!getDolGlobalString('THEME_ELDY_TOPMENU_BACK1') ? $colorbackhmenu1 : $conf->global->THEME_ELDY_TOPMENU_BACK1) : (empty($user->conf->THEME_ELDY_TOPMENU_BACK1) ? $colorbackhmenu1 : $user->conf->THEME_ELDY_TOPMENU_BACK1); +if (!isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) $conf->global->THEME_ELDY_TOPMENU_BACK1 = $colorbackhmenu1; +$colorbackhmenu1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TOPMENU_BACK1) ? $colorbackhmenu1 : $conf->global->THEME_ELDY_TOPMENU_BACK1) : (empty($user->conf->THEME_ELDY_TOPMENU_BACK1) ? $colorbackhmenu1 : $user->conf->THEME_ELDY_TOPMENU_BACK1); @@ -91 +58 @@ -> +global->MAIN_LOGIN_BACKGROUND) ? '' : ' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; background-image: url(\''.DOL_URL_ROOT.'/viewimage.php?cache=1&noalt=1&modulepart=mycompany&file='.urlencode('logos/'.$conf->global->MAIN_LOGIN_BACKGROUND).'\')"'; ?>> @@ -94 +61 @@ -
'; - print ''.$langs->trans("ECMSections").''; + print ''; + print ' '.$langs->trans("ECMSections"); @@ -283 +156 @@ - $showonrightsize = ''; + $showonrightsize = ''; @@ -286,48 +159,43 @@ - $htmltooltip = $langs->trans("ECMAreaDesc2a"); - $htmltooltip .= '
'.$langs->trans("ECMAreaDesc2b"); - - if (!empty($conf->use_javascript_ajax) && !getDolGlobalString('MAIN_ECM_DISABLE_JS')) { - // Show the link to "Root" - if ($showroot) { - print '
'; - if ($module == 'medias') { - print $langs->trans("RootOfMedias"); - } else { - print $langs->trans("Root"); - } - print '
'; - - // Show filemanager tree (will be filled by a call of ajax /ecm/tpl/enablefiletreeajax.tpl.php, later, that executes ajaxdirtree.php) - print '
'; - - if ($action == 'deletefile') { - print $form->formconfirm('eeeee', $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', '', 'deletefile'); - } - - print '
'; - - $_POST['modulepart'] = $module; - $_POST['openeddir'] = GETPOST('openeddir'); - $_POST['dir'] = empty($_POST['dir']) ? '/' : $_POST['dir']; - - // Show filemanager tree (will be filled by direct include of ajaxdirtree.php in mode noajax, this will return all dir - all levels - to show) - print '
'; - - // Variables that may be defined: - // $_GET['modulepart'], $_GET['openeddir'], $_GET['sortfield'], $_GET['sortorder'] - // $_POST['dir'] - $mode = 'noajax'; - if (empty($url)) { - $url = DOL_URL_ROOT.'/ecm/index.php'; - } - include DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirtree.php'; - - print '
'; - print '
'; + if ($module == 'medias') print $langs->trans("RootOfMedias"); + else print $langs->trans("Root"); + print '
'; + + // Show filemanager tree (will be filled by a call of ajax /ecm/tpl/enablefiletreeajax.tpl.php, later, that executes ajaxdirtree.php) + print '
'; + + if ($action == 'deletefile') print $form->formconfirm('eeeee', $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', '', 'deletefile'); + + print '
'; + + $_POST['modulepart'] = $module; + $_POST['openeddir'] = GETPOST('openeddir'); + $_POST['dir'] = empty($_POST['dir']) ? '/' : $_POST['dir']; + + // Show filemanager tree (will be filled by direct include of ajaxdirtree.php in mode noajax, this will return all dir - all levels - to show) + print '
'; + + // Variables that may be defined: + // $_GET['modulepart'], $_GET['openeddir'], $_GET['sortfield'], $_GET['sortorder'] + // $_POST['dir'] + $mode = 'noajax'; + if (empty($url)) $url = DOL_URL_ROOT.'/ecm/index.php'; + include DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirtree.php'; + + print '
'; + print '
'.price($totalarray['val'][$totalarray['pos'][$i]]).''.$langs->trans("Total").''.$langs->trans("Totalforthispage").''; - print (!empty($totalarray['val'][$totalarray['pos'][$i]]) ? convertSecondToTime($totalarray['val'][$totalarray['pos'][$i]], 'allhourmin') : 0); - print ''; - print (!empty($totalarray['val'][$totalarray['pos'][$i]]) ? $totalarray['val'][$totalarray['pos'][$i]] : ''); - print ''; - print price2num(!empty($totalarray['val'][$totalarray['pos'][$i]]) ? $totalarray['val'][$totalarray['pos'][$i]] : 0, 'MS'); - print ''; - print price(!empty($totalarray['val'][$totalarray['pos'][$i]]) ? $totalarray['val'][$totalarray['pos'][$i]] : 0); - print ''.$langs->trans("Total").''; - if (is_object($form)) { - print $form->textwithpicto($langs->trans("Total"), $langs->transnoentitiesnoconv("Totalforthispage")); - } else { - print $langs->trans("Totalforthispage"); - } - print '">"> - - "> + "> @@ -479 +381 @@ - if (getDolGlobalInt('PRODUCT_USE_UNITS')) { + if (!empty($conf->global->PRODUCT_USE_UNITS)) { @@ -482 +384 @@ - print $form->selectUnits(empty($line->fk_unit) ? $conf->global->PRODUCT_USE_UNITS : $line->fk_unit, "units"); + print $form->selectUnits($line->fk_unit, "units"); @@ -491,2 +393 @@ - - ">%">%%%%%%%
'; - $date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear')); - $date_end = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear')); - - $prefillDates = false; - - if (getDolGlobalString('MAIN_FILL_SERVICE_DATES_FROM_LAST_SERVICE_LINE') && !empty($object->lines)) { - for ($i = count($object->lines) - 1; $i >= 0; $i--) { - $lastline = $object->lines[$i]; - - if ($lastline->product_type == Product::TYPE_SERVICE && (!empty($lastline->date_start) || !empty($lastline->date_end))) { - $date_start_prefill = $lastline->date_start; - $date_end_prefill = $lastline->date_end; - - $prefillDates = true; - break; - } - } - } - - if (!empty($object->element) && $object->element == 'contrat') { +if (is_object($objectline)) { + print $objectline->showOptionals($extrafields, 'edit', array('colspan'=>$coldisplay), '', '', 1); +} + +if ((!empty($conf->service->enabled) || ($object->element == 'contrat')) && $dateSelector && GETPOST('type') != '0') // We show date field if required +{ + print '
'; + $date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear')); + $date_end = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear')); + if (!empty($object->element) && $object->element == 'contrat') + { @@ -560 +451,3 @@ - } else { + } + else + { @@ -562 +455 @@ - print $form->selectDate($date_start, 'date_start', !getDolGlobalString('MAIN_USE_HOURMIN_IN_DATE_RANGE') ? 0 : 1, !getDolGlobalString('MAIN_USE_HOURMIN_IN_DATE_RANGE') ? 0 : 1, 1, "addproduct", 1, 0); + print $form->selectDate($date_start, 'date_start', empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 0 : 1, empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 0 : 1, 1, "addproduct", 1, 0); @@ -564,27 +457,3 @@ - print $form->selectDate($date_end, 'date_end', !getDolGlobalString('MAIN_USE_HOURMIN_IN_DATE_RANGE') ? 0 : 1, !getDolGlobalString('MAIN_USE_HOURMIN_IN_DATE_RANGE') ? 0 : 1, 1, "addproduct", 1, 0); - } - - if ($prefillDates) { - echo ' '.$langs->trans('FillWithLastServiceDates').''; - } - - print ''; - print '
+ @@ -97,0 +74 @@ + @@ -103,23 +80 @@ - if (empty($canchangeproduct)) { - if ($line->fk_parent_line > 0) { - echo img_picto('', 'rightarrow'); - } ?> - - product_type == 1) { - echo img_object($langs->trans('ShowService'), 'service'); - } else { - print img_object($langs->trans('ShowProduct'), 'product'); - } - echo ' '.$line->ref; ?> - - product_label); - print ''; - } else { - if ($senderissupplier) { - $form->select_produits_fournisseurs(!empty($line->fk_product) ? $line->fk_product : 0, 'productid'); - } else { - print $form->select_produits(!empty($line->fk_product) ? $line->fk_product : 0, 'productid'); - } - } + if ($line->fk_parent_line > 0) echo img_picto('', 'rightarrow'); @@ -126,0 +82,11 @@ + + product_type == 1) echo img_object($langs->trans('ShowService'), 'service'); + else print img_object($langs->trans('ShowProduct'), 'product'); + echo ' '.$line->ref; + ?> + + product_label); + ?> + @@ -127,0 +94 @@ + @@ -131,12 +98,5 @@ - if (is_object($hookmanager)) { - $fk_parent_line = (GETPOST('fk_parent_line') ? GETPOST('fk_parent_line', 'int') : $line->fk_parent_line); - $parameters = array('line'=>$line, 'fk_parent_line'=>$fk_parent_line, 'var'=>$var, 'dateSelector'=>$dateSelector, 'seller'=>$seller, 'buyer'=>$buyer); - $reshook = $hookmanager->executeHooks('formEditProductOptions', $parameters, $this, $action); - } - - $situationinvoicelinewithparent = 0; - if ($line->fk_prev_id != null && in_array($object->element, array('facture', 'facturedet'))) { - if ($object->type == $object::TYPE_SITUATION) { // The constant TYPE_SITUATION exists only for object invoice - // Set constant to disallow editing during a situation cycle - $situationinvoicelinewithparent = 1; - } + if (is_object($hookmanager)) + { + $fk_parent_line = (GETPOST('fk_parent_line') ? GETPOST('fk_parent_line') : $line->fk_parent_line); + $parameters = array('line'=>$line, 'fk_parent_line'=>$fk_parent_line, 'var'=>$var, 'dateSelector'=>$dateSelector, 'seller'=>$seller, 'buyer'=>$buyer); + $reshook = $hookmanager->executeHooks('formEditProductOptions', $parameters, $this, $action); @@ -146,6 +106,2 @@ - // but in some situations that is required (update legal informations for example) - if (getDolGlobalString('INVOICE_SITUATION_CAN_FORCE_UPDATE_DESCRIPTION')) { - $situationinvoicelinewithparent = 0; - } - - if (!$situationinvoicelinewithparent) { + if ($line->fk_prev_id == null) + { @@ -155,3 +111 @@ - if (getDolGlobalString('MAIN_INPUT_DESC_HEIGHT')) { - $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT; - } + if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT; @@ -160,4 +114,2 @@ - if (getDolGlobalString('FCKEDITOR_ENABLE_DETAILS_FULL')) { - $toolbarname = 'dolibarr_notes'; - } - $doleditor = new DolEditor('product_desc', GETPOSTISSET('product_desc') ? GETPOST('product_desc', 'restricthtml') : $line->description, '', (!getDolGlobalString('MAIN_DOLEDITOR_HEIGHT') ? 164 : $conf->global->MAIN_DOLEDITOR_HEIGHT), $toolbarname, '', false, true, $enable, $nbrows, '98%'); + if (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname = 'dolibarr_notes'; + $doleditor = new DolEditor('product_desc', $line->description, '', (empty($conf->global->MAIN_DOLEDITOR_HEIGHT) ? 164 : $conf->global->MAIN_DOLEDITOR_HEIGHT), $toolbarname, '', false, true, $enable, $nbrows, '98%'); @@ -166,13 +118 @@ - print ''; - } - - //Line extrafield - if (!empty($extrafields)) { - $temps = $line->showOptionals($extrafields, 'edit', array('class'=>'tredited'), '', '', 1, 'line'); - if (!empty($temps)) { - print '
'; - print $temps; - print '
'; - } + print ''; @@ -182,5 +122,2 @@ - if (isModEnabled("service") && $line->product_type == 1 && ($line->element == 'facturedetrec' || $line->element == 'invoice_supplier_det_rec')) { - if ($line->element == 'invoice_supplier_det_rec') { - $line->date_start_fill = $line->date_start; - $line->date_end_fill = $line->date_end; - } + if (!empty($conf->service->enabled) && $line->product_type == 1 && $line->element == 'facturedetrec') + { @@ -189 +126 @@ - echo $form->selectyesno('date_start_fill', GETPOSTISSET('date_start_fill') ? GETPOST('date_start_fill', 'int') : $line->date_start_fill, 1); + echo $form->selectyesno('date_start_fill', $line->date_start_fill, 1); @@ -192 +129 @@ - echo $form->selectyesno('date_end_fill', GETPOSTISSET('date_end_fill') ? GETPOST('date_end_fill', 'int') : $line->date_end_fill, 1); + echo $form->selectyesno('date_end_fill', $line->date_end_fill, 1); @@ -199,3 +136,5 @@ - if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier' || $object->element == 'invoice_supplier_rec') { // We must have same test in printObjectLines - $coldisplay++; ?> -
'; - print $form->load_tva('tva_tx', GETPOSTISSET('tva_tx') ? GETPOST('tva_tx', 'alpha') : ($line->tva_tx.($line->vat_src_code ? (' ('.$line->vat_src_code.')') : '')), $seller, $buyer, 0, $line->info_bits, $line->product_type, false, 1); - print ''.$form->load_tva('tva_tx', $line->tva_tx.($line->vat_src_code ? (' ('.$line->vat_src_code.')') : ''), $seller, $buyer, 0, $line->info_bits, $line->product_type, false, 1).'fk_prev_id != null) print ' readonly'; @@ -223 +156,7 @@ - if (isModEnabled("multicurrency") && $object->multicurrency_code != $conf->currency) { + if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { + $coldisplay++; + print 'fk_prev_id != null) print ' readonly'; @@ -244 +172 @@ - // I comment warning of stock because it shows the info even when it should not. + // I comment this because it shows info even when not required @@ -248,4 +176,2 @@ - print 'fk_prev_id != null) print ' readonly'; @@ -259,13 +185,3 @@ - if (getDolGlobalString('PRODUCT_USE_UNITS')) { - $unit_type = false; - // limit unit select to unit type - if (!empty($line->fk_unit) && !getDolGlobalString('MAIN_EDIT_LINE_ALLOW_ALL_UNIT_TYPE')) { - include_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php'; - $cUnit = new CUnits($line->db); - if ($cUnit->fetch($line->fk_unit) > 0) { - if (!empty($cUnit->unit_type)) { - $unit_type = $cUnit->unit_type; - } - } - } - $coldisplay++; + if ($conf->global->PRODUCT_USE_UNITS) + { + $coldisplay++; @@ -273 +189 @@ - print $form->selectUnits(GETPOSTISSET('units') ? GETPOST('units') : $line->fk_unit, "units", 0, $unit_type); + print $form->selectUnits($line->fk_unit, "units"); @@ -278,4 +194,2 @@ - - + remise_percent ? $line->remise_percent : '')).'"'; - if ($situationinvoicelinewithparent) { - print ' readonly'; - } - print '>%'; + print 'fk_prev_id != null) print ' readonly'; + print '>%'; @@ -292 +203,0 @@ - @@ -294,2 +205 @@ - // Progession for situation invoices - if ($object->situation_cycle_ref) { + if ($this->situation_cycle_ref) { @@ -297 +207 @@ - print '%% + if (!empty($usemargins)) + { + if (!empty($user->rights->margins->creer)) + { + $coldisplay++; + ?> + @@ -307 +219 @@ - + product->enabled) || !empty($conf->service->enabled)) { ?> @@ -311 +223 @@ - + @@ -313,6 +225,6 @@ - hasRight('margins', 'creer')) { - if (getDolGlobalString('DISPLAY_MARGIN_RATES')) { - $margin_rate = (GETPOSTISSET("np_marginRate") ? GETPOST("np_marginRate", "alpha", 2) : (($line->pa_ht == 0) ? '' : price($line->marge_tx))); + rights->margins->creer) { + if (!empty($conf->global->DISPLAY_MARGIN_RATES)) + { + $margin_rate = (isset($_POST["np_marginRate"]) ?GETPOST("np_marginRate", "alpha", 2) : (($line->pa_ht == 0) ? '' : price($line->marge_tx))); @@ -320,5 +232,4 @@ - if ($line->subprice < 0) { - echo ''.$margin_rate.'%%'.$margin_rate.'%%'.$mark_rate.'%%'.$mark_rate.'%%trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; ?> + trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; ?> @@ -359 +278 @@ - print ''; - if (GETPOST('mode', 'aZ09') == 'vatforalllines') { - print '
'; - print $form->load_tva('vatforalllines', '', $mysoc, $object->thirdparty, 0, 0, '', false, 1); - print ''; - print '
'; - } -} -print ''; +print '
'.$langs->trans('VAT').''.$langs->trans('PriceUHT').''.$langs->trans('PriceUHT').''.$langs->trans('PriceUHTCurrency', $this->multicurrency_code).''.$langs->trans('PriceUHTCurrency', $this->multicurrency_code).''.$langs->trans('PriceUTTC').''.$langs->trans('PriceUTTC').''.$langs->trans('Qty').''.$langs->trans('Qty').''.$langs->trans('Unit').''.$langs->trans('Unit').''; -print $langs->trans('ReductionShort'); - -if (in_array($object->element, array('propal', 'commande', 'facture')) && $object->status == $object::STATUS_DRAFT) { - global $mysoc; - - if (empty($disableedit) && GETPOST('mode', 'aZ09') != 'remiseforalllines') { - print 'id.'">'.img_edit($langs->trans("UpdateForAllLines"), 0, 'class="clickvatforalllines opacitymedium paddingleft cursorpointer"').''; - } - //print ''; - if (GETPOST('mode', 'aZ09') == 'remiseforalllines') { - print '
'; - print ''; - print ''; - print '
'; - } -} -print '
'.$langs->trans('ReductionShort').''.$langs->trans('Progress').''.$form->textwithpicto($langs->trans('TotalHT100Short'), $langs->trans('UnitPriceXQtyLessDiscount')).''.$langs->trans('Progress').''.$form->textwithpicto($langs->trans('TotalHT100Short'), $langs->trans('UnitPriceXQtyLessDiscount')).''.$langs->trans('BuyingPrice').''.$langs->trans('BuyingPrice').''.$langs->trans('CostPrice').''.$langs->trans('CostPrice').''.$langs->trans('MarginRate'); - if ($user->hasRight("propal", "creer")) { - print 'id.'">'.img_edit($langs->trans("UpdateForAllLines"), 0, 'class="clickmarginforalllines opacitymedium paddingleft cursorpointer"').''; - if (GETPOST('mode', 'aZ09') == 'marginforalllines') { - print '
'; - print ''; - print ''; - print '
'; - } - } - print '
'.$langs->trans('MarginRate').''.$langs->trans('MarkRate').''.$langs->trans('MarkRate').''.$langs->trans('TotalHTShort').''.$langs->trans('TotalHTShort').''.$langs->trans('TotalHTShortCurrency', $this->multicurrency_code).''.$langs->trans('TotalHTShortCurrency', $this->multicurrency_code).''.$langs->trans('TotalTTCShort').''.$langs->trans('TotalTTCShort').''; +if ($action == 'selectlines') +{ + print ''; @@ -187 +127 @@ - print ''; + print 'subprice); ?>multicurrency_subprice); ?>subprice); ?>multicurrency_subprice); ?>pu_ttc) ? $line->pu_ttc : null; - if (getDolGlobalInt('MAIN_UNIT_PRICE_WITH_TAX_IS_FOR_ALL_TAXES')) { - $upinctax = price2num($line->total_ttc / $line->qty, 'MU'); - } - print(isset($upinctax) ? price($sign * $upinctax) : price($sign * $line->subprice)); - ?>pu_ttc) ?price($line->pu_ttc) : price($line->subprice)); ?> + @@ -348 +226 @@ - // I comment this because it shows info even when not required + // I comment this because it shows info even when not required @@ -353,3 +231 @@ -} else { - print ' '; -} +} else print ' '; @@ -358 +234,2 @@ -if (getDolGlobalString('PRODUCT_USE_UNITS')) { +if ($conf->global->PRODUCT_USE_UNITS) +{ @@ -378,2 +255,3 @@ -if (isset($this->situation_cycle_ref) && $this->situation_cycle_ref) { - include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; +if ($this->situation_cycle_ref) +{ + include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; @@ -385,5 +263,6 @@ - print ''.price($sign * $tmp[0]).''.price($tmp[0]).'pa_ht == 0) ? 'n/a' : price(price2num($line->marge_tx, 'MT')).'%'); ?>pa_ht == 0) ? 'n/a' : price(price2num($line->marge_tx, 'MT')).'%'); ?>marque_tx, 'MT')).'%'; ?>marque_tx, 'MT')).'%'; ?>'.price($sign * $line->multicurrency_total_ht).''.price($sign * $line->total_ttc).''; - $coldisplay++; - if (!empty($product_static->accountancy_code_buy) || - !empty($product_static->accountancy_code_buy_intra) || - !empty($product_static->accountancy_code_buy_export) - ) { - $accountancy_category_asset = $conf->global->ASSET_ACCOUNTANCY_CATEGORY; - $filters = array(); - if (!empty($product_static->accountancy_code_buy)) { - $filters[] = "account_number = '" . $this->db->escape($product_static->accountancy_code_buy) . "'"; - } - if (!empty($product_static->accountancy_code_buy_intra)) { - $filters[] = "account_number = '" . $this->db->escape($product_static->accountancy_code_buy_intra) . "'"; - } - if (!empty($product_static->accountancy_code_buy_export)) { - $filters[] = "account_number = '" . $this->db->escape($product_static->accountancy_code_buy_export) . "'"; - } - $sql = "SELECT COUNT(*) AS found"; - $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account"; - $sql .= " WHERE pcg_type = '" . $this->db->escape($conf->global->ASSET_ACCOUNTANCY_CATEGORY) . "'"; - $sql .= " AND (" . implode(' OR ', $filters). ")"; - $resql_asset = $this->db->query($sql); - if (!$resql_asset) { - print 'Error SQL: ' . $this->db->lasterror(); - } elseif ($obj = $this->db->fetch_object($resql_asset)) { - if (!empty($obj->found)) { - print ''; - print img_edit_add() . ''; + if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $tooltiponprice = $langs->transcountry("TotalHT", $mysoc->country_code).'='.price($line->total_ht); + $tooltiponprice .= '
'.$langs->transcountry("TotalVAT", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'='.price($line->total_tva); + if (!$senderissupplier && is_object($object->thirdparty)) { + if ($mysoc->useLocalTax(1)) { + if (($mysoc->country_code == $object->thirdparty->country_code) || $object->thirdparty->useLocalTax(1)) { + $tooltiponprice .= '
'.$langs->transcountry("TotalLT1", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'='.price($line->total_localtax1); + } else { + $tooltiponprice .= '
'.$langs->transcountry("TotalLT1", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'='.$langs->trans("NotUsedForThisCustomer").''; @@ -463,5 +295,29 @@ - } - print '
'.price($line->multicurrency_total_ht).''.price($line->total_ttc).'
'.$this->tpl['label'].''.$this->tpl['description'].''.$this->tpl['vat_rate'].''.$this->tpl['price'].''.$this->tpl['multicurrency_price'].'
'.$this->tpl['label'].''.$this->tpl['description'].''.$this->tpl['vat_rate'].''.$this->tpl['price'].''.$this->tpl['multicurrency_price'].''.$this->tpl['qty'].''.$langs->trans($this->tpl['unit']).''.$this->tpl['qty'].''.$langs->trans($this->tpl['unit']).''.$this->tpl['remise_percent'].''.$this->tpl['total_ht'].''.$this->tpl['remise_percent'].'