diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index f5271e40694..d5fe542ce42 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -85,7 +85,6 @@ class PaymentVarious extends CommonObject $this->db = $db; $this->element = 'payment_various'; $this->table_element = 'payment_various'; - return 1; } /** @@ -387,13 +386,14 @@ class PaymentVarious extends CommonObject // Insert payment into llx_bank // Add link 'payment_various' in bank_url between payment and bank transaction - if ($this->sens == '0') $sign='-'; + $sign=1; + if ($this->sens == '0') $sign=-1; $bank_line_id = $acc->addline( $this->datep, $this->type_payment, $this->label, - $sign.abs($this->amount), + $sign * abs($this->amount), $this->num_payment, '', $user @@ -543,11 +543,13 @@ class PaymentVarious extends CommonObject /** * Send name clicable (with possibly the picto) * - * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto - * @param string $option link option - * @return string Chaine with URL + * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto + * @param string $option link option + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @param int $notooltip 1=Disable tooltip + * @return string String with URL */ - function getNomUrl($withpicto=0,$option='') + function getNomUrl($withpicto=0, $option='', $save_lastsearch_value=-1, $notooltip=0) { global $langs; @@ -558,8 +560,8 @@ class PaymentVarious extends CommonObject $linkend=''; $result .= $linkstart; - if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); - if ($withpicto != 2) $result.= ($maxlen?dol_trunc($this->ref,$maxlen):$this->ref); + if ($withpicto) $result.=img_object(($notooltip?'':$label), $this->picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); + if ($withpicto != 2) $result.= $this->ref.($option == 'reflabel' && $this->label ? ' - '.$this->label : ''); $result .= $linkend; return $result; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index feb41f5dffd..472ecbb40e5 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1268,7 +1268,7 @@ function dol_delete_dir($dir,$nophperrors=0) * @param int $nophperrors Disable all PHP output errors * @param int $onlysub Delete only files and subdir, not main directory * @param int $countdeleted Counter to count nb of elements found really deleted - * @return int Number of files and directory we try to remove. NB really removed is returned into $countdeleted. + * @return int Number of files and directory we try to remove. NB really removed is returned into var by reference $countdeleted. */ function dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0) { diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 6d10399088c..0e67b9a4c44 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -451,7 +451,7 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target // Contact on a thirdparty that is a different thirdparty than the thirdparty of object if ($targetcontact->socid > 0 && $targetcontact->socid != $targetcompany->id) { - $targetcontact->fetch_thirparty(); + $targetcontact->fetch_thirdparty(); $companytouseforaddress = $targetcontact->thirdparty; } diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index 913ed96356e..e59ac551eb3 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -150,9 +150,11 @@ function dolWebsiteOutput($content) $nbrep=0; if (! $symlinktomediaexists) { - $content=preg_replace('/(]*href=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1'.$urlwithroot.'/viewimage.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep); - $content=preg_replace('/(]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1'.$urlwithroot.'/viewimage.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep); - $content=preg_replace('/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)modulepart=medias([^\)]*)file=([^\)]*)(["\']?\))/', '\1'.$urlwithroot.'/viewimage.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep); + $content=preg_replace('/(]*src=")[^\"]*document\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\document.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep); + + $content=preg_replace('/(]*href=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/viewimage.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep); + $content=preg_replace('/(]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/viewimage.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep); + $content=preg_replace('/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)modulepart=medias([^\)]*)file=([^\)]*)(["\']?\))/', '\1/viewimage.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep); } else { diff --git a/htdocs/install/doctemplates/shipment/index.html b/htdocs/install/doctemplates/shipments/index.html similarity index 100% rename from htdocs/install/doctemplates/shipment/index.html rename to htdocs/install/doctemplates/shipments/index.html diff --git a/htdocs/install/doctemplates/shipment/template_shipment.odt b/htdocs/install/doctemplates/shipments/template_shipment.odt similarity index 100% rename from htdocs/install/doctemplates/shipment/template_shipment.odt rename to htdocs/install/doctemplates/shipments/template_shipment.odt diff --git a/htdocs/install/doctemplates/supplier_proposal/index.html b/htdocs/install/doctemplates/supplier_proposals/index.html similarity index 100% rename from htdocs/install/doctemplates/supplier_proposal/index.html rename to htdocs/install/doctemplates/supplier_proposals/index.html diff --git a/htdocs/install/doctemplates/supplier_proposal/template_supplier_proposal.odt b/htdocs/install/doctemplates/supplier_proposals/template_supplier_proposal.odt similarity index 100% rename from htdocs/install/doctemplates/supplier_proposal/template_supplier_proposal.odt rename to htdocs/install/doctemplates/supplier_proposals/template_supplier_proposal.odt diff --git a/htdocs/install/doctemplates/websites/index.html b/htdocs/install/doctemplates/websites/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/install/doctemplates/websites/website_template-forinit.zip b/htdocs/install/doctemplates/websites/website_template-forinit.zip new file mode 100644 index 00000000000..7a46b854734 Binary files /dev/null and b/htdocs/install/doctemplates/websites/website_template-forinit.zip differ diff --git a/htdocs/install/step1.php b/htdocs/install/step1.php index f6f1571b4ec..374dcf585f2 100644 --- a/htdocs/install/step1.php +++ b/htdocs/install/step1.php @@ -485,8 +485,8 @@ if (! $error && $db->connected && $action == "set") 'products' => 'product', 'projects' => 'project', 'proposals' => 'proposal', - 'shipment' => 'shipment', - 'supplier_proposal' => 'supplier_proposal', + 'shipments' => 'shipment', + 'supplier_proposals' => 'supplier_proposal', 'tasks' => 'task_summary', 'thirdparties' => 'thirdparty', 'usergroups' => 'usergroups', diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index ef2b70b685a..2ad4ecca5e7 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -18,10 +18,10 @@ HtmlHeaderPage=HTML header (specific to this page only) PageNameAliasHelp=Name or alias of the page.
This alias is also used to forge a SEO URL when website is ran from a Virtual host of a Web server (like Apacke, Nginx, ...). Use the button "%s" to edit this alias. EditTheWebSiteForACommonHeader=Note: If you want to define a personalized header for all pages, edit the header on the site level instead of on the page/container. MediaFiles=Media library -EditCss=Edit Style/CSS or HTML header +EditCss=Edit website properties EditMenu=Edit menu EditMedias=Edit medias -EditPageMeta=Edit Meta +EditPageMeta=Edit page/container properties EditInLine=Edit inline AddWebsite=Add website Webpage=Web page/container @@ -30,6 +30,7 @@ HomePage=Home Page PageContainer=Page/container PreviewOfSiteNotYetAvailable=Preview of your website %s not yet available. You must first add a page. RequestedPageHasNoContentYet=Requested page with id %s has no content yet, or cache file .tpl.php was removed. Edit content of the page to solve this. +SiteDeleted=Web site '%s' deleted PageContent=Page/Contenair PageDeleted=Page/Contenair '%s' of website %s deleted PageAdded=Page/Contenair '%s' added @@ -38,8 +39,8 @@ ViewPageInNewTab=View page in new tab SetAsHomePage=Set as Home page RealURL=Real URL ViewWebsiteInProduction=View web site using home URLs -SetHereVirtualHost=If you can create, on your web server (Apache, Nginx, ...), a dedicated Virtual Host with PHP enabled and a Root directory on
%s
then enter here the virtual hostname you have created, so the preview can be done also using this dedicated web server access instead of only using Dolibarr server. -YouCanAlsoTestWithPHPS=On develop environment, you may prefer to test the site with the PHP embedded web server (PHP 5.5 required) by running
php -S 0.0.0.0:8080 -t %s +SetHereVirtualHost=Use with Apache/NGinx/...
If you can create, on your web server (Apache, Nginx, ...), a dedicated Virtual Host with PHP enabled and a Root directory on
%s
then enter here the virtual hostname you have created, so the preview can be done also using this dedicated web server access instead of only using Dolibarr server. +YouCanAlsoTestWithPHPS=Use with PHP embedded server
On develop environment, you may prefer to test the site with the PHP embedded web server (PHP 5.5 required) by running
php -S 0.0.0.0:8080 -t %s CheckVirtualHostPerms=Check also that virtual host has permission %s on files into
%s ReadPerm=Read WritePerm=Write @@ -50,7 +51,7 @@ NoPageYet=No pages yet YouCanCreatePageOrImportTemplate=You can create a new page or import a full website template SyntaxHelp=Help on specific syntax tips YouCanEditHtmlSourceckeditor=You can edit HTML source code using the "Source" button in editor. -YouCanEditHtmlSource=
You can include PHP code into this source using tags <?php ?>. The following global variables are available: $conf, $langs, $db, $mysoc, $user, $website.

You can also include content of another Page/Container with the following syntax:
<?php includeContainer('alias_of_container_to_include'); ?>

You can make a redirect to another Page/Container with the following syntax:
<?php redirectToContainer('alias_of_container_to_redirect_to'); ?>

To include a link to download a file stored into the documents directory, use the document.php wrapper:
Example, for a file into documents/ecm (need to be logged), syntax is:
<a href="/document.php?modulepart=ecm&file=[relative_dir/]filename.ext">
For a file into documents/medias (open directory for public access), syntax is:
<a href="/document.php?modulepart=medias&file=[relative_dir/]filename.ext">
For a file shared with a share link (open access using the sharing hash key of file), syntax is:
<a href="/document.php?hashp=publicsharekeyoffile">

To include an image stored into the documents directory, use the viewimage.php wrapper:
Example, for an image into documents/medias (open access), syntax is:
<a href="/viewimage.php?modulepart=medias&file=[relative_dir/]filename.ext">
+YouCanEditHtmlSource=
You can include PHP code into this source using tags <?php ?>. The following global variables are available: $conf, $langs, $db, $mysoc, $user, $website.

You can also include content of another Page/Container with the following syntax:
<?php includeContainer('alias_of_container_to_include'); ?>

You can make a redirect to another Page/Container with the following syntax (Note: do not output any content before a redirect):
<?php redirectToContainer('alias_of_container_to_redirect_to'); ?>

To include a link to download a file stored into the documents directory, use the document.php wrapper:
Example, for a file into documents/ecm (need to be logged), syntax is:
<a href="/document.php?modulepart=ecm&file=[relative_dir/]filename.ext">
For a file into documents/medias (open directory for public access), syntax is:
<a href="/document.php?modulepart=medias&file=[relative_dir/]filename.ext">
For a file shared with a share link (open access using the sharing hash key of file), syntax is:
<a href="/document.php?hashp=publicsharekeyoffile">

To include an image stored into the documents directory, use the viewimage.php wrapper:
Example, for an image into documents/medias (open directory for public access), syntax is:
<img src="/viewimage.php?modulepart=medias&file=[relative_dir/]filename.ext">
ClonePage=Clone page/container CloneSite=Clone site SiteAdded=Web site added diff --git a/htdocs/modulebuilder/template/class/api_mymodule.class.php b/htdocs/modulebuilder/template/class/api_mymodule.class.php index 36b8b1d3fa8..ab559a26612 100644 --- a/htdocs/modulebuilder/template/class/api_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/api_mymodule.class.php @@ -120,6 +120,7 @@ class MyModuleApi extends DolibarrApi $restictonsocid = 0; // Set to 1 if there is a field socid in table of object // If the internal user must only see his customers, force searching by him + $search_sale = 0; if ($restictonsocid && ! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id; $sql = "SELECT t.rowid"; diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index 3bb8adbd058..13a453cebbe 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -484,6 +484,14 @@ class Website extends CommonObject } } + if (! $error && ! empty($this->ref)) + { + global $dolibarr_main_data_root; + $pathofwebsite=$dolibarr_main_data_root.'/website/'.$this->ref; + + dol_delete_dir_recursive($pathofwebsite); + } + // Commit or rollback if ($error) { $this->db->rollback(); diff --git a/htdocs/website/index.php b/htdocs/website/index.php index ce8be81e2cd..812ad8a891e 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -58,6 +58,7 @@ $type_container=GETPOST('WEBSITE_TYPE_CONTAINER', 'alpha'); $section_dir = GETPOST('section_dir', 'alpha'); $file_manager = GETPOST('file_manager', 'alpha'); +if (GETPOST('deletesite','alpha')) { $action='deletesite'; } if (GETPOST('delete','alpha')) { $action='delete'; } if (GETPOST('preview','alpha')) $action='preview'; if (GETPOST('createsite','alpha')) { $action='createsite'; } @@ -714,6 +715,41 @@ if ($action == 'addcontainer') } } +// Delete site +if ($action == 'deletesite') +{ + $error = 0; + + $db->begin(); + + $res = $object->fetch(0, $websitekey); + $website = $object; + + if ($res > 0) + { + $res = $object->delete($user); + if ($res <= 0) + { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + } + } + + if (! $error) + { + $db->commit(); + setEventMessages($langs->trans("SiteDeleted", $object->ref, $websitekey), null, 'mesgs'); + + header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } + else + { + $db->rollback(); + dol_print_error($db); + } +} + // Delete page if ($action == 'delete') { @@ -1590,6 +1626,8 @@ if (count($object->records) > 0) print ''; } + print ''; + print '   '; print ''; @@ -1635,11 +1673,11 @@ if (count($object->records) > 0) //print ''; $htmltext =$langs->trans("SetHereVirtualHost", $dataroot); $htmltext.='
'; - $htmltext.='
'; - $htmltext.=$langs->trans("YouCanAlsoTestWithPHPS", $dataroot); - $htmltext.='
'; $htmltext.='
'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("ReadPerm"), DOL_DOCUMENT_ROOT); $htmltext.='
'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("WritePerm"), DOL_DATA_ROOT); + $htmltext.='
'; + $htmltext.='
'; + $htmltext.=$langs->trans("YouCanAlsoTestWithPHPS", $dataroot); print $form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'helpvirtualhost'); print '';