diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php index f7bbbb97969b4d068c9b2203a66879c34ac84e09..eaf69f34f1f43422b6db13a33b30c8f2dd16ea6b 100644 --- a/htdocs/accountancy/admin/export.php +++ b/htdocs/accountancy/admin/export.php @@ -130,7 +130,7 @@ print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="action" value="update">'; -dol_fiche_head($head, 'export', $langs->trans("Configuration"), 0, 'cron'); +dol_fiche_head($head, 'export', $langs->trans("Configuration"), -1, 'cron'); $var = true; diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 3ea77a24b43a161fb7247390211a6d4a2a1e76b9..899aaa1a3d2308e2ead33b7e3d749c94fbd44cf3 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -171,7 +171,7 @@ print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="action" value="update">'; -dol_fiche_head($head, 'general', $langs->trans("Configuration"), 0, 'cron'); +dol_fiche_head($head, 'general', $langs->trans("Configuration"), -1, 'cron'); // Default mode for calculating turnover (parameter ACCOUNTING_MODE) @@ -299,7 +299,7 @@ print '<div class="center"><input type="submit" class="button" value="' . $langs print '<br>'; print '<br>'; -print $langs->trans("AccountancySetupDoneFromAccountancyMenu", $langs->transnoentitiesnoconv("Home").'-'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")); +print '<div class="opacitymedium">'.$langs->trans("AccountancySetupDoneFromAccountancyMenu", $langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")).'</div>'; print '<br>'; print '</form>'; diff --git a/htdocs/accountancy/admin/journals.php b/htdocs/accountancy/admin/journals.php index 03b51089d9a9d907de775202842cecc8a30ab2c6..677f2a743e51f687bd3e25aaf5cbc19c08f651fc 100644 --- a/htdocs/accountancy/admin/journals.php +++ b/htdocs/accountancy/admin/journals.php @@ -94,7 +94,7 @@ print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'titl $head = admin_accounting_prepare_head(null); -dol_fiche_head($head, 'journal', $langs->trans("Configuration"), 0, 'cron'); +dol_fiche_head($head, 'journal', $langs->trans("Configuration"), -1, 'cron'); $sql = "SELECT j.rowid, j.code, j.label, j.nature, j.active"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_journal as j"; diff --git a/htdocs/admin/websites.php b/htdocs/admin/websites.php index b0c81ec18af37e18ea50b45ef762ba01e7f70ae0..06e9a7b93a43f6f50ea17bf9a33a7a528ef8cd88 100644 --- a/htdocs/admin/websites.php +++ b/htdocs/admin/websites.php @@ -375,11 +375,11 @@ if ($id) // dans les dictionnaires de donnees $valuetoshow=ucfirst($fieldlist[$field]); // Par defaut $valuetoshow=$langs->trans($valuetoshow); // try to translate - $align="left"; + $align=''; if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); } if ($valuetoshow != '') { - print '<td align="'.$align.'">'; + print '<td class="'.$align.'">'; if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i',$tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1,$valuetoshow).'</a>'; else if (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow,$tabhelp[$id][$value]); else print $valuetoshow; @@ -413,14 +413,11 @@ if ($id) $reshook=$hookmanager->executeHooks('createDictionaryFieldlist',$parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $error=$hookmanager->error; $errors=$hookmanager->errors; - if ($id == 3) unset($fieldlist[2]); - if (empty($reshook)) { fieldListWebsites($fieldlist,$obj,$tabname[$id],'add'); } - if ($id == 4) print '<td></td>'; print '<td colspan="3" align="right">'; if ($action != 'edit') { @@ -430,15 +427,9 @@ if ($id) print "</tr>"; $colspan=count($fieldlist)+2; - if ($id == 4) $colspan++; - - if (! empty($alabelisused) && $id != 25) // If there is one label among fields, we show legend of * - { - print '<tr><td colspan="'.$colspan.'">* '.$langs->trans("LabelUsedByDefault").'.</td></tr>'; - } - print '<tr><td colspan="'.$colspan.'"> </td></tr>'; // Keep to have a line with enough height } + print '</table>'; print '</form>'; @@ -453,6 +444,15 @@ if ($id) $var=true; if ($num) { + print '<br>'; + + print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">'; + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; + print '<input type="hidden" name="page" value="'.$page.'">'; + print '<input type="hidden" name="rowid" value="'.$rowid.'">'; + + print '<table class="noborder" width="100%">'; + // There is several pages if ($num > $listlimit) { @@ -503,14 +503,9 @@ if ($id) $obj = $db->fetch_object($resql); //print_r($obj); - print '<tr '.$bc[$var].' id="rowid-'.$obj->rowid.'">'; + print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">'; if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code))) { - print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">'; - print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; - print '<input type="hidden" name="page" value="'.$page.'">'; - print '<input type="hidden" name="rowid" value="'.$rowid.'">'; - $tmpaction='edit'; $parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); $reshook=$hookmanager->executeHooks('editDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks @@ -548,16 +543,6 @@ if ($id) $url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'').'&id='.$id.'&'; - // Favorite - // Only activated on country dictionary - if ($id == 4) - { - print '<td align="center" class="nowrap">'; - if ($iserasable) print '<a href="'.$url.'action='.$acts[$obj->favorite].'_favorite">'.$actl[$obj->favorite].'</a>'; - else print $langs->trans("AlwaysActive"); - print '</td>'; - } - // Active print '<td align="center" class="nowrap">'; print '<a href="'.$url.'action='.$acts[$obj->status].'">'.$actl[$obj->status].'</a>'; @@ -575,15 +560,15 @@ if ($id) } $i++; } + + print '</table>'; + + print '</form>'; } } else { dol_print_error($db); } - - print '</table>'; - - print '</form>'; } print '<br>'; diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 67ab40f4946a9beaeb6310b7015521928b13476a..aae1398109d1bb1eacb40de7ded9bd2e3eff61a7 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -1098,7 +1098,7 @@ if ($id > 0) else print '<div class="inline-block divButAction"><a class="butActionRefused" title="'.dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")).'" href="#">'.$langs->trans("AddBill").'</a></div>'; } - if ($object->client != 0 && $object->client != 2) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&socid='.$object->id.'">'.$langs->trans("AddBill").'</a></div>'; + if ($object->client != 0 && $object->client != 2) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddBill").'</a></div>'; else print '<div class="inline-block divButAction"><a class="butActionRefused" title="'.dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")).'" href="#">'.$langs->trans("AddBill").'</a></div>'; } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 6e8c3b6d8953394185a0742aaa7542e19fcf6e10..70eea532a790b6c66f664cf0036493d40614675c 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2191,7 +2191,7 @@ if ($action == 'create') else { print '<td colspan="2">'; - print $form->select_company($soc->id, 'socid', '(s.client = 1 OR s.client = 3) AND status=1', 'SelectThirdParty'); + print $form->select_company($soc->id, 'socid', '(s.client = 1 OR s.client = 3) AND status=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); // Option to reload page to retrieve customer informations. Note, this clear other input if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE)) { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index b839e46dc8b46a0073712e14aad2c5e8cdfbc583..3275ee0f303ff32313e44359a786d709413af0c7 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -994,7 +994,7 @@ class Form print img_picto($langs->trans("Search"), 'search'); } } - print '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(!empty($conf->global->THIRDPARTY_SEARCH_AUTOFOCUS) ? 'autofocus' : '').' />'; + print '<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(!empty($conf->global->THIRDPARTY_SEARCH_AUTOFOCUS) ? 'autofocus' : '').' />'; if ($hidelabel == 3) { print img_picto($langs->trans("Search"), 'search'); } diff --git a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql index 9ff9de4e70da0e1add626e7eb72ff1441d34507a..c2edae8b59263e47e621e87dbcb402b85c391499 100644 --- a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql +++ b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql @@ -137,6 +137,9 @@ ALTER TABLE llx_chargesociales ADD COLUMN fk_projet integer DEFAULT NULL; ALTER TABLE llx_cronjob ADD COLUMN processing integer NOT NULL DEFAULT 0; +ALTER TABLE llx_website ADD COLUMN fk_user_create integer; +ALTER TABLE llx_website ADD COLUMN fk_user_modif integer; + create table llx_payment_various ( diff --git a/htdocs/install/mysql/tables/llx_website.sql b/htdocs/install/mysql/tables/llx_website.sql index 331e6b085bdc6006298d7ac1d23d6b6c95f4bf29..84a9dd471886b903348c1dd98dbc6459fba6cfaa 100644 --- a/htdocs/install/mysql/tables/llx_website.sql +++ b/htdocs/install/mysql/tables/llx_website.sql @@ -26,7 +26,8 @@ CREATE TABLE llx_website status integer, fk_default_home integer, virtualhost varchar(255), - date_creation datetime, - date_modification datetime, - tms timestamp + fk_user_create integer, + fk_user_modif integer, + date_creation datetime, + tms timestamp ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_website_pages.sql b/htdocs/install/mysql/tables/llx_website_pages.sql index 982420dd5075620aa1d895cec2b7ca0c68fb8850..69b6c417528155e7ac739ad2e51d48660f3e4588 100644 --- a/htdocs/install/mysql/tables/llx_website_pages.sql +++ b/htdocs/install/mysql/tables/llx_website_pages.sql @@ -27,6 +27,8 @@ CREATE TABLE llx_website_page keywords varchar(255), content mediumtext, -- text is not enough in size status integer, - date_creation datetime, - tms timestamp + fk_user_create integer, + fk_user_modif integer, + date_creation datetime, + tms timestamp ) ENGINE=innodb; diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 71788071a2de2cef5bb8f3143e21e7f435ebf4b3..1a3eea413df99cc13fd7cacef1e0e99601a6db96 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -823,5 +823,5 @@ SearchIntoContracts=Contracts SearchIntoCustomerShipments=Customer shipments SearchIntoExpenseReports=Expense reports SearchIntoLeaves=Leaves - +SetMultiCurrencyCode=Set currency BulkActions=Bulk actions \ No newline at end of file diff --git a/htdocs/langs/en_US/sendings.lang b/htdocs/langs/en_US/sendings.lang index ef6fe44856b6bc874df4a15596909278ec0da9e5..ac180cb5fe6357b6afdd3b473015ae70b236107b 100644 --- a/htdocs/langs/en_US/sendings.lang +++ b/htdocs/langs/en_US/sendings.lang @@ -53,7 +53,7 @@ ShipmentCreationIsDoneFromOrder=For the moment, creation of a new shipment is do ShipmentLine=Shipment line ProductQtyInCustomersOrdersRunning=Product quantity into open customers orders ProductQtyInSuppliersOrdersRunning=Product quantity into open suppliers orders -ProductQtyInShipmentAlreadySent=Product quantity from oped customer order already sent +ProductQtyInShipmentAlreadySent=Product quantity from open customer order already sent ProductQtyInSuppliersShipmentAlreadyRecevied=Product quantity from open supplier order already received NoProductToShipFoundIntoStock=No product to ship found into warehouse <b>%s</b>. Correct stock or go back to choose another warehouse. WeightVolShort=Weight/Vol. diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index fcb09c8d5c13f102cc30b2f48602e76139cc6810..03069d6f649eea0db18617b41cb4657db53dfd34 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -24,5 +24,5 @@ SetAsHomePage=Set as Home page RealURL=Real URL ViewWebsiteInProduction=View web site using home URLs SetHereVirtualHost=If you can set, on your web server, a dedicated virtual host with a root directory on <strong>%s</strong>, define here the virtual hostname so the preview can be done also using this direct web server access and not only using Dolibarr server. -PreviewSiteServedByWebServer=Preview %s in a new tab. The %s will be served by an external web server (like Apache, Nginx, IIS). You must instal and setup this server before.<br>URL of %s served by external server:<br><strong>%s</strong> -PreviewSiteServedByDolibarr=Preview %s in a new tab. The %s will be served by Dolibarr server so it does not need any extra web server (like Apache, Nginx, IIS) to be installed.<br>The inconvenient is that URL of pages are not user friendly and start with path of your Dolibarr.<br>URL of %s served by Dolibarr:<br><strong>%s</strong> +PreviewSiteServedByWebServer=Preview %s in a new tab.<br><br>The %s will be served by an external web server (like Apache, Nginx, IIS). You must install and setup this server before to point to directory:<br><strong>%s</strong><br>URL served by external server:<br><strong>%s</strong> +PreviewSiteServedByDolibarr=Preview %s in a new tab.<br><br>The %s will be served by Dolibarr server so it does not need any extra web server (like Apache, Nginx, IIS) to be installed.<br>The inconvenient is that URL of pages are not user friendly and start with path of your Dolibarr.<br>URL served by Dolibarr:<br><strong>%s</strong><br><br>To use your own external web server to serve this web site, create a virtual host on your web server that point on directory<br><strong>%s</strong><br>then enter the name of this virtual server and clicking on the other preview button. diff --git a/htdocs/theme/eldy/img/save.png b/htdocs/theme/eldy/img/save.png new file mode 100644 index 0000000000000000000000000000000000000000..eca2d92eccc5665b070d3c04e7241fbc2cbb71d5 Binary files /dev/null and b/htdocs/theme/eldy/img/save.png differ diff --git a/htdocs/theme/md/img/save.png b/htdocs/theme/md/img/save.png new file mode 100644 index 0000000000000000000000000000000000000000..eca2d92eccc5665b070d3c04e7241fbc2cbb71d5 Binary files /dev/null and b/htdocs/theme/md/img/save.png differ diff --git a/htdocs/websites/class/website.class.php b/htdocs/websites/class/website.class.php index 51a61d90112ac478c9c3525125d6fec36b02201a..a77079c94a60c27e96404aab6700de6d85daa27a 100644 --- a/htdocs/websites/class/website.class.php +++ b/htdocs/websites/class/website.class.php @@ -73,10 +73,6 @@ class Website extends CommonObject * @var mixed */ public $date_creation; - /** - * @var mixed - */ - public $date_modification; /** * @var mixed */ @@ -123,7 +119,6 @@ class Website extends CommonObject $error = 0; // Clean parameters - if (isset($this->entity)) { $this->entity = trim($this->entity); } @@ -136,36 +131,30 @@ class Website extends CommonObject if (isset($this->status)) { $this->status = trim($this->status); } - - + if (empty($this->date_creation)) $this->date_creation = dol_now(); // Check parameters // Put here code to add control on parameters values // Insert request $sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '('; - $sql.= 'entity,'; $sql.= 'ref,'; $sql.= 'description,'; $sql.= 'status,'; $sql.= 'fk_default_home,'; $sql.= 'virtualhost,'; - $sql.= 'date_creation,'; - $sql.= 'date_modification'; - + $sql.= 'fk_user_create'; + $sql.= 'date_creation'; $sql .= ') VALUES ('; - $sql .= ' '.(! isset($this->entity)?'NULL':$this->entity).','; $sql .= ' '.(! isset($this->ref)?'NULL':"'".$this->db->escape($this->ref)."'").','; $sql .= ' '.(! isset($this->description)?'NULL':"'".$this->db->escape($this->description)."'").','; $sql .= ' '.(! isset($this->status)?'NULL':$this->status).','; $sql .= ' '.(! isset($this->fk_default_home)?'NULL':$this->fk_default_home).','; $sql .= ' '.(! isset($this->virtualhost)?'NULL':$this->virtualhost).','; - $sql .= ' '.(! isset($this->date_creation) || dol_strlen($this->date_creation)==0?'NULL':"'".$this->db->idate($this->date_creation)."'").','; - $sql .= ' '.(! isset($this->date_modification) || dol_strlen($this->date_modification)==0?'NULL':"'".$this->db->idate($this->date_modification)."'"); - - + $sql .= ' '.(! isset($this->fk_user_create)?$user->id:$this->fk_user_create).','; + $sql .= ' '.(! isset($this->date_creation) || dol_strlen($this->date_creation)==0?'NULL':"'".$this->db->idate($this->date_creation)."'"); $sql .= ')'; $this->db->begin(); @@ -223,8 +212,9 @@ class Website extends CommonObject $sql .= " t.status,"; $sql .= " t.fk_default_home,"; $sql .= " t.virtualhost,"; + $sql .= " t.fk_user_create,"; + $sql .= " t.fk_user_modif,"; $sql .= " t.date_creation,"; - $sql .= " t.date_modification,"; $sql .= " t.tms"; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; if (null !== $ref) { @@ -247,11 +237,10 @@ class Website extends CommonObject $this->status = $obj->status; $this->fk_default_home = $obj->fk_default_home; $this->virtualhost = $obj->virtualhost; + $this->fk_user_create = $obj->fk_user_create; + $this->fk_user_modif = $obj->fk_user_modif; $this->date_creation = $this->db->jdate($obj->date_creation); - $this->date_modification = $this->db->jdate($obj->date_modification); $this->tms = $this->db->jdate($obj->tms); - - } $this->db->free($resql); @@ -292,8 +281,9 @@ class Website extends CommonObject $sql .= " t.status,"; $sql .= " t.fk_default_home,"; $sql .= " t.virtualhost,"; + $sql .= " t.fk_user_create,"; + $sql .= " t.fk_user_modif,"; $sql .= " t.date_creation,"; - $sql .= " t.date_modification,"; $sql .= " t.tms"; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t'; @@ -331,8 +321,9 @@ class Website extends CommonObject $line->status = $obj->status; $line->fk_default_home = $obj->fk_default_home; $line->virtualhost = $obj->virtualhost; + $this->fk_user_create = $obj->fk_user_create; + $this->fk_user_modif = $obj->fk_user_modif; $line->date_creation = $this->db->jdate($obj->date_creation); - $line->date_modification = $this->db->jdate($obj->date_modification); $line->tms = $this->db->jdate($obj->tms); $this->records[$line->id] = $line; @@ -377,25 +368,20 @@ class Website extends CommonObject $this->status = trim($this->status); } - - // Check parameters // Put here code to add a control on parameters values // Update request $sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET'; - $sql .= ' entity = '.(isset($this->entity)?$this->entity:"null").','; $sql .= ' ref = '.(isset($this->ref)?"'".$this->db->escape($this->ref)."'":"null").','; $sql .= ' description = '.(isset($this->description)?"'".$this->db->escape($this->description)."'":"null").','; $sql .= ' status = '.(isset($this->status)?$this->status:"null").','; $sql .= ' fk_default_home = '.(($this->fk_default_home > 0)?$this->fk_default_home:"null").','; $sql .= ' virtualhost = '.(($this->virtualhost != '')?"'".$this->db->escape($this->virtualhost)."'":"null").','; + $sql .= ' fk_user_modif = '.(! isset($this->fk_user_modif) ? $user->id : $this->fk_user_modif).','; $sql .= ' date_creation = '.(! isset($this->date_creation) || dol_strlen($this->date_creation) != 0 ? "'".$this->db->idate($this->date_creation)."'" : 'null').','; - $sql .= ' date_modification = '.(! isset($this->date_modification) || dol_strlen($this->date_modification) != 0 ? "'".$this->db->idate($this->date_modification)."'" : 'null').','; $sql .= ' tms = '.(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : "'".$this->db->idate(dol_now())."'"); - - $sql .= ' WHERE rowid=' . $this->id; $this->db->begin(); @@ -631,6 +617,8 @@ class Website extends CommonObject */ public function initAsSpecimen() { + global $user; + $this->id = 0; $this->entity = 1; @@ -639,8 +627,9 @@ class Website extends CommonObject $this->status = ''; $this->fk_default_home = null; $this->virtualhost = 'http://myvirtualhost'; + $this->fk_user_create = $user->id; + $this->fk_user_modif = $user->id; $this->date_creation = dol_now(); - $this->date_modification = dol_now(); $this->tms = dol_now(); diff --git a/htdocs/websites/class/websitepage.class.php b/htdocs/websites/class/websitepage.class.php index 883b6495c53ed8c6070a2ed081a93b5745e716da..c80d20fe44b1de9c07c294640658e737849d573c 100644 --- a/htdocs/websites/class/websitepage.class.php +++ b/htdocs/websites/class/websitepage.class.php @@ -181,7 +181,7 @@ class WebsitePage extends CommonObject /** * Load object in memory from the database * - * @param int $id Id object + * @param int $id Id object. If this is 0, the default page of website_id will be used, if not defined, the first one. found * @param string $website_id Web site id * @param string $page Page name * @@ -205,13 +205,16 @@ class WebsitePage extends CommonObject $sql .= " t.tms as date_modification"; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; + //$sql .= ' WHERE entity IN ('.getEntity('website', 1).')'; // entity is on website level + $sql .= ' WHERE 1 = 1'; if (null !== $website_id) { - $sql .= ' WHERE t.fk_website = ' . '\'' . $website_id . '\''; - $sql .= ' AND t.pageurl = ' . '\'' . $page . '\''; + $sql .= " AND t.fk_website = '" . $this->db->escape($website_id) . "'"; + if ($page) $sql .= " AND t.pageurl = '" . $this->db->escape($page) . "'"; } else { - $sql .= ' WHERE t.rowid = ' . $id; + $sql .= ' AND t.rowid = ' . $id; } - + $sql .= $this->db->plimit(1); + $resql = $this->db->query($sql); if ($resql) { $numrows = $this->db->num_rows($resql); diff --git a/htdocs/websites/index.php b/htdocs/websites/index.php index b55f81f5b7fd18c3d9460854c01fd0a12a81eaec..b78a172e01f66f4a71c2a3e5d93fa9876526ac23 100644 --- a/htdocs/websites/index.php +++ b/htdocs/websites/index.php @@ -438,16 +438,34 @@ if ($action == 'updatemeta') // Update page if ($action == 'updatecontent' || GETPOST('refreshsite') || GETPOST('refreshpage') || GETPOST('preview')) { - $db->begin(); $object->fetch(0, $website); + /*if (GETPOST('savevirtualhost') && $object->virtualhost != GETPOST('previewsite')) + { + $object->virtualhost = GETPOST('previewsite', 'alpha'); + $object->update($user); + }*/ + $objectpage->fk_website = $object->id; - $res = $objectpage->fetch($pageid, $object->fk_website); + if ($pageid > 0) + { + $res = $objectpage->fetch($pageid); + } + else + { + $res = $objectpage->fetch($object->fk_default_home); + if (! $res > 0) + { + $res = $objectpage->fetch(0, $object->fk_website); + } + } if ($res > 0) { if ($action == 'updatecontent') { + $db->begin(); + $objectpage->content = GETPOST('PAGE_CONTENT'); // Clean data. We remove all the head section. @@ -632,7 +650,7 @@ if (count($object->records) > 0) // List of websites print '<div class="websiteselection">'; $out=''; - $out.='<select name="website" id="website">'; + $out.='<select name="website" class="minwidth100" id="website">'; if (empty($object->records)) $out.='<option value="-1"> </option>'; // Loop on each sites $i=0; @@ -654,9 +672,9 @@ if (count($object->records) > 0) if ($website) { - $realurl=$urlwithroot.'/public/websites/index.php?website='.$website; + $virtualurl=''; $dataroot=DOL_DATA_ROOT.'/websites/'.$website; - if (! empty($object->virtualhost)) $realurl=$object->virtualhost; + if (! empty($object->virtualhost)) $virtualurl=$object->virtualhost; } if ($website && $action == 'preview') @@ -680,20 +698,23 @@ if (count($object->records) > 0) if ($action == 'preview') { print '<div class="websiteinputurl">'; - print '<input type="text" id="previewsiteurl" class="minwidth200imp" name="previewsite" value="'.$realurl.'">'; + print '<input type="text" id="previewsiteurl" class="minwidth200imp" name="previewsite" placeholder="'.$langs->trans("http://myvirtualhost").'" value="'.$virtualurl.'">'; //print '<input type="submit" class="button" name="previewwebsite" target="tab'.$website.'" value="'.$langs->trans("ViewSiteInNewTab").'">'; $htmltext=$langs->trans("SetHereVirtualHost", $dataroot); print $form->textwithpicto('', $htmltext); print '</div>'; - $urlext=$realurl; - $urlint=DOL_URL_ROOT.'/public/websites/index.php?website='.$website; - print '<a class="websitebuttonsitepreview" id="previewsiteext" href="'.$urlext.'" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByWebServer")).'">'; - print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $urlext), 1, 'preview_ext'); - print '</a>'; + $urlext=$virtualurl; + $urlint=$urlwithroot.'/public/websites/index.php?website='.$website; + //if (! empty($object->virtualhost)) + //{ + print '<a class="websitebuttonsitepreview" id="previewsiteext" href="'.$urlext.'" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext)).'">'; + print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext?$urlext:$langs->trans("VirtualHostUrlNotDefined")), 1, 'preview_ext'); + print '</a>'; + //} - print '<a class="websitebuttonsitepreview" id="previewsite" href="'.DOL_URL_ROOT.'/public/websites/index.php?website='.$website.'" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByDolibarr")).'">'; - print $form->textwithpicto('', $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $urlint), 1, 'preview'); + print '<a class="websitebuttonsitepreview" id="previewsite" href="'.$urlwithroot.'/public/websites/index.php?website='.$website.'" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint)).'">'; + print $form->textwithpicto('', $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint, $dataroot), 1, 'preview'); print '</a>'; } @@ -803,13 +824,22 @@ if (count($object->records) > 0) print $form->textwithpicto('', $htmltext); print '</div>'; - $urlext=$realurl.'/'.$pagealias.'.php'; - print '<a class="websitebuttonsitepreview" id="previewpageext" href="'.$urlext.'" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByWebServer")).'">'; - print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $urlext), 1, 'preview_ext'); - print '</a>'; + if (! empty($object->virtualhost)) + { + $urlext=$virtualurl.'/'.$pagealias.'.php'; + print '<a class="websitebuttonsitepreview" id="previewpageext" href="'.$urlext.'" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $dataroot, $urlext)).'">'; + print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $dataroot, $urlext?$urlext:$langs->trans("VirtualHostUrlNotDefined")), 1, 'preview_ext'); + print '</a>'; + } + else + { + print '<a class="websitebuttonsitepreview" id="previewpageextnoclick" href="#">'; + print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $dataroot, $urlext?$urlext:$langs->trans("VirtualHostUrlNotDefined")), 1, 'preview_ext'); + print '</a>'; + } - print '<a class="websitebuttonsitepreview" id="previewpage" href="'.$realpage.'&nocache='.dol_now().'" class="button" target="tab'.$website.'">'; - print $form->textwithpicto('', $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $realpage), 1, 'preview'); + print '<a class="websitebuttonsitepreview" id="previewpage" href="'.$realpage.'&nocache='.dol_now().'" class="button" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $realpage)).'">'; + print $form->textwithpicto('', $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $realpage, $dataroot), 1, 'preview'); print '</a>'; // View page in new Tab //print '<input type="submit" class="button" name="previewpage" target="tab'.$website.'"value="'.$langs->trans("ViewPageInNewTab").'">';