Merge branch 'develop' into new_branch_21_09_2018

This commit is contained in:
Philippe Grand 2018-09-27 09:29:26 +02:00 committed by GitHub
commit b7304e3d82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
60 changed files with 816 additions and 446 deletions

View File

@ -295,6 +295,7 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a
if (preg_match('/^DescADHERENT_/', $value)) $qualifiedforclean=0;
if (preg_match('/^SubmitTranslation/', $value)) $qualifiedforclean=0;
if (preg_match('/^ModuleCompanyCode/', $value)) $qualifiedforclean=0;
if (preg_match('/InDolibarr$/', $value)) $qualifiedforclean=0;
// admin.lang
if (preg_match('/^DAV_ALLOW_PUBLIC_DIR/i', $value)) $qualifiedforclean=0;
if (preg_match('/^DAV_ALLOW_ECM_DIR/i', $value)) $qualifiedforclean=0;

View File

@ -67,6 +67,8 @@ if ($action == 'update')
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS"],'chaine',0,'', $conf->entity);
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DESC", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DESC"],'chaine',0,'', $conf->entity);
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_REF"],'chaine',0,'', $conf->entity);
dolibarr_set_const($db, "MAIN_INVERT_SENDER_RECIPIENT", $_POST["MAIN_INVERT_SENDER_RECIPIENT"],'chaine',0,'', $conf->entity);
dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", $_POST["MAIN_PDF_USE_ISO_LOCATION"],'chaine',0,'', $conf->entity);
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS"],'chaine',0,'', $conf->entity);
@ -572,31 +574,36 @@ else // Show
print "</td>";
print '</tr>';
//Desc
// Hide Desc
print '<tr class="oddeven"><td>'.$langs->trans("HideDescOnPDF").'</td><td colspan="2">';
print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC,1);
print '</td></tr>';
//Ref
// Hide Ref
print '<tr class="oddeven"><td>'.$langs->trans("HideRefOnPDF").'</td><td colspan="2">';
print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF,1);
print '</td></tr>';
//Details
// Hide Details
print '<tr class="oddeven"><td>'.$langs->trans("HideDetailsOnPDF").'</td><td colspan="2">';
print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS,1);
print '</td></tr>';
// Invert sender and recipient
print '<tr class="oddeven"><td>'.$langs->trans("SwapSenderAndRecipientOnPDF").'</td><td colspan="2">';
print yn($conf->global->MAIN_INVERT_SENDER_RECIPIENT,1);
print '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("PlaceCustomerAddressToIsoLocation").'</td><td colspan="2">';
// Use French location
print '<tr class="oddeven"><td>'.$langs->trans("PlaceCustomerAddressToIsoLocation").'</td><td colspan="2">';
print yn($conf->global->MAIN_PDF_USE_ISO_LOCATION,1);
print '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("ShowDetailsInPDFPageFoot").'</td><td colspan="2">';
print '<tr class="oddeven"><td>'.$langs->trans("ShowDetailsInPDFPageFoot").'</td><td colspan="2">';
print $arraydetailsforpdffoot[($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS ? $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS : 0)];
print '</td></tr>';

View File

@ -874,7 +874,7 @@ else
}
}
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php">'.$langs->trans("BackToList").'</a>';
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$morehtmlright='';
$nbtry = $nbok = 0;

View File

@ -530,6 +530,81 @@ class Mailing extends CommonObject
}
/**
* Return a link to the object card (with optionaly the picto)
*
* @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
* @param string $option On what the link point to ('nolink', ...)
* @param int $notooltip 1=Disable tooltip
* @param string $morecss Add more css on link
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
*/
function getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1)
{
global $db, $conf, $langs, $hookmanager;
global $dolibarr_main_authentication, $dolibarr_main_demo;
global $menumanager;
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
$result = '';
$companylink = '';
$label = '<u>' . $langs->trans("ShowEmailing") . '</u>';
$label.= '<br>';
$label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
$url = DOL_URL_ROOT.'/comm/mailing/card.php?id='.$this->id;
if ($option != 'nolink')
{
// Add param to save lastsearch_values or not
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
}
$linkclose='';
if (empty($notooltip))
{
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
$label=$langs->trans("ShowEmailing");
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose.=' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
/*
$hookmanager->initHooks(array('myobjectdao'));
$parameters=array('id'=>$this->id);
$reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) $linkclose = $hookmanager->resPrint;
*/
}
else $linkclose = ($morecss?' class="'.$morecss.'"':'');
$linkstart = '<a href="'.$url.'"';
$linkstart.=$linkclose.'>';
$linkend='</a>';
$result .= $linkstart;
if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
if ($withpicto != 2) $result.= $this->ref;
$result .= $linkend;
//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
global $action;
$hookmanager->initHooks(array('emailingdao'));
$parameters=array('id'=>$this->id, 'getnomurl'=>$result);
$reshook=$hookmanager->executeHooks('getNomUrl',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) $result = $hookmanager->resPrint;
else $result .= $hookmanager->resPrint;
return $result;
}
/**
* Return label of status of emailing (draft, validated, ...)
*

View File

@ -35,15 +35,15 @@ $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$page = GETPOST("page",'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
if (empty($page) || $page == -1 || GETPOST('button_search','alpha') || GETPOST('button_removefilter','alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="m.date_creat";
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$sref=GETPOST("sref", "alpha");
$search_all=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$search_ref=GETPOST("search_ref", "alpha") ? GETPOST("search_ref", "alpha") : GETPOST("sref", "alpha");
$filteremail=GETPOST('filteremail','alpha');
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
@ -59,6 +59,53 @@ $fieldstosearchall = array(
'm.titre'=>'Ref',
);
$object = new Mailing($db);
/*
* Actions
*/
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
$parameters=array();
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
{
// Selection of new fields
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
// Purge search criteria
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
{
/*foreach($object->fields as $key => $val)
{
$search[$key]='';
}*/
$search_ref = '';
$search_all = '';
$toselect='';
$search_array_options=array();
}
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')
|| GETPOST('button_search_x','alpha') || GETPOST('button_search.x','alpha') || GETPOST('button_search','alpha'))
{
$massaction=''; // Protection to avoid mass action if we force a new search during a mass action confirmation
}
// Mass actions
/*$objectclass='MyObject';
$objectlabel='MyObject';
$permtoread = $user->rights->mymodule->read;
$permtodelete = $user->rights->mymodule->delete;
$uploaddir = $conf->mymodule->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
*/
}
/*
@ -76,8 +123,8 @@ if ($filteremail)
$sql.= " FROM ".MAIN_DB_PREFIX."mailing as m, ".MAIN_DB_PREFIX."mailing_cibles as mc";
$sql.= " WHERE m.rowid = mc.fk_mailing AND m.entity = ".$conf->entity;
$sql.= " AND mc.email = '".$db->escape($filteremail)."'";
if ($sref) $sql.= " AND m.rowid = '".$db->escape($sref)."'";
if ($sall) $sql.= " AND (m.titre like '%".$db->escape($sall)."%' OR m.sujet like '%".$db->escape($sall)."%' OR m.body like '%".$db->escape($sall)."%')";
if ($search_ref) $sql.= " AND m.rowid = '".$db->escape($search_ref)."'";
if ($search_all) $sql.= " AND (m.titre like '%".$db->escape($search_all)."%' OR m.sujet like '%".$db->escape($search_all)."%' OR m.body like '%".$db->escape($search_all)."%')";
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="m.rowid";
$sql.= $db->order($sortfield,$sortorder);
@ -88,8 +135,8 @@ else
$sql = "SELECT m.rowid, m.titre, m.nbemail, m.statut, m.date_creat as datec, m.date_envoi as date_envoi";
$sql.= " FROM ".MAIN_DB_PREFIX."mailing as m";
$sql.= " WHERE m.entity = ".$conf->entity;
if ($sref) $sql.= " AND m.rowid = '".$db->escape($sref)."'";
if ($sall) $sql.= " AND (m.titre like '%".$db->escape($sall)."%' OR m.sujet like '%".$db->escape($sall)."%' OR m.body like '%".$db->escape($sall)."%')";
if ($search_ref) $sql.= " AND m.rowid = '".$db->escape($search_ref)."'";
if ($search_all) $sql.= " AND (m.titre like '%".$db->escape($search_all)."%' OR m.sujet like '%".$db->escape($search_all)."%' OR m.body like '%".$db->escape($search_all)."%')";
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="m.rowid";
$sql.= $db->order($sortfield,$sortorder);
@ -115,7 +162,7 @@ if ($result)
$i = 0;
$param = "&sall=".urlencode($sall);
$param = "&search_all=".urlencode($search_all);
if ($filteremail) $param.='&filteremail='.urlencode($filteremail);
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
@ -135,11 +182,11 @@ if ($result)
print '<tr class="liste_titre_filter">';
print '<td class="liste_titre">';
print '<input type="text" class="flat maxwidth50" name="sref" value="'.dol_escape_htmltag($sref).'">';
print '<input type="text" class="flat maxwidth50" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
print '</td>';
// Title
print '<td class="liste_titre">';
print '<input type="text" class="flat maxwidth100 maxwidth50onsmartphone" name="sall" value="'.dol_escape_htmltag($sall).'">';
print '<input type="text" class="flat maxwidth100 maxwidth50onsmartphone" name="search_all" value="'.dol_escape_htmltag($search_all).'">';
print '</td>';
print '<td class="liste_titre">&nbsp;</td>';
if (! $filteremail) print '<td class="liste_titre">&nbsp;</td>';
@ -169,16 +216,22 @@ if ($result)
{
$obj = $db->fetch_object($result);
$email->id = $obj->rowid;
$email->ref = $obj->rowid;
print "<tr>";
print '<td><a href="'.DOL_URL_ROOT.'/comm/mailing/card.php?id='.$obj->rowid.'">';
print img_object($langs->trans("ShowEMail"),"email").' '.stripslashes($obj->rowid).'</a></td>';
print '<td>';
print $email->getNomUrl(1);
print '</td>';
print '<td>'.$obj->titre.'</td>';
// Date creation
print '<td align="center">';
print dol_print_date($db->jdate($obj->datec),'day');
print '</td>';
// Nb of email
if (! $filteremail)
{
@ -196,9 +249,11 @@ if ($result)
print $nbemail;
print '</td>';
}
// Last send
print '<td align="center" class="nowrap">'.dol_print_date($db->jdate($obj->date_envoi),'day').'</td>';
print '</td>';
// Status
print '<td align="right" class="nowrap">';
if ($filteremail)
@ -210,7 +265,9 @@ if ($result)
print $email->LibStatut($obj->statut,5);
}
print '</td>';
print '<td></td>';
print "</tr>\n";
$i++;
}

View File

@ -60,7 +60,8 @@ $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('bankcard','globalcard'));
/*
* Actions

View File

@ -49,6 +49,9 @@ $result=restrictedArea($user,'banque',$id,'bank_account&bank_account','','',$fie
$vline=isset($_GET["vline"])?$_GET["vline"]:$_POST["vline"];
$page=isset($_GET["page"])?$_GET["page"]:0;
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('banktreso','globalcard'));
/*
* View
*/
@ -130,6 +133,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
// Remainder to pay in future
$sqls = array();
// Customer invoices
$sql = "SELECT 'invoice' as family, f.rowid as objid, f.facnumber as ref, f.total_ttc, f.type, f.date_lim_reglement as dlr,";
@ -138,79 +142,55 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid";
$sql.= " WHERE f.entity = ".$conf->entity;
$sql.= " AND f.paye = 0 AND f.fk_statut = 1"; // Not paid
$sql.= " AND (f.fk_account IN (0, ".$object->id.") OR f.fk_account IS NULL)"; // Id bank account of invoice
$sql.= " ORDER BY dlr ASC";
$sql.= " AND (f.fk_account IN (0, ".$object->id.") OR f.fk_account IS NULL)"; // Id bank account of invoice
$sql.= " ORDER BY dlr ASC";
$sqls[] = $sql;
// Supplier invoices
$sql2= " SELECT 'invoice_supplier' as family, ff.rowid as objid, ff.ref as ref, ff.ref_supplier as ref_supplier, (-1*ff.total_ttc) as total_ttc, ff.type, ff.date_lim_reglement as dlr,";
$sql2.= " s.rowid as socid, s.nom as name, s.fournisseur";
$sql2.= " FROM ".MAIN_DB_PREFIX."facture_fourn as ff";
$sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON ff.fk_soc = s.rowid";
$sql2.= " WHERE ff.entity = ".$conf->entity;
$sql2.= " AND ff.paye = 0 AND fk_statut = 1"; // Not paid
$sql2.= " AND (ff.fk_account IN (0, ".$object->id.") OR ff.fk_account IS NULL)"; // Id bank account of supplier invoice
$sql2.= " ORDER BY dlr ASC";
$sql = " SELECT 'invoice_supplier' as family, ff.rowid as objid, ff.ref as ref, ff.ref_supplier as ref_supplier, (-1*ff.total_ttc) as total_ttc, ff.type, ff.date_lim_reglement as dlr,";
$sql.= " s.rowid as socid, s.nom as name, s.fournisseur";
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as ff";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON ff.fk_soc = s.rowid";
$sql.= " WHERE ff.entity = ".$conf->entity;
$sql.= " AND ff.paye = 0 AND fk_statut = 1"; // Not paid
$sql.= " AND (ff.fk_account IN (0, ".$object->id.") OR ff.fk_account IS NULL)"; // Id bank account of supplier invoice
$sql.= " ORDER BY dlr ASC";
$sqls[] = $sql;
// Social contributions
$sql3= " SELECT 'social_contribution' as family, cs.rowid as objid, cs.libelle as ref, (-1*cs.amount) as total_ttc, ccs.libelle as type, cs.date_ech as dlr";
$sql3.= ", cs.fk_account";
$sql3.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs";
$sql3.= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as ccs ON cs.fk_type = ccs.id";
$sql3.= " WHERE cs.entity = ".$conf->entity;
$sql3.= " AND cs.paye = 0"; // Not paid
$sql3.= " AND (cs.fk_account IN (0, ".$object->id.") OR cs.fk_account IS NULL)"; // Id bank account of social contribution
$sql3.= " ORDER BY dlr ASC";
$sql = " SELECT 'social_contribution' as family, cs.rowid as objid, cs.libelle as ref, (-1*cs.amount) as total_ttc, ccs.libelle as type, cs.date_ech as dlr";
$sql.= ", cs.fk_account";
$sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as ccs ON cs.fk_type = ccs.id";
$sql.= " WHERE cs.entity = ".$conf->entity;
$sql.= " AND cs.paye = 0"; // Not paid
$sql.= " AND (cs.fk_account IN (0, ".$object->id.") OR cs.fk_account IS NULL)"; // Id bank account of social contribution
$sql.= " ORDER BY dlr ASC";
$sqls[] = $sql;
// others sql
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreSQL', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if(empty($reshook) and isset($hookmanager->resArray['sql'])){
$sqls[] = $hookmanager->resArray['sql'];
}
$error=0;
$tab_sqlobjOrder=array();
$tab_sqlobj=array();
// List customer invoices
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
for ($i = 0;$i < $num;$i++)
{
$sqlobj = $db->fetch_object($result);
$tab_sqlobj[] = $sqlobj;
$tab_sqlobjOrder[]= $db->jdate($sqlobj->dlr);
}
$db->free($result);
}
else $error++;
// List supplier invoices
$result2=$db->query($sql2);
if ($result2)
{
$num = $db->num_rows($result2);
for ($i = 0;$i < $num;$i++)
{
$sqlobj = $db->fetch_object($result2);
$tab_sqlobj[] = $sqlobj;
$tab_sqlobjOrder[]= $db->jdate($sqlobj->dlr);
}
$db->free($result2);
}
else $error++;
// List social contributions
$result3=$db->query($sql3);
if ($result3)
{
$num = $db->num_rows($result3);
for ($i = 0;$i < $num;$i++)
{
$sqlobj = $db->fetch_object($result3);
$tab_sqlobj[] = $sqlobj;
$tab_sqlobjOrder[]= $db->jdate($sqlobj->dlr);
}
$db->free($result3);
}
else $error++;
foreach($sqls as $sql){
$resql = $db->query($sql);
if($resql){
while($sqlobj = $db->fetch_object($resql)){
$tab_sqlobj[] = $sqlobj;
$tab_sqlobjOrder[]= $db->jdate($sqlobj->dlr);
}
$db->free($resql);
}else{
$error++;
}
}
// Sort array
if (! $error)
@ -228,7 +208,6 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$num = count($tab_sqlobj);
//$num = $db->num_rows($result);
$i = 0;
while ($i < $num)
{
@ -236,7 +215,6 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$ref = '';
$refcomp = '';
//$obj = $db->fetch_object($result);
$obj = array_shift($tab_sqlobj);
if ($obj->family == 'invoice_supplier')
@ -284,6 +262,14 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$paiement = -1*$socialcontribstatic->getSommePaiement(); // Payment already done
}
$parameters = array('obj' => $obj);
$reshook = $hookmanager->executeHooks('moreFamily', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if(empty($reshook)){
$ref = isset($hookmanager->resArray['ref']) ? $hookmanager->resArray['ref'] : '';
$refcomp = isset($hookmanager->resArray['refcomp']) ? $hookmanager->resArray['refcomp'] : '';
$paiement = isset($hookmanager->resArray['paiement']) ? $hookmanager->resArray['paiement'] : 0;
}
$total_ttc = $obj->total_ttc;
if ($paiement) $total_ttc = $obj->total_ttc - $paiement;
$solde += $total_ttc;
@ -291,8 +277,6 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
// We discard lines with a remainder to pay to 0
if (price2num($total_ttc) != 0)
{
// Show line
print '<tr class="oddeven">';
print '<td>';
@ -315,15 +299,22 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
dol_print_error($db);
}
// Solde actuel
// Other lines
$parameters = array('solde' => $solde);
$reshook = $hookmanager->executeHooks('printObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if(empty($reshook)){
print $hookmanager->resPrint;
$solde = isset($hookmanager->resArray['solde']) ? $hookmanager->resArray['solde'] : $solde;
}
// solde
print '<tr class="liste_total">';
print '<td align="left" colspan="5">'.$langs->trans("FutureBalance").' ('.$object->currency_code.')</td>';
print '<td align="right" class="nowrap">'.price($solde, 0, $langs, 0, 0, -1, $object->currency_code).'</td>';
print '</tr>';
print "</table>";
print "</div>";
print "</div>";
}
else
{

View File

@ -1982,7 +1982,8 @@ class Facture extends CommonInvoice
if (! dol_delete_file($file,0,0,0,$this)) // For triggers
{
$this->error=$langs->trans("ErrorCanNotDeleteFile",$file);
$langs->load("errors");
$this->error=$langs->trans("ErrorFailToDeleteFile",$file);
$this->db->rollback();
return 0;
}
@ -1991,7 +1992,8 @@ class Facture extends CommonInvoice
{
if (! dol_delete_dir_recursive($dir)) // For remove dir and meta
{
$this->error=$langs->trans("ErrorCanNotDeleteDir",$dir);
$langs->load("errors");
$this->error=$langs->trans("ErrorFailToDeleteDir",$dir);
$this->db->rollback();
return 0;
}

View File

@ -903,7 +903,8 @@ if ($resql)
print "</tr>\n";
$projectstatic=new Project($db);
$discount = new DiscountAbsolute($db);
if ($num > 0)
{
$i=0;
@ -920,6 +921,9 @@ if ($resql)
$facturestatic->total_tva=$obj->total_vat;
$facturestatic->total_ttc=$obj->total_ttc;
$facturestatic->statut=$obj->fk_statut;
$facturestatic->total_ttc=$obj->total_ttc;
$facturestatic->paye=$obj->paye;
$facturestatic->fk_soc=$obj->fk_soc;
$facturestatic->date_lim_reglement=$db->jdate($obj->datelimite);
$facturestatic->note_public=$obj->note_public;
$facturestatic->note_private=$obj->note_private;
@ -939,7 +943,12 @@ if ($resql)
$totalcreditnotes = $facturestatic->getSumCreditNotesUsed();
$totaldeposits = $facturestatic->getSumDepositsUsed();
$totalpay = $paiement + $totalcreditnotes + $totaldeposits;
$remaintopay = $obj->total_ttc - $totalpay;
$remaintopay = $facturestatic->total_ttc - $totalpay;
if ($facturestatic->type == Facture::TYPE_CREDIT_NOTE && $obj->paye == 1) {
$remaincreditnote = $discount->getAvailableDiscounts($obj->fk_soc, '', 'rc.fk_facture_source='.$facturestatic->id);
$remaintopay = -$remaincreditnote;
$totalpay = $facturestatic->total_ttc - $remaintopay;
}
print '<tr class="oddeven">';
if (! empty($arrayfields['f.facnumber']['checked']))

View File

@ -186,6 +186,8 @@ if (empty($reshook))
$object->country_id = GETPOST("country_id",'int');
$object->state_id = GETPOST("state_id",'int');
$object->skype = GETPOST("skype",'alpha');
$object->twitter = GETPOST("twitter",'alpha');
$object->facebook = GETPOST("facebook",'alpha');
$object->email = GETPOST("email",'alpha');
$object->phone_pro = GETPOST("phone_pro",'alpha');
$object->phone_perso = GETPOST("phone_perso",'alpha');
@ -358,6 +360,8 @@ if (empty($reshook))
$object->email = GETPOST("email",'alpha');
$object->skype = GETPOST("skype",'alpha');
$object->twitter = GETPOST("twitter",'alpha');
$object->facebook = GETPOST("facebook",'alpha');
$object->phone_pro = GETPOST("phone_pro",'alpha');
$object->phone_perso = GETPOST("phone_perso",'alpha');
$object->phone_mobile = GETPOST("phone_mobile",'alpha');
@ -658,13 +662,28 @@ else
// Instant message and no email
print '<tr><td><label for="jabberid">'.$langs->trans("IM").'</label></td>';
print '<td colspan="3"><input name="jabberid" id="jabberid" type="text" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOST("jabberid",'alpha')?GETPOST("jabberid",'alpha'):$object->jabberid).'"></td></tr>';
print '<td colspan="3"><input name="jabberid" id="jabberid" type="text" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("jabberid")?GETPOST("jabberid",'alpha'):$object->jabberid).'"></td></tr>';
// Skype
if (! empty($conf->skype->enabled))
if (! empty($conf->socialnetworks->enabled))
{
print '<tr><td><label for="skype">'.$langs->trans("Skype").'</label></td>';
print '<td colspan="3"><input name="skype" id="skype" type="text" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOST("skype",'alpha')?GETPOST("skype",'alpha'):$object->skype).'"></td></tr>';
// Skype
if (! empty($conf->global->SOCIALNETWORKS_SKYPE))
{
print '<tr><td><label for="skype">'.fieldLabel('Skype','skype').'</label></td>';
print '<td colspan="3"><input type="text" name="skype" id="skype" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("skype")?GETPOST("skype",'alpha'):$object->skype).'"></td></tr>';
}
// Twitter
if (! empty($conf->global->SOCIALNETWORKS_TWITTER))
{
print '<tr><td><label for="twitter">'.fieldLabel('Twitter','twitter').'</label></td>';
print '<td colspan="3"><input type="text" name="twitter" id="twitter" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("twitter")?GETPOST("twitter",'alpha'):$object->twitter).'"></td></tr>';
}
// Facebook
if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK))
{
print '<tr><td><label for="facebook">'.fieldLabel('Facebook','facebook').'</label></td>';
print '<td colspan="3"><input type="text" name="facebook" id="facebook" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("facebook")?GETPOST("facebook",'alpha'):$object->facebook).'"></td></tr>';
}
}
// Visibility
@ -914,11 +933,26 @@ else
}
print '</tr>';
// Skype
if (! empty($conf->skype->enabled))
if (! empty($conf->socialnetworks->enabled))
{
print '<tr><td><label for="skype">'.$langs->trans("Skype").'</label></td>';
print '<td><input name="skype" id="skype" type="text" class="minwidth100" maxlength="80" value="'.(isset($_POST["skype"])?GETPOST("skype"):$object->skype).'"></td></tr>';
// Skype
if (! empty($conf->global->SOCIALNETWORKS_SKYPE))
{
print '<tr><td><label for="skype">'.fieldLabel('Skype','skype').'</label></td>';
print '<td><input type="text" name="skype" id="skype" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("skype")?GETPOST("skype",'alpha'):$object->skype).'"></td></tr>';
}
// Twitter
if (! empty($conf->global->SOCIALNETWORKS_TWITTER))
{
print '<tr><td><label for="twitter">'.fieldLabel('Twitter','twitter').'</label></td>';
print '<td><input type="text" name="twitter" id="twitter" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOSTISSET("twitter")?GETPOST("twitter",'alpha'):$object->twitter).'"></td></tr>';
}
// Facebook
if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK))
{
print '<tr><td><label for="facebook">'.fieldLabel('Facebook','facebook').'</label></td>';
print '<td><input type="text" name="facebook" id="facebook" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOST("facebook")?GETPOST("facebook",'alpha'):$object->facebook).'"></td></tr>';
}
}
// Visibility

View File

@ -354,6 +354,8 @@ class Contact extends CommonObject
$sql .= ", fax='".$this->db->escape($this->fax)."'";
$sql .= ", email='".$this->db->escape($this->email)."'";
$sql .= ", skype='".$this->db->escape($this->skype)."'";
$sql .= ", twitter='".$this->db->escape($this->twitter)."'";
$sql .= ", facebook='".$this->db->escape($this->facebook)."'";
$sql .= ", photo='".$this->db->escape($this->photo)."'";
$sql .= ", birthday=".($this->birthday ? "'".$this->db->idate($this->birthday)."'" : "null");
$sql .= ", note_private = ".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null");
@ -441,6 +443,16 @@ class Contact extends CommonObject
$tmpobj->skype = $this->skype;
$usermustbemodified++;
}
if ($tmpobj->twitter != $this->twitter)
{
$tmpobj->twitter = $this->twitter;
$usermustbemodified++;
}
if ($tmpobj->facebook != $this->facebook)
{
$tmpobj->facebook = $this->facebook;
$usermustbemodified++;
}
if ($usermustbemodified)
{
$result=$tmpobj->update($user, 0, 1, 1, 1);
@ -690,7 +702,7 @@ class Contact extends CommonObject
$sql.= " c.fk_pays as country_id,";
$sql.= " c.fk_departement,";
$sql.= " c.birthday,";
$sql.= " c.poste, c.phone, c.phone_perso, c.phone_mobile, c.fax, c.email, c.jabberid, c.skype,";
$sql.= " c.poste, c.phone, c.phone_perso, c.phone_mobile, c.fax, c.email, c.jabberid, c.skype, c.twitter, c.facebook,";
$sql.= " c.photo,";
$sql.= " c.priv, c.note_private, c.note_public, c.default_lang, c.no_email, c.canvas,";
$sql.= " c.import_key,";
@ -756,6 +768,8 @@ class Contact extends CommonObject
$this->email = $obj->email;
$this->jabberid = $obj->jabberid;
$this->skype = $obj->skype;
$this->twitter = $obj->twitter;
$this->facebook = $obj->facebook;
$this->photo = $obj->photo;
$this->priv = $obj->priv;
$this->mail = $obj->email;
@ -1069,9 +1083,9 @@ class Contact extends CommonObject
function getNbOfEMailings()
{
$sql = "SELECT count(mc.email) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
$sql.= " WHERE mc.email = '".$this->db->escape($this->email)."'";
$sql.= " AND mc.statut NOT IN (-1,0)"; // -1 erreur, 0 non envoye, 1 envoye avec succes
$sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc, ".MAIN_DB_PREFIX."mailing as m";
$sql.= " WHERE mc.fk_mailing=m.rowid AND mc.email = '".$this->db->escape($this->email)."' ";
$sql.= " AND m.entity IN (".getEntity($this->element).") AND mc.statut NOT IN (-1,0)"; // -1 error, 0 not sent, 1 sent with success
$resql=$this->db->query($sql);
if ($resql)

View File

@ -40,7 +40,10 @@ class AntiVir
*/
public $errors = array();
var $output;
/**
* @var string Used to return message
*/
public $output;
/**
* @var DoliDB Database handler.

View File

@ -43,15 +43,15 @@ class Canvas
*/
public $errors = array();
var $actiontype;
public $actiontype;
var $dirmodule; // Module directory
var $targetmodule; // Module concerned by canvas (ex: thirdparty, contact, ...)
var $canvas; // Name of canvas (ex: company, individual, product, service, ...)
var $card; // Tab (sub-canvas)
public $dirmodule; // Module directory
public $targetmodule; // Module concerned by canvas (ex: thirdparty, contact, ...)
public $canvas; // Name of canvas (ex: company, individual, product, service, ...)
public $card; // Tab (sub-canvas)
var $template_dir; // Initialized by getCanvas with templates directory
var $control; // Initialized by getCanvas with controller instance
public $template_dir; // Initialized by getCanvas with templates directory
public $control; // Initialized by getCanvas with controller instance
/**

View File

@ -2899,6 +2899,7 @@ abstract class CommonObject
// Special case
if ($origin == 'order') $origin='commande';
if ($origin == 'invoice') $origin='facture';
if ($origin == 'invoice_template') $origin='facturerec';
$this->db->begin();

View File

@ -39,46 +39,46 @@
*/
class DolGraph
{
var $type=array(); // Array with type of each series. Example: array('bars', 'lines', ...)
var $mode='side'; // Mode bars graph: side, depth
public $type=array(); // Array with type of each series. Example: array('bars', 'lines', ...)
public $mode='side'; // Mode bars graph: side, depth
private $_library='jflot'; // Graphic library to use (jflot, artichow)
//! Array of data
var $data; // Data of graph: array(array('abs1',valA1,valB1), array('abs2',valA2,valB2), ...)
var $title; // Title of graph
var $cssprefix=''; // To add into css styles
var $width=380;
var $height=200;
var $MaxValue=0;
var $MinValue=0;
var $SetShading=0;
public $data; // Data of graph: array(array('abs1',valA1,valB1), array('abs2',valA2,valB2), ...)
public $title; // Title of graph
public $cssprefix=''; // To add into css styles
public $width=380;
public $height=200;
public $MaxValue=0;
public $MinValue=0;
public $SetShading=0;
var $PrecisionY=-1;
public $PrecisionY=-1;
var $horizTickIncrement=-1;
var $SetNumXTicks=-1;
var $labelInterval=-1;
public $horizTickIncrement=-1;
public $SetNumXTicks=-1;
public $labelInterval=-1;
var $hideXGrid=false;
var $hideYGrid=false;
public $hideXGrid=false;
public $hideYGrid=false;
var $Legend=array();
var $LegendWidthMin=0;
var $showlegend=1;
var $showpointvalue=1;
var $showpercent=0;
var $combine=0; // 0.05 if you want to combine records < 5% into "other"
var $graph; // Objet Graph (Artichow, Phplot...)
public $Legend=array();
public $LegendWidthMin=0;
public $showlegend=1;
public $showpointvalue=1;
public $showpercent=0;
public $combine=0; // 0.05 if you want to combine records < 5% into "other"
public $graph; // Objet Graph (Artichow, Phplot...)
/**
* @var string Error code (or message)
*/
public $error='';
var $bordercolor; // array(R,G,B)
var $bgcolor; // array(R,G,B)
var $bgcolorgrid=array(255,255,255); // array(R,G,B)
var $datacolor; // array(array(R,G,B),...)
public $bordercolor; // array(R,G,B)
public $bgcolor; // array(R,G,B)
public $bgcolorgrid=array(255,255,255); // array(R,G,B)
public $datacolor; // array(array(R,G,B),...)
private $stringtoshow; // To store string to output graph into HTML page

View File

@ -6370,6 +6370,7 @@ class Form
'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').')'),
'order'=>array('enabled'=>$conf->commande->enabled, 'perms'=>1, 'label'=>'LinkToOrder', '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."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('commande').')'),
'invoice'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.facnumber as ref, t.ref_client, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('facture').')'),
'invoice_template'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToTemplateInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('facture').')'),
'contrat'=>array('enabled'=>$conf->contrat->enabled , 'perms'=>1, 'label'=>'LinkToContract', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, '' as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('contract').')'),
'fichinter'=>array('enabled'=>$conf->ficheinter->enabled, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('intervention').')'),
'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled , 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('supplier_proposal').')'),
@ -6432,8 +6433,7 @@ class Form
{
$objp = $this->db->fetch_object($resqllist);
$var = ! $var;
print '<tr ' . $bc [$var] . '>';
print '<tr class="oddeven">';
print '<td aling="left">';
print '<input type="radio" name="idtolinkto" value=' . $objp->rowid . '>';
print '</td>';

View File

@ -185,7 +185,7 @@ class FormFile
if ($linkfiles)
{
$out .= "\n<!-- Start form attach new link -->\n";
$out .= "\n<!-- Start form link new url -->\n";
$langs->load('link');
$title = $langs->trans("LinkANewFile");
$out .= load_fiche_titre($title, null, null);
@ -213,19 +213,18 @@ class FormFile
$out .= '</div>';
$out .= '<div class="clearboth"></div>';
$out .= '</form><br>';
$parameters = array('socid'=>(isset($GLOBALS['socid'])?$GLOBALS['socid']:''),'id'=>(isset($GLOBALS['id'])?$GLOBALS['id']:''), 'url'=>$url, 'perm'=>$perm);
$res = $hookmanager->executeHooks('formattachOptions',$parameters,$object);
$out .= "\n<!-- End form attach new file -->\n";
$out .= "\n<!-- End form link new url -->\n";
}
$parameters = array('socid'=>(isset($GLOBALS['socid'])?$GLOBALS['socid']:''), 'id'=>(isset($GLOBALS['id'])?$GLOBALS['id']:''), 'url'=>$url, 'perm'=>$perm);
$res = $hookmanager->executeHooks('formattachOptions',$parameters,$object);
if (empty($res))
{
print '<div class="attacharea attacharea'.$htmlname.'">';
print $out;
print '</div>';
}
print $hookmanager->resPrint;
return 1;

View File

@ -341,7 +341,7 @@ class Utils
{
// Renommer fichier sortie en fichier erreur
//print "$outputfile -> $outputerror";
@dol_delete_file($outputerror,1);
@dol_delete_file($outputerror, 1, 0, 0, null, false, 0);
@rename($outputfile,$outputerror);
// Si safe_mode on et command hors du parametre exec, on a un fichier out vide donc errormsg vide
if (! $errormsg)
@ -448,7 +448,7 @@ class Utils
{
$i++;
if ($i <= $keeplastnfiles) continue;
dol_delete_file($val['fullname']);
dol_delete_file($val['fullname'], 0, 0, 0, null, false, 0);
}
}
@ -675,8 +675,9 @@ class Utils
}
/**
* This saves syslog files and compresses older ones
* Used from cronjob
* This saves syslog files and compresses older ones.
* Nb of archive to keep is defined into $conf->global->SYSLOG_FILE_SAVES
* CAN BE A CRON TASK
*
* @return int 0 if OK, < 0 if KO
*/
@ -714,50 +715,52 @@ class Utils
$logname = $file['name'];
$logpath = $file['path'];
// Handle already compressed files to rename them and add +1
if (dol_is_file($logpath.'/'.$logname) && dol_filesize($logpath.'/'.$logname) > 0) // If log file exists and is not empty
{
// Handle already compressed files to rename them and add +1
$filter = '^'.preg_quote($logname, '/').'\.([0-9]+)\.gz$';
$filter = '^'.preg_quote($logname, '/').'\.([0-9]+)\.gz$';
$gzfilestmp = dol_dir_list($logpath, 'files', 0, $filter);
$gzfiles = array();
$gzfilestmp = dol_dir_list($logpath, 'files', 0, $filter);
$gzfiles = array();
foreach($gzfilestmp as $gzfile) {
$tabmatches = array();
preg_match('/'.$filter.'/i', $gzfile['name'], $tabmatches);
foreach($gzfilestmp as $gzfile) {
$tabmatches = array();
preg_match('/'.$filter.'/i', $gzfile['name'], $tabmatches);
$numsave = intval($tabmatches[1]);
$numsave = intval($tabmatches[1]);
$gzfiles[$numsave] = $gzfile;
}
krsort($gzfiles, SORT_NUMERIC);
foreach($gzfiles as $numsave => $dummy) {
if (dol_is_file($logpath.'/'.$logname.'.'.($numsave+1).'.gz')) {
return -2;
$gzfiles[$numsave] = $gzfile;
}
if($numsave >= $nbSaves) {
dol_delete_file($logpath.'/'.$logname.'.'.$numsave.'.gz');
} else {
dol_move($logpath.'/'.$logname.'.'.$numsave.'.gz', $logpath.'/'.$logname.'.'.($numsave+1).'.gz', 0, 1, 0, 0);
}
}
krsort($gzfiles, SORT_NUMERIC);
// Compress last save
if (dol_is_file($logpath.'/'.$logname.'.1')) {
if($nbSaves > 1) {
$gzfilehandle = gzopen($logpath.'/'.$logname.'.2.gz', 'wb9');
foreach($gzfiles as $numsave => $dummy) {
if (dol_is_file($logpath.'/'.$logname.'.'.($numsave+1).'.gz')) {
return -2;
}
if($numsave >= $nbSaves) {
dol_delete_file($logpath.'/'.$logname.'.'.$numsave.'.gz', 0, 0, 0, null, false, 0);
} else {
dol_move($logpath.'/'.$logname.'.'.$numsave.'.gz', $logpath.'/'.$logname.'.'.($numsave+1).'.gz', 0, 1, 0, 0);
}
}
// Compress current file and recreate it
if ($nbSaves > 0) { // If $nbSaves is 1, we keep 1 archive .gz file, If 2, we keep 2 .gz files
$gzfilehandle = gzopen($logpath.'/'.$logname.'.1.gz', 'wb9');
if (empty($gzfilehandle)) {
$this->error = 'Failted to open file '.$logpath.'/'.$logname.'.2.gz';
$this->error = 'Failted to open file '.$logpath.'/'.$logname.'.1.gz';
return -3;
}
$sourcehandle = fopen($logpath.'/'.$logname.'.1', 'r');
$sourcehandle = fopen($logpath.'/'.$logname, 'r');
if (empty($sourcehandle)) {
$this->error = 'Failed to open file '.$logpath.'/'.$logname.'.1';
$this->error = 'Failed to open file '.$logpath.'/'.$logname;
return -4;
}
@ -767,19 +770,18 @@ class Utils
fclose($sourcehandle);
gzclose($gzfilehandle);
} else {
dol_delete_file($logpath.'/'.$logname.'.1');
}
}
// Compress current file et recreate it
if (dol_is_file($logpath.'/'.$logname)) {
if (dol_move($logpath.'/'.$logname, $logpath.'/'.$logname.'.1', 0, 1, 0, 0))
{
$newlog = fopen($logpath.'/'.$logname, 'a+');
fclose($newlog);
@chmod($logpath.'/'.$logname.'.1.gz', octdec(empty($conf->global->MAIN_UMASK)?'0664':$conf->global->MAIN_UMASK));
}
dol_delete_file($logpath.'/'.$logname, 0, 0, 0, null, false, 0);
// Create empty file
$newlog = fopen($logpath.'/'.$logname, 'a+');
fclose($newlog);
//var_dump($logpath.'/'.$logname." - ".octdec(empty($conf->global->MAIN_UMASK)?'0664':$conf->global->MAIN_UMASK));
@chmod($logpath.'/'.$logname, octdec(empty($conf->global->MAIN_UMASK)?'0664':$conf->global->MAIN_UMASK));
}
}

View File

@ -1133,10 +1133,11 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
* @param int $nohook Disable all hooks
* @param object $object Current object in use
* @param boolean $allowdotdot Allow to delete file path with .. inside. Never use this, it is reserved for migration purpose.
* @param int $indexdatabase Try to remove also index entries.
* @return boolean True if no error (file is deleted or if glob is used and there's nothing to delete), False if error
* @see dol_delete_dir
*/
function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=null,$allowdotdot=false)
function dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1)
{
global $db, $conf, $user, $langs;
global $hookmanager;
@ -1200,7 +1201,7 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=n
{
$rel_filetodelete = preg_replace('/^[\\/]/', '', $rel_filetodelete);
if (is_object($db)) // $db may not be defined when lib is in a context with define('NOREQUIREDB',1)
if (is_object($db) && $indexdatabase) // $db may not be defined when lib is in a context with define('NOREQUIREDB',1)
{
dol_syslog("Try to remove also entries in database for full relative path = ".$rel_filetodelete, LOG_DEBUG);
include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';

View File

@ -5213,6 +5213,11 @@ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer,
}
}
// Si (vendeur en France et acheteur hors Communaute europeenne et acheteur particulier) alors TVA par defaut=TVA du produit vendu. Fin de regle
if (! empty($conf->global->MAIN_USE_VAT_OF_PRODUCT_FOR_INDIVIDUAL_CUSTOMER_OUT_OF_EEC) && empty($buyer_in_cee) && !$thirdparty_buyer->isACompany()) {
return get_product_vat_for_country($idprod,$thirdparty_seller,$idprodfournprice);
}
// Sinon la TVA proposee par defaut=0. Fin de regle.
// Rem: Cela signifie qu'au moins un des 2 est hors Communaute europeenne et que le pays differe
//print 'VATRULE 5';
@ -6154,12 +6159,13 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
$substitutionarray=array_merge($substitutionarray, array(
'__DAY__' => (string) $tmp['mday'],
'__DAY_TEXT__' => $outputlangs->trans('Day'.$tmp['wday']),
'__DAY_TEXT_SHORT__' => $outputlangs->trans('Short'.$tmp['weekday']),
'__DAY_TEXT_MIN__' => $outputlangs->trans($tmp['weekday'].'Min'),
'__DAY_TEXT__' => $outputlangs->trans('Day'.$tmp['wday']), // Monday
'__DAY_TEXT_SHORT__' => $outputlangs->trans($tmp['weekday'].'Min'), // Mon
'__DAY_TEXT_MIN__' => $outputlangs->trans('Short'.$tmp['weekday']), // M
'__MONTH__' => (string) $tmp['mon'],
'__MONTH_TEXT__' => $outputlangs->trans($tmp['month']),
'__MONTH_TEXT_MIN__' => $outputlangs->trans($tmp['month'].'Min'),
'__MONTH_TEXT__' => $outputlangs->trans('Month'.sprintf("%02d", $tmp['mon'])),
'__MONTH_TEXT_SHORT__' => $outputlangs->trans('MonthShort'.sprintf("%02d", $tmp['mon'])),
'__MONTH_TEXT_MIN__' => $outputlangs->trans('MonthVeryShort'.sprintf("%02d", $tmp['mon'])),
'__YEAR__' => (string) $tmp['year'],
'__PREVIOUS_DAY__' => (string) $tmp2['day'],
'__PREVIOUS_MONTH__' => (string) $tmp3['month'],

View File

@ -52,6 +52,11 @@ function dolWebsiteReplacementOfLinks($website, $content, $removephppart=0)
if ($removephppart) $replacewith='';
$content = preg_replace('/src="<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
$replacewith='href="php';
if ($removephppart) $replacewith='';
$content = preg_replace('/href="<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
//$replacewith='<span class="phptag">...php...</span>';
$replacewith='<span class="phptag">...php...</span>';
if ($removephppart) $replacewith='';
$content = preg_replace('/<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
@ -89,23 +94,28 @@ function dolWebsiteReplacementOfLinks($website, $content, $removephppart=0)
*
* @param string $content Content string
* @return void
* @see dolWebsiteReplacementOfLinks for function used to replace content in the backoffice editor context
* @see dolWebsiteReplacementOfLinks for function used to replace content in the backoffice context when USEDOLIBARREDITOR is not on
*/
function dolWebsiteOutput($content)
{
global $db, $langs, $conf, $user;
global $dolibarr_main_url_root, $dolibarr_main_data_root;
dol_syslog("dolWebsiteOutput start (mode=".(defined('USEDOLIBARRSERVER')?'USEDOLIBARRSERVER':'').')');
dol_syslog("dolWebsiteOutput start (USEDOLIBARRSERVER=".(defined('USEDOLIBARRSERVER')?'1':'')." (USEDOLIBARREDITOR=".(defined('USEDOLIBARREDITOR')?'1':'').')');
// 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
// Note: This seems never called when page is output inside the website editor (search 'REPLACEMENT OF LINKS When page called by website editor')
if (defined('USEDOLIBARRSERVER')) // REPLACEMENT OF LINKS When page called from Dolibarr server
if (defined('USEDOLIBARREDITOR')) // REPLACEMENT OF LINKS When page called from Dolibarr editor
{
// We remove the <head> part of content
$content = preg_replace('/<head>.*<\/head>/ims', '', $content);
$content = preg_replace('/^.*<body(\s[^>]*)*>/ims', '', $content);
$content = preg_replace('/<\/body(\s[^>]*)*>.*$/ims', '', $content);
}
elseif (defined('USEDOLIBARRSERVER')) // REPLACEMENT OF LINKS When page called from Dolibarr server
{
global $website;
@ -139,7 +149,7 @@ function dolWebsiteOutput($content)
// action="newpage.php" => action="dolibarr/website/index.php?website=...&pageref=newpage
$content = preg_replace('/(action=")\/?([^:\"]*)(\.php\")/', '\1'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=\2"', $content, -1, $nbrep);
}
else // REPLACEMENT OF LINKS When page called from virtual host
else // REPLACEMENT OF LINKS When page called from virtual host
{
$symlinktomediaexists=1;
@ -536,7 +546,7 @@ function dolSaveMasterFile($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_once '".DOL_DOCUMENT_ROOT."/master.inc.php';\n";
$mastercontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) require_once '".DOL_DOCUMENT_ROOT."/master.inc.php';\n";
$mastercontent.= '?>'."\n";
$result = file_put_contents($filemaster, $mastercontent);
if (! empty($conf->global->MAIN_UMASK))
@ -598,7 +608,7 @@ function dolSavePageContent($filetpl, $object, $objectpage)
$tplcontent ='';
$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.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { 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";
@ -663,7 +673,7 @@ function dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl, $filewrapper)
$indexcontent = '<?php'."\n";
$indexcontent.= "// BEGIN PHP File generated to provide an index.php as Home Page or alias redirector - DO NOT MODIFY - It is just a generated wrapper.\n";
$indexcontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
$indexcontent.= "if (! defined('USEDOLIBARRSERVER')) { require_once './master.inc.php'; } // Load master if not already loaded\n";
$indexcontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Load master if not already loaded\n";
$indexcontent.= 'if (! empty($_GET[\'pageref\']) || ! empty($_GET[\'pagealiasalt\']) || ! empty($_GET[\'pageid\'])) {'."\n";
$indexcontent.= " require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
$indexcontent.= " require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
@ -679,7 +689,7 @@ function dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl, $filewrapper)
$wrappercontent = '<?php'."\n";
$wrappercontent.= "// BEGIN PHP File generated to provide a wrapper.php - DO NOT MODIFY - It is just a generated wrapper.\n";
$wrappercontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
$wrappercontent.= "if (! defined('USEDOLIBARRSERVER')) { require_once './master.inc.php'; } // Load master if not already loaded\n";
$wrappercontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Load master if not already loaded\n";
$wrappercontent.= '$original_file=str_replace("../","/", GETPOST("file","alpha"));'."\n";
$wrappercontent.= 'if ($_GET["modulepart"] == "mycompany" && preg_match(\'/^\/?logos\//\', $original_file)) readfile(dol_osencode($conf->mycompany->dir_output."/".$original_file));'."\n";
$wrappercontent.= "else print 'Bad value for modulepart or file';\n";

View File

@ -116,9 +116,9 @@ class pdf_einstein extends ModelePDFCommandes
/**
* Issuer
* @var Societe
* @var Company object that emits
*/
public $emetteur; // Objet societe qui emet
public $emetteur;
/**

View File

@ -105,9 +105,9 @@ class pdf_rouget extends ModelePdfExpedition
/**
* Issuer
* @var Societe
* @var Company object that emits
*/
public $emetteur; // Objet societe qui emet
public $emetteur;
/**

View File

@ -107,9 +107,9 @@ class pdf_standard extends ModeleExpenseReport
/**
* Issuer
* @var Societe
* @var Company object that emits
*/
public $emetteur; // Objet societe qui emet
public $emetteur;
/**

View File

@ -40,9 +40,9 @@ class doc_generic_invoice_odt extends ModelePDFFactures
{
/**
* Issuer
* @var Societe
* @var Company object that emits
*/
public $emetteur; // Objet societe qui emet
public $emetteur;
/**
* @var array() Minimum version of PHP required by module.

View File

@ -117,9 +117,9 @@ class pdf_crabe extends ModelePDFFactures
/**
* Issuer
* @var Societe
* @var Company object that emits
*/
public $emetteur; // Objet societe qui emet
public $emetteur;
/**
* @var bool Situation invoice type

View File

@ -107,9 +107,9 @@ class pdf_soleil extends ModelePDFFicheinter
/**
* Issuer
* @var Societe
* @var Company object that emits
*/
public $emetteur; // Objet societe qui emet
public $emetteur;
/**
* Constructor

View File

@ -108,9 +108,9 @@ class pdf_typhon extends ModelePDFDeliveryOrder
/**
* Issuer
* @var Societe
* @var Company object that emits
*/
public $emetteur; // Objet societe qui emet
public $emetteur;
/**
* Constructor

View File

@ -107,9 +107,9 @@ class pdf_baleine extends ModelePDFProjects
/**
* Issuer
* @var Societe
* @var Company object that emits
*/
public $emetteur; // Objet societe qui emet
public $emetteur;
/**
* Constructor

View File

@ -56,9 +56,9 @@ class doc_generic_task_odt extends ModelePDFTask
{
/**
* Issuer
* @var Societe
* @var Company object that emits
*/
public $emetteur; // Objet societe qui emet
public $emetteur;
/**
* @var array() Minimum version of PHP required by module.

View File

@ -39,9 +39,9 @@ class doc_generic_proposal_odt extends ModelePDFPropales
{
/**
* Issuer
* @var Societe
* @var Company object that emits
*/
public $emetteur; // Objet societe qui emet
public $emetteur;
/**
* @var array() Minimum version of PHP required by module.

View File

@ -115,7 +115,7 @@ class pdf_azur extends ModelePDFPropales
/**
* Issuer
* @var Objet societe qui emet
* @var Company object that emits
*/
public $emetteur;

View File

@ -106,7 +106,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
/**
* Issuer
* @var Objet societe qui emet
* @var Company object that emits
*/
public $emetteur;

View File

@ -110,7 +110,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
/**
* Issuer
* @var Objet societe qui emet
* @var Company object that emits
*/
public $emetteur;

View File

@ -42,9 +42,9 @@ class doc_generic_user_odt extends ModelePDFUser
public $emetteur;
/**
* @var array() Minimum version of PHP required by module.
* @var array() Minimum version of PHP required by module.
* e.g.: PHP 5.4 = array(5, 4)
*/
*/
public $phpmin = array(5, 4);
/**

View File

@ -44,9 +44,9 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup
public $emetteur;
/**
* @var array() Minimum version of PHP required by module.
* @var array() Minimum version of PHP required by module.
* e.g.: PHP 5.4 = array(5, 4)
*/
*/
public $phpmin = array(5, 4);
/**

View File

@ -38,15 +38,18 @@ if (empty($module)) $module='ecm';
$permtoadd = 0;
$permtoupload = 0;
$showroot = 0;
if ($module == 'ecm')
{
$permtoadd = $user->rights->ecm->setup;
$permtoupload = $user->rights->ecm->upload;
$showroot = 0;
}
if ($module == 'medias')
{
$permtoadd = ($user->rights->mailing->creer || $user->rights->website->write);
$permtoupload = ($user->rights->mailing->creer || $user->rights->website->write);
$showroot = 1;
}
@ -69,29 +72,25 @@ if (($action == 'delete' || $action == 'file_manager_delete') && empty($conf->us
print '<div class="inline-block toolbarbutton centpercent">';
// Toolbar
//if (preg_match('/\/ecm/', $_SERVER['PHP_SELF'])) {
//if ($module == 'ecm') {
if ($permtoadd)
{
print '<a href="'.DOL_URL_ROOT.'/ecm/dir_add_card.php?action=create&module='.urlencode($module).($websitekey?'&website='.$websitekey:'').($pageid?'&pageid='.$pageid:'').'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid).'" class="inline-block valignmiddle toolbarbutton" title="'.dol_escape_htmltag($langs->trans('ECMAddSection')).'">';
print '<img class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/folder-new.png">';
print '</a>';
}
else
{
print '<a href="#" class="inline-block valignmiddle toolbarbutton" title="'.$langs->trans("NotAllowed").'">';
print '<img class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/folder-new.png">';
print '</a>';
}
if ($module == 'ecm')
{
$tmpurl=((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&amp;module='.$module:'').($section?'&amp;section='.$section:'')));
print '<a href="'.$tmpurl.'" class="inline-block valignmiddle toolbarbutton" title="'.dol_escape_htmltag($langs->trans('ReSyncListOfDir')).'">';
print '<img id="refreshbutton" class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/view-refresh.png">';
print '</a>';
}
//}
if ($permtoadd)
{
print '<a href="'.DOL_URL_ROOT.'/ecm/dir_add_card.php?action=create&module='.urlencode($module).($websitekey?'&website='.$websitekey:'').($pageid?'&pageid='.$pageid:'').'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid).'" class="inline-block valignmiddle toolbarbutton" title="'.dol_escape_htmltag($langs->trans('ECMAddSection')).'">';
print '<img class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/folder-new.png">';
print '</a>';
}
else
{
print '<a href="#" class="inline-block valignmiddle toolbarbutton" title="'.$langs->trans("NotAllowed").'">';
print '<img class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/folder-new.png">';
print '</a>';
}
if ($module == 'ecm')
{
$tmpurl=((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&amp;module='.$module:'').($section?'&amp;section='.$section:'')));
print '<a href="'.$tmpurl.'" class="inline-block valignmiddle toolbarbutton" title="'.dol_escape_htmltag($langs->trans('ReSyncListOfDir')).'">';
print '<img id="refreshbutton" class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/view-refresh.png">';
print '</a>';
}
// Start "Add new file" area
$nameforformuserfile = 'formuserfileecm';
@ -148,7 +147,7 @@ if (empty($action) || $action == 'editfile' || $action == 'file_manager' || preg
print '<!-- Title for manual directories -->'."\n";
print '<tr class="liste_titre">'."\n";
print '<th class="liste_titre" align="left" colspan="6">';
print '<th class="liste_titre" align="left">';
print '&nbsp;'.$langs->trans("ECMSections");
print '</th></tr>';
@ -159,9 +158,17 @@ if (empty($action) || $action == 'editfile' || $action == 'file_manager' || preg
if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))
{
print '<tr><td colspan="6">';
// Show the link to "Root"
if ($showroot)
{
print '<tr><td><div style="padding-left: 5px; padding-right: 5px;"><a href="'.$_SERVER["PHP_SELF"].'?file_manager=1&pageid='.$pageid.'">'.$langs->trans("Root").'</a></div></td></tr>';
}
// Show filemanager tree (will be filled by call of ajax enablefiletreeajax.tpl.php that execute ajaxdirtree.php)
print '<tr><td>';
// Show filemanager tree (will be filled by call of ajax /ecm/tpl/enablefiletreeajax.tpl.php that execute ajaxdirtree.php)
print '<div id="filetree" class="ecmfiletree"></div>';
if ($action == 'deletefile') print $form->formconfirm('eeeee', $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', '', 'deletefile');
@ -170,7 +177,7 @@ if (empty($action) || $action == 'editfile' || $action == 'file_manager' || preg
}
else
{
print '<tr><td colspan="6" style="padding-left: 20px">';
print '<tr><td style="padding-left: 20px">';
$_POST['modulepart'] = $module;
$_POST['openeddir'] = GETPOST('openeddir');

View File

@ -213,7 +213,9 @@ if ($forgetpasslink || $helpcenterlink)
echo '<br>';
echo '<div class="center" style="margin-top: 15px;">';
if ($forgetpasslink) {
echo '<a class="alogin" href="'.DOL_URL_ROOT.'/user/passwordforgotten.php'.$moreparam.'">';
$url=DOL_URL_ROOT.'/user/passwordforgotten.php'.$moreparam;
if (! empty($conf->global->MAIN_PASSWORD_FORGOTLINK)) $url=$conf->global->MAIN_PASSWORD_FORGOTLINK;
echo '<a class="alogin" href="'.dol_escape_htmltag($url).'">';
echo $langs->trans('PasswordForgotten');
echo '</a>';
}

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2017-2018 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
@ -19,10 +19,11 @@
/**
* \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.
* The global variable $websitekey must be defined.
*/
include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php';
$website=new Website($db);
$website->fetch(0,$websitekey);
include_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php';

View File

@ -27,7 +27,7 @@ if (empty($conf) || ! is_object($conf))
?>
<!-- BEGIN PHP TEMPLATE ecm/tpl/enablefiletreeajax.tpl.php -->
<!-- Doc of fileTree plugin at http://www.abeautifulsite.net/blog/2008/03/jquery-file-tree/ -->
<!-- Doc of fileTree plugin at https://www.abeautifulsite.net/jquery-file-tree: http://www.abeautifulsite.net/blog/2008/03/jquery-file-tree/ -->
<script type="text/javascript">

View File

@ -967,7 +967,8 @@ class Fichinter extends CommonObject
if (! dol_delete_file($file,0,0,0,$this)) // For triggers
{
$this->error=$langs->trans("ErrorCanNotDeleteFile",$file);
$langs->load("errors");
$this->error=$langs->trans("ErrorFailToDeleteFile",$file);
return 0;
}
}
@ -975,7 +976,8 @@ class Fichinter extends CommonObject
{
if (! dol_delete_dir_recursive($dir))
{
$this->error=$langs->trans("ErrorCanNotDeleteDir",$dir);
$langs->load("errors");
$this->error=$langs->trans("ErrorFailToDeleteDir",$dir);
return 0;
}
}

View File

@ -74,3 +74,7 @@ ALTER TABLE llx_societe ADD COLUMN twitter varchar(255) after skype;
ALTER TABLE llx_societe ADD COLUMN facebook varchar(255) after skype;
ALTER TABLE llx_socpeople ADD COLUMN twitter varchar(255) after skype;
ALTER TABLE llx_socpeople ADD COLUMN facebook varchar(255) after skype;
ALTER TABLE llx_website CHANGE COLUMN fk_user_create fk_user_creat integer;
ALTER TABLE llx_website_page CHANGE COLUMN fk_user_create fk_user_creat integer;

View File

@ -27,9 +27,9 @@ CREATE TABLE llx_website
status integer DEFAULT 1,
fk_default_home integer,
virtualhost varchar(255),
fk_user_create integer,
fk_user_modif integer,
date_creation datetime,
tms timestamp,
import_key varchar(14) -- import key
fk_user_creat integer,
fk_user_modif integer,
date_creation datetime,
tms timestamp,
import_key varchar(14) -- import key
) ENGINE=innodb;

View File

@ -32,10 +32,10 @@ CREATE TABLE llx_website_page
htmlheader text,
content mediumtext, -- text is not enough in size
status integer DEFAULT 1,
grabbed_from varchar(255),
fk_user_create integer,
fk_user_modif integer,
date_creation datetime,
tms timestamp,
import_key varchar(14) -- import key
grabbed_from varchar(255),
fk_user_creat integer,
fk_user_modif integer,
date_creation datetime,
tms timestamp,
import_key varchar(14) -- import key
) ENGINE=innodb;

View File

@ -1793,6 +1793,7 @@ MAIN_PDF_MARGIN_LEFT=Left margin on PDF
MAIN_PDF_MARGIN_RIGHT=Right margin on PDF
MAIN_PDF_MARGIN_TOP=Top margin on PDF
MAIN_PDF_MARGIN_BOTTOM=Bottom margin on PDF
NothingToSetup=There is no specific setup to do for this module.
SetToYesIfGroupIsComputationOfOtherGroups=Set this to yes if this group is a computation of other groups
EnterCalculationRuleIfPreviousFieldIsYes=Enter calculation rule if previous field was set to Yes (For example 'CODEGRP1+CODEGRP2')
SeveralLangugeVariatFound=Several language variants found
@ -1807,6 +1808,7 @@ ChartLoaded=Chart of account loaded
SocialNetworkSetup=Setup of module Social Networks
EnableFeatureFor=Enable features for <strong>%s</strong>
VATIsUsedIsOff=Note: The option to use sales Tax or VAT has been set to <strong>Off</strong> in the menu %s - %s, so Sale tax or Vat used will always be 0 for sales.
SwapSenderAndRecipientOnPDF=Swap sender and recipient address on PDF
##### Resource ####
ResourceSetup=Configuration du module Resource
UseSearchToSelectResource=Use a search form to choose a resource (rather than a drop-down list).

View File

@ -546,3 +546,4 @@ AutoFillDateFromShort=Set start date
AutoFillDateTo=Set end date for service line with next invoice date
AutoFillDateToShort=Set end date
MaxNumberOfGenerationReached=Max number of gen. reached
BILL_DELETEInDolibarr=Invoice deleted

View File

@ -20,22 +20,22 @@ BoxLastMembers=Latest members
BoxFicheInter=Latest interventions
BoxCurrentAccounts=Open accounts balance
BoxTitleLastRssInfos=Latest %s news from %s
BoxTitleLastProducts=Products/Services: last %s modified
BoxTitleLastProducts=Products/Services: latest %s modified
BoxTitleProductsAlertStock=Products: stock alert
BoxTitleLastSuppliers=Latest %s recorded suppliers
BoxTitleLastModifiedSuppliers=Latest %s modified vendors
BoxTitleLastModifiedCustomers=Latest %s modified customers
BoxTitleLastCustomersOrProspects=Latest %s customers or prospects
BoxTitleLastCustomerBills=Latest %s customer invoices
BoxTitleLastSupplierBills=Latest %s supplier invoices
BoxTitleLastModifiedProspects=Prospects: last %s modified
BoxTitleLastModifiedMembers=Latest %s members
BoxTitleLastCustomerBills=Latest %s modified customer invoices
BoxTitleLastSupplierBills=Latest %s modified vendor invoices
BoxTitleLastModifiedProspects=Latest %s modified prospects
BoxTitleLastModifiedMembers=Latest %s modified members
BoxTitleLastFicheInter=Latest %s modified interventions
BoxTitleOldestUnpaidCustomerBills=Customer Invoices: oldest %s unpaid
BoxTitleOldestUnpaidSupplierBills=Supplier Invoices: oldest %s unpaid
BoxTitleCurrentAccounts=Open Accounts: balances
BoxTitleLastModifiedContacts=Contacts/Addresses: last %s modified
BoxMyLastBookmarks=Bookmarks: last %s
BoxTitleLastModifiedContacts=Contacts/Addresses: latest %s modified
BoxMyLastBookmarks=Bookmarks: latest %s modified
BoxOldestExpiredServices=Oldest active expired services
BoxLastExpiredServices=Latest %s oldest contacts with active expired services
BoxTitleLastActionsToDo=Latest %s actions to do

View File

@ -531,18 +531,6 @@ September=September
October=October
November=November
December=December
JanuaryMin=Jan
FebruaryMin=Feb
MarchMin=Mar
AprilMin=Apr
MayMin=May
JuneMin=Jun
JulyMin=Jul
AugustMin=Aug
SeptemberMin=Sep
OctoberMin=Oct
NovemberMin=Nov
DecemberMin=Dec
Month01=January
Month02=February
Month03=March

View File

@ -28,7 +28,7 @@ Webpage=Web page/container
AddPage=Add page/container
HomePage=Home Page
PageContainer=Page/container
PreviewOfSiteNotYetAvailable=Preview of your website <strong>%s</strong> not yet available. You must first add a page.
PreviewOfSiteNotYetAvailable=Preview of your website <strong>%s</strong> not yet available. You must first '<strong>Import a full website template</strong>' or just '<strong>Add a page/container</strong>'.
RequestedPageHasNoContentYet=Requested page with id %s has no content yet, or cache file .tpl.php was removed. Edit content of the page to solve this.
SiteDeleted=Web site '%s' deleted
PageContent=Page/Contenair
@ -51,7 +51,7 @@ NoPageYet=No pages yet
YouCanCreatePageOrImportTemplate=You can create a new page or import a full website template
SyntaxHelp=Help on specific syntax tips
YouCanEditHtmlSourceckeditor=You can edit HTML source code using the "Source" button in editor.
YouCanEditHtmlSource=<br><span class="fa fa-bug"></span> You can include PHP code into this source using tags <strong>&lt;?php ?&gt;</strong>. The following global variables are available: $conf, $langs, $db, $mysoc, $user, $website.<br><br><span class="fa fa-bug"></span> You can also include content of another Page/Container with the following syntax:<br><strong>&lt;?php includeContainer('alias_of_container_to_include'); ?&gt;</strong><br><br><span class="fa fa-bug"></span> You can make a redirect to another Page/Container with the following syntax (Note: do not output any content before a redirect):<br><strong>&lt;?php redirectToContainer('alias_of_container_to_redirect_to'); ?&gt;</strong><br><br><span class="fa fa-download"></span> To include a <strong>link to download</strong> a file stored into the <strong>documents</strong> directory, use the <strong>document.php</strong> wrapper:<br>Example, for a file into documents/ecm (need to be logged), syntax is:<br><strong>&lt;a href="/document.php?modulepart=ecm&file=[relative_dir/]filename.ext"&gt;</strong><br>For a file into documents/medias (open directory for public access), syntax is:<br><strong>&lt;a href="/document.php?modulepart=medias&file=[relative_dir/]filename.ext"&gt;</strong><br>For a file shared with a share link (open access using the sharing hash key of file), syntax is:<br><strong>&lt;a href="/document.php?hashp=publicsharekeyoffile"&gt;</strong><br><br><span class="fa fa-picture-o"></span> To include an <strong>image</strong> stored into the <strong>documents</strong> directory, use the <strong>viewimage.php</strong> wrapper:<br>Example, for an image into documents/medias (open directory for public access), syntax is:<br><strong>&lt;img src="/viewimage.php?modulepart=medias&amp;file=[relative_dir/]filename.ext"&gt;</strong><br>
YouCanEditHtmlSource=<br><span class="fa fa-bug"></span> You can include PHP code into this source using tags <strong>&lt;?php ?&gt;</strong>. The following global variables are available: $conf, $langs, $db, $mysoc, $user, $website.<br><br><span class="fa fa-bug"></span> You can also include content of another Page/Container with the following syntax:<br><strong>&lt;?php includeContainer('alias_of_container_to_include'); ?&gt;</strong><br><br><span class="fa fa-bug"></span> You can make a redirect to another Page/Container with the following syntax (Note: do not output any content before a redirect):<br><strong>&lt;?php redirectToContainer('alias_of_container_to_redirect_to'); ?&gt;</strong><br><br><span class="fa fa-link"></span> To add a link to another page, use the syntax:<br><strong>&lt;a href="alias_of_page_to_link_to.php"&gt;mylink&lt;a&gt;</strong><br><br><span class="fa fa-download"></span> To include a <strong>link to download</strong> a file stored into the <strong>documents</strong> directory, use the <strong>document.php</strong> wrapper:<br>Example, for a file into documents/ecm (need to be logged), syntax is:<br><strong>&lt;a href="/document.php?modulepart=ecm&file=[relative_dir/]filename.ext"&gt;</strong><br>For a file into documents/medias (open directory for public access), syntax is:<br><strong>&lt;a href="/document.php?modulepart=medias&file=[relative_dir/]filename.ext"&gt;</strong><br>For a file shared with a share link (open access using the sharing hash key of file), syntax is:<br><strong>&lt;a href="/document.php?hashp=publicsharekeyoffile"&gt;</strong><br><br><span class="fa fa-picture-o"></span> To include an <strong>image</strong> stored into the <strong>documents</strong> directory, use the <strong>viewimage.php</strong> wrapper:<br>Example, for an image into documents/medias (open directory for public access), syntax is:<br><strong>&lt;img src="/viewimage.php?modulepart=medias&amp;file=[relative_dir/]filename.ext"&gt;</strong><br>
ClonePage=Clone page/container
CloneSite=Clone site
SiteAdded=Web site added
@ -63,8 +63,8 @@ WebsiteId=Website ID
CreateByFetchingExternalPage=Create page/container by fetching page from external URL...
OrEnterPageInfoManually=Or create page from scratch or from a page template...
FetchAndCreate=Fetch and Create
ExportSite=Export site
ImportSite=Import site
ExportSite=Export website
ImportSite=Import website template
IDOfPage=Id of page
Banner=Banner
BlogPost=Blog post

View File

@ -85,7 +85,7 @@ $head = mymoduleAdminPrepareHead();
dol_fiche_head($head, 'settings', '', -1, "mymodule@mymodule");
// Setup page goes here
echo $langs->trans("MyModuleSetupPage");
echo $langs->trans("MyModuleSetupPage").'<br><br>';
if ($action == 'edit')
@ -99,13 +99,10 @@ if ($action == 'edit')
foreach($arrayofparameters as $key => $val)
{
if (isset($val['enabled']) && empty($val['enabled'])) continue;
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans($key),$langs->trans($key.'Tooltip'));
print '</td><td><input name="'.$key.'" class="flat '.(empty($val['css'])?'minwidth200':$val['css']).'" value="' . $conf->global->$key . '"></td></tr>';
}
print '</table>';
print '<br><div class="center">';
@ -117,21 +114,28 @@ if ($action == 'edit')
}
else
{
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
foreach($arrayofparameters as $key => $val)
if (! empty($arrayofparameters))
{
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans($key),$langs->trans($key.'Tooltip'));
print '</td><td>' . $conf->global->$key . '</td></tr>';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
foreach($arrayofparameters as $key => $val)
{
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans($key),$langs->trans($key.'Tooltip'));
print '</td><td>' . $conf->global->$key . '</td></tr>';
}
print '</table>';
print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
print '</div>';
}
else
{
print '<br>'.$langs->trans("NothingToSetup");
}
print '</table>';
print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
print '</div>';
}
@ -140,3 +144,4 @@ dol_fiche_end();
llxFooter();
$db->close();

View File

@ -20,15 +20,14 @@
*/
/**
* \file dev/skeletons/skeleton_class.class.php
* \ingroup mymodule othermodule1 othermodule2
* \brief This file is an example for a CRUD class file (Create/Read/Update/Delete)
* Put some comments here
* \file htdocs/multicurrency/class/multicurrency.class.php
* \ingroup multicurrency
* \brief This file is a CRUD class file (Create/Read/Update/Delete) for multicurrency
*/
// Put here all includes required by your class file
require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
require_once DOL_DOCUMENT_ROOT ."/core/class/commonobjectline.class.php";
require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
require_once DOL_DOCUMENT_ROOT .'/core/class/commonobjectline.class.php';
/**
* Class Currency

View File

@ -1244,7 +1244,7 @@ else
print '</td></tr>';
}
// Email web
// Email / Web
print '<tr><td>'.fieldLabel('EMail','email',$conf->global->SOCIETE_EMAIL_MANDATORY).'</td>';
print '<td colspan="3"><input type="text" name="email" id="email" value="'.$object->email.'"></td></tr>';
print '<tr><td>'.fieldLabel('Web','url').'</td>';
@ -1256,19 +1256,19 @@ else
if (! empty($conf->global->SOCIALNETWORKS_SKYPE))
{
print '<tr><td>'.fieldLabel('Skype','skype').'</td>';
print '<td colspan="3"><input type="text" name="skype" id="skype" value="'.$object->skype.'"></td></tr>';
print '<td colspan="3"><input type="text" name="skype" class="minwidth100" maxlength="80" id="skype" value="'.dol_escape_htmltag(GETPOSTISSET("skype")?GETPOST("skype",'alpha'):$object->skype).'"></td></tr>';
}
// Twitter
if (! empty($conf->global->SOCIALNETWORKS_TWITTER))
{
print '<tr><td>'.fieldLabel('Twitter','twitter').'</td>';
print '<td colspan="3"><input type="text" name="twitter" id="twitter" value="'.$object->twitter.'"></td></tr>';
print '<td colspan="3"><input type="text" name="twitter" class="minwidth100" maxlength="80" id="twitter" value="'.dol_escape_htmltag(GETPOSTISSET("twitter")?GETPOST("twitter",'alpha'):$object->twitter).'"></td></tr>';
}
// Facebook
if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK))
{
print '<tr><td>'.fieldLabel('Facebook','facebook').'</td>';
print '<td colspan="3"><input type="text" name="facebook" id="facebook" value="'.$object->facebook.'"></td></tr>';
print '<td colspan="3"><input type="text" name="facebook" class="minwidth100" maxlength="80" id="facebook" value="'.dol_escape_htmltag(GETPOSTISSET("facebook")?GETPOST("facebook",'alpha'):$object->facebook).'"></td></tr>';
}
}
@ -1396,16 +1396,14 @@ else
print '</tr>';
}
if ($user->rights->societe->client->voir)
{
// Assign a Name
print '<tr>';
print '<td>'.fieldLabel('AllocateCommercial','commercial_id').'</td>';
print '<td colspan="3" class="maxwidthonsmartphone">';
$userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 0, 0, 0, '', 0, '', '', 0, 1);
print $form->multiselectarray('commercial', $userlist, GETPOST('commercial', 'array'), null, null, null, null, "90%");
print '</td></tr>';
}
// Assign a sale representative
print '<tr>';
print '<td>'.fieldLabel('AllocateCommercial','commercial_id').'</td>';
print '<td colspan="3" class="maxwidthonsmartphone">';
$userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 0, 0, 0, '', 0, '', '', 0, 1);
// Note: If user has no right to "see all thirdparties", we for selection of sale representative to him, so after creation he can see the record.
print $form->multiselectarray('commercial', $userlist, (count(GETPOST('commercial', 'array')) > 0?GETPOST('commercial', 'array'):(empty($user->rights->societe->client->voir)?array($user->id):array())), null, null, null, null, "90%");
print '</td></tr>';
// Incoterms
if (!empty($conf->incoterm->enabled))

View File

@ -79,9 +79,9 @@ class Societe extends CommonObject
*/
public $fields=array(
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
'nom' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
'name_alias' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20),
'nom' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
'name_alias' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20),
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>60),
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>61),
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>500),
@ -186,6 +186,16 @@ class Societe extends CommonObject
* @var string
*/
public $skype;
/**
* Twitter username
* @var string
*/
public $twitter;
/**
* Facebook username
* @var string
*/
public $facebook;
/**
* Webpage
* @var string
@ -811,6 +821,8 @@ class Societe extends CommonObject
$this->fax = preg_replace("/\./","",$this->fax);
$this->email = trim($this->email);
$this->skype = trim($this->skype);
$this->twitter = trim($this->twitter);
$this->facebook = trim($this->facebook);
$this->url = $this->url?clean_url($this->url,0):'';
$this->note_private = trim($this->note_private);
$this->note_public = trim($this->note_public);
@ -934,6 +946,8 @@ class Societe extends CommonObject
$sql .= ",fax = ".(! empty($this->fax)?"'".$this->db->escape($this->fax)."'":"null");
$sql .= ",email = ".(! empty($this->email)?"'".$this->db->escape($this->email)."'":"null");
$sql .= ",skype = ".(! empty($this->skype)?"'".$this->db->escape($this->skype)."'":"null");
$sql .= ",twitter = ".(! empty($this->twitter)?"'".$this->db->escape($this->twitter)."'":"null");
$sql .= ",facebook = ".(! empty($this->facebook)?"'".$this->db->escape($this->facebook)."'":"null");
$sql .= ",url = ".(! empty($this->url)?"'".$this->db->escape($this->url)."'":"null");
$sql .= ",parent = " . ($this->parent > 0 ? $this->parent : "null");
@ -1059,6 +1073,8 @@ class Societe extends CommonObject
$lmember->address=$this->address;
$lmember->email=$this->email;
$lmember->skype=$this->skype;
$lmember->twitter=$this->twitter;
$lmember->facebook=$this->facebook;
$lmember->phone=$this->phone;
$result=$lmember->update($user,0,1,1,1); // Use nosync to 1 to avoid cyclic updates
@ -1162,7 +1178,7 @@ class Societe extends CommonObject
$sql .= ', s.status';
$sql .= ', s.price_level';
$sql .= ', s.tms as date_modification, s.fk_user_creat, s.fk_user_modif';
$sql .= ', s.phone, s.fax, s.email, s.skype, s.url, s.zip, s.town, s.note_private, s.note_public, s.model_pdf, s.client, s.fournisseur';
$sql .= ', s.phone, s.fax, s.email, s.skype, s.twitter, s.facebook, s.url, s.zip, s.town, s.note_private, s.note_public, s.model_pdf, s.client, s.fournisseur';
$sql .= ', s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6';
$sql .= ', s.capital, s.tva_intra';
$sql .= ', s.fk_typent as typent_id';
@ -1255,6 +1271,8 @@ class Societe extends CommonObject
$this->email = $obj->email;
$this->skype = $obj->skype;
$this->twitter = $obj->twitter;
$this->facebook = $obj->facebook;
$this->url = $obj->url;
$this->phone = $obj->phone;
$this->fax = $obj->fax;
@ -3221,6 +3239,8 @@ class Societe extends CommonObject
$this->phone=$member->phone; // Prof phone
$this->email=$member->email;
$this->skype=$member->skype;
$this->twitter=$member->twitter;
$this->facebook=$member->facebook;
$this->client = 1; // A member is a customer by default
$this->code_client = -1;
@ -3360,6 +3380,8 @@ class Societe extends CommonObject
$this->country_code='FR';
$this->email='specimen@specimen.com';
$this->skype='tom.hanson';
$this->twitter='tomhanson';
$this->facebook='tomhanson';
$this->url='http://www.specimen.com';
$this->phone='0909090901';

View File

@ -161,25 +161,26 @@ if (! $rowid) {
print '<tr class="oddeven">';
// Ref
if (!empty($stripeacc)) $connect=$stripeacc.'/';
if (!empty($stripeacc)) $connect=$stripeacc.'/';
// Ref
if (preg_match('/po_/i', $txn->source)){
$origin="payouts";
} elseif (preg_match('/fee_/i', $txn->source)) {
$origin="connect/application_fees";
} else {
$origin="payments";
}
if (preg_match('/po_/i', $txn->source)){
$origin="payouts";
} elseif (preg_match('/fee_/i', $txn->source)) {
$origin="connect/application_fees";
} else {
$origin="payments";
}
$url='https://dashboard.stripe.com/'.$connect.'test/'.$origin.'/'.$txn->source;
if ($servicestatus)
{
$url='https://dashboard.stripe.com/'.$connect.$origin.'/'.$txn->source;
}
if ($txn->type == 'stripe_fee' || $txn->type == 'reserve_transaction') {
print "<td>".$txn->type."</td>";
} else print "<td><a href='".$url."' target='_stripe'>".img_picto($langs->trans('ShowInStripe'), 'object_globe')." " . $txn->source . "</a></td>\n";
if ($servicestatus) {
$url='https://dashboard.stripe.com/'.$connect.$origin.'/'.$txn->source;
}
if ($txn->type == 'stripe_fee' || $txn->type == 'reserve_transaction') {
print "<td>".$txn->type."</td>";
} else {
print "<td><a href='".$url."' target='_stripe'>".img_picto($langs->trans('ShowInStripe'), 'object_globe')." " . $txn->source . "</a></td>\n";
}
// Stripe customer
//print "<td>".$charge->customer."</td>\n";

View File

@ -497,6 +497,7 @@ input#onlinepaymenturl, input#directdownloadlink {
}
hr { border: 0; border-top: 1px solid #ccc; }
.tabBar hr { margin-top: 20px; margin-bottom: 17px; }
.button, .buttonDelete, input[name="sbmtConnexion"] {
margin-bottom: 0;
@ -4430,7 +4431,7 @@ td.gminorheading {
.ecmfiletree {
width: 99%;
height: 99%;
background: #FFF;
/* background: #FFF; */
padding-left: 2px;
font-weight: normal;
}

View File

@ -62,7 +62,7 @@ class User extends CommonObject
public $birth;
public $email;
public $skype;
public $job;
public $job; // job position
public $signature;
public $address;
public $zip;

View File

@ -1,10 +1,9 @@
<?php
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2007-2018 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) ---Put here your own copyright and developer email---
*
* 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
@ -158,7 +157,7 @@ class Website extends CommonObject
$sql.= 'status,';
$sql.= 'fk_default_home,';
$sql.= 'virtualhost,';
$sql.= 'fk_user_create,';
$sql.= 'fk_user_creat,';
$sql.= 'date_creation,';
$sql.= 'tms';
$sql .= ') VALUES (';
@ -168,7 +167,7 @@ class Website extends CommonObject
$sql .= ' '.(! isset($this->status)?'1':$this->status).',';
$sql .= ' '.(! isset($this->fk_default_home)?'NULL':$this->fk_default_home).',';
$sql .= ' '.(! isset($this->virtualhost)?'NULL':"'".$this->db->escape($this->virtualhost)."'").",";
$sql .= ' '.(! isset($this->fk_user_create)?$user->id:$this->fk_user_create).',';
$sql .= ' '.(! isset($this->fk_user_creat)?$user->id:$this->fk_user_creat).',';
$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 .= ')';
@ -227,7 +226,7 @@ class Website extends CommonObject
$sql .= " t.status,";
$sql .= " t.fk_default_home,";
$sql .= " t.virtualhost,";
$sql .= " t.fk_user_create,";
$sql .= " t.fk_user_creat,";
$sql .= " t.fk_user_modif,";
$sql .= " t.date_creation,";
$sql .= " t.tms as date_modification";
@ -253,7 +252,7 @@ class Website extends CommonObject
$this->status = $obj->status;
$this->fk_default_home = $obj->fk_default_home;
$this->virtualhost = $obj->virtualhost;
$this->fk_user_create = $obj->fk_user_create;
$this->fk_user_creat = $obj->fk_user_creat;
$this->fk_user_modif = $obj->fk_user_modif;
$this->date_creation = $this->db->jdate($obj->date_creation);
$this->date_modification = $this->db->jdate($obj->date_modification);
@ -317,7 +316,7 @@ class Website extends CommonObject
$sql .= " t.status,";
$sql .= " t.fk_default_home,";
$sql .= " t.virtualhost,";
$sql .= " t.fk_user_create,";
$sql .= " t.fk_user_creat,";
$sql .= " t.fk_user_modif,";
$sql .= " t.date_creation,";
$sql .= " t.tms as date_modification";
@ -357,7 +356,7 @@ class Website extends CommonObject
$line->status = $obj->status;
$line->fk_default_home = $obj->fk_default_home;
$line->virtualhost = $obj->virtualhost;
$this->fk_user_create = $obj->fk_user_create;
$this->fk_user_creat = $obj->fk_user_creat;
$this->fk_user_modif = $obj->fk_user_modif;
$line->date_creation = $this->db->jdate($obj->date_creation);
$line->date_modification = $this->db->jdate($obj->date_modification);
@ -639,10 +638,11 @@ class Website extends CommonObject
if (! $error)
{
$filetpl=$pathofwebsitenew.'/page'.$newidforhome.'.tpl.php';
$filewrapper=$pathofwebsitenew.'/wrapper.php';
// Generate the index.php page to be the home page
//-------------------------------------------------
$result = dolSaveIndexPage($pathofwebsitenew, $fileindex, $filetpl);
$result = dolSaveIndexPage($pathofwebsitenew, $fileindex, $filetpl, $filewrapper);
}
}
@ -769,7 +769,7 @@ class Website extends CommonObject
$this->status = '';
$this->fk_default_home = null;
$this->virtualhost = 'http://myvirtualhost';
$this->fk_user_create = $user->id;
$this->fk_user_creat = $user->id;
$this->fk_user_modif = $user->id;
$this->date_creation = dol_now();
$this->tms = dol_now();
@ -783,7 +783,7 @@ class Website extends CommonObject
*/
function exportWebSite()
{
global $conf;
global $conf, $mysoc;
$website = $this;
@ -904,6 +904,9 @@ class Website extends CommonObject
$stringtoexport = str_replace('file=js/'.$website->ref.'/', "file=js/__WEBSITE_KEY__/", $stringtoexport);
$stringtoexport = str_replace('medias/image/'.$website->ref.'/', "medias/image/__WEBSITE_KEY__/", $stringtoexport);
$stringtoexport = str_replace('medias/js/'.$website->ref.'/', "medias/js/__WEBSITE_KEY__/", $stringtoexport);
$stringtoexport = str_replace('file=logos%2Fthumbs%2F'.$mysoc->logo_small, "file=logos%2Fthumbs%2F__LOGO_SMALL_KEY__", $stringtoexport);
$stringtoexport = str_replace('file=logos%2Fthumbs%2F'.$mysoc->logo_mini, "file=logos%2Fthumbs%2F__LOGO_MINI_KEY__", $stringtoexport);
$stringtoexport = str_replace('file=logos%2Fthumbs%2F'.$mysoc->logo, "file=logos%2Fthumbs%2F__LOGO_KEY__", $stringtoexport);
$line.= "'".$this->db->escape(str_replace(array("\r\n","\r","\n"), "__N__", $stringtoexport))."', "; // Replace \r \n to have record on 1 line
$stringtoexport = $objectpageold->content;
@ -912,6 +915,9 @@ class Website extends CommonObject
$stringtoexport = str_replace('file=js/'.$website->ref.'/', "file=js/__WEBSITE_KEY__/", $stringtoexport);
$stringtoexport = str_replace('medias/image/'.$website->ref.'/', "medias/image/__WEBSITE_KEY__/", $stringtoexport);
$stringtoexport = str_replace('medias/js/'.$website->ref.'/', "medias/js/__WEBSITE_KEY__/", $stringtoexport);
$stringtoexport = str_replace('file=logos%2Fthumbs%2F'.$mysoc->logo_small, "file=logos%2Fthumbs%2F__LOGO_SMALL_KEY__", $stringtoexport);
$stringtoexport = str_replace('file=logos%2Fthumbs%2F'.$mysoc->logo_mini, "file=logos%2Fthumbs%2F__LOGO_MINI_KEY__", $stringtoexport);
$stringtoexport = str_replace('file=logos%2Fthumbs%2F'.$mysoc->logo, "file=logos%2Fthumbs%2F__LOGO_KEY__", $stringtoexport);
$line.= "'".$this->db->escape($stringtoexport)."'"; // Replace \r \n to have record on 1 line
$line.= ");";
$line.= "\n";
@ -951,7 +957,7 @@ class Website extends CommonObject
*/
function importWebSite($pathtofile)
{
global $conf;
global $conf, $mysoc;
$error = 0;
@ -1000,10 +1006,14 @@ class Website extends CommonObject
$arrayreplacement['__WEBSITE_ID__'] = $object->id;
$arrayreplacement['__WEBSITE_KEY__'] = $object->ref;
$arrayreplacement['__N__'] = $this->db->escape("\n"); // Restore \n
$arrayreplacement['__LOGO_SMALL_KEY__'] = $this->db->escape($mysoc->logo_small);
$arrayreplacement['__LOGO_MINI_KEY__'] = $this->db->escape($mysoc->logo_mini);
$arrayreplacement['__LOGO_KEY__'] = $this->db->escape($mysoc->logo);
$result = dolReplaceInFile($sqlfile, $arrayreplacement);
$this->db->begin();
// Search the $maxrowid because we need it later
$sqlgetrowid='SELECT MAX(rowid) as max from '.MAIN_DB_PREFIX.'website_page';
$resql=$this->db->query($sqlgetrowid);
if ($resql)
@ -1012,7 +1022,8 @@ class Website extends CommonObject
$maxrowid=$obj->max;
}
$runsql = run_sql($sqlfile, 1, '', 0, '', 'none', 0, 1);
// Load sql record
$runsql = run_sql($sqlfile, 1, '', 0, '', 'none', 0, 1); // The maxrowid of table is searched into this function two
if ($runsql <= 0)
{
$this->errors[]='Failed to load sql file '.$sqlfile;
@ -1035,13 +1046,19 @@ class Website extends CommonObject
$newid = ($reg[2] + $maxrowid);
$aliasesarray = explode(',', $reg[3]);
$objectpagestatic->fetch($newid);
dol_syslog("Found ID ".$oldid." to replace with ID ".$newid." and shortcut aliases to create: ".$reg[3]);
dol_move($conf->website->dir_output.'/'.$object->ref.'/page'.$oldid.'.tpl.php', $conf->website->dir_output.'/'.$object->ref.'/page'.$newid.'.tpl.php', 0, 1, 0, 0);
// The move is not enough, so we regenerate page
$filetpl=$conf->website->dir_output.'/'.$object->ref.'/page'.$newid.'.tpl.php';
dolSavePageContent($filetpl, $object, $objectpagestatic);
// Regenerate alternative aliases pages
foreach($aliasesarray as $aliasshortcuttocreate)
{
$objectpagestatic->id = $newid;
$filealias=$conf->website->dir_output.'/'.$object->ref.'/'.$aliasshortcuttocreate.'.php';
dolSavePageAlias($filealias, $object, $objectpagestatic);
}

View File

@ -1,9 +1,8 @@
<?php
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2007-2018 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) ---Put here your own copyright and developer email---
*
* 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
@ -92,8 +91,8 @@ class WebsitePage extends CommonObject
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>501),
//'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>502),
//'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>true, 'position'=>510),
//'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-1, 'position'=>511),
'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>true, 'position'=>510),
'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-1, 'position'=>511),
//'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'index'=>1, 'position'=>1000, 'notnull'=>-1),
);
@ -130,7 +129,7 @@ class WebsitePage extends CommonObject
* Load object in memory from the database
*
* @param int $id Id object.
* - If this is 0, the value into $page will be used. If not found of $page not defined, the default page of website_id will be used or the first page found if not set.
* - If this is 0, the value into $page will be used. If not found or $page not defined, the default page of website_id will be used or the first page found if not set.
* - If value is < 0, we must exclude this ID.
* @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)
@ -159,7 +158,7 @@ class WebsitePage extends CommonObject
$sql .= " t.grabbed_from,";
$sql .= " t.date_creation,";
$sql .= " t.tms as date_modification,";
$sql .= " t.fk_user_create,";
$sql .= " t.fk_user_creat,";
$sql .= " t.fk_user_modif";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
//$sql .= ' WHERE entity IN ('.getEntity('website').')'; // entity is on website level
@ -202,7 +201,7 @@ class WebsitePage extends CommonObject
$this->grabbed_from = $obj->grabbed_from;
$this->date_creation = $this->db->jdate($obj->date_creation);
$this->date_modification = $this->db->jdate($obj->date_modification);
$this->fk_user_create = $obj->fk_user_create;
$this->fk_user_creat = $obj->fk_user_creat;
$this->fk_user_modif = $obj->fk_user_modif;
}
$this->db->free($resql);
@ -255,7 +254,7 @@ class WebsitePage extends CommonObject
$sql .= " t.grabbed_from,";
$sql .= " t.date_creation,";
$sql .= " t.tms as date_modification,";
$sql .= " t.fk_user_create,";
$sql .= " t.fk_user_creat,";
$sql .= " t.fk_user_modif";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t';
$sql .= ' WHERE t.fk_website = '.$websiteid;
@ -271,11 +270,11 @@ class WebsitePage extends CommonObject
}
}
if (count($sqlwhere) > 0) {
$sql .= ' AND ' . implode(' '.$filtermode.' ', $sqlwhere);
$sql .= ' AND (' . implode(' '.$filtermode.' ', $sqlwhere).')';
}
if (!empty($sortfield)) {
$sql .= $this->db->order($sortfield,$sortorder);
$sql .= $this->db->order($sortfield, $sortorder);
}
if (!empty($limit)) {
$sql .= ' ' . $this->db->plimit($limit, $offset);
@ -305,7 +304,7 @@ class WebsitePage extends CommonObject
$record->grabbed_from = $obj->grabbed_from;
$record->date_creation = $this->db->jdate($obj->date_creation);
$record->date_modification = $this->db->jdate($obj->date_modification);
$record->fk_user_create = $obj->fk_user_create;
$record->fk_user_creat = $obj->fk_user_creat;
$record->fk_user_modif = $obj->fk_user_modif;
//var_dump($record->id);
$records[$record->id] = $record;
@ -401,7 +400,7 @@ class WebsitePage extends CommonObject
$object->ref = $newref;
$object->pageurl = $newref;
$object->aliasalt = '';
$object->fk_user_create = $user->id;
$object->fk_user_creat = $user->id;
$object->title = ($keeptitleunchanged ? '' : $langs->trans("CopyOf").' ').$object->title;
if (! empty($newlang)) $object->lang=$newlang;
if ($istranslation) $object->fk_page = $fromid;
@ -555,6 +554,6 @@ class WebsitePage extends CommonObject
$this->grabbed_from = '';
$this->date_creation = $now - (24 * 30 * 3600);
$this->date_modification = $now - (24 * 7 * 3600);
$this->fk_user_create = $user->id;
$this->fk_user_creat = $user->id;
}
}

View File

@ -109,28 +109,55 @@ if ($websitekey)
}
$website = $object;
// Check pageid received as aprameter
if ($pageid < 0) $pageid = 0;
if (($pageid > 0 || $pageref) && $action != 'addcontainer')
{
$res = $objectpage->fetch($pageid, ($object->id > 0 ? $object->id : null), $pageref);
//var_dump($res);exit;
//if ($res == 0) // Page ref not found, we check in alias
//{
// $res = $objectpage->fetch($pageid, ($object->id > 0 ? $object->id : null), $pageref);
//}
// Check if pageid is inside the new website, if not we reset param pageid
if ($object->id > 0 && ($objectpage->fk_website != $object->id))
if ($res >= 0 && $object->id > 0)
{
$res = $objectpage->fetch(0, $object->id, '');;
if ($res == 0) // Page was not found, we reset it
if ($objectpage->fk_website != $object->id) // We have a bad page.
{
$objectpage=new WebsitePage($db);
$res = $objectpage->fetch(0, $object->id, ''); // We search first page of web site
if ($res == 0) // Page was not found, we reset it
{
$objectpage=new WebsitePage($db);
}
else // We found a page, we set pageid to it.
{
$pageid = $objectpage->id;
}
}
else // We have a valid page. We force pageid for the case we got the page with a fetch on ref.
{
$pageid = $objectpage->id;
}
}
$pageid = $objectpage->id;
}
// Define pageid if pageid and pageref not received as parameter or was wrong
if (empty($pageid) && empty($pageref) && $object->id > 0 && $action != 'createcontainer')
{
$pageid = $object->fk_default_home;
if (empty($pageid))
{
$array=$objectpage->fetchAll($object->id, 'ASC,ASC', 'type_container,pageurl');
if (! is_array($array) && $array < 0) dol_print_error('', $objectpage->error, $objectpage->errors);
$atleastonepage=(is_array($array) && count($array) > 0);
$firstpageid=0;$homepageid=0;
foreach($array as $key => $valpage)
{
if (empty($firstpageid)) $firstpageid=$valpage->id;
if ($object->fk_default_home && $key == $object->fk_default_home) $homepageid=$valpage->id;
}
$pageid=($homepageid?$homepageid:$firstpageid); // We choose home page and if not defined yet, we take first page
}
}
global $dolibarr_main_data_root;
$pathofwebsite=$dolibarr_main_data_root.'/website/'.$websitekey;
$filehtmlheader=$pathofwebsite.'/htmlheader.html';
@ -180,6 +207,7 @@ if ($action == 'renamefile') $action='file_manager'; // After actions_linkedfil
if ($action == 'seteditinline')
{
dolibarr_set_const($db, 'WEBSITE_EDITINLINE', 1);
setEventMessages($langs->trans("FeatureNotYetAvailable"), null, 'warnings');
dolibarr_set_const($db, 'WEBSITE_SUBCONTAINERSINLINE', 0); // Force disable of show included containers
header("Location: ".$_SERVER["PHP_SELF"].'?website='.GETPOST('website','alphanohtml').'&pageid='.GETPOST('pageid','int'));
exit;
@ -360,7 +388,7 @@ if ($action == 'addcontainer')
// Remove comments
$tmp['content'] = removeHtmlComment($tmp['content']);
preg_match('/<head>(.*)<\/head>/is', $tmp['content'], $reg);
preg_match('/<head>(.*)<\/head>/ims', $tmp['content'], $reg);
$head = $reg[1];
$objectpage->type_container = 'page';
@ -820,7 +848,7 @@ if ($action == 'updatecss')
/* We disable php code since htmlheader is never executed as an include but only read by fgets_content.
$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.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { 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";
@ -843,7 +871,7 @@ if ($action == 'updatecss')
$csscontent.= "<?php // BEGIN PHP\n";
$csscontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
$csscontent.= "if (! defined('USEDOLIBARRSERVER')) { require_once dirname(__FILE__).'/master.inc.php'; } // Not already loaded"."\n"; // For the css, we need to set path of master using the dirname of css file.
$csscontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once dirname(__FILE__).'/master.inc.php'; } // Not already loaded"."\n"; // For the css, we need to set path of master using the dirname of css file.
$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";
@ -875,7 +903,7 @@ if ($action == 'updatecss')
$jscontent.= "<?php // BEGIN PHP\n";
$jscontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
$jscontent.= "if (! defined('USEDOLIBARRSERVER')) { require_once dirname(__FILE__).'/master.inc.php'; } // Not already loaded"."\n"; // For the css, we need to set path of master using the dirname of css file.
$jscontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once dirname(__FILE__).'/master.inc.php'; } // Not already loaded"."\n"; // For the css, we need to set path of master using the dirname of css file.
$jscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
$jscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
$jscontent.= "ob_start();\n";
@ -907,7 +935,7 @@ if ($action == 'updatecss')
/*$robotcontent.= "<?php // BEGIN PHP\n";
$robotcontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
$robotcontent.= "if (! defined('USEDOLIBARRSERVER')) { require_once './master.inc.php'; } // Not already loaded"."\n";
$robotcontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Not already loaded"."\n";
$robotcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
$robotcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
$robotcontent.= "ob_start();\n";
@ -939,7 +967,7 @@ if ($action == 'updatecss')
/*$robotcontent.= "<?php // BEGIN PHP\n";
$robotcontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
$robotcontent.= "if (! defined('USEDOLIBARRSERVER')) { require_once './master.inc.php'; } // Not already loaded"."\n";
$robotcontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Not already loaded"."\n";
$robotcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
$robotcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
$robotcontent.= "ob_start();\n";
@ -1203,6 +1231,8 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf
if ($action == 'confirm_createfromclone')
{
$db->begin();
$objectnew = new Website($db);
$result = $objectnew->createFromClone($user, GETPOST('id','int'), GETPOST('siteref','aZ09'), (GETPOST('newlang','aZ09')?GETPOST('newlang','aZ09'):''));
if ($result < 0)
@ -1210,6 +1240,8 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf
$error++;
setEventMessages($objectnew->error, $objectnew->errors, 'errors');
$action='preview';
$db->rollback();
}
else
{
@ -1217,6 +1249,8 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf
$id = $object->id;
$pageid = $object->fk_default_home;
$websitekey = GETPOST('siteref','aZ09');
$db->commit();
}
}
@ -1235,17 +1269,51 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf
if (! $error)
{
$db->begin();
$newwebsiteid = GETPOST('newwebsite','int');
$pathofwebsitenew = $pathofwebsite;
$tmpwebsite=new Website($db);
if ($newwebsiteid > 0 && $newwebsiteid != $object->id)
{
$tmpwebsite->fetch($newwebsiteid);
$pathofwebsitenew = $dolibarr_main_data_root.'/website/'.$tmpwebsite->ref;
}
else
{
$tmpwebsite = $object;
}
$objectpage = new WebsitePage($db);
$result = $objectpage->createFromClone($user, $pageid, GETPOST('pageurl','aZ09'), (GETPOST('newlang','aZ09')?GETPOST('newlang','aZ09'):''), $istranslation, GETPOST('newwebsite','int'));
if ($result < 0)
$resultpage = $objectpage->createFromClone($user, $pageid, GETPOST('pageurl','aZ09'), (GETPOST('newlang','aZ09')?GETPOST('newlang','aZ09'):''), $istranslation, $newwebsiteid);
if ($resultpage < 0)
{
$error++;
setEventMessages($objectpage->error, $objectpage->errors, 'errors');
$action='createpagefromclone';
$db->rollback();
}
else
{
// TODO Switch on the new page ?
$fileindex=$pathofwebsitenew.'/index.php';
$filetpl=$pathofwebsitenew.'/page'.$resultpage->id.'.tpl.php';
$filewrapper=$pathofwebsitenew.'/wrapper.php';
//var_dump($pathofwebsitenew);
//var_dump($filetpl);
//exit;
dolSavePageContent($filetpl, $tmpwebsite, $resultpage);
// Switch on the new page if web site of new page/container is same
if (empty($newwebsiteid) || $newwebsiteid == $object->id)
{
$pageid = $resultpage->id;
}
$db->commit();
}
}
}
@ -1299,7 +1367,7 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf
$objectpage->content = GETPOST('PAGE_CONTENT','none');
// Clean data. We remove all the head section.
$objectpage->content = preg_replace('/<head>.*<\/head>/s', '', $objectpage->content);
$objectpage->content = preg_replace('/<head>.*<\/head>/ims', '', $objectpage->content);
/* $objectpage->content = preg_replace('/<base\s+href=[\'"][^\'"]+[\'"]\s/?>/s', '', $objectpage->content); */
@ -1566,7 +1634,7 @@ if (! GETPOST('hide_websitemenu'))
//var_dump($objectpage);exit;
print '<div class="centpercent websitebar">';
if (count($object->records) > 0)
if (count($object->records) > 0) // There is at least one web site
{
// ***** Part for web sites
@ -1662,7 +1730,8 @@ if (count($object->records) > 0)
print '</div>';
// Toolbar for website
// Toolbar for websites
print '<div class="websitetools">';
if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone')
@ -1762,7 +1831,7 @@ if (count($object->records) > 0)
$out.='<option value="'.$key.'"';
if ($pageid > 0 && $pageid == $key) $out.=' selected'; // To preselect a value
$out.='>';
$out.='['.$valpage->type_container.' '.$valpage->id.'] ';
$out.='['.$valpage->type_container.' '.sprintf("%03d", $valpage->id).'] ';
$out.=$valpage->pageurl.' - '.$valpage->title;
if ($object->fk_default_home && $key == $object->fk_default_home) $out.=' ('.$langs->trans("HomePage").')';
$out.='</option>';
@ -2368,10 +2437,15 @@ if ($action == 'editmeta' || $action == 'createcontainer')
$pagekeywords=$objectpage->keywords;
$pagelang=$objectpage->lang;
$pagehtmlheader=$objectpage->htmlheader;
$pagedatecreation=$objectpage->date_creation;
$pagedatemodification=$objectpage->date_modification;
$pageauthorid=$objectpage->fk_user_create;
}
else
{
$type_container = 'page';
$pagedatecreation=dol_now();
$pageauthorid=$user->id;
}
if (GETPOST('WEBSITE_TITLE','alpha')) $pagetitle=GETPOST('WEBSITE_TITLE','alpha');
if (GETPOST('WEBSITE_PAGENAME','alpha')) $pageurl=GETPOST('WEBSITE_PAGENAME','alpha');
@ -2436,13 +2510,37 @@ if ($action == 'editmeta' || $action == 'createcontainer')
print '<input type="text" class="flat minwidth300" name="WEBSITE_ALIASALT" value="'.dol_escape_htmltag($pagealiasalt).'">';
print '</td></tr>';
$fuser=new User($db);
$fuser->fetch($pageauthorid);
print '<tr><td>';
print $langs->trans('Author');
print '</td><td>';
if ($pageauthorid > 0) print $fuser->getNomUrl(1);
print '</td></tr>';
print '<tr><td>';
print $langs->trans('DateCreation');
print '</td><td>';
print dol_print_date($pagedatecreation, 'dayhour');
print '</td></tr>';
if ($action != 'createcontainer')
{
print '<tr><td>';
print $langs->trans('DateModification');
print '</td><td>';
print dol_print_date($pagedatemodification, 'dayhour');
print '</td></tr>';
}
print '<tr><td class="tdhtmlheader tdtop">';
$htmlhelp=$langs->trans("EditTheWebSiteForACommonHeader").'<br><br>';
$htmlhelp=$langs->trans("Example").' :<br>';
$htmlhelp.=dol_htmlentitiesbr($htmlheadercontentdefault);
print $form->textwithpicto($langs->trans('HtmlHeaderPage'), $htmlhelp, 1, 'help', '', 0, 2, 'htmlheadertooltip');
print '</td><td>';
$doleditor=new DolEditor('htmlheader', $pagehtmlheader, '', '180', 'ace', 'In', true, false, 'ace', 0, '100%', '');
$doleditor=new DolEditor('htmlheader', $pagehtmlheader, '', '120', 'ace', 'In', true, false, 'ace', ROWS_3, '100%', '');
print $doleditor->Create(1, '', true, 'HTML Header', 'html');
print '</td></tr>';
@ -2508,31 +2606,34 @@ if ($action == 'editmenu')
if ($action == 'editsource')
{
/*
* Editing with source editor
*/
// Editing with source editor
$contentforedit = '';
/*$contentforedit.='<style scoped>'."\n"; // "scoped" means "apply to parent element only". Not yet supported by browsers
$contentforedit.=$csscontent;
$contentforedit.='</style>'."\n";*/
//$contentforedit.='<style scoped>'."\n"; // "scoped" means "apply to parent element only". Not yet supported by browsers
//$contentforedit.=$csscontent;
//$contentforedit.='</style>'."\n";
$contentforedit .= $objectpage->content;
//var_dump($_SESSION["dol_screenheight"]);
$maxheightwin=480;
if (isset($_SESSION["dol_screenheight"]))
{
if ($_SESSION["dol_screenheight"] > 680) $maxheightwin = $_SESSION["dol_screenheight"]-400;
if ($_SESSION["dol_screenheight"] > 800) $maxheightwin = $_SESSION["dol_screenheight"]-490;
}
//var_dump($_SESSION["dol_screenheight"]);
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('PAGE_CONTENT',$contentforedit,'',500,'Full','',true,true,'ace',ROWS_5,'90%');
$doleditor=new DolEditor('PAGE_CONTENT',$contentforedit,'',$maxheightwin,'Full','',true,true,'ace',ROWS_5,'40%');
$doleditor->Create(0, '', false, 'HTML Source', 'php');
}
if ($action == 'editcontent')
/*if ($action == 'editcontent')
{
/*
* Editing with default ckeditor
*/
// Editing with default ckeditor
$contentforedit = '';
/*$contentforedit.='<style scoped>'."\n"; // "scoped" means "apply to parent element only". Not yet supported by browsers
$contentforedit.=$csscontent;
$contentforedit.='</style>'."\n";*/
//$contentforedit.='<style scoped>'."\n"; // "scoped" means "apply to parent element only". Not yet supported by browsers
//$contentforedit.=$csscontent;
//$contentforedit.='</style>'."\n";
$contentforedit .= $objectpage->content;
$contentforedit = preg_replace('/(<img.*src=")(?!http)/', '\1'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $contentforedit, -1, $nbrep);
@ -2540,7 +2641,7 @@ if ($action == 'editcontent')
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('PAGE_CONTENT',$contentforedit,'',500,'Full','',true,true,true,ROWS_5,'90%');
$doleditor->Create(0, '', false);
}
}*/
print "</div>\n</form>\n";
@ -2557,16 +2658,21 @@ if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpa
$objectpage->fetch($pageid);
$jscontent = @file_get_contents($filejs);
$out = '<!-- Page content '.$filetpl.' : Div with (CSS Of website from file + Style/htmlheader of page from database + Page content from database) -->'."\n";
$out = '<!-- Page content '.$filetpl.' : Div with (CSS Of website from file + Style/htmlheader of page from database + Page content from database or by include if WEBSITE_SUBCONTAINERSINLINE is on) -->'."\n";
// Include a html so we can benefit of the header of page.
// Note: We can't use iframe as it can be used to include another external html file
// Note: We can't use frame as it is deprecated.
/*if ($includepageintoaframeoradiv == 'iframe')
{
$out .= "<iframe><body></html>";
}*/
$out.="\n<html><head>\n";
$out.=dolWebsiteReplacementOfLinks($object, $objectpage->htmlheader, 1);
$out.="</head>\n";
$out.="\n<body>";
$out.='<div id="websitecontentundertopmenu" class="websitecontentundertopmenu">'."\n";
// REPLACEMENT OF LINKS When page called by website editor
@ -2601,27 +2707,32 @@ if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpa
// Do not enable the contenteditable when page was grabbed, ckeditor is removing span and adding borders,
// so editable will be available only from container created from scratch
//$out.='<div id="bodywebsite" class="bodywebsite"'.($objectpage->grabbed_from ? ' contenteditable="true"' : '').'>'."\n";
$out.='<div id="bodywebsite" class="bodywebsite">'."\n";
$out.='<div id="divbodywebsite" class="bodywebsite">'."\n";
// TODO Add the contenteditable="true" when mode Edit Inline is on
$newcontent = $objectpage->content;
// If mode WEBSITE_SUBCONTAINERSINLINE is on
if (! empty($conf->global->WEBSITE_SUBCONTAINERSINLINE))
{
define('USEDOLIBARREDITOR', 1);
//var_dump($filetpl);
$filephp = $filetpl;
ob_start();
include $filephp;
$newcontent = ob_get_contents();
ob_end_clean();
}
// Change the contenteditable to "true" or "false" when mode Edit Inline is on or off
if (empty($conf->global->WEBSITE_EDITINLINE))
{
$newcontent = preg_replace('/(div|section)(\s[^\>]*)contenteditable="true"/', '\1\2', $newcontent);
}
else
{
// TODO Add the contenteditable="true" when mode Edit Inline is on
}
/*
$filephp = $objectpage->
ob_start();
include $filephp;
$newcontent = ob_get_contents();
ob_end_clean();
*/
$out.=dolWebsiteReplacementOfLinks($object, $newcontent)."\n";
$out.='</div>';
@ -2636,9 +2747,6 @@ if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpa
$out.= "\n".'<!-- End page content '.$filetpl.' -->'."\n\n";
// For jqueryscoped (does not work as expected)
//$out.="<script>$.scoped();</script>";
print $out;
/*file_put_contents($filetpl, $out);