Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into
develop_dict Conflicts: htdocs/install/mysql/migration/5.0.0-6.0.0.sql
This commit is contained in:
commit
26df1389f4
@ -2,6 +2,11 @@
|
||||
English Dolibarr ChangeLog
|
||||
--------------------------------------------------------------
|
||||
|
||||
|
||||
***** ChangeLog for 7.0.0 compared to 6.0.* *****
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 6.0.0 compared to 5.0.* *****
|
||||
|
||||
For developers:
|
||||
|
||||
@ -1 +1,4 @@
|
||||
http://www.taxrates.cc/index.html
|
||||
http://www.taxrates.cc/index.html
|
||||
|
||||
For India: VAT=IGST/CGST=Localtax1/SGST=Localtax2: https://cleartax.in/s/what-is-sgst-cgst-igst
|
||||
|
||||
|
||||
@ -100,7 +100,7 @@ elseif ($action == 'update_currency')
|
||||
if ($submit == $langs->trans('Modify'))
|
||||
{
|
||||
$fk_multicurrency = GETPOST('fk_multicurrency', 'int');
|
||||
$rate = GETPOST('rate', 'float');
|
||||
$rate = price2num(GETPOST('rate', 'alpha'));
|
||||
$currency = new MultiCurrency($db);
|
||||
|
||||
if ($currency->fetch($fk_multicurrency) > 0)
|
||||
|
||||
@ -73,7 +73,7 @@ $tablib[1] = "Websites";
|
||||
|
||||
// Requests to extract data
|
||||
$tabsql=array();
|
||||
$tabsql[1] = "SELECT f.rowid as rowid, f.entity, f.ref, f.description, f.status FROM ".MAIN_DB_PREFIX."website as f";
|
||||
$tabsql[1] = "SELECT f.rowid as rowid, f.entity, f.ref, f.description, f.virtualhost, f.status FROM ".MAIN_DB_PREFIX."website as f";
|
||||
|
||||
// Criteria to sort dictionaries
|
||||
$tabsqlsort=array();
|
||||
@ -81,15 +81,15 @@ $tabsqlsort[1] ="ref ASC";
|
||||
|
||||
// Nom des champs en resultat de select pour affichage du dictionnaire
|
||||
$tabfield=array();
|
||||
$tabfield[1] = "ref,description";
|
||||
$tabfield[1] = "ref,description,virtualhost";
|
||||
|
||||
// Nom des champs d'edition pour modification d'un enregistrement
|
||||
$tabfieldvalue=array();
|
||||
$tabfieldvalue[1] = "ref,description";
|
||||
$tabfieldvalue[1] = "ref,description,virtualhost";
|
||||
|
||||
// Nom des champs dans la table pour insertion d'un enregistrement
|
||||
$tabfieldinsert=array();
|
||||
$tabfieldinsert[1] = "ref,description,entity";
|
||||
$tabfieldinsert[1] = "ref,description,virtualhost,entity";
|
||||
|
||||
// Nom du rowid si le champ n'est pas de type autoincrement
|
||||
// Example: "" if id field is "rowid" and has autoincrement on
|
||||
@ -103,7 +103,7 @@ $tabcond[1] = (! empty($conf->websites->enabled));
|
||||
|
||||
// List of help for fields
|
||||
$tabhelp=array();
|
||||
$tabhelp[1] = array();
|
||||
$tabhelp[1] = array('ref'=>$langs->trans("EnterAnyCode"), 'virtualhost'=>$langs->trans("SetHereVirtualHost", DOL_DATA_ROOT.'/websites/<i>websiteref</i>'));
|
||||
|
||||
// List of check for fields (NOT USED YET)
|
||||
$tabfieldcheck=array();
|
||||
@ -114,7 +114,7 @@ $tabfieldcheck[1] = array();
|
||||
$elementList = array();
|
||||
$sourceList=array();
|
||||
|
||||
// Actions add or modify an entry into a dictionary
|
||||
// Actions add or modify a website
|
||||
if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha'))
|
||||
{
|
||||
$listfield=explode(',',$tabfield[$id]);
|
||||
@ -126,12 +126,25 @@ if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha'))
|
||||
$ok=1;
|
||||
foreach ($listfield as $f => $value)
|
||||
{
|
||||
if (! isset($_POST[$value]) || $_POST[$value]=='') // Fields that are not mandatory
|
||||
if ((! isset($_POST[$value]) || $_POST[$value]=='')
|
||||
&& (! in_array($listfield[$f], array('virtualhost')))) // Fields that are not mandatory
|
||||
{
|
||||
$ok=0;
|
||||
$fieldnamekey=$listfield[$f];
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||
}
|
||||
if ($value == 'ref' && ! preg_match('/^[a-z0-9]+$/i', $_POST[$value]))
|
||||
{
|
||||
$ok=0;
|
||||
$fieldnamekey=$listfield[$f];
|
||||
setEventMessages($langs->transnoentities("ErrorFieldCanNotContainSpecialCharacters", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// Clean parameters
|
||||
if (! empty($_POST['ref']))
|
||||
{
|
||||
$websitekey=strtolower($_POST['ref']);
|
||||
}
|
||||
|
||||
// Si verif ok et action add, on ajoute la ligne
|
||||
@ -153,6 +166,12 @@ if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha'))
|
||||
}
|
||||
}
|
||||
|
||||
/* $website=new Website($db);
|
||||
$website->ref=
|
||||
$website->description=
|
||||
$website->virtualhost=
|
||||
$website->create($user); */
|
||||
|
||||
// Add new entry
|
||||
$sql = "INSERT INTO ".$tabname[$id]." (";
|
||||
// List of fields
|
||||
@ -171,6 +190,9 @@ if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha'))
|
||||
if ($value == 'entity') {
|
||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||
}
|
||||
if ($value == 'ref') {
|
||||
$_POST[$listfieldvalue[$i]] = strtolower($_POST[$listfieldvalue[$i]]);
|
||||
}
|
||||
if ($i) $sql.=",";
|
||||
if ($_POST[$listfieldvalue[$i]] == '') $sql.="null";
|
||||
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||
@ -182,6 +204,29 @@ if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha'))
|
||||
$result = $db->query($sql);
|
||||
if ($result) // Add is ok
|
||||
{
|
||||
global $dolibarr_main_data_root;
|
||||
$pathofwebsite=$dolibarr_main_data_root.'/websites/'.$websitekey;
|
||||
$filehtmlheader=$pathofwebsite.'/htmlheader.html';
|
||||
$filecss=$pathofwebsite.'/styles.css.php';
|
||||
$filetpl=$pathofwebsite.'/page'.$pageid.'.tpl.php';
|
||||
$fileindex=$pathofwebsite.'/index.php';
|
||||
|
||||
// Css file
|
||||
$csscontent = '<!-- BEGIN DOLIBARR-WEBSITE-ADDED-HEADER -->'."\n";
|
||||
$csscontent.= '<!-- File generated to wrap the css file - YOU CAN MODIFY DIRECTLY THE FILE styles.css.php. Change affects all pages of website. -->'."\n";
|
||||
$csscontent.= '<?php '."\n";
|
||||
$csscontent.= "header('Content-type: text/css');\n";
|
||||
$csscontent.= "?>"."\n";
|
||||
$csscontent.= '<!-- END -->'."\n";
|
||||
$csscontent.= 'body { margin: 0; }'."\n";
|
||||
|
||||
dol_syslog("Save file css into ".$filecss);
|
||||
|
||||
dol_mkdir($pathofwebsite);
|
||||
$result = file_put_contents($filecss, $csscontent);
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($filecss, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
|
||||
unset($_POST); // Clean $_POST array, we keep only
|
||||
}
|
||||
@ -393,7 +438,11 @@ if ($id)
|
||||
{
|
||||
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]);
|
||||
elseif (! empty($tabhelp[$id][$value]))
|
||||
{
|
||||
if ($value == 'virtualhost') print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, 'tooltipvirtual');
|
||||
else print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
|
||||
}
|
||||
else print $valuetoshow;
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
@ -355,6 +355,7 @@ if ($resql)
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($socid);
|
||||
$title = $langs->trans('ListOfProposals') . ' - '.$soc->name;
|
||||
if (empty($search_societe)) $search_societe = $soc->name;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -578,6 +578,7 @@ if ($resql)
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($socid);
|
||||
$title = $langs->trans('ListOfOrders') . ' - '.$soc->name;
|
||||
if (empty($search_company)) $search_company = $soc->name;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -531,6 +531,7 @@ if ($resql)
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($socid);
|
||||
if (empty($search_societe)) $search_societe = $soc->name;
|
||||
}
|
||||
|
||||
$param='&socid='.$socid;
|
||||
|
||||
@ -1633,8 +1633,8 @@ class Contrat extends CommonObject
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options)>0) // For avoid conflicts if trigger used
|
||||
{
|
||||
$contractline = new ContratLigne($this->db);
|
||||
$contractline->array_options=$array_option;
|
||||
$contractline->id= $this->db->last_insert_id(MAIN_DB_PREFIX.$contractline->table_element);
|
||||
$contractline->array_options=$array_options;
|
||||
$contractline->id= $rowid;
|
||||
$result=$contractline->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
|
||||
@ -305,8 +305,15 @@ if ($resql)
|
||||
$i = 0;
|
||||
|
||||
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||
|
||||
if ($socid > 0)
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($socid);
|
||||
if (empty($search_name)) $search_name = $soc->name;
|
||||
}
|
||||
|
||||
$param='';
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($sall != '') $param.='&sall='.$sall;
|
||||
|
||||
@ -391,6 +391,9 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
$object->trackid = $trackid;
|
||||
$object->fk_element = $object->id;
|
||||
$object->elementtype = $object->element;
|
||||
if (is_array($attachedfiles) && count($attachedfiles)>0) {
|
||||
$object->attachedfiles = $attachedfiles;
|
||||
}
|
||||
|
||||
// Call of triggers
|
||||
if (! empty($trigger_name))
|
||||
|
||||
@ -52,7 +52,7 @@ class DolEditor
|
||||
* @param string $content Content of WYSIWIG field
|
||||
* @param int $width Width in pixel of edit area (auto by default)
|
||||
* @param int $height Height in pixel of edit area (200px by default)
|
||||
* @param string $toolbarname Name of bar set to use ('Full', 'dolibarr_notes[_encoded]', 'dolibarr_details[_encoded]'=the less featured, 'dolibarr_mailings[_encoded]', 'dolibarr_readonly')
|
||||
* @param string $toolbarname Name of bar set to use ('Full', 'dolibarr_notes[_encoded]', 'dolibarr_details[_encoded]'=the less featured, 'dolibarr_mailings[_encoded]', 'dolibarr_readonly', 'ace').
|
||||
* @param string $toolbarlocation Where bar is stored :
|
||||
* 'In' each window has its own toolbar
|
||||
* 'Out:name' share toolbar into the div called 'name'
|
||||
@ -145,9 +145,10 @@ class DolEditor
|
||||
* @param string $morejs Add more js. For example: ".on( \'saveSnapshot\', function(e) { alert(\'ee\'); });". Used by CKEditor only.
|
||||
* @param boolean $disallowAnyContent Disallow to use any content. true=restrict to a predefined list of allowed elements. Used by CKEditor only.
|
||||
* @param string $titlecontent Show title content before editor area. Used by ACE editor only.
|
||||
* @param string $option For ACE editor, set the source language ('html', 'php', 'javascript', ...)
|
||||
* @return void|string
|
||||
*/
|
||||
function Create($noprint=0, $morejs='', $disallowAnyContent=true, $titlecontent='')
|
||||
function Create($noprint=0, $morejs='', $disallowAnyContent=true, $titlecontent='', $option='')
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
@ -254,21 +255,21 @@ class DolEditor
|
||||
if (preg_match('/^ace/', $this->tool))
|
||||
{
|
||||
$found=1;
|
||||
$format=(GETPOST('format','aZ09')?GETPOST('format','aZ09'):'php');
|
||||
$format=$option;
|
||||
|
||||
$out.= '<!-- Output Ace editor -->'."\n";
|
||||
$out.= "\n".'<!-- Output Ace editor -->'."\n";
|
||||
|
||||
if ($titlecontent)
|
||||
{
|
||||
$out.= '<div class="aceeditorstatusbar" id="statusBar">'.$titlecontent;
|
||||
$out.= ' - <a id="morelines" href="#" class="right morelines">'.dol_escape_htmltag($langs->trans("ShowMoreLines")).'</a> ';
|
||||
$out.= '<div class="aceeditorstatusbar" id="statusBar'.$this->htmlname.'">'.$titlecontent;
|
||||
$out.= ' - <a id="morelines" href="#" class="right morelines'.$this->htmlname.'">'.dol_escape_htmltag($langs->trans("ShowMoreLines")).'</a> ';
|
||||
$out.= '</div>';
|
||||
$out.= '<script type="text/javascript" language="javascript">'."\n";
|
||||
$out.= 'jQuery(document).ready(function() {'."\n";
|
||||
$out.= ' var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid");
|
||||
var StatusBar = window.ace.require("ace/ext/statusbar").StatusBar; // Init status bar. Need lib ext-statusbar
|
||||
var statusBar = new StatusBar(aceEditor, document.getElementById("statusBar")); // Init status bar. Need lib ext-statusbar
|
||||
jQuery("#morelines").click(function() {
|
||||
var StatusBar = window.ace.require("ace/ext/statusbar").StatusBar; // Init status bar. Need lib ext-statusbar
|
||||
var statusBar = new StatusBar(aceEditor, document.getElementById("statusBar'.$this->htmlname.'")); // Init status bar. Need lib ext-statusbar
|
||||
jQuery(".morelines'.$this->htmlname.'").click(function() {
|
||||
console.log("We click on more lines");
|
||||
var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid");
|
||||
aceEditor.setOptions({ maxLines: 500 });
|
||||
@ -297,8 +298,8 @@ class DolEditor
|
||||
enableLiveAutocompletion: false, // the editor completes the statement while you are typing. Need lib ext-language_tools.js
|
||||
showPrintMargin: false, // hides the vertical limiting strip
|
||||
minLines: 10,
|
||||
maxLines: 34,
|
||||
fontSize: "110%" // ensures that the editor fits in the environment
|
||||
maxLines: '.(empty($this->height)?'34':(round($this->height/10))).',
|
||||
fontSize: "110%" // ensures that the editor fits in the environment
|
||||
});
|
||||
|
||||
// defines the style of the editor
|
||||
@ -311,10 +312,12 @@ class DolEditor
|
||||
|
||||
$out.= 'jQuery(document).ready(function() {
|
||||
jQuery("#savefile").click(function() {
|
||||
console.log("We click on savefile button");
|
||||
console.log("We click on savefile button for component '.$this->htmlname.'");
|
||||
var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid")
|
||||
console.log(aceEditor.getSession().getValue());
|
||||
jQuery("#'.$this->htmlname.'").val(aceEditor.getSession().getValue());
|
||||
if (strlen(jQuery("#'.$this->htmlname.'").html()) > 0) return true;
|
||||
else return false;
|
||||
/*if (jQuery("#'.$this->htmlname.'").html().length > 0) return true;
|
||||
else return false;*/
|
||||
});
|
||||
})';
|
||||
$out.= '</script>'."\n";
|
||||
|
||||
@ -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').')'),
|
||||
|
||||
@ -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";
|
||||
}
|
||||
}
|
||||
|
||||
@ -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('/(<img.*src=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^\/]*\/>)/', '\1medias/\4\5', $content, -1, $nbrep);
|
||||
$content=preg_replace('/(<img.*src=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^\/]*\/>)/', '\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('/^.*<body[^>]*>/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--;
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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");
|
||||
|
||||
@ -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
|
||||
|
||||
28
htdocs/core/website.inc.php
Normal file
28
htdocs/core/website.inc.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
* 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);
|
||||
@ -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='';
|
||||
|
||||
@ -427,6 +427,7 @@ if ($resql)
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($socid);
|
||||
if (empty($search_societe)) $search_societe = $soc->name;
|
||||
}
|
||||
|
||||
$param='&socid='.$socid;
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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;
|
||||
ALTER TABLE llx_multicurrency_rate ADD COLUMN entity integer DEFAULT 1;
|
||||
|
||||
ALTER TABLE llx_user MODIFY COLUMN login varchar(50);
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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),
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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.<br>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 "<strong>%s</strong>" to edit this alias.
|
||||
PageNameAliasHelp=Name or alias of the page.<br>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 "<strong>%s</strong>" 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 <strong>%s</strong> 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 <strong>%s</strong><br>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.<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 click on the other preview button.
|
||||
NoPageYet=No pages yet
|
||||
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 <strong><?php ?></strong>. The following global variables are available: $conf, $langs, $db, $mysoc, $user, $website.<br><br>You can also include content of another Page/Container with the following syntax: <strong><?php dolIncludeHtmlContent($websitekey.'/contentaliastoinclude.php'); ?></strong><br><br>To include a link to download a file stored into the documents/medias directory, use syntax:<br><strong><a href="/document.php?modulepart=medias&file=filename.ext"></strong>.
|
||||
ClonePage=Clone page/container
|
||||
CloneSite=Clone site
|
||||
@ -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
|
||||
|
||||
@ -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 '<input type="hidden" name="module" value="'.$module.'">';
|
||||
|
||||
$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 '<br>';
|
||||
print '<center>';
|
||||
print '<input type="submit" class="button" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
|
||||
@ -1314,7 +1314,7 @@ elseif (! empty($module))
|
||||
print '<input type="hidden" name="module" value="'.$module.'">';
|
||||
|
||||
$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 '<br>';
|
||||
print '<center>';
|
||||
print '<input type="submit" class="button" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
|
||||
@ -1365,7 +1365,7 @@ elseif (! empty($module))
|
||||
print '<input type="hidden" name="module" value="'.$module.'">';
|
||||
|
||||
$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 '<br>';
|
||||
print '<center>';
|
||||
print '<input type="submit" class="button" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
|
||||
@ -1410,7 +1410,7 @@ elseif (! empty($module))
|
||||
print '<input type="hidden" name="module" value="'.$module.'">';
|
||||
|
||||
$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 '<br>';
|
||||
print '<center>';
|
||||
print '<input type="submit" class="button" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
|
||||
@ -1454,7 +1454,7 @@ elseif (! empty($module))
|
||||
print '<input type="hidden" name="module" value="'.$module.'">';
|
||||
|
||||
$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 '<br>';
|
||||
print '<center>';
|
||||
print '<input type="submit" class="button" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
|
||||
|
||||
@ -609,7 +609,26 @@ else
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($arrayfields["ef.".$key]['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (! empty($arrayfields["ef.".$key]['checked'])) {
|
||||
$align=$extrafields->getAlignFlag($key);
|
||||
$typeofextrafield=$extrafields->attribute_type[$key];
|
||||
print '<td class="liste_titre'.($align?' '.$align:'').'">';
|
||||
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 '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">';
|
||||
}
|
||||
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 '</td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
// Fields from hook
|
||||
|
||||
@ -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';
|
||||
|
||||
@ -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".'<!-- Page content '.$original_file.' : Html with CSS link + Body was saved into tpl -->'."\n";
|
||||
print '<!-- Page content '.$original_file.' : Html with CSS link and html header + Body that was saved into tpl -->'."\n";
|
||||
include_once $original_file_osencoded;
|
||||
|
||||
|
||||
|
||||
@ -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 '<tr><td class="titlefieldcreate">'.$langs->trans("RUM").'</td>';
|
||||
print '<td>'.$langs->trans("RUMWillBeGenerated").'</td></tr>';
|
||||
print '<td colspan="4"><input size="30" type="text" name="rum" value="'.dol_escape_htmltag($account->rum).'"><br>'.$langs->trans("RUMWillBeGenerated").'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("WithdrawMode").'</td><td>';
|
||||
$tblArraychoice = array("FRST" => $langs->trans("FRST"), "RECUR" => $langs->trans("RECUR"));
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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 = '<!-- BEGIN DOLIBARR-WEBSITE-ADDED-HEADER -->'."\n";
|
||||
$htmlheadercontent.= '<!-- File generated to save common html header - YOU CAN MODIFY DIRECTLY THIS FILE. Change affects all pages of website. -->'."\n";
|
||||
$htmlheadercontent.= '<!-- END -->'."\n";
|
||||
$htmlheadercontent.= GETPOST('WEBSITE_HTML_HEADER');
|
||||
// Html header file
|
||||
$htmlheadercontent ='';
|
||||
|
||||
dol_syslog("Save file css into ".$filehtmlheader);
|
||||
$htmlheadercontent.= "<?php // BEGIN PHP\n";
|
||||
$htmlheadercontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
|
||||
$htmlheadercontent.= "if (! defined('USEDOLIBARRSERVER')) { require_once './master.inc.php'; } // Not already loaded"."\n";
|
||||
$htmlheadercontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
|
||||
$htmlheadercontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
|
||||
$htmlheadercontent.= "ob_start();\n";
|
||||
// $htmlheadercontent.= "header('Content-type: text/html');\n"; // Not required. htmlheader.html is never call as a standalone page
|
||||
$htmlheadercontent.= "// END PHP ?>\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('/<html>\n*/ims','/<\/html>\n*/ims'),array('',''),GETPOST('WEBSITE_HTML_HEADER'));
|
||||
|
||||
if (! $result)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages('Failed to write file '.$filehtmlheader, null, 'errors');
|
||||
}
|
||||
$htmlheadercontent.= "\n".'<?php // BEGIN PHP'."\n";
|
||||
$htmlheadercontent.= '$tmp = ob_get_contents(); ob_end_clean(); dolWebsiteOutput($tmp);'."\n";
|
||||
$htmlheadercontent.= "// END PHP ?>"."\n";
|
||||
|
||||
// Css file
|
||||
$csscontent = '<!-- BEGIN DOLIBARR-WEBSITE-ADDED-HEADER -->'."\n";
|
||||
$csscontent.= '<!-- File generated to wrap the css file - YOU CAN MODIFY DIRECTLY THIS FILE. Change affects all pages of website. -->'."\n";
|
||||
$csscontent.= '<?php '."\n";
|
||||
$csscontent.= "header('Content-type: text/css');\n";
|
||||
$csscontent.= "?>"."\n";
|
||||
$csscontent.= '<!-- END -->'."\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.= "<?php // BEGIN PHP\n";
|
||||
$csscontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
|
||||
$csscontent.= "if (! defined('USEDOLIBARRSERVER')) { require_once './master.inc.php'; } // Not already loaded"."\n";
|
||||
$csscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
|
||||
$csscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
|
||||
$csscontent.= "ob_start();\n";
|
||||
$csscontent.= "header('Content-type: text/css');\n";
|
||||
$csscontent.= "// END PHP ?>\n";
|
||||
|
||||
$csscontent.= GETPOST('WEBSITE_CSS_INLINE');
|
||||
|
||||
$csscontent.= "\n".'<?php // BEGIN PHP'."\n";
|
||||
$csscontent.= '$tmp = ob_get_contents(); ob_end_clean(); dolWebsiteOutput($tmp);'."\n";
|
||||
$csscontent.= "// END PHP ?>"."\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 = '<?php'."\n";
|
||||
$mastercontent.= '// File generated to link to the master file - DO NOT MODIFY - It is just an include'."\n";
|
||||
$mastercontent.= "if (! defined('USEDOLIBARRSERVER')) require '".DOL_DOCUMENT_ROOT."/master.inc.php';\n";
|
||||
$mastercontent.= "if (! defined('USEDOLIBARRSERVER')) require_once '".DOL_DOCUMENT_ROOT."/master.inc.php';\n";
|
||||
//$mastercontent.= "include_once DOL_DOCUMENT_ROOT.'/websites/class/website.class.php';"."\n";
|
||||
//$mastercontent.= '$website = new WebSite($db)'."\n";
|
||||
$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 = '<?php'."\n";
|
||||
$aliascontent.= '// File generated to wrap the page - DO NOT MODIFY - It is just an include'."\n";
|
||||
$aliascontent.= "include_once './page".$objectpage->id.".tpl.php';\n";
|
||||
$aliascontent.= '?>'."\n";
|
||||
$result = file_put_contents($filealias, $aliascontent);
|
||||
$aliascontent = '<?php'."\n";
|
||||
$aliascontent.= "// File generated to wrap the alias page - DO NOT MODIFY - It is just a copy of database page content\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))
|
||||
@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.= '<?php require "./master.inc.php"; ?>'."\n";
|
||||
$tplcontent.= "<?php // BEGIN PHP\n";
|
||||
$tplcontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
|
||||
$tplcontent.= "if (! defined('USEDOLIBARRSERVER')) { require_once './master.inc.php'; } // Not already loaded"."\n";
|
||||
$tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
|
||||
$tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
|
||||
$tplcontent.= "ob_start();\n";
|
||||
$tplcontent.= "// END PHP ?>\n";
|
||||
$tplcontent.= '<html>'."\n";
|
||||
$tplcontent.= '<header>'."\n";
|
||||
$tplcontent.= '<title>'.dol_escape_htmltag($objectpage->title).'</title>'."\n";
|
||||
$tplcontent.= '<title>'.dol_string_nohtmltag($objectpage->title, 0, 'UTF-8').'</title>'."\n";
|
||||
$tplcontent.= '<meta charset="UTF-8">'."\n";
|
||||
$tplcontent.= '<meta http-equiv="content-type" content="text/html; charset=utf-8" />'."\n";
|
||||
$tplcontent.= '<meta name="robots" content="index, follow" />'."\n";
|
||||
$tplcontent.= '<meta name="viewport" content="width=device-width, initial-scale=0.8">'."\n";
|
||||
$tplcontent.= '<link rel="canonical" href="'.$objectpage->pageurl.'">'."\n";
|
||||
$tplcontent.= '<meta name="keywords" content="'.join(', ', explode(',',$objectpage->keywords)).'" />'."\n";
|
||||
$tplcontent.= '<meta name="title" content="'.dol_escape_htmltag($objectpage->title).'" />'."\n";
|
||||
$tplcontent.= '<meta name="description" content="'.dol_escape_htmltag($objectpage->description).'" />'."\n";
|
||||
$tplcontent.= '<meta name="generator" content="'.DOL_APPLICATION_TITLE.'" />'."\n";
|
||||
$tplcontent.= '<meta name="title" content="'.dol_string_nohtmltag($objectpage->title, 0, 'UTF-8').'" />'."\n";
|
||||
$tplcontent.= '<meta name="description" content="'.dol_string_nohtmltag($objectpage->description, 0, 'UTF-8').'" />'."\n";
|
||||
$tplcontent.= '<meta name="generator" content="'.DOL_APPLICATION_TITLE.' '.DOL_VERSION.'" />'."\n";
|
||||
$tplcontent.= '<!-- Include link to CSS file -->'."\n";
|
||||
$tplcontent.= '<link rel="stylesheet" href="styles.css.php?websiteid='.$object->id.'" type="text/css" />'."\n";
|
||||
$tplcontent.= '<!-- Include common page header file -->'."\n";
|
||||
$tplcontent.= '<?php print file_get_contents(DOL_DATA_ROOT."/websites/'.$object->ref.'/header.html"); ?>'."\n";
|
||||
$tplcontent.= '<!-- Include common HTML header file -->'."\n";
|
||||
$tplcontent.= '<?php print file_get_contents(DOL_DATA_ROOT."/websites/'.$object->ref.'/htmlheader.html"); ?>'."\n";
|
||||
$tplcontent.= '</header>'."\n";
|
||||
|
||||
$tplcontent.= '<body>'."\n";
|
||||
$tplcontent.= '<!-- File generated by Dolibarr website module editor -->'."\n";
|
||||
$tplcontent.= '<body id="bodywebsite" class="bodywebsite">'."\n";
|
||||
$tplcontent.= $objectpage->content."\n";
|
||||
$tplcontent.= '</body>'."\n";
|
||||
|
||||
$tplcontent.= '<?php // BEGIN PHP'."\n";
|
||||
$tplcontent.= '$tmp = ob_get_contents(); ob_end_clean(); dolWebsiteOutput($tmp);'."\n";
|
||||
$tplcontent.= "// END PHP ?>"."\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 = '<?php'."\n";
|
||||
$mastercontent.= '// File generated to link to the master file'."\n";
|
||||
$mastercontent.= "if (! defined('USEDOLIBARRSERVER')) require '".DOL_DOCUMENT_ROOT."/master.inc.php';\n";
|
||||
$mastercontent.= "if (! defined('USEDOLIBARRSERVER')) require_once '".DOL_DOCUMENT_ROOT."/master.inc.php';\n";
|
||||
$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 = '<?php'."\n";
|
||||
$aliascontent.= "// File generated to wrap the alias page - DO NOT MODIFY - It is just a copy of database page content\n";
|
||||
$aliascontent.= "include_once './page".$objectpage->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.= "<?php // BEGIN PHP\n";
|
||||
$tplcontent.= "if (! defined('USEDOLIBARRSERVER')) { require './master.inc.php'; } // Not already loaded"."\n";
|
||||
$tplcontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
|
||||
$tplcontent.= "if (! defined('USEDOLIBARRSERVER')) { require_once './master.inc.php'; } // Not already loaded"."\n";
|
||||
$tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
|
||||
$tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
|
||||
$tplcontent.= "ob_start();\n";
|
||||
$tplcontent.= "// END PHP ?>\n";
|
||||
$tplcontent.= '<html>'."\n";
|
||||
$tplcontent.= '<header>'."\n";
|
||||
$tplcontent.= '<title>'.dol_escape_htmltag($objectpage->title).'</title>'."\n";
|
||||
$tplcontent.= '<title>'.dol_string_nohtmltag($objectpage->title, 0, 'UTF-8').'</title>'."\n";
|
||||
$tplcontent.= '<meta charset="UTF-8">'."\n";
|
||||
$tplcontent.= '<meta http-equiv="content-type" content="text/html; charset=utf-8" />'."\n";
|
||||
$tplcontent.= '<meta name="robots" content="index, follow" />'."\n";
|
||||
$tplcontent.= '<meta name="viewport" content="width=device-width, initial-scale=0.8">'."\n";
|
||||
$tplcontent.= '<meta name="keywords" content="'.join(', ', explode(',',$objectpage->keywords)).'" />'."\n";
|
||||
$tplcontent.= '<meta name="title" content="'.dol_escape_htmltag($objectpage->title).'" />'."\n";
|
||||
$tplcontent.= '<meta name="description" content="'.dol_escape_htmltag($objectpage->description).'" />'."\n";
|
||||
$tplcontent.= '<meta name="generator" content="'.DOL_APPLICATION_TITLE.'" />'."\n";
|
||||
$tplcontent.= '<meta name="title" content="'.dol_string_nohtmltag($objectpage->title, 0, 'UTF-8').'" />'."\n";
|
||||
$tplcontent.= '<meta name="description" content="'.dol_string_nohtmltag($objectpage->description, 0, 'UTF-8').'" />'."\n";
|
||||
$tplcontent.= '<meta name="generator" content="'.DOL_APPLICATION_TITLE.' '.DOL_VERSION.'" />'."\n";
|
||||
$tplcontent.= '<!-- Include link to CSS file -->'."\n";
|
||||
$tplcontent.= '<link rel="stylesheet" href="styles.css.php?websiteid='.$object->id.'" type="text/css" />'."\n";
|
||||
$tplcontent.= '<!-- Include common page header file -->'."\n";
|
||||
$tplcontent.= '<?php print file_get_contents(DOL_DATA_ROOT."/websites/'.$object->ref.'/header.html"); ?>'."\n";
|
||||
$tplcontent.= '<!-- Include common HTML header file -->'."\n";
|
||||
$tplcontent.= '<?php print file_get_contents(DOL_DATA_ROOT."/websites/'.$object->ref.'/htmlheader.html"); ?>'."\n";
|
||||
$tplcontent.= '</header>'."\n";
|
||||
|
||||
$tplcontent.= '<body>'."\n";
|
||||
$tplcontent.= '<!-- File generated by Dolibarr website module editor -->'."\n";
|
||||
$tplcontent.= '<body id="bodywebsite" class="bodywebsite">'."\n";
|
||||
$tplcontent.= $objectpage->content."\n";
|
||||
$tplcontent.= '</body>'."\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".'<form action="'.$_SERVER["PHP_SELF"].'" method="POST"><div>';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@ -727,7 +818,7 @@ if (count($object->records) > 0)
|
||||
//print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("MediaFiles")).'" name="editmedia">';
|
||||
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditCss")).'" name="editcss">';
|
||||
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditMenu")).'" name="editmenu">';
|
||||
print '<input type="submit"'.$disabled.' class="button" value="'.dol_escape_htmltag($langs->trans("AddPage")).'" name="create">';
|
||||
//print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("CloneSite")).'" name="createfromclone">';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
@ -737,7 +828,7 @@ if (count($object->records) > 0)
|
||||
|
||||
if ($action == 'preview')
|
||||
{
|
||||
print '<div class="websiteinputurl">';
|
||||
print '<div class="websiteinputurl" id="websiteinputurl">';
|
||||
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);
|
||||
@ -746,12 +837,9 @@ if (count($object->records) > 0)
|
||||
|
||||
$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'.($urlext?'':' websitebuttonsitepreviewdisabled cursornotallowed').'" id="previewsiteext" href="'.$urlext.'" target="tab'.$website.'ext" 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="'.$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');
|
||||
@ -760,9 +848,9 @@ if (count($object->records) > 0)
|
||||
|
||||
if (in_array($action, array('editcss','editmenu','create')))
|
||||
{
|
||||
if (preg_match('/^create/',$action)) print '<input type="submit" id="savefile" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
||||
if (preg_match('/^edit/',$action)) print '<input type="submit" id="savefile" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
||||
if ($action != 'preview') print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Cancel")).'" name="preview">';
|
||||
if (preg_match('/^create/',$action)) print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
||||
if (preg_match('/^edit/',$action)) print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
@ -779,6 +867,11 @@ if (count($object->records) > 0)
|
||||
$atleastonepage=(is_array($array) && count($array) > 0);
|
||||
|
||||
print '<div class="centpercent websitebar"'.($style?' style="'.$style.'"':'').'">';
|
||||
|
||||
print '<div class="websiteselection hideonsmartphoneimp">';
|
||||
print '<input type="submit"'.$disabled.' class="button" value="'.dol_escape_htmltag($langs->trans("AddPage")).'" name="create">';
|
||||
print '</div>';
|
||||
|
||||
print '<div class="websiteselection hideonsmartphoneimp">';
|
||||
print $langs->trans("Page").': ';
|
||||
print '</div>';
|
||||
@ -787,7 +880,7 @@ if (count($object->records) > 0)
|
||||
if ($action != 'add')
|
||||
{
|
||||
$out='';
|
||||
$out.='<select name="pageid" id="pageid" class="minwidth200">';
|
||||
$out.='<select name="pageid" id="pageid" class="minwidth200 maxwidth300">';
|
||||
if ($atleastonepage)
|
||||
{
|
||||
if (empty($pageid) && $action != 'create') // Page id is not defined, we try to take one
|
||||
@ -806,7 +899,7 @@ if (count($object->records) > 0)
|
||||
$out.='<option value="'.$key.'"';
|
||||
if ($pageid > 0 && $pageid == $key) $out.=' selected'; // To preselect a value
|
||||
$out.='>';
|
||||
$out.=$valpage->title;
|
||||
$out.=$valpage->pageurl.' - '.$valpage->title;
|
||||
if ($object->fk_default_home && $key == $object->fk_default_home) $out.=' ('.$langs->trans("HomePage").')';
|
||||
$out.='</option>';
|
||||
}
|
||||
@ -822,7 +915,6 @@ if (count($object->records) > 0)
|
||||
}
|
||||
|
||||
print '<input type="submit" class="button" name="refreshpage" value="'.$langs->trans("Load").'"'.($atleastonepage?'':' disabled="disabled"').'>';
|
||||
//print $form->selectarray('page', $array);
|
||||
|
||||
if ($action == 'preview')
|
||||
{
|
||||
@ -833,18 +925,15 @@ if (count($object->records) > 0)
|
||||
{
|
||||
print ' ';
|
||||
|
||||
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditPageContent")).'" name="editcontent">';
|
||||
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditPageMeta")).'" name="editmeta">';
|
||||
if ($object->fk_default_home > 0 && $pageid == $object->fk_default_home) print '<input type="submit" class="button" disabled="disabled" value="'.dol_escape_htmltag($langs->trans("SetAsHomePage")).'" name="setashome">';
|
||||
else print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("SetAsHomePage")).'" name="setashome">';
|
||||
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditPageMeta")).'" name="editmeta">';
|
||||
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditPageContent")).'" name="editcontent">';
|
||||
//print '<a href="'.$_SERVER["PHP_SELF"].'?action=editmeta&website='.urlencode($website).'&pageid='.urlencode($pageid).'" class="button">'.dol_escape_htmltag($langs->trans("EditPageMeta")).'</a>';
|
||||
//print '<a href="'.$_SERVER["PHP_SELF"].'?action=editcontent&website='.urlencode($website).'&pageid='.urlencode($pageid).'" class="button">'.dol_escape_htmltag($langs->trans("EditPageContent")).'</a>';
|
||||
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("ClonePage")).'" name="createpagefromclone">';
|
||||
print '<input type="submit" class="buttonDelete" name="delete" value="'.$langs->trans("Delete").'"'.($atleastonepage?'':' disabled="disabled"').'>';
|
||||
}
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
print '<div class="websiteselection">';
|
||||
print '</div>';
|
||||
|
||||
print '<div class="websitetools">';
|
||||
@ -854,29 +943,20 @@ if (count($object->records) > 0)
|
||||
$websitepage = new WebSitePage($db);
|
||||
$websitepage->fetch($pageid);
|
||||
|
||||
$realpage=$urlwithroot.'/public/websites/index.php?website='.$website.'&page='.$pageid;
|
||||
$realpage=$urlwithroot.'/public/websites/index.php?website='.$website.'&pageref='.$websitepage->pageurl;
|
||||
$pagealias = $websitepage->pageurl;
|
||||
|
||||
print '<div class="websiteinputurl">';
|
||||
print '<div class="websiteinputurl" id="websiteinputpage">';
|
||||
print '<input type="text" id="previewpageurl" class="minwidth200imp" name="previewsite" value="'.$pagealias.'" disabled="disabled">';
|
||||
//print '<input type="submit" class="button" name="previewwebsite" target="tab'.$website.'" value="'.$langs->trans("ViewSiteInNewTab").'">';
|
||||
$htmltext=$langs->trans("PageNameAliasHelp", $langs->transnoentitiesnoconv("EditPageMeta"));
|
||||
print $form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'helppagealias');
|
||||
print '</div>';
|
||||
|
||||
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>';
|
||||
}
|
||||
$urlext=$virtualurl.'/'.$pagealias.'.php';
|
||||
$urlint=$urlwithroot.'/public/websites/index.php?website='.$website;
|
||||
print '<a class="websitebuttonsitepreview'.($virtualurl?'':' websitebuttonsitepreviewdisabled cursornotallowed').'" id="previewpageext" href="'.$urlext.'" target="tab'.$website.'ext" 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, $virtualurl?$urlext:'<span class="error">'.$langs->trans("VirtualHostUrlNotDefined").'</span>'), 1, 'preview_ext');
|
||||
print '</a>';
|
||||
|
||||
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');
|
||||
@ -887,13 +967,23 @@ if (count($object->records) > 0)
|
||||
}
|
||||
if (! in_array($action, array('editcss','editmenu','create')))
|
||||
{
|
||||
if (preg_match('/^create/',$action)) print '<input type="submit" id="savefile" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
||||
if (preg_match('/^edit/',$action)) print '<input type="submit" id="savefile" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
||||
if ($action != 'preview') print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Cancel")).'" name="preview">';
|
||||
if (preg_match('/^create/',$action)) print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
||||
if (preg_match('/^edit/',$action)) print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<div class="websitehelp">';
|
||||
if (GETPOST('editcontent', 'alpha'))
|
||||
{
|
||||
$htmltext=$langs->transnoentitiesnoconv("YouCanEditHtmlSource");
|
||||
print $form->textwithpicto($langs->trans("SyntaxHelp"), $htmltext, 1, 'help', 'inline-block', 0, 2, 'tooltipsubstitution');
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
|
||||
|
||||
if ($action == 'preview')
|
||||
{
|
||||
// Adding jquery code to change on the fly url of preview ext
|
||||
@ -901,6 +991,11 @@ if (count($object->records) > 0)
|
||||
{
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#websiteinputurl").keyup(function() {
|
||||
console.log("Website external url modified "+jQuery("#previewsiteurl").val());
|
||||
if (jQuery("#previewsiteurl").val() != "") jQuery("a.websitebuttonsitepreviewdisabled img").css({ opacity: 1 });
|
||||
else jQuery("a.websitebuttonsitepreviewdisabled img").css({ opacity: 0.2 });
|
||||
});
|
||||
jQuery("#previewsiteext,#previewpageext").click(function() {
|
||||
newurl=jQuery("#previewsiteurl").val();
|
||||
newpage=jQuery("#previewsiteurl").val() + "/" + jQuery("#previewpageurl").val() + ".php";
|
||||
@ -953,14 +1048,21 @@ if ($action == 'editcss')
|
||||
|
||||
print '<br>';
|
||||
|
||||
$htmlheader = @file_get_contents($filehtmlheader);
|
||||
// Clean the php css file to remove php code and get only html part
|
||||
$htmlheader = preg_replace('/<!-- BEGIN DOLIBARR.*END -->/s', '', $htmlheader);
|
||||
|
||||
|
||||
$csscontent = @file_get_contents($filecss);
|
||||
// Clean the php css file to remove php code and get only css part
|
||||
$csscontent = preg_replace('/<!-- BEGIN DOLIBARR.*END -->/s', '', $csscontent);
|
||||
$csscontent = preg_replace('/<\?php \/\/ BEGIN PHP.*END PHP \?>\n*/ims', '', $csscontent);
|
||||
|
||||
$csscontent.= GETPOST('WEBSITE_CSS_INLINE');
|
||||
|
||||
if (! trim($csscontent)) $csscontent='/* CSS content (all pages) */'."\n".'body.bodywebsite { margin: 0; }';
|
||||
|
||||
|
||||
$htmlheader = @file_get_contents($filehtmlheader);
|
||||
// Clean the php htmlheader file to remove php code and get only html part
|
||||
$htmlheader = preg_replace('/<\?php \/\/ BEGIN PHP.*END PHP \?>\n*/ims', '', $htmlheader);
|
||||
|
||||
if (! trim($htmlheader)) $htmlheader='<html>'."\n".'<!-- HTML header content (all pages) -->'."\n".'</html>';
|
||||
else $htmlheader='<html>'."\n".$htmlheader."\n".'</html>';
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
@ -976,24 +1078,26 @@ if ($action == 'editcss')
|
||||
print '<tr><td class="tdtop">';
|
||||
print $langs->trans('WEBSITE_CSS_INLINE');
|
||||
print '</td><td>';
|
||||
print '<textarea class="flat centpercent" rows="20" name="WEBSITE_CSS_INLINE">';
|
||||
|
||||
$doleditor=new DolEditor('WEBSITE_CSS_INLINE', $csscontent, '', '220', 'ace', 'In', true, false, 'ace', 0, '100%', '');
|
||||
print $doleditor->Create(1, '', true, 'CSS', 'css');
|
||||
|
||||
/*print '<textarea class="flat centpercent" rows="20" name="WEBSITE_CSS_INLINE">';
|
||||
print $csscontent;
|
||||
print '</textarea>';
|
||||
print '</textarea>';*/
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td class="tdtop">';
|
||||
print '<tr><td class="tdtop">';
|
||||
print $langs->trans('WEBSITE_HTML_HEADER');
|
||||
print '</td><td>';
|
||||
print '<textarea class="flat centpercent" rows="20" name="WEBSITE_HTML_HEADER">';
|
||||
print $htmlheader;
|
||||
print '</textarea>';
|
||||
print '</td></tr>';
|
||||
|
||||
/*print '<tr><td>';
|
||||
print $langs->trans('WEBSITE_CSS_URL');
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="flat" size="96" name="WEBSITE_CSS_URL" value="'.dol_escape_htmltag($obj->WEBSITE_CSS_URL).'">';
|
||||
print '</td></tr>';*/
|
||||
$doleditor=new DolEditor('WEBSITE_HTML_HEADER', $htmlheader, '', '220', 'ace', 'In', true, false, 'ace', 0, '100%', '');
|
||||
print $doleditor->Create(1, '', true, 'HTML Header', 'html');
|
||||
|
||||
/*print '<textarea class="flat centpercent" rows="20" name="WEBSITE_HTML_HEADER">';
|
||||
print $htmlheader;
|
||||
print '</textarea>';*/
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -1032,13 +1136,13 @@ if ($action == 'editmeta' || $action == 'create')
|
||||
if (GETPOST('WEBSITE_DESCRIPTION')) $pagedescription=GETPOST('WEBSITE_DESCRIPTION');
|
||||
if (GETPOST('WEBSITE_KEYWORDS')) $pagekeywords=GETPOST('WEBSITE_KEYWORDS');
|
||||
|
||||
print '<tr><td class="titlefieldcreate">';
|
||||
print '<tr><td class="titlefieldcreate fieldrequired">';
|
||||
print $langs->trans('WEBSITE_PAGENAME');
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="flat" size="96" name="WEBSITE_PAGENAME" value="'.$pageurl.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>';
|
||||
print '<tr><td class="fieldrequired">';
|
||||
print $langs->trans('WEBSITE_TITLE');
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="flat" size="96" name="WEBSITE_TITLE" value="'.$pagetitle.'">';
|
||||
@ -1104,11 +1208,12 @@ if ($action == 'preview')
|
||||
{
|
||||
if ($pageid > 0)
|
||||
{
|
||||
// Ouput page under the Dolibarr top menu
|
||||
$objectpage->fetch($pageid);
|
||||
|
||||
$out = "\n".'<!-- Page content '.$filetpl.' : Div with (CSS + Page content from database) -->'."\n";
|
||||
$out = '<!-- Page content '.$filetpl.' : Div with (CSS + Page content from database) -->'."\n";
|
||||
|
||||
$out.='<div id="websitecontent" class="websitecontent">'."\n";
|
||||
$out.='<div id="websitecontentundertopmenu" class="websitecontentundertopmenu">'."\n";
|
||||
|
||||
$csscontent = @file_get_contents($filecss);
|
||||
|
||||
@ -1116,11 +1221,20 @@ if ($action == 'preview')
|
||||
$out.=$csscontent;
|
||||
$out.='</style>'."\n";
|
||||
|
||||
// Replace php code
|
||||
$content = preg_replace('/<\?php.*\?>/ims', '<span style="background: #ddd; border: 1px solid #ccc; border-radius: 4px;">...php...</span>', $objectpage->content);
|
||||
$out.='<div id="bodywebsite" class="bodywebsite">'."\n";
|
||||
|
||||
// Replace php code. Note $objectpage->content come from database and does not contains body tags.
|
||||
$content = preg_replace('/<\?php[^\?]+\?>\n*/ims', '<span style="background: #ddd; border: 1px solid #ccc; border-radius: 4px;">...php...</span>', $objectpage->content);
|
||||
|
||||
// Replace relative link / with dolibarr URL
|
||||
$content = preg_replace('/(href=")\/\"/', '\1'.DOL_URL_ROOT.'/websites/index.php?website='.$object->ref.'&pageid='.$object->fk_default_home.'"', $content, -1, $nbrep);
|
||||
// Replace relative link /xxx.php with dolibarr URL
|
||||
$content = preg_replace('/(href=")\/?([^\"]*)(\.php\")/', '\1'.DOL_URL_ROOT.'/websites/index.php?website='.$object->ref.'&pageref=\2"', $content, -1, $nbrep);
|
||||
|
||||
|
||||
$out.=$content."\n";
|
||||
|
||||
$out.='</div>';
|
||||
$out.='</div>';
|
||||
|
||||
$out.= "\n".'<!-- End page content '.$filetpl.' -->'."\n\n";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user