';
$out.= ''."\n";
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 05d58d22bc0..6b0c856a6e6 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -5606,6 +5606,14 @@ class Form
{
$listofidcompanytoscan=$object->thirdparty->id;
if (($object->thirdparty->parent > 0) && ! empty($conf->global->THIRDPARTY_INCLUDE_PARENT_IN_LINKTO)) $listofidcompanytoscan.=','.$object->thirdparty->parent;
+ if (($object->fk_project > 0) && ! empty($conf->global->THIRDPARTY_INCLUDE_PROJECT_THIRDPARY_IN_LINKTO))
+ {
+ include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
+ $tmpproject=new Project($this->db);
+ $tmpproject->fetch($object->fk_project);
+ if ($tmpproject->socid > 0 && ($tmpproject->socid != $object->thirdparty->id)) $listofidcompanytoscan.=','.$tmpproject->socid;
+ unset($tmpproject);
+ }
$possiblelinks=array(
'propal'=>array('enabled'=>$conf->propal->enabled, 'perms'=>1, 'label'=>'LinkToProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('propal').')'),
diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php
index 9e6250f9f8d..c92558bf1d3 100644
--- a/htdocs/core/class/smtps.class.php
+++ b/htdocs/core/class/smtps.class.php
@@ -271,7 +271,7 @@ class SMTPs
{
$this->_moreinheader = $_val;
}
-
+
/**
* get trackid
*
@@ -291,7 +291,7 @@ class SMTPs
{
return $this->_moreinheader;
}
-
+
/**
* Set errors to
*
@@ -411,7 +411,7 @@ class SMTPs
function _server_authenticate()
{
global $conf;
-
+
// Send the RFC2554 specified EHLO.
// This improvment as provided by 'SirSir' to
// accomodate both SMTP AND ESMTP capable servers
@@ -462,7 +462,7 @@ class SMTPs
{
$this->_setErr(126, '"' . $host . '" does not support authenticated connections.');
return $_retVal;
- }
+ }
}
// Send Authentication to Server
// Check for errors along the way
@@ -903,7 +903,7 @@ class SMTPs
if ( $_strReplyTo )
$this->_msgReplyTo = $this->_strip_email($_strReplyTo);
}
-
+
/**
* Retrieves the Address from which mail will be the reply-to
*
@@ -913,15 +913,15 @@ class SMTPs
function getReplyTo($_part = true)
{
$_retValue = '';
-
+
if ( $_part === true )
$_retValue = $this->_msgReplyTo;
else
$_retValue = $this->_msgReplyTo[$_part];
-
+
return $_retValue;
}
-
+
/**
* Inserts given addresses into structured format.
* This method takes a list of given addresses, via an array
@@ -1217,6 +1217,8 @@ class SMTPs
*/
function getHeader()
{
+ global $conf;
+
$_header = 'From: ' . $this->getFrom('org') . "\r\n"
. 'To: ' . $this->getTO() . "\r\n";
@@ -1233,13 +1235,13 @@ class SMTPs
if ( $this->getBCC() )
$_header .= 'Bcc: ' . $this->getBCC() . "\r\n";
*/
-
+
$host=$this->getHost();
$host=preg_replace('@tcp://@i','',$host); // Remove prefix
$host=preg_replace('@ssl://@i','',$host); // Remove prefix
$host=dol_getprefix('email');
-
+
//NOTE: Message-ID should probably contain the username of the user who sent the msg
$_header .= 'Subject: ' . $this->getSubject() . "\r\n";
$_header .= 'Date: ' . date("r") . "\r\n";
@@ -1258,7 +1260,7 @@ class SMTPs
}
if ( $this->getMoreInHeader() )
$_header .= $this->getMoreInHeader(); // Value must include the "\r\n";
-
+
//$_header .=
// 'Read-Receipt-To: ' . $this->getFrom( 'org' ) . "\r\n"
// 'Return-Receipt-To: ' . $this->getFrom( 'org' ) . "\r\n";
@@ -1279,9 +1281,10 @@ class SMTPs
$_header .= "Reply-To: ".$this->getReplyTo('addr') ."\r\n";
$_header .= 'X-Mailer: Dolibarr version ' . DOL_VERSION .' (using SMTPs Mailer)' . "\r\n";
+ $_header .= 'X-Dolibarr-Option: '.($conf->global->MAIN_MAIL_USE_MULTI_PART?'MAIN_MAIL_USE_MULTI_PART':'No MAIN_MAIL_USE_MULTI_PART') . "\r\n";
$_header .= 'Mime-Version: 1.0' . "\r\n";
-
+
return $_header;
}
@@ -1310,17 +1313,17 @@ class SMTPs
$strContentAltText = html_entity_decode(strip_tags($strContent));
$strContentAltText = rtrim(wordwrap($strContentAltText, 75, "\r\n"));
}
-
+
// Make RFC2045 Compliant
//$strContent = rtrim(chunk_split($strContent)); // Function chunck_split seems ko if not used on a base64 content
$strContent = rtrim(wordwrap($strContent, 75, "\r\n")); // TODO Using this method creates unexpected line break on text/plain content.
-
+
$this->_msgContent[$strType] = array();
$this->_msgContent[$strType]['mimeType'] = $strMimeType;
$this->_msgContent[$strType]['data'] = $strContent;
$this->_msgContent[$strType]['dataText'] = $strContentAltText;
-
+
if ( $this->getMD5flag() )
$this->_msgContent[$strType]['md5'] = dol_hash($strContent, 3);
//}
@@ -1334,7 +1337,7 @@ class SMTPs
function getBodyContent()
{
global $conf;
-
+
// Generate a new Boundary string
$this->_setBoundary();
@@ -1382,7 +1385,7 @@ class SMTPs
$content .= "\r\n";
$content .= "--" . $this->_getBoundary('mixed') . "\r\n";
-
+
if (key_exists('image', $this->_msgContent)) // If inline image found
{
$content.= 'Content-Type: multipart/alternative; boundary="'.$this->_getBoundary('alternative').'"' . "\r\n";
@@ -1390,7 +1393,7 @@ class SMTPs
$content .= "--" . $this->_getBoundary('alternative') . "\r\n";
}
-
+
// $this->_msgContent must be sorted with key 'text' or 'html' first then 'image' then 'attachment'
@@ -1450,18 +1453,18 @@ class SMTPs
$content.= "\r\n";
$content.= "--" . $this->_getBoundary('related') . "\r\n";
}
-
+
if (! key_exists('image', $this->_msgContent) && $_content['dataText'] && ! empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) // Add plain text message part before html part
{
$content.= 'Content-Type: multipart/alternative; boundary="'.$this->_getBoundary('alternative').'"' . "\r\n";
$content .= "\r\n";
$content .= "--" . $this->_getBoundary('alternative') . "\r\n";
-
+
$content.= "Content-Type: text/plain; charset=" . $this->getCharSet() . "\r\n";
$content.= "\r\n". $_content['dataText'] . "\r\n";
$content.= "--" . $this->_getBoundary('alternative') . "\r\n";
- }
-
+ }
+
$content .= 'Content-Type: ' . $_content['mimeType'] . '; '
// . 'charset="' . $this->getCharSet() . '"';
. 'charset=' . $this->getCharSet() . '';
@@ -1483,7 +1486,7 @@ class SMTPs
{
$content.= "--" . $this->_getBoundary('alternative') . "--". "\r\n";
}
-
+
$content .= "\r\n";
}
}
diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php
index 37f01a0ffe3..354da07c6f2 100644
--- a/htdocs/core/lib/website.lib.php
+++ b/htdocs/core/lib/website.lib.php
@@ -31,17 +31,17 @@
function dolWebsiteOutput($content)
{
global $db, $langs, $conf, $user;
- global $dolibarr_main_url_root;
+ global $dolibarr_main_url_root, $dolibarr_main_data_root;
dol_syslog("dolWebsiteOutput start");
+ // Define $urlwithroot
+ $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
+ $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
+ //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
+
if (! defined('USEDOLIBARRSERVER'))
{
- // Define $urlwithroot
- $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
- $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
- //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
-
$symlinktomediaexists=1;
// Make a change into HTML code to allow to include images from medias directory correct with direct link for virtual server
@@ -55,12 +55,57 @@ function dolWebsiteOutput($content)
}
else
{
- $content=preg_replace('/()/', '\1medias/\4\5', $content, -1, $nbrep);
+ $content=preg_replace('/()/', '\1medias/\4\5', $content, -1, $nbrep);
+ $content=preg_replace('/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)modulepart=medias([^\)]*)file=([^\)]*)(["\']?\))/', '\1medias/\4\5', $content, -1, $nbrep);
}
}
+ else
+ {
+ global $website;
+
+ // Replace relative link / with dolibarr URL
+ $content=preg_replace('/(href=")\/\"/', '\1'.DOL_URL_ROOT.'/public/websites/index.php?website='.$website->ref.'&pageid='.$website->fk_default_home.'"', $content, -1, $nbrep);
+ // Replace relative link /xxx.php with dolibarr URL
+ $content=preg_replace('/(href=")\/?([^\"]*)(\.php\")/', '\1'.DOL_URL_ROOT.'/public/websites/index.php?website='.$website->ref.'&pageref=\2"', $content, -1, $nbrep);
+ }
dol_syslog("dolWebsiteOutput end");
print $content;
}
+
+/**
+ * Clean an HTML page to report only content, so we can include it into another page
+ * It outputs content of file sanitized from html and body part.
+ *
+ * @param string $contentfile Path to file to include (must include website root. Example: 'mywebsite/mypage.php')
+ * @return void
+ */
+function dolIncludeHtmlContent($contentfile)
+{
+ global $conf, $db, $langs, $mysoc, $user, $website;
+ global $includehtmlcontentopened;
+
+ $MAXLEVEL=20;
+
+ $fullpathfile=DOL_DATA_ROOT.'/websites/'.$contentfile;
+ //$content = file_get_contents($fullpathfile);
+ //print preg_replace(array('/^.*]*>/ims','/<\/body>.*$/ims'), array('', ''), $content);*/
+
+ if (empty($includehtmlcontentopened)) $includehtmlcontentopened=0;
+ $includehtmlcontentopened++;
+ if ($includehtmlcontentopened > $MAXLEVEL)
+ {
+ print 'ERROR: RECURSIVE CONTENT LEVEL. Depth of recursive call is more than the limit of '.$MAXLEVEL.".\n";
+ return;
+ }
+ $res = include $fullpathfile; // Include because we want to execute code content
+ if (! $res)
+ {
+ print 'ERROR: FAILED TO INCLUDE PAGE '.$contentfile.".\n";
+ }
+
+ $includehtmlcontentopened--;
+}
+
diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
index 396ac54e9b5..a3ae305549d 100644
--- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
+++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
@@ -45,28 +45,28 @@ class pdf_einstein extends ModelePDFCommandes
* @var DoliDb Database handler
*/
public $db;
-
+
/**
* @var string model name
*/
public $name;
-
+
/**
* @var string model description (short text)
*/
public $description;
-
+
/**
* @var string document type
*/
public $type;
-
+
/**
* @var array() Minimum version of PHP required by module.
* e.g.: PHP ≥ 5.3 = array(5, 3)
*/
- public $phpmin = array(5, 2);
-
+ public $phpmin = array(5, 2);
+
/**
* Dolibarr version of the loaded document
* @public string
@@ -240,11 +240,11 @@ class pdf_einstein extends ModelePDFCommandes
$pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
$pdf->SetAutoPageBreak(1,0);
-
+
$heightforinfotot = 40; // Height reserved to output the info and total part
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
-
+
if (class_exists('TCPDF'))
{
$pdf->setPrintHeader(false);
@@ -263,10 +263,10 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->SetDrawColor(128,128,128);
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
- $pdf->SetSubject($outputlangs->transnoentities("Order"));
+ $pdf->SetSubject($outputlangs->transnoentities("PdfOrderTitle"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
- $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Order")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
+ $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfOrderTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
@@ -317,16 +317,16 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1);
$nexY = $pdf->GetY();
$height_incoterms=$nexY-$tab_top;
-
+
// Rect prend une longueur en 3eme param
$pdf->SetDrawColor(192,192,192);
$pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_incoterms+1);
-
+
$tab_top = $nexY+6;
$height_incoterms += 4;
}
}
-
+
// Affiche notes
$notetoshow=empty($object->note_public)?'':$object->note_public;
if (! empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE))
@@ -478,7 +478,7 @@ class pdf_einstein extends ModelePDFCommandes
// Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva
if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva;
else $tvaligne=$object->lines[$i]->total_tva;
-
+
$localtax1ligne=$object->lines[$i]->total_localtax1;
$localtax2ligne=$object->lines[$i]->total_localtax2;
$localtax1_rate=$object->lines[$i]->localtax1_tx;
@@ -585,7 +585,7 @@ class pdf_einstein extends ModelePDFCommandes
$posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs);
}
*/
-
+
// Pied de page
$this->_pagefoot($pdf,$object,$outputlangs);
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
@@ -1201,7 +1201,7 @@ class pdf_einstein extends ModelePDFCommandes
* @param string $titlekey Translation key to show as title of document
* @return void
*/
- function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey="Order")
+ function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey="PdfOrderTitle")
{
global $conf,$langs,$hookmanager;
@@ -1294,7 +1294,7 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->MultiCell(100, 3, $langs->trans("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R');
}
}
-
+
$posy+=2;
// Show list of linked objects
diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
index 69e3af19224..da35434a34f 100644
--- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
+++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
@@ -284,10 +284,10 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetDrawColor(128,128,128);
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
- $pdf->SetSubject($outputlangs->transnoentities("Invoice"));
+ $pdf->SetSubject($outputlangs->transnoentities("PdfInvoiceTitle"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
- $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Invoice")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
+ $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfInvoiceTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
@@ -1141,26 +1141,26 @@ class pdf_crabe extends ModelePDFFactures
}
//}
-
+
// VAT
// Situations totals migth be wrong on huge amounts
if ($object->situation_cycle_ref && $object->situation_counter > 1) {
-
+
$sum_pdf_tva = 0;
foreach($this->tva as $tvakey => $tvaval){
$sum_pdf_tva+=$tvaval; // sum VAT amounts to compare to object
}
-
+
if($sum_pdf_tva!=$object->total_tva) { // apply coef to recover the VAT object amount (the good one)
$coef_fix_tva = $object->total_tva / $sum_pdf_tva;
-
+
foreach($this->tva as $tvakey => $tvaval) {
$this->tva[$tvakey]=$tvaval * $coef_fix_tva;
}
}
-
+
}
-
+
foreach($this->tva as $tvakey => $tvaval)
{
if ($tvakey != 0) // On affiche pas taux 0
@@ -1559,7 +1559,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetFont('','B', $default_font_size + 3);
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60);
- $title=$outputlangs->transnoentities("Invoice");
+ $title=$outputlangs->transnoentities("PdfInvoiceTitle");
if ($object->type == 1) $title=$outputlangs->transnoentities("InvoiceReplacement");
if ($object->type == 2) $title=$outputlangs->transnoentities("InvoiceAvoir");
if ($object->type == 3) $title=$outputlangs->transnoentities("InvoiceDeposit");
diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php
index 3eb284ec7fc..250796dd9d5 100644
--- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php
+++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php
@@ -273,7 +273,7 @@ class pdf_azur extends ModelePDFPropales
$pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
$pdf->SetAutoPageBreak(1,0);
-
+
if (class_exists('TCPDF'))
{
$pdf->setPrintHeader(false);
@@ -292,10 +292,10 @@ class pdf_azur extends ModelePDFPropales
$pdf->SetDrawColor(128,128,128);
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
- $pdf->SetSubject($outputlangs->transnoentities("CommercialProposal"));
+ $pdf->SetSubject($outputlangs->transnoentities("PdfCommercialProposalTitle"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
- $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("CommercialProposal")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
+ $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfCommercialProposalTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
@@ -322,19 +322,19 @@ class pdf_azur extends ModelePDFPropales
$pdf->AddPage();
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++;
-
+
$heightforinfotot = 40; // Height reserved to output the info and total part
$heightforsignature = empty($conf->global->PROPAL_DISABLE_SIGNATURE)?(pdfGetHeightForHtmlContent($pdf, $outputlangs->transnoentities("ProposalCustomerSignature"))+10):0;
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
- //print $heightforinfotot + $heightforsignature + $heightforfreetext + $heightforfooter;exit;
-
+ //print $heightforinfotot + $heightforsignature + $heightforfreetext + $heightforfooter;exit;
+
$this->_pagehead($pdf, $object, 1, $outputlangs);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0,0,0);
-
+
$tab_top = 90;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
$tab_height = 130;
@@ -383,7 +383,7 @@ class pdf_azur extends ModelePDFPropales
$notetoshow.='Affaire suivi par '.$tmpuser->getFullName($langs);
if ($tmpuser->email) $notetoshow.=', Mail: '.$tmpuser->email;
if ($tmpuser->office_phone) $notetoshow.=', Tel: '.$tmpuser->office_phone;
- }
+ }
if ($notetoshow)
{
$tab_top = 88 + $height_incoterms;
@@ -452,7 +452,7 @@ class pdf_azur extends ModelePDFPropales
$curX = $this->posxdesc-1;
$showpricebeforepagebreak=1;
-
+
$pdf->startTransaction();
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc);
$pageposafter=$pdf->getPage();
@@ -554,14 +554,14 @@ class pdf_azur extends ModelePDFPropales
// Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva
if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva;
else $tvaligne=$object->lines[$i]->total_tva;
-
+
$localtax1ligne=$object->lines[$i]->total_localtax1;
$localtax2ligne=$object->lines[$i]->total_localtax2;
$localtax1_rate=$object->lines[$i]->localtax1_tx;
$localtax2_rate=$object->lines[$i]->localtax2_tx;
$localtax1_type=$object->lines[$i]->localtax1_type;
- $localtax2_type=$object->lines[$i]->localtax2_type;
-
+ $localtax2_type=$object->lines[$i]->localtax2_type;
+
if ($object->remise_percent) $tvaligne-=($tvaligne*$object->remise_percent)/100;
if ($object->remise_percent) $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100;
if ($object->remise_percent) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100;
@@ -669,7 +669,7 @@ class pdf_azur extends ModelePDFPropales
{
$posy=$this->_signature_area($pdf, $object, $posy, $outputlangs);
}
-
+
// Pied de page
$this->_pagefoot($pdf,$object,$outputlangs);
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
@@ -1428,7 +1428,7 @@ class pdf_azur extends ModelePDFPropales
$pdf->SetFont('','B',$default_font_size + 3);
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60);
- $title=$outputlangs->transnoentities("CommercialProposal");
+ $title=$outputlangs->transnoentities("PdfCommercialProposalTitle");
$pdf->MultiCell(100, 4, $title, '', 'R');
$pdf->SetFont('','B',$default_font_size);
@@ -1481,7 +1481,7 @@ class pdf_azur extends ModelePDFPropales
$pdf->MultiCell(100, 3, $langs->trans("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R');
}
}
-
+
$posy+=2;
// Show list of linked objects
diff --git a/htdocs/core/website.inc.php b/htdocs/core/website.inc.php
new file mode 100644
index 00000000000..65db787734a
--- /dev/null
+++ b/htdocs/core/website.inc.php
@@ -0,0 +1,28 @@
+
+ *
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see .
+* or see http://www.gnu.org/
+*/
+
+/**
+ * \file htdocs/core/website.inc.php
+ * \brief Common file loaded used by all website pages (after master.inc.php)
+ * The global variable $website must be defined.
+ */
+
+
+include_once DOL_DOCUMENT_ROOT.'/websites/class/website.class.php';
+$website=new Website($db);
+$website->fetch(0,$websitekey);
diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php
index 3acef343aa9..853506920b3 100644
--- a/htdocs/fichinter/list.php
+++ b/htdocs/fichinter/list.php
@@ -249,8 +249,15 @@ $sql.= $db->plimit($limit+1, $offset);
$resql=$db->query($sql);
if ($resql)
{
- $num = $db->num_rows($resql);
-
+ $num = $db->num_rows($result);
+
+ if ($socid > 0)
+ {
+ $soc = new Societe($db);
+ $soc->fetch($socid);
+ if (empty($search_company)) $search_company = $soc->name;
+ }
+
$arrayofselected=is_array($toselect)?$toselect:array();
$param='';
diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php
index 3fadb82d067..7ecd7ba45fe 100644
--- a/htdocs/fourn/facture/list.php
+++ b/htdocs/fourn/facture/list.php
@@ -427,6 +427,7 @@ if ($resql)
{
$soc = new Societe($db);
$soc->fetch($socid);
+ if (empty($search_societe)) $search_societe = $soc->name;
}
$param='&socid='.$socid;
diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql
index dd0aba11632..6dc2521ca5d 100755
--- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql
+++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql
@@ -1106,6 +1106,7 @@ ALTER TABLE llx_projet_task_time ADD INDEX idx_projet_task_time_datehour (task_d
ALTER TABLE llx_projet_task MODIFY COLUMN duration_effective real DEFAULT 0 NULL;
ALTER TABLE llx_projet_task MODIFY COLUMN planned_workload real DEFAULT 0 NULL;
+-- VPGSQL8.2 ALTER TABLE llx_projet_task ALTER COLUMN planned_workload DROP NOT NULL;
-- add extrafield on ficheinter lines
CREATE TABLE llx_fichinterdet_extrafields
diff --git a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql
index c997d511fdb..63bc1a8d7a3 100755
--- a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql
+++ b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql
@@ -110,6 +110,7 @@ ALTER TABLE llx_projet_task_time ADD COLUMN task_date_withhour integer DEFAULT 0
ALTER TABLE llx_projet_task MODIFY COLUMN duration_effective real DEFAULT 0 NULL;
ALTER TABLE llx_projet_task MODIFY COLUMN planned_workload real DEFAULT 0 NULL;
+-- VPGSQL8.2 ALTER TABLE llx_projet_task ALTER COLUMN planned_workload DROP NOT NULL;
ALTER TABLE llx_commande_fournisseur MODIFY COLUMN date_livraison datetime;
diff --git a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql
index 7ed89ebb173..c67bd51b430 100644
--- a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql
+++ b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql
@@ -547,4 +547,6 @@ INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (178,
-- VMYSQL4.1 ALTER TABLE llx_establishment CHANGE COLUMN fk_user_mod fk_user_mod integer NULL;
-- VPGSQL8.2 ALTER TABLE llx_establishment ALTER COLUMN fk_user_mod DROP NOT NULL;
-ALTER TABLE llx_multicurrency_rate ADD COLUMN entity integer DEFAULT 1;
\ No newline at end of file
+ALTER TABLE llx_multicurrency_rate ADD COLUMN entity integer DEFAULT 1;
+
+ALTER TABLE llx_user MODIFY COLUMN login varchar(50);
\ No newline at end of file
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 e0e572ba4d2..386ae968505 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
@@ -467,6 +467,8 @@ DELETE FROM llx_categorie_project WHERE fk_categorie NOT IN (SELECT rowid FROM l
ALTER TABLE llx_inventory ADD COLUMN ref varchar(48);
+-- VPGSQL8.2 ALTER TABLE llx_projet_task ALTER COLUMN planned_workload DROP NOT NULL;
+
CREATE TABLE llx_loan_schedule
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
@@ -572,11 +574,6 @@ UPDATE llx_bank SET label= '(payment_salary)' WHERE label LIKE 'Règlement salai
ALTER TABLE llx_mailing_cibles MODIFY COLUMN source_url varchar(255);
-ALTER TABLE llx_c_paiement DROP PRIMARY KEY;
-ALTER TABLE llx_c_paiement ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER id;
-ALTER TABLE llx_c_paiement DROP INDEX uk_c_paiement;
-ALTER TABLE llx_c_paiement ADD UNIQUE INDEX uk_c_paiement(id, entity, code);
+-- VPGSQL8.2 CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_website FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
+-- VPGSQL8.2 CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_website_page FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
-ALTER TABLE llx_c_payment_term DROP PRIMARY KEY;
-ALTER TABLE llx_c_payment_term ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER rowid;
-ALTER TABLE llx_c_payment_term ADD UNIQUE INDEX uk_c_payment_term(rowid, entity, code);
diff --git a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql
index 43c2b813536..d9a496c6c91 100644
--- a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql
+++ b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql
@@ -28,4 +28,13 @@
ALTER TABLE llx_facture_fourn ADD COLUMN date_pointoftax date DEFAULT NULL;
ALTER TABLE llx_facture_fourn ADD COLUMN date_valid date;
+ALTER TABLE llx_website_page MODIFY COLUMN pageurl varchar(255);
+ALTER TABLE llx_c_paiement DROP PRIMARY KEY;
+ALTER TABLE llx_c_paiement ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER id;
+ALTER TABLE llx_c_paiement DROP INDEX uk_c_paiement;
+ALTER TABLE llx_c_paiement ADD UNIQUE INDEX uk_c_paiement(id, entity, code);
+
+ALTER TABLE llx_c_payment_term DROP PRIMARY KEY;
+ALTER TABLE llx_c_payment_term ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER rowid;
+ALTER TABLE llx_c_payment_term ADD UNIQUE INDEX uk_c_payment_term(rowid, entity, code);
diff --git a/htdocs/install/mysql/tables/llx_user.sql b/htdocs/install/mysql/tables/llx_user.sql
index d033ba5eca4..9df2f57a22b 100644
--- a/htdocs/install/mysql/tables/llx_user.sql
+++ b/htdocs/install/mysql/tables/llx_user.sql
@@ -33,7 +33,7 @@ create table llx_user
tms timestamp,
fk_user_creat integer,
fk_user_modif integer,
- login varchar(24) NOT NULL,
+ login varchar(50) NOT NULL,
pass varchar(128),
pass_crypted varchar(128),
pass_temp varchar(128), -- temporary password when asked for forget password
diff --git a/htdocs/install/mysql/tables/llx_website_page.sql b/htdocs/install/mysql/tables/llx_website_page.sql
index 69b6c417528..ff7cbb47a16 100644
--- a/htdocs/install/mysql/tables/llx_website_page.sql
+++ b/htdocs/install/mysql/tables/llx_website_page.sql
@@ -21,7 +21,7 @@ CREATE TABLE llx_website_page
(
rowid integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
fk_website integer NOT NULL,
- pageurl varchar(16) NOT NULL,
+ pageurl varchar(255) NOT NULL,
title varchar(255),
description varchar(255),
keywords varchar(255),
diff --git a/htdocs/install/pgsql/functions/functions.sql b/htdocs/install/pgsql/functions/functions.sql
index 2e4125e39e4..06ef2ed41e3 100644
--- a/htdocs/install/pgsql/functions/functions.sql
+++ b/htdocs/install/pgsql/functions/functions.sql
@@ -163,6 +163,8 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_user_extrafields FOR
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_usergroup FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_usergroup_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_product_price_by_qty FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
+CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_website FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
+CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_website_page FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
-- Add triggers for timestamp fields named date_m
diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang
index 189ef5c1fe2..03ddb1f958e 100644
--- a/htdocs/langs/en_US/bills.lang
+++ b/htdocs/langs/en_US/bills.lang
@@ -45,6 +45,7 @@ InvoiceHasAvoir=Was source of one or several credit notes
CardBill=Invoice card
PredefinedInvoices=Predefined Invoices
Invoice=Invoice
+PdfInvoiceTitle=Invoice
Invoices=Invoices
InvoiceLine=Invoice line
InvoiceCustomer=Customer invoice
diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang
index 363fb504a5b..07d7268a8f0 100644
--- a/htdocs/langs/en_US/orders.lang
+++ b/htdocs/langs/en_US/orders.lang
@@ -4,6 +4,7 @@ SuppliersOrdersArea=Suppliers orders area
OrderCard=Order card
OrderId=Order Id
Order=Order
+PdfOrderTitle=Order
Orders=Orders
OrderLine=Order line
OrderDate=Order date
diff --git a/htdocs/langs/en_US/propal.lang b/htdocs/langs/en_US/propal.lang
index aefe8e89cd2..61a8d4ff99c 100644
--- a/htdocs/langs/en_US/propal.lang
+++ b/htdocs/langs/en_US/propal.lang
@@ -6,6 +6,7 @@ ProposalsDraft=Draft commercial proposals
ProposalsOpened=Open commercial proposals
Prop=Commercial proposals
CommercialProposal=Commercial proposal
+PdfCommercialProposalTitle=Commercial proposal
ProposalCard=Proposal card
NewProp=New commercial proposal
NewPropal=New proposal
diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang
index cc2f31143ce..3b29f51e29d 100644
--- a/htdocs/langs/en_US/website.lang
+++ b/htdocs/langs/en_US/website.lang
@@ -7,20 +7,21 @@ WEBSITE_PAGENAME=Page name/alias
WEBSITE_HTML_HEADER=HTML Header
WEBSITE_CSS_URL=URL of external CSS file
WEBSITE_CSS_INLINE=CSS content
-PageNameAliasHelp=Name or alias of the page. This alias is also used to forge a SEO URL when website is read from a Virtual host of a Web server (like Apacke, Nginx, ...). Use the button "%s" to edit this alias.
+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.
MediaFiles=Media library
-EditCss=Edit Style/CSS
+EditCss=Edit Style/CSS or HTML header
EditMenu=Edit menu
EditPageMeta=Edit Meta
EditPageContent=Edit Content
Website=Web site
-Webpage=Web page
-AddPage=Add page
+Webpage=Web page/container
+AddPage=Add page/container
HomePage=Home Page
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.
-PageDeleted=Page '%s' of website %s deleted
-PageAdded=Page '%s' added
+PageContent=Page/Contenair
+PageDeleted=Page/Contenair '%s' of website %s deleted
+PageAdded=Page/Contenair '%s' added
ViewSiteInNewTab=View site in new tab
ViewPageInNewTab=View page in new tab
SetAsHomePage=Set as Home page
@@ -29,4 +30,9 @@ 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 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 install and setup this server before to point to directory: %s URL served by external server: %s
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. The inconvenient is that URL of pages are not user friendly and start with path of your Dolibarr. URL served by Dolibarr: %s
To use your own external web server to serve this web site, create a virtual host on your web server that point on directory %s then enter the name of this virtual server and click on the other preview button.
-NoPageYet=No pages yet
\ No newline at end of file
+VirtualHostUrlNotDefined=URL of the virtual host served by external web server not defined
+NoPageYet=No pages yet
+SyntaxHelp=Help on code syntax
+YouCanEditHtmlSource=You can edit HTML source code using the "Source" button in editor. You can also 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 dolIncludeHtmlContent($websitekey.'/contentaliastoinclude.php'); ?>
To include a link to download a file stored into the documents/medias directory, use syntax: <a href="/document.php?modulepart=medias&file=filename.ext">.
+ClonePage=Clone page/container
+CloneSite=Clone site
\ No newline at end of file
diff --git a/htdocs/langs/fr_FR/withdrawals.lang b/htdocs/langs/fr_FR/withdrawals.lang
index 07c87c60b23..d82237d0a64 100644
--- a/htdocs/langs/fr_FR/withdrawals.lang
+++ b/htdocs/langs/fr_FR/withdrawals.lang
@@ -76,7 +76,7 @@ ThisWillAlsoAddPaymentOnInvoice=Ceci créera également les paiements sur les fa
StatisticsByLineStatus=Statistiques par statut des lignes
RUM=RUM
RUMLong=Référence Unique de Mandat
-RUMWillBeGenerated=Le numéro de RUM sera généré une fois les informations de compte bancaire sont enregistrées
+RUMWillBeGenerated=Si vide le numéro de RUM sera généré une fois les informations de compte bancaire sont enregistrées
WithdrawMode=Mode de prélévement (FRST ou RECUR)
WithdrawRequestAmount=Montant de la demande de prélèvement
WithdrawRequestErrorNilAmount=Impossible de créer une demande de prélèvement pour un montant nul
diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php
index 1fc949c6f02..d789dc77b55 100644
--- a/htdocs/modulebuilder/index.php
+++ b/htdocs/modulebuilder/index.php
@@ -611,7 +611,7 @@ if (! dol_is_dir($dirins))
}
$dirins_ok=(dol_is_dir($dirins));
-llxHeader('', $langs->trans("ModuleBuilder"), "", '', 0, 0,
+llxHeader('', $langs->trans("ModuleBuilder"), '', '', 0, 0,
array(
'/includes/ace/ace.js',
'/includes/ace/ext-statusbar.js',
@@ -998,7 +998,7 @@ elseif (! empty($module))
dol_fiche_head($head2, $tab, '', -1, '');
$doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%', '');
- print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file);
+ print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html'));
dol_fiche_end();
@@ -1052,7 +1052,7 @@ elseif (! empty($module))
print '';
$doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%');
- print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file);
+ print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html'));
print ' ';
print '
';
+ if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')) && empty($extrafields->attribute_computed[$key]))
+ {
+ $crit=$val;
+ $tmpkey=preg_replace('/search_options_/','',$key);
+ $searchclass='';
+ if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring';
+ if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
+ print '';
+ }
+ else
+ {
+ // for the type as 'checkbox', 'chkbxlst', 'sellist' we should use code instead of id (example: I declare a 'chkbxlst' to have a link with dictionnairy, I have to extend it with the 'code' instead 'rowid')
+ echo $extrafields->showInputField($key, $search_array_options['search_options_'.$key], '', '', 'search_');
+ }
+ print '
';
+ }
}
}
// Fields from hook
diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php
index 84050012a5a..67398674a2f 100644
--- a/htdocs/projet/class/project.class.php
+++ b/htdocs/projet/class/project.class.php
@@ -1000,6 +1000,17 @@ class Project extends CommonObject
}
$linkclose.=' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose.=' class="classfortooltip"';
+
+ if (! is_object($hookmanager)) {
+ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
+ $hookmanager=new HookManager($this->db);
+ }
+ $hookmanager->initHooks(array('projectdao'));
+ $parameters=array('id'=>$this->id);
+ // Note that $action and $object may have been modified by some hooks
+ $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action);
+ if ($reshook > 0)
+ $linkclose = $hookmanager->resPrint;
}
$picto = 'projectpub';
diff --git a/htdocs/public/websites/index.php b/htdocs/public/websites/index.php
index 0bc85dce463..84e0a72f9fd 100644
--- a/htdocs/public/websites/index.php
+++ b/htdocs/public/websites/index.php
@@ -47,8 +47,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$error=0;
-$website=GETPOST('website', 'alpha');
+$websitekey=GETPOST('website', 'alpha');
$pageid=GETPOST('page', 'alpha')?GETPOST('page', 'alpha'):GETPOST('pageid', 'alpha');
+$pageref=GETPOST('pageref', 'aZ09')?GETPOST('pageref', 'aZ09'):'';
$accessallowed = 1;
$type='';
@@ -69,8 +70,9 @@ if (empty($pageid))
require_once DOL_DOCUMENT_ROOT.'/websites/class/websitepage.class.php';
$object=new Website($db);
- $object->fetch(0, $website);
- if (empty($object->id))
+ $object->fetch(0, $websitekey);
+
+ if (empty($object->id))
{
if (empty($pageid))
{
@@ -84,23 +86,34 @@ if (empty($pageid))
$objectpage=new WebsitePage($db);
- if ($object->fk_default_home > 0)
+ if ($pageref)
{
- $result=$objectpage->fetch($object->fk_default_home);
+ $result=$objectpage->fetch(0, $object->id, $pageref);
if ($result > 0)
- {
- $pageid = $objectpage->id;
- }
+ {
+ $pageid = $objectpage->id;
+ }
}
-
- if (empty($pageid))
+ else
{
- $array=$objectpage->fetchAll($object->id);
- if (is_array($array) && count($array) > 0)
- {
- $firstrep=reset($array);
- $pageid=$firstrep->id;
- }
+ if ($object->fk_default_home > 0)
+ {
+ $result=$objectpage->fetch($object->fk_default_home);
+ if ($result > 0)
+ {
+ $pageid = $objectpage->id;
+ }
+ }
+
+ if (empty($pageid))
+ {
+ $array=$objectpage->fetchAll($object->id);
+ if (is_array($array) && count($array) > 0)
+ {
+ $firstrep=reset($array);
+ $pageid=$firstrep->id;
+ }
+ }
}
}
if (empty($pageid))
@@ -125,11 +138,11 @@ if ($pageid == 'css') // No more used ?
//if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate');
//else
header('Cache-Control: no-cache');
- $original_file=$dolibarr_main_data_root.'/websites/'.$website.'/styles.css.php';
+ $original_file=$dolibarr_main_data_root.'/websites/'.$websitekey.'/styles.css.php';
}
else
{
- $original_file=$dolibarr_main_data_root.'/websites/'.$website.'/page'.$pageid.'.tpl.php';
+ $original_file=$dolibarr_main_data_root.'/websites/'.$websitekey.'/page'.$pageid.'.tpl.php';
}
// Find the subdirectory name as the reference
@@ -177,7 +190,7 @@ if (! file_exists($original_file_osencoded))
// Output page content
define('USEDOLIBARRSERVER', 1);
-print "\n".''."\n";
+print ''."\n";
include_once $original_file_osencoded;
diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php
index 7385b466e34..97ae92e4044 100644
--- a/htdocs/societe/rib.php
+++ b/htdocs/societe/rib.php
@@ -204,7 +204,8 @@ if (empty($reshook))
$account->proprio = GETPOST('proprio','alpha');
$account->owner_address = GETPOST('owner_address','alpha');
$account->frstrecur = GETPOST('frstrecur');
-
+ $account->rum = GETPOST('rum','alpha');
+
// This test can be done only once properties were set
if ($account->needIBAN() == 1)
{
@@ -868,7 +869,7 @@ if ($socid && $action == 'create' && $user->rights->societe->creer)
// RUM
print '
'.$langs->trans("RUM").'
';
- print '
'.$langs->trans("RUMWillBeGenerated").'
';
+ print '
'.$langs->trans("RUMWillBeGenerated").'
';
print '
'.$langs->trans("WithdrawMode").'
';
$tblArraychoice = array("FRST" => $langs->trans("FRST"), "RECUR" => $langs->trans("RECUR"));
diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php
index 46650804063..06015d69a2b 100644
--- a/htdocs/theme/eldy/style.css.php
+++ b/htdocs/theme/eldy/style.css.php
@@ -551,6 +551,9 @@ textarea.centpercent {
.cursormove {
cursor: move;
}
+.cursornotallowed {
+ cursor: not-allowed;
+}
.badge {
display: inline-block;
min-width: 10px;
@@ -3347,6 +3350,14 @@ a.websitebuttonsitepreview img {
width: 26px;
display: inline-block;
}
+a.websitebuttonsitepreviewdisabled img {
+ opacity: 0.2;
+}
+.websitehelp {
+ vertical-align: middle;
+ float: right;
+ padding-top: 8px;
+}
/* ============================================================================== */
@@ -3664,7 +3675,7 @@ a.cke_dialog_ui_button_ok span {
border: 1px solid #ddd;
margin: 0;
}
-#statusBar {
+.aceeditorstatusbar {
margin: 0;
padding: 0;
left: 0;
diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php
index 55a83326e75..11fd6b9650a 100644
--- a/htdocs/theme/md/style.css.php
+++ b/htdocs/theme/md/style.css.php
@@ -551,6 +551,9 @@ textarea.centpercent {
.cursormove {
cursor: move;
}
+.cursornotallowed {
+ cursor: not-allowed;
+}
.badge {
display: inline-block;
min-width: 10px;
@@ -3425,10 +3428,17 @@ a.websitebuttonsitepreview img {
width: 26px;
display: inline-block;
}
+a.websitebuttonsitepreviewdisabled img {
+ opacity: 0.2;
+}
.websiteiframenoborder {
border: 0px;
}
-
+.websitehelp {
+ vertical-align: middle;
+ float: right;
+ padding-top: 8px;
+}
/* ============================================================================== */
/* Module agenda */
@@ -3747,7 +3757,7 @@ a.cke_dialog_ui_button_ok span {
border: 1px solid #ddd;
margin: 0;
}
-#statusBar {
+.aceeditorstatusbar {
margin: 0;
padding: 0;
left: 0;
diff --git a/htdocs/websites/class/website.class.php b/htdocs/websites/class/website.class.php
index a77079c94a6..d7cb1559982 100644
--- a/htdocs/websites/class/website.class.php
+++ b/htdocs/websites/class/website.class.php
@@ -48,11 +48,6 @@ class Website extends CommonObject
*/
public $table_element = 'website';
- /**
- * @var WebsitePage[] Lines of all pages
- */
- public $lines = array();
-
/**
* @var int
*/
@@ -85,13 +80,7 @@ class Website extends CommonObject
* @var string
*/
public $virtualhost;
-
-
- public $records;
-
- /**
- */
-
+
/**
* Constructor
@@ -117,6 +106,7 @@ class Website extends CommonObject
dol_syslog(__METHOD__, LOG_DEBUG);
$error = 0;
+ $now=dol_now();
// Clean parameters
if (isset($this->entity)) {
@@ -131,7 +121,8 @@ class Website extends CommonObject
if (isset($this->status)) {
$this->status = trim($this->status);
}
- if (empty($this->date_creation)) $this->date_creation = dol_now();
+ if (empty($this->date_creation)) $this->date_creation = $now;
+ if (empty($this->date_modification)) $this->date_modification = $now;
// Check parameters
// Put here code to add control on parameters values
@@ -144,8 +135,9 @@ class Website extends CommonObject
$sql.= 'status,';
$sql.= 'fk_default_home,';
$sql.= 'virtualhost,';
- $sql.= 'fk_user_create';
- $sql.= 'date_creation';
+ $sql.= 'fk_user_create,';
+ $sql.= 'date_creation,';
+ $sql.= 'tmps';
$sql .= ') VALUES (';
$sql .= ' '.(! isset($this->entity)?'NULL':$this->entity).',';
$sql .= ' '.(! isset($this->ref)?'NULL':"'".$this->db->escape($this->ref)."'").',';
@@ -155,6 +147,7 @@ class Website extends CommonObject
$sql .= ' '.(! isset($this->virtualhost)?'NULL':$this->virtualhost).',';
$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 .= ' '.(! isset($this->date_modification) || dol_strlen($this->date_modification)==0?'NULL':"'".$this->db->idate($this->date_creation)."'");
$sql .= ')';
$this->db->begin();
@@ -215,10 +208,10 @@ class Website extends CommonObject
$sql .= " t.fk_user_create,";
$sql .= " t.fk_user_modif,";
$sql .= " t.date_creation,";
- $sql .= " t.tms";
+ $sql .= " t.tms as date_modification";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
if (null !== $ref) {
- $sql .= ' WHERE t.ref = ' . '\'' . $ref . '\'';
+ $sql .= " WHERE t.ref = '" . $this->db->escape($ref) . "'";
} else {
$sql .= ' WHERE t.rowid = ' . $id;
}
@@ -230,7 +223,7 @@ class Website extends CommonObject
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
-
+
$this->entity = $obj->entity;
$this->ref = $obj->ref;
$this->description = $obj->description;
@@ -240,7 +233,7 @@ class Website extends CommonObject
$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->tms = $this->db->jdate($obj->tms);
+ $this->date_modification = $this->db->jdate($obj->date_modification);
}
$this->db->free($resql);
@@ -284,7 +277,7 @@ class Website extends CommonObject
$sql .= " t.fk_user_create,";
$sql .= " t.fk_user_modif,";
$sql .= " t.date_creation,";
- $sql .= " t.tms";
+ $sql .= " t.tms as date_modification";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t';
// Manage filter
@@ -297,7 +290,7 @@ class Website extends CommonObject
if (count($sqlwhere) > 0) {
$sql .= ' WHERE ' . implode(' '.$filtermode.' ', $sqlwhere);
}
-
+
if (!empty($sortfield)) {
$sql .= $this->db->order($sortfield,$sortorder);
}
@@ -314,7 +307,7 @@ class Website extends CommonObject
$line = new self($this->db);
$line->id = $obj->rowid;
-
+
$line->entity = $obj->entity;
$line->ref = $obj->ref;
$line->description = $obj->description;
@@ -324,7 +317,7 @@ class Website extends CommonObject
$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->tms = $this->db->jdate($obj->tms);
+ $line->date_modification = $this->db->jdate($obj->date_modification);
$this->records[$line->id] = $line;
}
@@ -354,7 +347,7 @@ class Website extends CommonObject
dol_syslog(__METHOD__, LOG_DEBUG);
// Clean parameters
-
+
if (isset($this->entity)) {
$this->entity = trim($this->entity);
}
@@ -380,8 +373,8 @@ class Website extends CommonObject
$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 .= ' tms = '.(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : "'".$this->db->idate(dol_now())."'");
+ $sql .= ' date_creation = '.(! isset($this->date_creation) || dol_strlen($this->date_creation) != 0 ? "'".$this->db->idate($this->date_creation)."'" : 'null');
+ $sql .= ', tms = '.(dol_strlen($this->date_modification) != 0 ? "'".$this->db->idate($this->date_modification)."'" : "'".$this->db->idate(dol_now())."'");
$sql .= ' WHERE rowid=' . $this->id;
$this->db->begin();
@@ -552,7 +545,7 @@ class Website extends CommonObject
$result.= $link . $this->ref . $linkend;
return $result;
}
-
+
/**
* Retourne le libelle du status d'un user (actif, inactif)
*
@@ -607,8 +600,8 @@ class Website extends CommonObject
if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
}
}
-
-
+
+
/**
* Initialise object with example values
* Id must be 0 if object instance is a specimen
@@ -618,9 +611,9 @@ class Website extends CommonObject
public function initAsSpecimen()
{
global $user;
-
+
$this->id = 0;
-
+
$this->entity = 1;
$this->ref = 'myspecimenwebsite';
$this->description = 'A specimen website';
@@ -632,7 +625,7 @@ class Website extends CommonObject
$this->date_creation = dol_now();
$this->tms = dol_now();
-
+
}
}
diff --git a/htdocs/websites/class/websitepage.class.php b/htdocs/websites/class/websitepage.class.php
index 4f9dc58c615..d313905a3bc 100644
--- a/htdocs/websites/class/websitepage.class.php
+++ b/htdocs/websites/class/websitepage.class.php
@@ -109,10 +109,10 @@ class WebsitePage extends CommonObject
if (isset($this->status)) {
$this->status = trim($this->status);
}
- if (isset($this->date_creation)) {
+ if (empty($this->date_creation)) {
$this->date_creation = $now;
}
- if (isset($this->date_modification)) {
+ if (empty($this->date_modification)) {
$this->date_modification = $now;
}
@@ -181,9 +181,9 @@ class WebsitePage extends CommonObject
/**
* Load object in memory from the database
*
- * @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
+ * @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 (page name must also be filled if this parameter is used)
+ * @param string $page Page name (website id must also be filled if this parameter is used)
*
* @return int <0 if KO, 0 if not found, >0 if OK
*/
@@ -205,12 +205,17 @@ class WebsitePage extends CommonObject
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
//$sql .= ' WHERE entity IN ('.getEntity('website').')'; // entity is on website level
$sql .= ' WHERE 1 = 1';
- if (null !== $website_id) {
- $sql .= " AND t.fk_website = '" . $this->db->escape($website_id) . "'";
- if ($page) $sql .= " AND t.pageurl = '" . $this->db->escape($page) . "'";
- } else {
+ if ($id > 0)
+ {
$sql .= ' AND t.rowid = ' . $id;
}
+ else
+ {
+ if (null !== $website_id) {
+ $sql .= " AND t.fk_website = '" . $this->db->escape($website_id) . "'";
+ if ($page) $sql .= " AND t.pageurl = '" . $this->db->escape($page) . "'";
+ }
+ }
$sql .= $this->db->plimit(1);
$resql = $this->db->query($sql);
@@ -381,8 +386,8 @@ class WebsitePage extends CommonObject
$sql .= ' keywords = '.(isset($this->keywords)?"'".$this->db->escape($this->keywords)."'":"null").',';
$sql .= ' content = '.(isset($this->content)?"'".$this->db->escape($this->content)."'":"null").',';
$sql .= ' status = '.(isset($this->status)?$this->status:"null").',';
- $sql .= ' date_creation = '.(! isset($this->date_creation) || dol_strlen($this->date_creation) != 0 ? "'".$this->db->idate($this->date_creation)."'" : 'null').',';
- $sql .= ' tms = '.(dol_strlen($this->date_modification) != 0 ? "'".$this->db->idate($this->date_modification)."'" : "'".$this->db->idate(dol_now())."'");
+ $sql .= ' date_creation = '.(! isset($this->date_creation) || dol_strlen($this->date_creation) != 0 ? "'".$this->db->idate($this->date_creation)."'" : 'null');
+ $sql .= ', tms = '.(dol_strlen($this->date_modification) != 0 ? "'".$this->db->idate($this->date_modification)."'" : "'".$this->db->idate(dol_now())."'");
$sql .= ' WHERE rowid=' . $this->id;
$this->db->begin();
@@ -477,17 +482,17 @@ class WebsitePage extends CommonObject
/**
* Load an object from its id and create a new one in database
*
- * @param int $fromid Id of object to clone
- *
- * @return int New id of clone
+ * @param int $fromid Id of object to clone
+ * @return int New id of clone
*/
public function createFromClone($fromid)
{
+ global $user, $langs;
+
dol_syslog(__METHOD__, LOG_DEBUG);
- global $user;
$error = 0;
- $object = new Websitepage($this->db);
+ $object = new self($this->db);
$this->db->begin();
@@ -497,14 +502,17 @@ class WebsitePage extends CommonObject
$object->id = 0;
// Clear fields
- // ...
+ $object->ref = 'copy_of_'.$object->ref;
+ $object->pageurl = 'copy_of_'.$object->pageurl;
+ $object->title = $langs->trans("CopyOf").' '.$object->title;
// Create clone
$result = $object->create($user);
// Other options
if ($result < 0) {
- $error ++;
+ $error++;
+ $this->error = $object->error;
$this->errors = $object->errors;
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
}
@@ -517,7 +525,7 @@ class WebsitePage extends CommonObject
} else {
$this->db->rollback();
- return - 1;
+ return -1;
}
}
diff --git a/htdocs/websites/index.php b/htdocs/websites/index.php
index 2c9c364edac..0ae1902613c 100644
--- a/htdocs/websites/index.php
+++ b/htdocs/websites/index.php
@@ -70,6 +70,7 @@ function llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0,
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
require_once DOL_DOCUMENT_ROOT.'/websites/class/website.class.php';
require_once DOL_DOCUMENT_ROOT.'/websites/class/websitepage.class.php';
@@ -88,6 +89,7 @@ $error=0;
$website=GETPOST('website', 'alpha');
$page=GETPOST('page', 'alpha');
$pageid=GETPOST('pageid', 'int');
+$pageref=GETPOST('pageref', 'aZ09');
$action=GETPOST('action','alpha');
if (GETPOST('delete')) { $action='delete'; }
@@ -99,6 +101,8 @@ if (GETPOST('editmenu')) { $action='editmenu'; }
if (GETPOST('setashome')) { $action='setashome'; }
if (GETPOST('editmeta')) { $action='editmeta'; }
if (GETPOST('editcontent')) { $action='editcontent'; }
+if (GETPOST('createfromclone')) { $action='createfromclone'; }
+if (GETPOST('createpagefromclone')) { $action='createpagefromclone'; }
if (empty($action)) $action='preview';
@@ -122,14 +126,15 @@ if ($website)
}
if ($pageid < 0) $pageid = 0;
-if ($pageid > 0 && $action != 'add')
+if (($pageid > 0 || $pageref) && $action != 'add')
{
- $res = $objectpage->fetch($pageid);
+ $res = $objectpage->fetch($pageid, ($object->id > 0 ? $object->id : null), $pageref);
+ $pageid = $objectpage->id;
}
global $dolibarr_main_data_root;
$pathofwebsite=$dolibarr_main_data_root.'/websites/'.$website;
-$filehtmlheader=$pathofwebsite.'/header.html';
+$filehtmlheader=$pathofwebsite.'/htmlheader.html';
$filecss=$pathofwebsite.'/styles.css.php';
$filetpl=$pathofwebsite.'/page'.$pageid.'.tpl.php';
$fileindex=$pathofwebsite.'/index.php';
@@ -146,8 +151,7 @@ $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain
*/
if (GETPOST('refreshsite')) $pageid=0; // If we change the site, we reset the pageid.
-if (GETPOST('refreshpage')) $action='preview';
-
+if (GETPOST('refreshpage') && ! in_array($action, array('updatecss'))) $action='preview';
// Add page
if ($action == 'add')
@@ -167,6 +171,11 @@ if ($action == 'add')
$error++;
$action='create';
}
+ else if (! preg_match('/^[a-z0-9]+$/i', $objectpage->pageurl))
+ {
+ $error++;
+ setEventMessages($langs->transnoentities("ErrorFieldCanNotContainSpecialCharacters", $langs->transnoentities('WEBSITE_PAGENAME')), null, 'errors');
+ }
if (empty($objectpage->title))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("WEBSITE_TITLE")), null, 'errors');
@@ -241,56 +250,85 @@ if ($action == 'delete')
// Update css
if ($action == 'updatecss')
{
- $res = $object->fetch(0, $website);
+ if (GETPOST('refreshsite') || GETPOST('refreshpage')) // If we tried to reload another site/page, we stay on editcss mode.
+ {
+ $action='editcss';
+ }
+ else
+ {
+ $res = $object->fetch(0, $website);
- // Html header file
- $htmlheadercontent = ''."\n";
- $htmlheadercontent.= ''."\n";
- $htmlheadercontent.= ''."\n";
- $htmlheadercontent.= GETPOST('WEBSITE_HTML_HEADER');
+ // Html header file
+ $htmlheadercontent ='';
- dol_syslog("Save file css into ".$filehtmlheader);
+ $htmlheadercontent.= "\n";
- dol_mkdir($pathofwebsite);
- $result = file_put_contents($filehtmlheader, $htmlheadercontent);
- if (! empty($conf->global->MAIN_UMASK))
- @chmod($filehtmlheader, octdec($conf->global->MAIN_UMASK));
+ $htmlheadercontent.= preg_replace(array('/\n*/ims','/<\/html>\n*/ims'),array('',''),GETPOST('WEBSITE_HTML_HEADER'));
- if (! $result)
- {
- $error++;
- setEventMessages('Failed to write file '.$filehtmlheader, null, 'errors');
- }
+ $htmlheadercontent.= "\n".'"."\n";
- // Css file
- $csscontent = ''."\n";
- $csscontent.= ''."\n";
- $csscontent.= '"."\n";
- $csscontent.= ''."\n";
- $csscontent.= GETPOST('WEBSITE_CSS_INLINE');
+ dol_syslog("Save file css into ".$filehtmlheader);
- dol_syslog("Save file css into ".$filecss);
+ dol_mkdir($pathofwebsite);
+ $result = file_put_contents($filehtmlheader, $htmlheadercontent);
+ if (! empty($conf->global->MAIN_UMASK))
+ @chmod($filehtmlheader, octdec($conf->global->MAIN_UMASK));
- dol_mkdir($pathofwebsite);
- $result = file_put_contents($filecss, $csscontent);
- if (! empty($conf->global->MAIN_UMASK))
- @chmod($filecss, octdec($conf->global->MAIN_UMASK));
+ if (! $result)
+ {
+ $error++;
+ setEventMessages('Failed to write file '.$filehtmlheader, null, 'errors');
+ }
- if (! $result)
- {
- $error++;
- setEventMessages('Failed to write file '.$filecss, null, 'errors');
- }
+ // Css file
+ $csscontent ='';
+
+ $csscontent.= "\n";
+
+ $csscontent.= GETPOST('WEBSITE_CSS_INLINE');
+
+ $csscontent.= "\n".'"."\n";
- if (! $error)
- {
- setEventMessages($langs->trans("Saved"), null, 'mesgs');
- }
+ dol_syslog("Save file css into ".$filecss);
- $action='preview';
+ dol_mkdir($pathofwebsite);
+ $result = file_put_contents($filecss, $csscontent);
+ if (! empty($conf->global->MAIN_UMASK))
+ @chmod($filecss, octdec($conf->global->MAIN_UMASK));
+
+ if (! $result)
+ {
+ $error++;
+ setEventMessages('Failed to write file '.$filecss, null, 'errors');
+ }
+
+
+ if (! $error)
+ {
+ setEventMessages($langs->trans("Saved"), null, 'mesgs');
+ }
+
+ $action='preview';
+ }
}
// Update page
@@ -343,8 +381,22 @@ if ($action == 'updatemeta')
$objectpage->fk_website = $object->id;
+ // Check parameters
+ if (! preg_match('/^[a-z0-9\-\_]+$/i', $objectpage->pageurl))
+ {
+ $error++;
+ setEventMessages($langs->transnoentities("ErrorFieldCanNotContainSpecialCharacters", $langs->transnoentities('WEBSITE_PAGENAME')), null, 'errors');
+ $action='editmeta';
+ }
+
$res = $objectpage->fetch($pageid, $object->fk_website);
- if ($res > 0)
+ if ($res <= 0)
+ {
+ $error++;
+ dol_print_error($db, 'Page not found');
+ }
+
+ if (! $error)
{
$objectpage->old_object = clone $objectpage;
@@ -372,12 +424,14 @@ if ($action == 'updatemeta')
// Now generate the master.inc.php page
- dol_syslog("We regenerate the master file");
+ dol_syslog("We regenerate the master file (because we update meta)");
dol_delete_file($filemaster);
$mastercontent = ''."\n";
$result = file_put_contents($filemaster, $mastercontent);
if (! empty($conf->global->MAIN_UMASK))
@@ -393,11 +447,13 @@ if ($action == 'updatemeta')
dol_delete_file($fileoldalias);
}
- $aliascontent = 'id.".tpl.php';\n";
- $aliascontent.= '?>'."\n";
- $result = file_put_contents($filealias, $aliascontent);
+ $aliascontent = 'id.'.tpl.php\';';
+ $aliascontent.= 'else require $dolibarr_main_data_root.\'/websites/\'.$website->ref.\'/page'.$objectpage->id.'.tpl.php\';'."\n";
+ $aliascontent.= '?>'."\n";
+ $result = file_put_contents($filealias, $aliascontent);
if (! empty($conf->global->MAIN_UMASK))
@chmod($filealias, octdec($conf->global->MAIN_UMASK));
@@ -409,28 +465,42 @@ if ($action == 'updatemeta')
dol_delete_file($filetpl);
+ // TODO Same code than into updatecontent
$tplcontent ='';
- $tplcontent.= ''."\n";
+ $tplcontent.= "\n";
$tplcontent.= ''."\n";
$tplcontent.= ''."\n";
- $tplcontent.= ''.dol_escape_htmltag($objectpage->title).''."\n";
+ $tplcontent.= ''.dol_string_nohtmltag($objectpage->title, 0, 'UTF-8').''."\n";
+ $tplcontent.= ''."\n";
$tplcontent.= ''."\n";
$tplcontent.= ''."\n";
$tplcontent.= ''."\n";
$tplcontent.= ''."\n";
$tplcontent.= ''."\n";
- $tplcontent.= ''."\n";
- $tplcontent.= ''."\n";
- $tplcontent.= ''."\n";
+ $tplcontent.= ''."\n";
+ $tplcontent.= ''."\n";
+ $tplcontent.= ''."\n";
$tplcontent.= ''."\n";
$tplcontent.= ''."\n";
- $tplcontent.= ''."\n";
- $tplcontent.= 'ref.'/header.html"); ?>'."\n";
+ $tplcontent.= ''."\n";
+ $tplcontent.= 'ref.'/htmlheader.html"); ?>'."\n";
$tplcontent.= ''."\n";
- $tplcontent.= ''."\n";
+ $tplcontent.= ''."\n";
+ $tplcontent.= ''."\n";
$tplcontent.= $objectpage->content."\n";
$tplcontent.= ''."\n";
+
+ $tplcontent.= '"."\n";
+
//var_dump($filetpl);exit;
$result = file_put_contents($filetpl, $tplcontent);
if (! empty($conf->global->MAIN_UMASK))
@@ -451,17 +521,25 @@ if ($action == 'updatemeta')
$db->rollback();
}
}
- else
- {
- dol_print_error($db, 'Page not found');
- }
}
// Update page
-if ($action == 'updatecontent' || GETPOST('refreshsite') || GETPOST('refreshpage') || GETPOST('preview'))
+if (($action == 'updatecontent' || $action == 'createpagefromclone')
+ || ($action == 'preview' && (GETPOST('refreshsite') || GETPOST('refreshpage') || GETPOST('preview'))))
{
$object->fetch(0, $website);
+ if ($action == 'createpagefromclone')
+ {
+ $objectpage = new WebsitePage($db);
+ $result = $objectpage->createFromClone($pageid);
+ if ($result < 0)
+ {
+ setEventMessages($objectpage->error, $objectpage->errors, 'errors');
+ $action='preview';
+ }
+ }
+
// Check symlink to medias and restore it if ko
$pathtomedias=DOL_DATA_ROOT.'/medias';
$pathtomediasinwebsite=$pathofwebsite.'/medias';
@@ -533,7 +611,7 @@ if ($action == 'updatecontent' || GETPOST('refreshsite') || GETPOST('refreshpage
$mastercontent = ''."\n";
$result = file_put_contents($filemaster, $mastercontent);
if (! empty($conf->global->MAIN_UMASK))
@@ -551,7 +629,9 @@ if ($action == 'updatecontent' || GETPOST('refreshsite') || GETPOST('refreshpage
$aliascontent = 'id.".tpl.php';\n";
+ $aliascontent.= 'global $dolibarr_main_data_root;'."\n";
+ $aliascontent.= 'if (empty($dolibarr_main_data_root)) require \'./page'.$objectpage->id.'.tpl.php\';';
+ $aliascontent.= 'else require $dolibarr_main_data_root.\'/websites/\'.$website->ref.\'/page'.$objectpage->id.'.tpl.php\';'."\n";
$aliascontent.= '?>'."\n";
$result = file_put_contents($filealias, $aliascontent);
if (! empty($conf->global->MAIN_UMASK))
@@ -563,29 +643,34 @@ if ($action == 'updatecontent' || GETPOST('refreshsite') || GETPOST('refreshpage
// Now create the .tpl file with code to be able to make dynamic changes
dol_delete_file($filetpl);
- $tplcontent ='';
+ // TODO Same code than into updatemeta
+ $tplcontent ='';
$tplcontent.= "\n";
$tplcontent.= ''."\n";
$tplcontent.= ''."\n";
- $tplcontent.= ''.dol_escape_htmltag($objectpage->title).''."\n";
+ $tplcontent.= ''.dol_string_nohtmltag($objectpage->title, 0, 'UTF-8').''."\n";
+ $tplcontent.= ''."\n";
$tplcontent.= ''."\n";
$tplcontent.= ''."\n";
$tplcontent.= ''."\n";
$tplcontent.= ''."\n";
- $tplcontent.= ''."\n";
- $tplcontent.= ''."\n";
- $tplcontent.= ''."\n";
+ $tplcontent.= ''."\n";
+ $tplcontent.= ''."\n";
+ $tplcontent.= ''."\n";
$tplcontent.= ''."\n";
$tplcontent.= ''."\n";
- $tplcontent.= ''."\n";
- $tplcontent.= 'ref.'/header.html"); ?>'."\n";
+ $tplcontent.= ''."\n";
+ $tplcontent.= 'ref.'/htmlheader.html"); ?>'."\n";
$tplcontent.= ''."\n";
- $tplcontent.= ''."\n";
+ $tplcontent.= ''."\n";
+ $tplcontent.= ''."\n";
$tplcontent.= $objectpage->content."\n";
$tplcontent.= ''."\n";
@@ -638,7 +723,13 @@ $form = new Form($db);
$help_url='';
-llxHeader('', $langs->trans("WebsiteSetup"), $help_url);
+llxHeader('', $langs->trans("WebsiteSetup"), $help_url, '', 0, 0,
+ array(
+ '/includes/ace/ace.js',
+ '/includes/ace/ext-statusbar.js',
+ '/includes/ace/ext-language_tools.js',
+ //'/includes/ace/ext-chromevox.js'
+ ), array());
print "\n".'