Merge remote-tracking branch 'upstream/develop' into 14a26
This commit is contained in:
commit
7c0350e948
@ -490,6 +490,9 @@ if ($id) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isset($obj->position)) {
|
||||
$obj->position = 1;
|
||||
}
|
||||
|
||||
fieldListWebsites($fieldlist, $obj, $tabname[$id], 'add');
|
||||
|
||||
@ -499,8 +502,6 @@ if ($id) {
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>";
|
||||
|
||||
$colspan = count($fieldlist) + 2;
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -735,7 +735,7 @@ class Translate
|
||||
* @param string $str string root to translate
|
||||
* @param string $countrycode country code (FR, ...)
|
||||
* @return string translated string
|
||||
* @see transcountrynoentities()
|
||||
* @see transcountrynoentities(), picto_from_langcode()
|
||||
*/
|
||||
public function transcountry($str, $countrycode)
|
||||
{
|
||||
@ -753,7 +753,7 @@ class Translate
|
||||
* @param string $str string root to translate
|
||||
* @param string $countrycode country code (FR, ...)
|
||||
* @return string translated string
|
||||
* @see transcountry()
|
||||
* @see transcountry(), picto_from_langcode()
|
||||
*/
|
||||
public function transcountrynoentities($str, $countrycode)
|
||||
{
|
||||
|
||||
@ -7996,7 +7996,7 @@ function dol_validElement($element)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return img flag of country for a language code or country code
|
||||
* Return img flag of country for a language code or country code.
|
||||
*
|
||||
* @param string $codelang Language code ('en_IN', 'fr_CA', ...) or ISO Country code on 2 characters in uppercase ('IN', 'FR')
|
||||
* @param string $moreatt Add more attribute on img tag (For example 'style="float: right"' or 'class="saturatemedium"')
|
||||
|
||||
@ -203,10 +203,6 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage,
|
||||
}
|
||||
// Add translation reference (main language)
|
||||
if ($object->isMultiLang()) {
|
||||
// Add myself
|
||||
$tplcontent .= '<?php if ($_SERVER["PHP_SELF"] == "'.(($object->fk_default_home == $objectpage->id) ? '/' : (($shortlangcode != substr($object->lang, 0, 2)) ? '/'.$shortlangcode : '')).'/'.$objectpage->pageurl.'.php") { ?>'."\n";
|
||||
$tplcontent .= '<link rel="alternate" hreflang="'.$shortlangcode.'" href="'.(($object->fk_default_home == $objectpage->id) ? '/' : (($shortlangcode != substr($object->lang, 0, 2)) ? '/'.$shortlangcode : '').'/'.$objectpage->pageurl.'.php').'" />'."\n";
|
||||
|
||||
// Add page "translation of"
|
||||
$translationof = $objectpage->fk_page;
|
||||
if ($translationof) {
|
||||
@ -225,6 +221,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add "has translation pages"
|
||||
$sql = 'SELECT rowid as id, lang, pageurl from '.MAIN_DB_PREFIX.'website_page where fk_page IN ('.$db->sanitize($objectpage->id.($translationof ? ', '.$translationof : '')).")";
|
||||
$resql = $db->query($sql);
|
||||
@ -244,6 +241,11 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage,
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
// Add myself
|
||||
$tplcontent .= '<?php if ($_SERVER["PHP_SELF"] == "'.(($object->fk_default_home == $objectpage->id) ? '/' : (($shortlangcode != substr($object->lang, 0, 2)) ? '/'.$shortlangcode : '')).'/'.$objectpage->pageurl.'.php") { ?>'."\n";
|
||||
$tplcontent .= '<link rel="alternate" hreflang="'.$shortlangcode.'" href="'.(($object->fk_default_home == $objectpage->id) ? '/' : (($shortlangcode != substr($object->lang, 0, 2)) ? '/'.$shortlangcode : '').'/'.$objectpage->pageurl.'.php').'" />'."\n";
|
||||
|
||||
$tplcontent .= '<?php } ?>'."\n";
|
||||
}
|
||||
// Add manifest.json. Do we have to add it only on home page ?
|
||||
|
||||
@ -362,7 +362,7 @@ tr.choiceselected td .button {
|
||||
}
|
||||
|
||||
a.button:link,a.button:visited,a.button:active {
|
||||
color: #888;
|
||||
color: #555;
|
||||
|
||||
}
|
||||
.button {
|
||||
|
||||
@ -572,7 +572,7 @@ dolibarr_install_syslog("- step2: end");
|
||||
|
||||
|
||||
$out = '<input type="checkbox" name="dolibarrpingno" id="dolibarrpingno" value="checked" checked="true"> ';
|
||||
$out .= $langs->trans("MakeAnonymousPing");
|
||||
$out .= '<label for="dolibarrpingno">'.$langs->trans("MakeAnonymousPing").'</label>';
|
||||
|
||||
$out .= '<!-- Add js script to manage the uncheck of option to not send the ping -->';
|
||||
$out .= '<script type="text/javascript">';
|
||||
|
||||
@ -143,5 +143,5 @@ ConfirmSitemapsCreation=Confirm sitemap generation
|
||||
SitemapGenerated=Sitemap Generated
|
||||
ImportFavicon=Favicon
|
||||
ErrorFaviconType=Favicon must be png
|
||||
ErrorFaviconSize=Favicon must be of size 32x32
|
||||
FaviconTooltip=Upload an image which needs to be a png of 32x32
|
||||
ErrorFaviconSize=Favicon must be sized 16x16, 32x32 or 64x64
|
||||
FaviconTooltip=Upload an image which needs to be a png (16x16, 32x32 or 64x64)
|
||||
|
||||
@ -213,10 +213,11 @@ if ($action == 'add' && empty($cancel)) {
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
|
||||
$ret = $object->create($user);
|
||||
if ($ret < 0) $error++;
|
||||
if (!empty($auto_create_paiement) && !$error) {
|
||||
$db->begin();
|
||||
// Create a line of payments
|
||||
$paiement = new PaymentSalary($db);
|
||||
$paiement->chid = $object->id;
|
||||
@ -243,15 +244,11 @@ if ($action == 'add' && empty($cancel)) {
|
||||
setEventMessages($paiement->error, null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
} else {
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($error)) {
|
||||
$db->commit();
|
||||
|
||||
if (GETPOST('saveandnew', 'alpha')) {
|
||||
setEventMessages($langs->trans("RecordSaved"), '', 'mesgs');
|
||||
header("Location: card.php?action=create&fk_project=" . urlencode($projectid) . "&accountid=" . urlencode($accountid) . '&paymenttype=' . urlencode(GETPOST('paymenttype', 'az09')) . '&datepday=' . GETPOST("datepday", 'int') . '&datepmonth=' . GETPOST("datepmonth", 'int') . '&datepyear=' . GETPOST("datepyear", 'int'));
|
||||
@ -260,6 +257,8 @@ if ($action == 'add' && empty($cancel)) {
|
||||
header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $object->id);
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -498,6 +498,12 @@ class Salary extends CommonObject
|
||||
$label = '<u>'.$langs->trans("Salary").'</u>';
|
||||
$label .= '<br>';
|
||||
$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
|
||||
if ($this->label) {
|
||||
$label .= '<br><b>'.$langs->trans('Label').':</b> '.$this->label;
|
||||
}
|
||||
if ($this->datesp && $this->dateep) {
|
||||
$label .= '<br><b>'.$langs->trans('Period').':</b> '.dol_print_date($this->datesp, 'day').' - '.dol_print_date($this->dateep, 'day');
|
||||
}
|
||||
|
||||
$url = DOL_URL_ROOT.'/salaries/card.php?id='.$this->id;
|
||||
|
||||
@ -647,9 +653,9 @@ class Salary extends CommonObject
|
||||
/**
|
||||
* Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee)
|
||||
*
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
|
||||
* @return string Libelle
|
||||
* @return string Label
|
||||
*/
|
||||
public function getLibStatut($mode = 0, $alreadypaid = -1)
|
||||
{
|
||||
|
||||
@ -123,8 +123,23 @@ if ($object->id) {
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize, 1, 1).'</td></tr>';
|
||||
|
||||
print "<tr>";
|
||||
print '<td class="titlefield">' . $langs->trans("DateStartPeriod") . '</td><td>';
|
||||
print dol_print_date($object->datesp, 'day');
|
||||
print '</td></tr>';
|
||||
|
||||
print "<tr>";
|
||||
print '<td>' . $langs->trans("DateEndPeriod") . '</td><td>';
|
||||
print dol_print_date($object->dateep, 'day');
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>' . $langs->trans("Amount") . '</td><td>' . price($object->amount, 0, $langs, 1, -1, -1, $conf->currency) . '</td></tr>';
|
||||
|
||||
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td>'.count($filearray).'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td>'.dol_print_size($totalsize, 1, 1).'</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
@ -532,6 +532,10 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
|
||||
$salstatic->id = $obj->rowid;
|
||||
$salstatic->ref = $obj->rowid;
|
||||
$salstatic->label = $obj->label;
|
||||
$salstatic->paye = $obj->paye;
|
||||
$salstatic->datesp = $db->jdate($obj->datesp);
|
||||
$salstatic->dateep = $db->jdate($obj->dateep);
|
||||
|
||||
// Show here line of result
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
@ -40,6 +40,7 @@ if (!empty($conf->expensereport->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||
}
|
||||
if (!empty($conf->salaries->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php';
|
||||
}
|
||||
|
||||
@ -354,16 +355,18 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac
|
||||
|
||||
// Latest payments of salaries
|
||||
if (!empty($conf->salaries->enabled) &&
|
||||
$user->rights->salaries->read && (in_array($object->id, $childids) || $object->id == $user->id)
|
||||
(($user->rights->salaries->read && (in_array($object->id, $childids) || $object->id == $user->id)) || (!empty($user->rights->salaries->readall)))
|
||||
) {
|
||||
$payment_salary = new PaymentSalary($db);
|
||||
$salary = new Salary($db);
|
||||
|
||||
$sql = "SELECT ps.rowid, s.datesp, s.dateep, ps.amount";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as ps";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."salary as s ON (s.rowid = ps.fk_salary)";
|
||||
$sql = "SELECT s.rowid as sid, s.ref as sref, s.label, s.datesp, s.dateep, s.paye, SUM(ps.amount) as alreadypaid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."salary as s";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."payment_salary as ps ON (s.rowid = ps.fk_salary)";
|
||||
$sql .= " WHERE s.fk_user = ".$object->id;
|
||||
$sql .= " AND ps.entity = ".$conf->entity;
|
||||
$sql .= " ORDER BY ps.rowid DESC";
|
||||
$sql .= " AND s.entity IN (".getEntity('salary').")";
|
||||
$sql .= " GROUP BY s.rowid, s.ref, s.label, s.datesp, s.dateep, s.paye";
|
||||
$sql .= " ORDER BY s.dateep DESC";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
@ -372,7 +375,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastSalaries", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/salaries/payments.php?search_user='.$object->login.'">'.$langs->trans("AllSalaries").'<span class="badge marginleftonlyshort">'.$num.'</span></a></td>';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastSalaries", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/salaries/list.php?search_user='.$object->login.'">'.$langs->trans("AllSalaries").'<span class="badge marginleftonlyshort">'.$num.'</span></a></td>';
|
||||
print '</tr></table></td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -380,16 +383,26 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac
|
||||
while ($i < $num && $i < $MAXLIST) {
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
$payment_salary->id = $objp->rowid;
|
||||
$payment_salary->ref = $objp->ref;
|
||||
$payment_salary->datep = $db->jdate($objp->datep);
|
||||
|
||||
$salary->id = $objp->sid;
|
||||
$salary->ref = $objp->sref ? $objp->sref : $objp->sid;
|
||||
$salary->label = $objp->label;
|
||||
$salary->datesp = $db->jdate($objp->datesp);
|
||||
$salary->dateep = $db->jdate($objp->dateep);
|
||||
$salary->paye = $objp->paye;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowraponall">';
|
||||
$payment_salary->id = $objp->rowid;
|
||||
$payment_salary->ref = $objp->rowid;
|
||||
print $payment_salary->getNomUrl(1);
|
||||
print $salary->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
print '<td class="right" width="80px">'.dol_print_date($db->jdate($objp->datesp), 'day')."</td>\n";
|
||||
print '<td class="right" width="80px">'.dol_print_date($db->jdate($objp->dateep), 'day')."</td>\n";
|
||||
print '<td class="right" style="min-width: 60px">'.price($objp->amount).'</td>';
|
||||
//print '<td class="right" class="nowraponall"><span class="ampount">'.price($objp->amount).'</span></td>';
|
||||
print '<td class="right" class="nowraponall">'.$salary->getLibStatut(5, $objp->alreadypaid).'</td>';
|
||||
|
||||
print '</tr>';
|
||||
$i++;
|
||||
|
||||
@ -2250,7 +2250,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
|
||||
|
||||
// Address
|
||||
print '<tr><td class="tdtop titlefield">'.$form->editfieldkey('Address', 'address', '', $object, 0).'</td>';
|
||||
print '<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey('Address', 'address', '', $object, 0).'</td>';
|
||||
print '<td>';
|
||||
if ($caneditfield) {
|
||||
print '<textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
|
||||
@ -2391,7 +2391,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
// Accountancy code
|
||||
if ($conf->accounting->enabled) {
|
||||
print "<tr>";
|
||||
print '<td class="titlefield">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td class="titlefieldcreate">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td>';
|
||||
if ($caneditfield) {
|
||||
print '<input size="30" type="text" class="flat" name="accountancy_code" value="'.$object->accountancy_code.'">';
|
||||
@ -2405,7 +2405,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
|
||||
// User color
|
||||
if (!empty($conf->agenda->enabled)) {
|
||||
print '<tr><td>'.$langs->trans("ColorUser").'</td>';
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("ColorUser").'</td>';
|
||||
print '<td>';
|
||||
if ($caneditfield) {
|
||||
print $formother->selectColor(GETPOSTISSET('color') ?GETPOST('color', 'alphanohtml') : $object->color, 'color', null, 1, '', 'hideifnotset');
|
||||
@ -2417,7 +2417,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
|
||||
// Photo
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Photo").'</td>';
|
||||
print '<td class="titlefieldcreate">'.$langs->trans("Photo").'</td>';
|
||||
print '<td>';
|
||||
print $form->showphoto('userphoto', $object, 60, 0, $caneditfield, 'photowithmargin', 'small', 1, 0, 'user', 1);
|
||||
print '</td>';
|
||||
@ -2535,21 +2535,26 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '</table><hr><table class="border centpercent">';
|
||||
print '</table>';
|
||||
|
||||
print '<hr>';
|
||||
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
|
||||
// TODO Move this into tab RH (HierarchicalResponsible must be on both tab)
|
||||
|
||||
// Default warehouse
|
||||
if (!empty($conf->stock->enabled) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) {
|
||||
print '<tr><td>'.$langs->trans("DefaultWarehouse").'</td><td>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("DefaultWarehouse").'</td><td>';
|
||||
print $formproduct->selectWarehouses($object->fk_warehouse, 'fk_warehouse', 'warehouseopen', 1);
|
||||
print ' <a href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit').'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddWarehouse").'"></span></a>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Position/Job
|
||||
print '<tr><td class="titlefield">'.$langs->trans("PostOrFunction").'</td>';
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("PostOrFunction").'</td>';
|
||||
print '<td>';
|
||||
if ($caneditfield) {
|
||||
print '<input size="30" type="text" name="job" value="'.dol_escape_htmltag($object->job).'">';
|
||||
|
||||
@ -595,7 +595,7 @@ $moreforfilter = '';
|
||||
// Filter on categories
|
||||
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('Categories').': ';
|
||||
$moreforfilter .= img_picto($langs->trans("Category"), 'category', 'class="paddingright"');
|
||||
$moreforfilter .= $formother->select_categories(Categorie::TYPE_USER, $search_categ, 'search_categ', 1);
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
@ -724,7 +724,7 @@ if (!empty($arrayfields['u.gender']['checked'])) {
|
||||
print_liste_field_titre("Gender", $_SERVER['PHP_SELF'], "u.gender", $param, "", "", $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['u.employee']['checked'])) {
|
||||
print_liste_field_titre("Employee", $_SERVER['PHP_SELF'], "u.employee", $param, "", "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Employee", $_SERVER['PHP_SELF'], "u.employee", $param, "", "", $sortfield, $sortorder, 'center ');
|
||||
}
|
||||
if (!empty($arrayfields['u.fk_user']['checked'])) {
|
||||
print_liste_field_titre("HierarchicalResponsible", $_SERVER['PHP_SELF'], "u.fk_user", $param, "", "", $sortfield, $sortorder);
|
||||
@ -822,6 +822,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
$li = $userstatic->getNomUrl(-1, '', 0, 0, 24, 1, 'login', '', 1);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
if (!empty($arrayfields['u.login']['checked'])) {
|
||||
print '<td class="nowraponall">';
|
||||
print $li;
|
||||
@ -836,13 +837,13 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
}
|
||||
}
|
||||
if (!empty($arrayfields['u.lastname']['checked'])) {
|
||||
print '<td class="tdoverflowmax150">'.$obj->lastname.'</td>';
|
||||
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->lastname).'">'.dol_escape_htmltag($obj->lastname).'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
if (!empty($arrayfields['u.firstname']['checked'])) {
|
||||
print '<td class="tdoverflowmax150">'.$obj->firstname.'</td>';
|
||||
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->lastname).'">'.dol_escape_htmltag($obj->firstname).'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -858,7 +859,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
}
|
||||
}
|
||||
if (!empty($arrayfields['u.employee']['checked'])) {
|
||||
print '<td>'.yn($obj->employee).'</td>';
|
||||
print '<td class="center">'.yn($obj->employee).'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -1091,6 +1091,12 @@ class Website extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
$line .= "\n-- For Dolibarr v14+ --\n";
|
||||
$line .= "UPDATE llx_website SET fk_default_lang = '".$this->fk_default_lang."' WHERE rowid = __WEBSITE_ID__;\n";
|
||||
$line .= "UPDATE llx_website SET otherlang = '".$this->otherlang."' WHERE rowid = __WEBSITE_ID__;\n";
|
||||
$line .= "\n";
|
||||
fputs($fp, $line);
|
||||
|
||||
fclose($fp);
|
||||
if (!empty($conf->global->MAIN_UMASK)) {
|
||||
@chmod($filesql, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
@ -1362,7 +1362,11 @@ if ($action == 'updatecss' && $usercanedit) {
|
||||
}
|
||||
$filetoread = realpath(dol_osencode($_FILES['addedfile']['tmp_name']));
|
||||
$filesize = getimagesize($filetoread);
|
||||
if ($filesize[0] != 32 || $filesize[1] != 32) {
|
||||
if ($filesize[0] != $filesize[1]) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans('ErrorFaviconMustBeASquaredImage'), array(), 'errors');
|
||||
}
|
||||
if (! $error && ($filesize[0] != 16 && $filesize[0] != 32 && $filesize[0] != 64)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans('ErrorFaviconSize'), array(), 'errors');
|
||||
}
|
||||
@ -2250,15 +2254,23 @@ $tempdir = $conf->website->dir_output.'/'.$websitekey.'/';
|
||||
// Generate web site sitemaps
|
||||
if ($action == 'generatesitemaps' && $usercanedit) {
|
||||
$domtree = new DOMDocument('1.0', 'UTF-8');
|
||||
|
||||
$root = $domtree->createElementNS('http://www.sitemaps.org/schemas/sitemap/0.9', 'urlset');
|
||||
$root->setAttributeNS('http://www.w3.org/2000/xmlns/' ,'xmlns:xhtml', 'http://www.w3.org/1999/xhtml');
|
||||
|
||||
$domtree->formatOutput = true;
|
||||
|
||||
$xmlname = 'sitemap.'.$websitekey.'.xml';
|
||||
|
||||
$sql = "SELECT wp.type_container , wp.pageurl, wp.lang, wp.tms as tms, w.virtualhost";
|
||||
$sql = "SELECT wp.rowid, wp.type_container , wp.pageurl, wp.lang, wp.fk_page, wp.tms as tms,";
|
||||
$sql .= " w.virtualhost, w.fk_default_home";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."website_page as wp, ".MAIN_DB_PREFIX."website as w";
|
||||
$sql .= " WHERE wp.type_container IN ('page', 'blogpost')";
|
||||
$sql .= " AND wp.fk_website = w.rowid";
|
||||
$sql .= " AND wp.status = ".WebsitePage::STATUS_VALIDATED;
|
||||
$sql .= " AND wp.pageurl NOT IN ('404', '500', '501', '503')";
|
||||
$sql .= " AND w.ref = '".dol_escape_json($websitekey)."'";
|
||||
$sql .= " ORDER BY wp.tms DESC, wp.rowid DESC";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num_rows = $db->num_rows($resql);
|
||||
@ -2267,18 +2279,115 @@ if ($action == 'generatesitemaps' && $usercanedit) {
|
||||
while ($i < $num_rows) {
|
||||
$objp = $db->fetch_object($resql);
|
||||
$url = $domtree->createElement('url');
|
||||
$pageurl = $objp->pageurl;
|
||||
|
||||
$shortlangcode = '';
|
||||
if ($objp->lang) {
|
||||
$pageurl = $objp->lang.'/'.$pageurl;
|
||||
$shortlangcode = substr($objp->lang, 0, 2); // en_US or en-US -> en
|
||||
}
|
||||
if (empty($shortlangcode)) {
|
||||
$shortlangcode = substr($object->lang, 0, 2); // en_US or en-US -> en
|
||||
}
|
||||
|
||||
// Forge $pageurl, adding language prefix if it is an alternative language
|
||||
$pageurl = $objp->pageurl.'.php';
|
||||
if ($objp->fk_default_home == $objp->rowid) {
|
||||
$pageurl = '';
|
||||
} else {
|
||||
if ($shortlangcode != substr($object->lang, 0, 2)) {
|
||||
$pageurl = $shortlangcode.'/'.$pageurl;
|
||||
}
|
||||
}
|
||||
|
||||
if ($objp->virtualhost) {
|
||||
$domainname = $objp->virtualhost;
|
||||
}
|
||||
$loc = $domtree->createElement('loc', 'http://'.$domainname.'/'.$pageurl);
|
||||
$lastmod = $domtree->createElement('lastmod', $db->jdate($objp->tms));
|
||||
if (! preg_match('/^http/i', $domainname)) {
|
||||
$domainname .= 'https://'.$domainname;
|
||||
}
|
||||
//$pathofpage = $dolibarr_main_url_root.'/'.$pageurl.'.php';
|
||||
|
||||
// URL of sitemaps must end with trailing slash if page is ''
|
||||
$loc = $domtree->createElement('loc', $domainname.'/'.$pageurl);
|
||||
$lastmod = $domtree->createElement('lastmod', dol_print_date($db->jdate($objp->tms), 'dayrfc', 'gmt'));
|
||||
$changefreq = $domtree->createElement('changefreq', 'weekly'); // TODO Manage other values
|
||||
$priority = $domtree->createElement('priority', '1');
|
||||
|
||||
$url->appendChild($loc);
|
||||
$url->appendChild($lastmod);
|
||||
// Add suggested frequency for refresh
|
||||
if (!empty($conf->global->WEBSITE_SITEMAPS_ADD_WEEKLY_FREQ)) {
|
||||
$url->appendChild($changefreq);
|
||||
}
|
||||
// Add higher priority for home page
|
||||
if ($objp->fk_default_home == $objp->rowid) {
|
||||
$url->appendChild($priority);
|
||||
}
|
||||
|
||||
// Now add alternate language entries
|
||||
if ($object->isMultiLang()) {
|
||||
$alternatefound = 0;
|
||||
|
||||
// Add page "translation of"
|
||||
$translationof = $objp->fk_page;
|
||||
if ($translationof) {
|
||||
$tmppage = new WebsitePage($db);
|
||||
$tmppage->fetch($translationof);
|
||||
if ($tmppage->id > 0) {
|
||||
$tmpshortlangcode = '';
|
||||
if ($tmppage->lang) {
|
||||
$tmpshortlangcode = preg_replace('/[_-].*$/', '', $tmppage->lang); // en_US or en-US -> en
|
||||
}
|
||||
if (empty($tmpshortlangcode)) {
|
||||
$tmpshortlangcode = preg_replace('/[_-].*$/', '', $object->lang); // en_US or en-US -> en
|
||||
}
|
||||
if ($tmpshortlangcode != $shortlangcode) {
|
||||
$xhtmllink = $domtree->createElement('xhtml:link', '');
|
||||
$xhtmllink->setAttribute("rel", "alternante");
|
||||
$xhtmllink->setAttribute("hreflang", $tmpshortlangcode);
|
||||
$xhtmllink->setAttribute("href", $domainname.($objp->fk_default_home == $tmppage->id ? '/' : (($tmpshortlangcode != substr($objp->lang, 0, 2)) ? '/'.$tmpshortlangcode : '').'/'.$tmppage->pageurl.'.php'));
|
||||
$url->appendChild($xhtmllink);
|
||||
|
||||
$alternatefound++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add "has translation pages"
|
||||
$sql = 'SELECT rowid as id, lang, pageurl from '.MAIN_DB_PREFIX.'website_page where fk_page IN ('.$db->sanitize($objp->rowid.($translationof ? ', '.$translationof : '')).")";
|
||||
$resqlhastrans = $db->query($sql);
|
||||
if ($resqlhastrans) {
|
||||
$num_rows_hastrans = $db->num_rows($resqlhastrans);
|
||||
if ($num_rows_hastrans > 0) {
|
||||
while ($objhastrans = $db->fetch_object($resqlhastrans)) {
|
||||
$tmpshortlangcode = '';
|
||||
if ($objhastrans->lang) {
|
||||
$tmpshortlangcode = preg_replace('/[_-].*$/', '', $objhastrans->lang); // en_US or en-US -> en
|
||||
}
|
||||
if ($tmpshortlangcode != $shortlangcode) {
|
||||
$xhtmllink = $domtree->createElement('xhtml:link', '');
|
||||
$xhtmllink->setAttribute("rel", "alternate");
|
||||
$xhtmllink->setAttribute("hreflang", $tmpshortlangcode);
|
||||
$xhtmllink->setAttribute("href", $domainname.($objp->fk_default_home == $objhastrans->id ? '/' : (($tmpshortlangcode != substr($objp->lang, 0, 2) ? '/'.$tmpshortlangcode : '')).'/'.$objhastrans->pageurl.'.php'));
|
||||
$url->appendChild($xhtmllink);
|
||||
|
||||
$alternatefound++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
if ($alternatefound) {
|
||||
// Add myself
|
||||
$xhtmllink = $domtree->createElement('xhtml:link', '');
|
||||
$xhtmllink->setAttribute("rel", "alternate");
|
||||
$xhtmllink->setAttribute("hreflang", $shortlangcode);
|
||||
$xhtmllink->setAttribute("href", $domainname.'/'.$pageurl);
|
||||
$url->appendChild($xhtmllink);
|
||||
}
|
||||
}
|
||||
|
||||
$root->appendChild($url);
|
||||
$i++;
|
||||
}
|
||||
@ -2295,6 +2404,8 @@ if ($action == 'generatesitemaps' && $usercanedit) {
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
// Add the entry Sitemap: into the robot file.
|
||||
$robotcontent = @file_get_contents($filerobot);
|
||||
$result = preg_replace('/<?php // BEGIN PHP[^?]END PHP ?>\n/ims', '', $robotcontent);
|
||||
if ($result) {
|
||||
@ -3199,7 +3310,7 @@ if ($action == 'editcss') {
|
||||
|
||||
print $form->textwithpicto($langs->trans('Virtualhost'), $htmltext, 1, 'help', '', 0, 2, 'virtualhosttooltip');
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="flat" value="'.(GETPOSTISSET('virtualhost') ? GETPOST('virtualhost', 'alpha') : $virtualurl).'" name="virtualhost">';
|
||||
print '<input type="text" class="flat minwidth300" value="'.(GETPOSTISSET('virtualhost') ? GETPOST('virtualhost', 'alpha') : $virtualurl).'" name="virtualhost">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -4113,7 +4224,7 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm' || $massaction =
|
||||
print getTitleFieldOfList("Type", 0, $_SERVER['PHP_SELF'], 'type_container', '', $param, '', $sortfield, $sortorder, '')."\n";
|
||||
print getTitleFieldOfList("Page", 0, $_SERVER['PHP_SELF'], 'pageurl', '', $param, '', $sortfield, $sortorder, '')."\n";
|
||||
print getTitleFieldOfList("Categories", 0, $_SERVER['PHP_SELF']);
|
||||
print getTitleFieldOfList("", 0, $_SERVER['PHP_SELF']);
|
||||
print getTitleFieldOfList("Language", 0, $_SERVER['PHP_SELF'], 'lang', '', $param, '', $sortfield, $sortorder, 'center ')."\n";
|
||||
print getTitleFieldOfList("", 0, $_SERVER['PHP_SELF']);
|
||||
print getTitleFieldOfList("DateLastModification", 0, $_SERVER['PHP_SELF'], 'tms', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; // Date last modif
|
||||
print getTitleFieldOfList("", 0, $_SERVER['PHP_SELF']);
|
||||
@ -4171,8 +4282,8 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm' || $massaction =
|
||||
$param .= '&searchstring='.urlencode($searchkey);
|
||||
|
||||
// Language
|
||||
print '<td>';
|
||||
print $answerrecord->lang;
|
||||
print '<td class="center">';
|
||||
print picto_from_langcode($answerrecord->lang, $answerrecord->lang);
|
||||
print '</td>';
|
||||
|
||||
// Number of words
|
||||
|
||||
Loading…
Reference in New Issue
Block a user