diff --git a/build/docker/Dockerfile b/build/docker/Dockerfile index 4b1df7e0876..9264eed5ef2 100644 --- a/build/docker/Dockerfile +++ b/build/docker/Dockerfile @@ -3,7 +3,7 @@ FROM php:7.2-apache ENV HOST_USER_ID 33 ENV PHP_INI_DATE_TIMEZONE 'UTC' -RUN apt-get update && apt-get install -y libpng-dev libjpeg-dev libldap2-dev libzip-dev zlib1g-dev libicu-dev g++\ +RUN apt-get update && apt-get install -y libpng16-16 libpng-dev libjpeg62-turbo libjpeg62-turbo-dev libldap2-dev zlib1g-dev libicu-dev g++\ && rm -rf /var/lib/apt/lists/* \ && docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \ && docker-php-ext-install gd \ @@ -14,7 +14,7 @@ RUN apt-get update && apt-get install -y libpng-dev libjpeg-dev libldap2-dev lib && docker-php-ext-install calendar \ && docker-php-ext-configure intl \ && docker-php-ext-install intl \ - && apt-get autoremove --purge -y libjpeg-dev libldap2-dev zlib1g-dev libicu-dev g++ + && apt-get autoremove --purge -y libpng-dev libjpeg62-turbo-dev libldap2-dev zlib1g-dev libicu-dev g++ RUN mkdir /var/documents RUN chown www-data /var/documents diff --git a/build/docker/docker-compose.yml b/build/docker/docker-compose.yml index 3fe6125a874..cc839810e7f 100644 --- a/build/docker/docker-compose.yml +++ b/build/docker/docker-compose.yml @@ -21,5 +21,12 @@ web: - ../../htdocs:/var/www/html links: - mariadb + - mail ports: - "80:80" + +mail: + image: maildev/maildev + ports: + - "8081:80" + - "25:25" \ No newline at end of file diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index cf00519e9d7..2ac97ee38ac 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -267,7 +267,7 @@ if ($resql) { $num = $db->num_rows($resql); - $param = ''; + $param = ''; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit; if ($search_account) $param .= '&search_account='.urlencode($search_account); diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 45b0c909016..af98dc14653 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; @@ -342,37 +343,41 @@ if ($result) { print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("AccountAccounting", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder); $clickpicto = $form->showCheckAddButtons(); print_liste_field_titre($clickpicto, '', '', '', '', '', '', '', 'center '); print "\n"; - $thirdpartystatic=new Societe($db); - $facture_static = new Facture($db); - $product_static = new Product($db); + $thirdpartystatic=new Societe($db); + $facturestatic = new Facture($db); + $productstatic = new Product($db); + $accountingaccountstatic = new AccountingAccount($db); - while ($objp = $db->fetch_object($result)) { - $codecompta = length_accountg($objp->account_number).' - '.$objp->label_compte.''; + while ($objp = $db->fetch_object($result)) + { + $accountingaccountstatic->account_number = $objp->account_number; + $accountingaccountstatic->label = $objp->label_account; + $accountingaccountstatic->labelshort = $objp->labelshort_account; - $facture_static->ref = $objp->ref; - $facture_static->id = $objp->facid; - $facture_static->type = $objp->ftype; + $facturestatic->ref = $objp->ref; + $facturestatic->id = $objp->facid; + $facturestatic->type = $objp->ftype; - $thirdpartystatic->id = $objp->socid; - $thirdpartystatic->name = $objp->name; - $thirdpartystatic->client = $objp->client; - $thirdpartystatic->fournisseur = $objp->fournisseur; - $thirdpartystatic->code_client = $objp->code_client; - $thirdpartystatic->code_compta_client = $objp->code_compta_client; - $thirdpartystatic->code_fournisseur = $objp->code_fournisseur; - $thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur; - $thirdpartystatic->email = $objp->email; - $thirdpartystatic->country_code = $objp->country_code; + $thirdpartystatic->id = $objp->socid; + $thirdpartystatic->name = $objp->name; + $thirdpartystatic->client = $objp->client; + $thirdpartystatic->fournisseur = $objp->fournisseur; + $thirdpartystatic->code_client = $objp->code_client; + $thirdpartystatic->code_compta_client = $objp->code_compta_client; + $thirdpartystatic->code_fournisseur = $objp->code_fournisseur; + $thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur; + $thirdpartystatic->email = $objp->email; + $thirdpartystatic->country_code = $objp->country_code; - $product_static->ref = $objp->product_ref; - $product_static->id = $objp->product_id; - $product_static->label = $objp->product_label; - $product_static->type = $objp->line_type; + $productstatic->ref = $objp->product_ref; + $productstatic->id = $objp->product_id; + $productstatic->label = $objp->product_label; + $productstatic->type = $objp->line_type; print ''; @@ -380,15 +385,15 @@ if ($result) { print ''.$objp->rowid.''; // Ref Invoice - print ''.$facture_static->getNomUrl(1).''; + print ''.$facturestatic->getNomUrl(1).''; // Date invoice print ''.dol_print_date($db->jdate($objp->datef), 'day').''; // Ref Product print ''; - if ($product_static->id > 0) print $product_static->getNomUrl(1); - if ($product_static->id > 0 && $objp->product_label) print '
'; + if ($productstatic->id > 0) print $productstatic->getNomUrl(1); + if ($productstatic->id > 0 && $objp->product_label) print '
'; if ($objp->product_label) print ''.$objp->product_label.''; print ''; @@ -415,8 +420,9 @@ if ($result) { print ''.$objp->tva_intra.''; - print ''; - print $codecompta.' '; + print ''; + print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1); + print ' '; print img_edit(); print ''; print ''; diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index 4cd51fb3a63..7ffbb9518f8 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -28,19 +28,22 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; +require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; +require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; // Load translation files required by the page -$langs->loadLangs(array("compta", "bills", "other", "accountancy", "trips", "productbatch")); +$langs->loadLangs(array("compta", "bills", "other", "accountancy", "trips", "productbatch", "hrm")); $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $account_parent = GETPOST('account_parent', 'int'); $changeaccount = GETPOST('changeaccount'); // Search Getpost +$search_login = GETPOST('search_login', 'alpha'); $search_expensereport = GETPOST('search_expensereport', 'alpha'); $search_label = GETPOST('search_label', 'alpha'); $search_desc = GETPOST('search_desc', 'alpha'); @@ -84,7 +87,8 @@ $formaccounting = new FormAccounting($db); // Purge search criteria if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test are required to be compatible with all browsers { - $search_expensereport = ''; + $search_login = ''; + $search_expensereport = ''; $search_label = ''; $search_desc = ''; $search_amount = ''; @@ -162,14 +166,21 @@ print ''; - } - } - } - - return $out; - } - - /** - * Fill array_options property of object by extrafields value (using for data sent by forms) - * - * @param array $extralabels Deprecated (old $array of extrafields, now set this to null) - * @param object $object Object - * @param string $onlykey Only the following key is filled. When we make update of only one extrafield ($action = 'update_extras'), calling page must set this to avoid to have other extrafields being reset. - * @return int 1 if array_options set, 0 if no value, -1 if error (field required missing for example) - */ - public function setOptionalsFromPost($extralabels, &$object, $onlykey = '') - { - global $_POST, $langs; - - $nofillrequired = 0; // For error when required field left blank - $error_field_required = array(); - - if (is_array($this->attributes[$object->table_element]['label'])) $extralabels = $this->attributes[$object->table_element]['label']; - - if (is_array($extralabels)) - { - // Get extra fields - foreach ($extralabels as $key => $value) - { - if (!empty($onlykey) && $key != $onlykey) continue; - - $key_type = $this->attributes[$object->table_element]['type'][$key]; - if ($key_type == 'separate') continue; - - $enabled = 1; - if (isset($this->attributes[$object->table_element]['list'][$key])) - { - $enabled = dol_eval($this->attributes[$object->table_element]['list'][$key], 1); - } - $perms = 1; - if (isset($this->attributes[$object->table_element]['perms'][$key])) - { - $perms = dol_eval($this->attributes[$object->table_element]['perms'][$key], 1); - } - if (empty($enabled)) continue; - if (empty($perms)) continue; - - if ($this->attributes[$object->table_element]['required'][$key]) // Value is required - { - // Check if empty without using GETPOST, value can be alpha, int, array, etc... - if ((!is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] != 'select' && $_POST["options_".$key] != '0') - || (!is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] == 'select') - || (is_array($_POST["options_".$key]) && empty($_POST["options_".$key]))) - { - //print 'ccc'.$value.'-'.$this->attributes[$object->table_element]['required'][$key]; - $nofillrequired++; - $error_field_required[] = $langs->transnoentitiesnoconv($value); - } - } - - if (in_array($key_type, array('date'))) - { - // Clean parameters - // TODO GMT date in memory must be GMT so we should add gm=true in parameters - $value_key = dol_mktime(0, 0, 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]); - } - elseif (in_array($key_type, array('datetime'))) - { - // Clean parameters - // TODO GMT date in memory must be GMT so we should add gm=true in parameters - $value_key = dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]); - } - elseif (in_array($key_type, array('checkbox', 'chkbxlst'))) - { - $value_arr = GETPOST("options_".$key, 'array'); // check if an array - if (!empty($value_arr)) { - $value_key = implode($value_arr, ','); - } else { - $value_key = ''; - } - } - elseif (in_array($key_type, array('price', 'double'))) - { - $value_arr = GETPOST("options_".$key, 'alpha'); - $value_key = price2num($value_arr); - } - else - { - $value_key = GETPOST("options_".$key); - if (in_array($key_type, array('link')) && $value_key == '-1') $value_key = ''; - } - - $object->array_options["options_".$key] = $value_key; - } - - if ($nofillrequired) { - $langs->load('errors'); - setEventMessages($langs->trans('ErrorFieldsRequired').' : '.implode(', ', $error_field_required), null, 'errors'); - return -1; - } - else { - return 1; - } - } - else { - return 0; - } - } - - /** - * return array_options array of data of extrafields value of object sent by a search form - * - * @param array|string $extrafieldsobjectkey array of extrafields (old usage) or value of object->table_element (new usage) - * @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names) - * @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names) - * @return array|int array_options set or 0 if no value - */ - public function getOptionalsFromPost($extrafieldsobjectkey, $keyprefix = '', $keysuffix = '') - { - global $_POST; - - if (is_string($extrafieldsobjectkey) && is_array($this->attributes[$extrafieldsobjectkey]['label'])) - { - $extralabels = $this->attributes[$extrafieldsobjectkey]['label']; - } - else - { - $extralabels = $extrafieldsobjectkey; - } - - if (is_array($extralabels)) - { - $array_options = array(); - - // Get extra fields - foreach ($extralabels as $key => $value) - { - $key_type = ''; - if (is_string($extrafieldsobjectkey)) - { - $key_type = $this->attributes[$extrafieldsobjectkey]['type'][$key]; - } - - if (in_array($key_type, array('date', 'datetime'))) - { - if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix."year")) continue; // Value was not provided, we should not set it. - // Clean parameters - $value_key = dol_mktime(GETPOST($keysuffix."options_".$key.$keyprefix."hour", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."min", 'int'), 0, GETPOST($keysuffix."options_".$key.$keyprefix."month", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."day", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."year", 'int')); - } - elseif (in_array($key_type, array('checkbox', 'chkbxlst'))) - { - if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) continue; // Value was not provided, we should not set it. - $value_arr = GETPOST($keysuffix."options_".$key.$keyprefix); - // Make sure we get an array even if there's only one checkbox - $value_arr = (array) $value_arr; - $value_key = implode(',', $value_arr); - } - elseif (in_array($key_type, array('price', 'double', 'int'))) - { - if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) continue; // Value was not provided, we should not set it. - $value_arr = GETPOST($keysuffix."options_".$key.$keyprefix); - $value_key = price2num($value_arr); - } - else - { - if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) continue; // Value was not provided, we should not set it. - $value_key = GETPOST($keysuffix."options_".$key.$keyprefix); - } - - $array_options[$keysuffix."options_".$key] = $value_key; // No keyprefix here. keyprefix is used only for read. - } - - return $array_options; - } - - return 0; - } } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 49758d55be7..231c83ac4bd 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -368,6 +368,8 @@ class Form $s = picto_from_langcode($langcode, 'class="pictoforlang paddingright"'); $resultforextrlang .= $s; + + // TODO Use the showInputField() method of ExtraLanguages object if ($typeofdata == 'textarea') { $resultforextrlang .= ' + '; + print '
'; +} +elseif ($action == "publicpayment") { + $langs->loadLangs(array("orders")); + print '

'.$langs->trans('StatusOrderDelivered').'

'; + print ''; + print '
'; +} +elseif ($action == "checkplease") { + print ''; + print ''; + print '
'; } elseif ($action == "editline") { $placeid = GETPOST('placeid', 'int'); @@ -99,13 +107,22 @@ elseif ($action == "editline") { print "
".$prod->description; print "
".price($prod->price_ttc, 1, $langs, 1, -1, -1, $conf->currency).""; print '
'; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; } } } else { + // Title + $title = 'TakePOS - Dolibarr '.DOL_VERSION; + if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $title = 'TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE; + $head = ' + + +'; + $arrayofcss = array('/takepos/css/phone.css'); + top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); ?> - + global->TAKEPOS_NUM_TERMINALS != "1" && $_SESSION["takeposterminal"] == "") print '
'.$langs->trans('TerminalSelect').'
'; ?> @@ -301,18 +327,18 @@ function CheckPlease(){ print ''; } else { - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; } ?> -
-
-
-
+
+
+
+
.dropdown-search, .open>.dropdown-bookmark, .open>.dropdown-menu, .dropdown dd ul.open { +.open>.dropdown-search, .open>.dropdown-bookmark, .open>.dropdown-quickadd, .open>.dropdown-menu, .dropdown dd ul.open { display: block; } @@ -59,6 +59,29 @@ button.dropdown-item.global-search-item { -webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175); box-shadow: 0 6px 12px rgba(0,0,0,.175); } +.dropdown-quickadd { + border-color: #eee; + + position: absolute; + top: 100%; + left: 0; + z-index: 1000; + display: none; + float: left; + min-width: 240px; + margin: 2px 0 0; + font-size: 14px; + text-align: left; + list-style: none; + background-color: #fff; + -webkit-background-clip: padding-box; + background-clip: padding-box; + border: 1px solid #ccc; + border: 1px solid rgba(0,0,0,.15); + border-radius: 4px; + -webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175); + box-shadow: 0 6px 12px rgba(0,0,0,.175); +} .dropdown-menu { border-color: #eee; @@ -163,7 +186,7 @@ button.dropdown-item.global-search-item { max-width: 100%; } -div#topmenu-global-search-dropdown, div#topmenu-bookmark-dropdown { +div#topmenu-global-search-dropdown, div#topmenu-bookmark-dropdown, div#topmenu-quickadd-dropdown { global->THEME_TOPMENU_DISABLE_IMAGE)) { ?> line-height: 46px; @@ -383,6 +406,58 @@ a.top-menu-dropdown-link { display: none !important; } +/* + * QUICK ADD + */ +#topmenu-quickadd-dropdown .dropdown-menu { + width: 300px !important; + color: #444; +} + +.quickadd-header { + color: #444 !important; +} + +div.quickadd { + display: -ms-flexbox; + display: -webkit-flex; + display: flex; + -webkit-flex-direction: row; + -ms-flex-direction: row; + flex-direction: row; + -webkit-flex-wrap: wrap; + -ms-flex-wrap: wrap; + flex-wrap: wrap; + -webkit-justify-content: center; + -ms-flex-pack: center; + justify-content: center; + -webkit-align-content: center; + -ms-flex-line-pack: center; + align-content: center; + -webkit-align-items: flex-start; + -ms-flex-align: start; + align-items: flex-start; +} + +div.quickadd a { + color: #444; +} + +div.quickadd a:hover, div.quickadd a:active { + color: #000000; +} + +div.quickaddblock { + width: 80px; + display: block ruby; +} + +div.quickaddblock:hover, +div.quickaddblock:active, +div.quickaddblock:focus { + background: ; +} + /* smartphone */ @media only screen and (max-width: 767px) { diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index fc365ae5812..16618f2592b 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -665,10 +665,10 @@ body[class*="colorblind-"] .text-success{ color : } -.editfielda span.fa-pencil-alt, .editfielda span.fa-trash, .editfieldlang { +.editfielda span.fa-pencil-alt, .editfielda span.fa-pencil-ruler, .editfielda span.fa-trash, .editfieldlang { color: #ccc !important; } -.editfielda span.fa-pencil-alt:hover, .editfielda span.fa-trash:hover, .editfieldlang:hover { +.editfielda span.fa-pencil-alt:hover, .editfielda span.fa-pencil-ruler:hover, .editfielda span.fa-trash:hover, .editfieldlang:hover { color: var(--colortexttitle) !important; } .fawidth30 { @@ -1339,7 +1339,7 @@ td.showDragHandle { #id-left { padding-top: 20px; padding-bottom: 5px; - global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN)) { ?> + global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN) && ! empty($conf->global->MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN)) { ?> padding-top: 8px; } diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php index 98130f1d03a..2b734f037b3 100644 --- a/htdocs/theme/eldy/info-box.inc.php +++ b/htdocs/theme/eldy/info-box.inc.php @@ -235,7 +235,7 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES .bg-infobox-bank_account{ color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } -.bg-infobox-adherent{ +.bg-infobox-adherent, .bg-infobox-member { color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } .bg-infobox-expensereport{ @@ -273,7 +273,7 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES .fa-dol-bank_account:before { content: "\f19c"; } -.fa-dol-adherent:before { +.fa-dol-member:before { content: "\f0c0"; } .fa-dol-expensereport:before { @@ -314,8 +314,8 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES display: flex; /* or inline-flex */ flex-direction: row; flex-wrap: wrap; - width: 100%; - margin: 0 0 0 -8px; + width: calc(100% + 14px); + margin: 0 -8px 0 -8px; /*justify-content: space-between;*/ } @@ -348,7 +348,8 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES @media only screen and (max-width: 767px) { .box-flex-container { - margin: 0 0 0 0 !important; + margin: 0 0 0 0px !important; + width: 100% !important; } .info-box-module { diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 927d29e1919..30a7c8635ac 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -203,7 +203,7 @@ $disableimages = 0; $maxwidthloginblock = 180; if (!empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) { $disableimages = 1; $maxwidthloginblock = $maxwidthloginblock + 50; $minwidthtmenu = 0; } - +if (!empty($conf->global->MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN)) { $maxwidthloginblock = $maxwidthloginblock + 55; } if (!empty($conf->global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN)) { $maxwidthloginblock = $maxwidthloginblock + 55; } if (!empty($conf->bookmark->enabled)) { $maxwidthloginblock = $maxwidthloginblock + 55; } diff --git a/htdocs/theme/md/info-box.inc.php b/htdocs/theme/md/info-box.inc.php index 2dec0087a1b..f2a2a8b810d 100644 --- a/htdocs/theme/md/info-box.inc.php +++ b/htdocs/theme/md/info-box.inc.php @@ -34,7 +34,7 @@ if (!empty($conf->global->THEME_INFOBOX_COLOR_ON_BACKGROUND)) $prefix = 'backgro .bg-infobox-bank_account{ color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } -.bg-infobox-adherent{ +.bg-infobox-adherent, .bg-infobox-member{ color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } .bg-infobox-expensereport{ @@ -258,7 +258,7 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES .bg-infobox-bank_account i.fa{ color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } -.bg-infobox-adherent i.fa{ +.bg-infobox-adherent i.fa, .bg-infobox-member i.fa{ color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } .bg-infobox-expensereport i.fa{ @@ -296,7 +296,7 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES .fa-dol-bank_account:before { content: "\f19c"; } -.fa-dol-adherent:before { +.fa-dol-member:before { content: "\f0c0"; } .fa-dol-expensereport:before { diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index f19c81960db..b67f56db935 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -71,12 +71,12 @@ class ProductCombination */ public $entity; - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - public function __construct(DoliDB $db) + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct(DoliDB $db) { global $conf; @@ -189,16 +189,16 @@ class ProductCombination */ public function countNbOfCombinationForFkProductParent($fk_product_parent) { - $nb = 0; - $sql = "SELECT count(rowid) as nb FROM ".MAIN_DB_PREFIX."product_attribute_combination WHERE fk_product_parent = ".(int) $fk_product_parent." AND entity IN (".getEntity('product').")"; + $nb = 0; + $sql = "SELECT count(rowid) as nb FROM ".MAIN_DB_PREFIX."product_attribute_combination WHERE fk_product_parent = ".(int) $fk_product_parent." AND entity IN (".getEntity('product').")"; - $resql = $this->db->query($sql); - if ($resql) { - $obj = $this->db->fetch_object($resql); - if ($obj) $nb = $obj->nb; - } + $resql = $this->db->query($sql); + if ($resql) { + $obj = $this->db->fetch_object($resql); + if ($obj) $nb = $obj->nb; + } - return $nb; + return $nb; } /** @@ -326,11 +326,20 @@ class ProductCombination $child = new Product($this->db); $child->fetch($this->fk_product_child); + $child->price_autogen = $parent->price_autogen; - $child->weight = $parent->weight + $this->variation_weight; - $child->weight_units = $parent->weight_units; - $varlabel = $this->getCombinationLabel($this->fk_product_child); - $child->label = $parent->label.$varlabel; + $child->weight = $parent->weight; + if ($this->variation_weight) { // If we must add a delta on weight + $child->weight = ($child->weight ? $child->weight : 0) + $this->variation_weight; + } + $child->weight_units = $parent->weight_units; + + // Don't update the child label if the user has already modified it. + if ($child->label == $parent->label) { + // This will trigger only at variant creation time + $varlabel = $this->getCombinationLabel($this->fk_product_child); + $child->label = $parent->label.$varlabel;; + } if ($child->update($child->id, $user) > 0) { $new_vat = $parent->tva_tx; @@ -527,9 +536,9 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1"; $newproduct->ref = $forced_refvar; } } else { - $forced_refvar = false; - $existingProduct = false; - $newproduct = clone $product; + $forced_refvar = false; + $existingProduct = false; + $newproduct = clone $product; } //Final weight impact @@ -590,11 +599,11 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1"; } if ($forced_refvar === false) { - if (isset($conf->global->PRODUIT_ATTRIBUTES_SEPARATOR)) { + if (isset($conf->global->PRODUIT_ATTRIBUTES_SEPARATOR)) { $newproduct->ref .= $conf->global->PRODUIT_ATTRIBUTES_SEPARATOR.$prodattrval->ref; - } else { + } else { $newproduct->ref .= '_'.$prodattrval->ref; - } + } } //The first one should not contain a linebreak @@ -613,62 +622,62 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1"; // Now create the product //print 'Create prod '.$newproduct->ref.'
'."\n"; if ($existingProduct === false) { - //To avoid wrong information in price history log - $newproduct->price = 0; - $newproduct->price_ttc = 0; - $newproduct->price_min = 0; - $newproduct->price_min_ttc = 0; + //To avoid wrong information in price history log + $newproduct->price = 0; + $newproduct->price_ttc = 0; + $newproduct->price_min = 0; + $newproduct->price_min_ttc = 0; - // A new variant must use a new barcode (not same product) - $newproduct->barcode = -1; - $result = $newproduct->create($user); + // A new variant must use a new barcode (not same product) + $newproduct->barcode = -1; + $result = $newproduct->create($user); - if ($result < 0) - { - //In case the error is not related with an already existing product - if ($newproduct->error != 'ErrorProductAlreadyExists') { - $this->error[] = $newproduct->error; - $this->errors = $newproduct->errors; - $db->rollback(); - return -1; - } + if ($result < 0) + { + //In case the error is not related with an already existing product + if ($newproduct->error != 'ErrorProductAlreadyExists') { + $this->error[] = $newproduct->error; + $this->errors = $newproduct->errors; + $db->rollback(); + return -1; + } - /** - * If there is an existing combination, then we update the prices and weight - * Otherwise, we try adding a random number to the ref - */ + /** + * If there is an existing combination, then we update the prices and weight + * Otherwise, we try adding a random number to the ref + */ - if ($newcomb->fk_product_child) { - $res = $newproduct->fetch($existingCombination->fk_product_child); - } else { - $orig_prod_ref = $newproduct->ref; - $i = 1; + if ($newcomb->fk_product_child) { + $res = $newproduct->fetch($existingCombination->fk_product_child); + } else { + $orig_prod_ref = $newproduct->ref; + $i = 1; - do { - $newproduct->ref = $orig_prod_ref.$i; - $res = $newproduct->create($user); + do { + $newproduct->ref = $orig_prod_ref.$i; + $res = $newproduct->create($user); - if ($newproduct->error != 'ErrorProductAlreadyExists') { - $this->errors[] = $newproduct->error; - break; - } + if ($newproduct->error != 'ErrorProductAlreadyExists') { + $this->errors[] = $newproduct->error; + break; + } - $i++; - } while ($res < 0); - } + $i++; + } while ($res < 0); + } - if ($res < 0) { - $db->rollback(); - return -1; - } - } + if ($res < 0) { + $db->rollback(); + return -1; + } + } } else { - $result = $newproduct->update($newproduct->id, $user); - if ($result < 0) - { - $db->rollback(); - return -1; - } + $result = $newproduct->update($newproduct->id, $user); + if ($result < 0) + { + $db->rollback(); + return -1; + } } $newcomb->fk_product_child = $newproduct->id; @@ -683,14 +692,14 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1"; return $newproduct->id; } - /** - * Copies all product combinations from the origin product to the destination product - * + /** + * Copies all product combinations from the origin product to the destination product + * * @param User $user Object user - * @param int $origProductId Origin product id - * @param Product $destProduct Destination product - * @return int >0 OK <0 KO - */ + * @param int $origProductId Origin product id + * @param Product $destProduct Destination product + * @return int >0 OK <0 KO + */ public function copyAll(User $user, $origProductId, Product $destProduct) { require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination2ValuePair.class.php'; @@ -712,7 +721,7 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1"; $variations[$tmp_pc2v->fk_prod_attr] = $tmp_pc2v->fk_prod_attr_val; } - if ($this->createProductCombination( + if ($this->createProductCombination( $user, $destProduct, $variations, @@ -720,7 +729,7 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1"; $combination->variation_price_percentage, $combination->variation_price, $combination->variation_weight - ) < 0) + ) < 0) { return -1; } diff --git a/htdocs/website/index.php b/htdocs/website/index.php index ba539ccb653..969c56dde8c 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -197,6 +197,7 @@ $fileindex = $pathofwebsite.'/index.php'; $filewrapper = $pathofwebsite.'/wrapper.php'; $filemanifestjson = $pathofwebsite.'/manifest.json.php'; $filereadme = $pathofwebsite.'/README.md'; +$filemaster = $pathofwebsite.'/master.inc.php'; // Define $urlwithroot $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); @@ -1189,8 +1190,6 @@ if ($action == 'updatecss') if (!$error) { // Save master.inc.php file - $filemaster = $pathofwebsite.'/master.inc.php'; - dol_syslog("Save master file ".$filemaster); dol_mkdir($pathofwebsite); @@ -1384,6 +1383,10 @@ if ($action == 'updatecss') } + // Save wrapper.php + $result = dolSaveIndexPage($pathofwebsite, '', '', $filewrapper); + + // Message if no error if (!$error) { @@ -1727,8 +1730,8 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf } else { - $fileindex = $pathofwebsitenew.'/index.php'; $filetpl = $pathofwebsitenew.'/page'.$resultpage->id.'.tpl.php'; + $fileindex = $pathofwebsitenew.'/index.php'; $filewrapper = $pathofwebsitenew.'/wrapper.php'; //var_dump($pathofwebsitenew); @@ -2270,6 +2273,11 @@ if (!GETPOST('hide_websitemenu')) */ print 'ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("ReplaceWebsiteContent")).'">'; + + if (! empty($conf->categorie->enabled)) { + print ''; + } + if (! empty($conf->global->WEBSITE_ADD_REGENERATE_BUTTON)) { print 'ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("RegenerateWebsiteContent")).'">'; } @@ -2977,6 +2985,14 @@ if ($action == 'editcss') print ''; + // RSS + print ''; + $htmlhelp = $langs->trans('RSSFeedDesc'); + print $form->textwithpicto($langs->trans('RSSFeed'), $htmlhelp, 1, 'help', '', 0, 2, ''); + print ''; + print '/wrapper.php?rss=1[&l=XX][&limit=123]'; + print ''; + print ''; dol_fiche_end(); @@ -3629,6 +3645,7 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm' || $massaction = print getTitleFieldOfList("Page", 0, $_SERVER['PHP_SELF'], 'pageurl', '', $param, '', $sortfield, $sortorder, '')."\n"; //print getTitleFieldOfList("Description", 0, $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, '')."\n"; print getTitleFieldOfList("", 0, $_SERVER['PHP_SELF']); + print getTitleFieldOfList("", 0, $_SERVER['PHP_SELF']); print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; print ''; @@ -3651,6 +3668,24 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm' || $massaction = print ''.$answerrecord->description.''; print ''; + // Edit properties + print ''; + $param = '?action=replacesiteconfirm'; + $param .= '&websiteid='.$website->id; + $param .= '&optioncontent='.GETPOST('optioncontent'); + $param .= '&optionmeta='.GETPOST('optionmeta'); + $param .= '&optionsitefiles='.GETPOST('optionsitefiles'); + $param .= '&searchstring='.$searchkey; + $disabled = ''; + $urltoedithtmlsource = $_SERVER["PHP_SELF"].'?action=editmeta&websiteid='.$website->id.'&pageid='.$answerrecord->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].$param); + if (empty($user->rights->website->write)) { + $disabled = ' disabled'; + $urltoedithtmlsource = ''; + } + print ''.img_picto($langs->trans("EditPageMeta"), 'pencil-ruler').''; + print ''; + + // Edit HTML source print ''; $param = '?action=replacesiteconfirm'; $param .= '&websiteid='.$website->id; diff --git a/htdocs/website/samples/wrapper.php b/htdocs/website/samples/wrapper.php index 25483a36f53..abb2bea0179 100644 --- a/htdocs/website/samples/wrapper.php +++ b/htdocs/website/samples/wrapper.php @@ -12,6 +12,8 @@ $hashp = GETPOST('hashp', 'aZ09'); $modulepart = GETPOST('modulepart', 'aZ09'); $entity = GETPOST('entity', 'int') ?GETPOST('entity', 'int') : $conf->entity; $original_file = GETPOST("file", "alpha"); +$l = GETPOST('l', 'aZ09'); +$limit = GETPOST('limit', 'int'); // Parameters for RSS $rss = GETPOST('rss', 'aZ09'); @@ -90,8 +92,8 @@ if ($rss) { $type = ''; $cachedelay = 0; $filename = $original_file; - $filters = array('type_container'=>'blogpost', 'lang'=>'en_US'); $dir_temp = $conf->website->dir_temp; + include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php'; include_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php'; $website = new Website($db); @@ -99,7 +101,10 @@ if ($rss) { $website->fetch('', $websitekey); - $MAXNEWS = 20; + $filters = array('type_container'=>'blogpost'); + if ($l) $filters['lang'] = $l; + + $MAXNEWS = ($limit ? $limit : 20); $arrayofblogs = $websitepage->fetchAll($website->id, 'DESC', 'date_creation', $MAXNEWS, 0, $filters); $eventarray = array(); if (is_array($arrayofblogs)) { @@ -151,7 +156,7 @@ if ($rss) { @chmod($outputfiletmp, octdec($conf->global->MAIN_UMASK)); // Write file - $result = build_rssfile($format, $title, $desc, $eventarray, $outputfiletmp, '', $website->virtualhost.'/wrapper.php?rss=1'); + $result = build_rssfile($format, $title, $desc, $eventarray, $outputfiletmp, '', $website->virtualhost.'/wrapper.php?rss=1'.($l ? '&l='.$l : ''), $l); if ($result >= 0) { diff --git a/test/phpunit/AccountingAccountTest.php b/test/phpunit/AccountingAccountTest.php index b4367e96f49..622bd346872 100644 --- a/test/phpunit/AccountingAccountTest.php +++ b/test/phpunit/AccountingAccountTest.php @@ -204,7 +204,7 @@ class AccountingAccountTest extends PHPUnit\Framework\TestCase $localobject->label='New label'; $result=$localobject->update($user); - print __METHOD__." id=".$id." result=".$result."\n"; + print __METHOD__." id=".$localobject->id." result=".$result."\n"; $this->assertLessThan($result, 0); return $localobject->id; diff --git a/test/phpunit/ActionCommTest.php b/test/phpunit/ActionCommTest.php index 0dd4946f69c..abebfd728bf 100644 --- a/test/phpunit/ActionCommTest.php +++ b/test/phpunit/ActionCommTest.php @@ -223,7 +223,7 @@ class ActionCommTest extends PHPUnit\Framework\TestCase $result=$localobject->update($user); $this->assertLessThan($result, 0); - print __METHOD__." id=".$id." result=".$result."\n"; + print __METHOD__." id=".$localobject->id." result=".$result."\n"; return $localobject->id; } diff --git a/test/phpunit/CommandeTest.php b/test/phpunit/CommandeTest.php index 990ef41f0b7..1decbe4e201 100644 --- a/test/phpunit/CommandeTest.php +++ b/test/phpunit/CommandeTest.php @@ -196,7 +196,7 @@ class CommandeTest extends PHPUnit\Framework\TestCase $result=$localobject->update($user); $this->assertLessThan($result, 0); - print __METHOD__." id=".$id." result=".$result."\n"; + print __METHOD__." id=".$localobject->id." result=".$result."\n"; return $localobject; }