This commit is contained in:
Florian HENRY 2022-10-11 08:59:15 +02:00
commit eb533294d1
94 changed files with 733 additions and 488 deletions

View File

@ -426,11 +426,9 @@ if ($action == 'create') {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Modify').'</a>'; print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Modify').'</a>';
} }
if ($user->hasRight('accounting', 'chartofaccount')) { // Delete
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id.'">'.$langs->trans('Delete').'</a>'; $permissiontodelete = $user->hasRight('accounting', 'chartofaccount');
} else { print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete);
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Delete').'</a>';
}
print '</div>'; print '</div>';
} }

View File

@ -305,7 +305,7 @@ if ($action == 'create') {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$id.'">'.$langs->trans('Modify').'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$id.'">'.$langs->trans('Modify').'</a>';
// print '<a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?action=delete&token='.newToken().'&id=' . $id . '">' . $langs->trans('Delete') . '</a>'; //print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete);
print '</div>'; print '</div>';
} }

View File

@ -133,7 +133,7 @@ if (empty($user->socid)) {
} }
if ($user->rights->adherent->supprimer) { if ($user->rights->adherent->supprimer) {
echo '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&action=delete&token='.newToken().'&canvas='.$canvas.'">'.$langs->trans('Delete').'</a>'; print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&action=delete&token='.newToken().'&canvas='.$canvas, 'delete', $user->rights->adherent->supprimer);
} }
echo '</div><br>'; echo '</div><br>';

View File

@ -142,31 +142,31 @@ if ($db->type == 'pgsql') {
unset($fieldstosearchall['d.rowid']); unset($fieldstosearchall['d.rowid']);
} }
$arrayfields = array( $arrayfields = array(
'd.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), 'd.ref'=>array('label'=>"Ref", 'checked'=>1),
'd.civility'=>array('label'=>$langs->trans("Civility"), 'checked'=>0), 'd.civility'=>array('label'=>"Civility", 'checked'=>0),
'd.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1), 'd.lastname'=>array('label'=>"Lastname", 'checked'=>1),
'd.firstname'=>array('label'=>$langs->trans("Firstname"), 'checked'=>1), 'd.firstname'=>array('label'=>"Firstname", 'checked'=>1),
'd.gender'=>array('label'=>$langs->trans("Gender"), 'checked'=>0), 'd.gender'=>array('label'=>"Gender", 'checked'=>0),
'd.company'=>array('label'=>$langs->trans("Company"), 'checked'=>1), 'd.company'=>array('label'=>"Company", 'checked'=>1),
'd.login'=>array('label'=>$langs->trans("Login"), 'checked'=>1), 'd.login'=>array('label'=>"Login", 'checked'=>1),
'd.morphy'=>array('label'=>$langs->trans("MemberNature"), 'checked'=>1), 'd.morphy'=>array('label'=>"MemberNature", 'checked'=>1),
't.libelle'=>array('label'=>$langs->trans("Type"), 'checked'=>1), 't.libelle'=>array('label'=>"Type", 'checked'=>1),
'd.email'=>array('label'=>$langs->trans("Email"), 'checked'=>1), 'd.email'=>array('label'=>"Email", 'checked'=>1),
'd.address'=>array('label'=>$langs->trans("Address"), 'checked'=>0), 'd.address'=>array('label'=>"Address", 'checked'=>0),
'd.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>0), 'd.zip'=>array('label'=>"Zip", 'checked'=>0),
'd.town'=>array('label'=>$langs->trans("Town"), 'checked'=>0), 'd.town'=>array('label'=>"Town", 'checked'=>0),
'd.phone'=>array('label'=>$langs->trans("Phone"), 'checked'=>0), 'd.phone'=>array('label'=>"Phone", 'checked'=>0),
'd.phone_perso'=>array('label'=>$langs->trans("PhonePerso"), 'checked'=>0), 'd.phone_perso'=>array('label'=>"PhonePerso", 'checked'=>0),
'd.phone_mobile'=>array('label'=>$langs->trans("PhoneMobile"), 'checked'=>0), 'd.phone_mobile'=>array('label'=>"PhoneMobile", 'checked'=>0),
'state.nom'=>array('label'=>$langs->trans("State"), 'checked'=>0), 'state.nom'=>array('label'=>"State", 'checked'=>0),
'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0), 'country.code_iso'=>array('label'=>"Country", 'checked'=>0),
/*'d.note_public'=>array('label'=>$langs->trans("NotePublic"), 'checked'=>0), /*'d.note_public'=>array('label'=>"NotePublic", 'checked'=>0),
'd.note_private'=>array('label'=>$langs->trans("NotePrivate"), 'checked'=>0),*/ 'd.note_private'=>array('label'=>"NotePrivate", 'checked'=>0),*/
'd.datefin'=>array('label'=>$langs->trans("EndSubscription"), 'checked'=>1, 'position'=>500), 'd.datefin'=>array('label'=>"EndSubscription", 'checked'=>1, 'position'=>500),
'd.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), 'd.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
'd.birth'=>array('label'=>$langs->trans("Birthday"), 'checked'=>0, 'position'=>500), 'd.birth'=>array('label'=>"Birthday", 'checked'=>0, 'position'=>500),
'd.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), 'd.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
'd.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), 'd.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
'd.import_key'=>array('label'=>"ImportId", 'checked'=>0, 'position'=>1100), 'd.import_key'=>array('label'=>"ImportId", 'checked'=>0, 'position'=>1100),
); );
// Extra fields // Extra fields
@ -350,27 +350,43 @@ $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
if (!empty($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { if (!empty($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (d.rowid = ef.fk_object)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (d.rowid = ef.fk_object)";
} }
if ((!empty($search_categ) && ($search_categ > 0 || $search_categ == -2)) || !empty($catid)) {
// We need this table joined to the select in order to filter by categ
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_member as cm ON d.rowid = cm.fk_member";
}
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = d.country)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = d.country)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = d.state_id)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = d.state_id)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on (s.rowid = d.fk_soc)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on (s.rowid = d.fk_soc)";
$sql .= ", ".MAIN_DB_PREFIX."adherent_type as t"; $sql .= ", ".MAIN_DB_PREFIX."adherent_type as t";
$sql .= " WHERE d.fk_adherent_type = t.rowid"; $sql .= " WHERE d.fk_adherent_type = t.rowid";
if ($catid > 0) {
$sql .= " AND cm.fk_categorie = ".((int) $catid); if ($catid && empty($search_categ)) {
$search_categ = $catid;
} }
if ($catid == -2) {
$sql .= " AND cm.fk_categorie IS NULL"; $searchCategoryContactList = $search_categ ? array($search_categ) : array();
} $searchCategoryContactOperator = 0;
if ($search_categ > 0) { // Search for tag/category ($searchCategoryContactList is an array of ID)
$sql .= " AND cm.fk_categorie = ".((int) $search_categ); if (!empty($searchCategoryContactList)) {
} $searchCategoryContactSqlList = array();
if ($search_categ == -2) { $listofcategoryid = '';
$sql .= " AND cm.fk_categorie IS NULL"; foreach ($searchCategoryContactList as $searchCategoryContact) {
if (intval($searchCategoryContact) == -2) {
$searchCategoryContactSqlList[] = "NOT EXISTS (SELECT ck.fk_categorie FROM ".MAIN_DB_PREFIX."categorie_member as ck WHERE d.rowid = ck.fk_member)";
} elseif (intval($searchCategoryContact) > 0) {
$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryContact);
}
}
if ($listofcategoryid) {
$searchCategoryContactSqlList[] = " EXISTS (SELECT ck.fk_categorie FROM ".MAIN_DB_PREFIX."categorie_member as ck WHERE d.rowid = ck.fk_member AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))";
}
if ($searchCategoryContactOperator == 1) {
if (!empty($searchCategoryContactSqlList)) {
$sql .= " AND (".implode(' OR ', $searchCategoryContactSqlList).")";
}
} else {
if (!empty($searchCategoryContactSqlList)) {
$sql .= " AND (".implode(' AND ', $searchCategoryContactSqlList).")";
}
}
} }
$sql .= " AND d.entity IN (".getEntity('adherent').")"; $sql .= " AND d.entity IN (".getEntity('adherent').")";
if ($sall) { if ($sall) {
$sql .= natural_search(array_keys($fieldstosearchall), $sall); $sql .= natural_search(array_keys($fieldstosearchall), $sall);
@ -391,7 +407,7 @@ if ($search_status != '') {
// Peut valoir un nombre ou liste de nombre separes par virgules // Peut valoir un nombre ou liste de nombre separes par virgules
$sql .= " AND d.statut in (".$db->sanitize($db->escape($search_status)).")"; $sql .= " AND d.statut in (".$db->sanitize($db->escape($search_status)).")";
} }
if ($search_morphy != '') { if ($search_morphy != '' && $search_morphy != '-1') {
$sql .= natural_search("d.morphy", $search_morphy); $sql .= natural_search("d.morphy", $search_morphy);
} }
if ($search_ref) { if ($search_ref) {
@ -670,7 +686,7 @@ $moreforfilter = '';
if (isModEnabled('categorie') && $user->rights->categorie->lire) { if (isModEnabled('categorie') && $user->rights->categorie->lire) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">'; $moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= img_picto($langs->trans('Categories'), 'category', 'class="pictofixedlength"').$formother->select_categories(Categorie::TYPE_MEMBER, $search_categ, 'search_categ', 1); $moreforfilter .= img_picto($langs->trans('Categories'), 'category', 'class="pictofixedlength"').$formother->select_categories(Categorie::TYPE_MEMBER, $search_categ, 'search_categ', 1, $langs->trans("MembersCategoriesShort"));
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
} }
$parameters = array(); $parameters = array();
@ -741,10 +757,11 @@ if (!empty($arrayfields['d.login']['checked'])) {
print '<td class="liste_titre left">'; print '<td class="liste_titre left">';
print '<input class="flat maxwidth75imp" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'"></td>'; print '<input class="flat maxwidth75imp" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'"></td>';
} }
// Nature
if (!empty($arrayfields['d.morphy']['checked'])) { if (!empty($arrayfields['d.morphy']['checked'])) {
print '<td class="liste_titre left">'; print '<td class="liste_titre center">';
$arraymorphy = array('mor'=>$langs->trans("Moral"), 'phy'=>$langs->trans("Physical")); $arraymorphy = array('mor'=>$langs->trans("Moral"), 'phy'=>$langs->trans("Physical"));
print $form->selectarray('search_morphy', $arraymorphy, $search_morphy, 1); print $form->selectarray('search_morphy', $arraymorphy, $search_morphy, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100');
print '</td>'; print '</td>';
} }
if (!empty($arrayfields['t.libelle']['checked'])) { if (!empty($arrayfields['t.libelle']['checked'])) {

View File

@ -65,18 +65,21 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
* View * View
*/ */
$textobject = $langs->transnoentitiesnoconv("Bank"); $help_url = '';
$page_name = "BankSetupModule";
llxHeader('', $langs->trans("BankSetupModule"), $help_url); llxHeader('', $langs->trans("BankSetupModule"), $help_url);
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("BankSetupModule"), $linkback, 'title_setup'); print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
$head = bank_admin_prepare_head(null); $head = bank_admin_prepare_head(null);
print dol_get_fiche_head($head, 'attributes', $langs->trans("BankSetupModule"), -1, 'account'); print dol_get_fiche_head($head, 'attributes', $langs->trans($page_name), -1, 'account');
$textobject = $langs->transnoentitiesnoconv("Bank");
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';

View File

@ -22,7 +22,7 @@
*/ */
/** /**
* \file admin/bankline_extrafields.php * \file htdocs/admin/bankline_extrafields.php
* \ingroup bank * \ingroup bank
* \brief Page to setup extra fields of bankline * \brief Page to setup extra fields of bankline
*/ */
@ -41,7 +41,7 @@ $form = new Form($db);
// List of supported format // List of supported format
$tmptype2label = ExtraFields::$type2label; $tmptype2label = ExtraFields::$type2label;
$type2label = []; $type2label = array();
foreach ($tmptype2label as $key => $val) { foreach ($tmptype2label as $key => $val) {
$type2label[$key] = $langs->transnoentitiesnoconv($val); $type2label[$key] = $langs->transnoentitiesnoconv($val);
} }
@ -80,6 +80,8 @@ $head = bank_admin_prepare_head(null);
print dol_get_fiche_head($head, 'bankline_extrafields', $langs->trans($page_name), -1, 'account'); print dol_get_fiche_head($head, 'bankline_extrafields', $langs->trans($page_name), -1, 'account');
$textobject = $langs->transnoentitiesnoconv("BankTransaction");
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
print dol_get_fiche_end(); print dol_get_fiche_end();

View File

@ -307,7 +307,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$nbtotalofrecords++; $nbtotalofrecords++;
}*/ }*/
/* The fast and low memory method to get and count full list converts the sql into a sql count */ /* The fast and low memory method to get and count full list converts the sql into a sql count */
$sqlforcount = preg_replace('/^SELECT[a-z0-9\._\s\(\),]+FROM/i', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql); $sqlforcount = preg_replace('/^SELECT[a-z0-9\._\s\(\),]+FROM/Ui', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
$resql = $db->query($sqlforcount); $resql = $db->query($sqlforcount);
$objforcount = $db->fetch_object($resql); $objforcount = $db->fetch_object($resql);
$nbtotalofrecords = $objforcount->nbtotalofrecords; $nbtotalofrecords = $objforcount->nbtotalofrecords;

View File

@ -307,7 +307,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$nbtotalofrecords = $db->num_rows($result); $nbtotalofrecords = $db->num_rows($result);
*/ */
/* The fast and low memory method to get and count full list converts the sql into a sql count */ /* The fast and low memory method to get and count full list converts the sql into a sql count */
$sqlforcount = preg_replace('/^SELECT[a-z0-9\._\s\(\),]+FROM/i', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql); $sqlforcount = preg_replace('/^SELECT[a-z0-9\._\s\(\),]+FROM/Ui', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
$resql = $db->query($sqlforcount); $resql = $db->query($sqlforcount);
if ($resql) { if ($resql) {

View File

@ -704,7 +704,7 @@ if (empty($reshook)) {
// Clone // Clone
if ($permissiontoadd) { if ($permissiontoadd) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=clone&object=bom&token='.newToken().'">'.$langs->trans("ToClone").'</a>'."\n"; print dolGetButtonAction($langs->trans("ToClone"), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=bom', 'clone', $permissiontoadd);
} }
// Close / Cancel // Close / Cancel
@ -726,11 +726,8 @@ if (empty($reshook)) {
} }
*/ */
if ($permissiontodelete) { // Delete
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').'</a>'."\n"; print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete);
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Delete').'</a>'."\n";
}
} }
print '</div>'."\n"; print '</div>'."\n";
} }

View File

@ -60,7 +60,7 @@ function printDropdownBookmarksList()
if ($sortorder) { if ($sortorder) {
$tmpurl .= ($tmpurl ? '&' : '').'sortorder='.urlencode($sortorder); $tmpurl .= ($tmpurl ? '&' : '').'sortorder='.urlencode($sortorder);
} }
if (is_array($_POST)) { if (!empty($_POST) && is_array($_POST)) {
foreach ($_POST as $key => $val) { foreach ($_POST as $key => $val) {
if ((preg_match('/^search_/', $key) || in_array($key, $authorized_var)) if ((preg_match('/^search_/', $key) || in_array($key, $authorized_var))
&& $val != '' && $val != ''

View File

@ -1865,7 +1865,7 @@ if ($id > 0) {
// Location // Location
if (empty($conf->global->AGENDA_DISABLE_LOCATION)) { if (empty($conf->global->AGENDA_DISABLE_LOCATION)) {
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="3"><input type="text" name="location" class="width500" value="'.$object->location.'"></td></tr>'; print '<tr><td>'.$langs->trans("Location").'</td><td colspan="3"><input type="text" name="location" class="minwidth300 maxwidth150onsmartphone" value="'.$object->location.'"></td></tr>';
} }
// Status // Status
@ -1997,7 +1997,7 @@ if ($id > 0) {
print '</table>'; print '</table>';
// Reminders // Reminders
if ($conf->global->AGENDA_REMINDER_EMAIL || $conf->global->AGENDA_REMINDER_BROWSER) { if (getDolGlobalString('AGENDA_REMINDER_EMAIL') || getDolGlobalString('AGENDA_REMINDER_BROWSER')) {
$filteruserid = $user->id; $filteruserid = $user->id;
if ($user->rights->agenda->allactions->read) { if ($user->rights->agenda->allactions->read) {
$filteruserid = 0; $filteruserid = 0;

View File

@ -573,7 +573,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$nbtotalofrecords++; $nbtotalofrecords++;
}*/ }*/
/* The fast and low memory method to get and count full list converts the sql into a sql count */ /* The fast and low memory method to get and count full list converts the sql into a sql count */
$sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),]+FROM/i', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql); $sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/Ui', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
$resql = $db->query($sqlforcount); $resql = $db->query($sqlforcount);
$objforcount = $db->fetch_object($resql); $objforcount = $db->fetch_object($resql);
$nbtotalofrecords = $objforcount->nbtotalofrecords; $nbtotalofrecords = $objforcount->nbtotalofrecords;

View File

@ -2933,10 +2933,7 @@ if ($action == 'create') {
} }
// Delete // Delete
if ($usercandelete) { print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $usercandelete);
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'"';
print '>'.$langs->trans('Delete').'</a>';
}
} }
} }

View File

@ -2899,7 +2899,7 @@ if ($action == 'create' && $usercancreate) {
// Delete order // Delete order
if ($usercandelete) { if ($usercandelete) {
if ($numshipping == 0) { if ($numshipping == 0) {
print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&amp;token='.newToken().'&amp;id='.$object->id, ''); print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, '');
} else { } else {
print dolGetButtonAction($langs->trans('ShippingExist'), $langs->trans('Delete'), 'default', $_SERVER['PHP_SELF']. '#', '', false); print dolGetButtonAction($langs->trans('ShippingExist'), $langs->trans('Delete'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
} }

View File

@ -492,11 +492,8 @@ if ($action == 'create') {
} }
} }
if ($user->rights->deplacement->supprimer) { $permissiontodelete = $user->rights->deplacement->supprimer;
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$id.'">'.$langs->trans('Delete').'</a>'; print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete);
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Delete').'</a>';
}
print '</div>'; print '</div>';
} }

View File

@ -1677,10 +1677,8 @@ if ($action == 'create') {
} }
} }
//if ($object->statut == Facture::STATUS_DRAFT && $user->rights->facture->supprimer) // Delete
if ($user->rights->facture->supprimer) { print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $user->rights->facture->supprimer);
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=ask_deleteinvoice&id='.$object->id.'&token='.newToken().'">'.$langs->trans('Delete').'</a></div>';
}
print '</div>'; print '</div>';

View File

@ -5744,8 +5744,7 @@ if ($action == 'create') {
} }
print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $deleteHref, '', $enableDelete, $params); print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $deleteHref, '', $enableDelete, $params);
} else { } else {
$params['attr']['title'] = $langs->trans('NotAllowed'); print dolGetButtonAction($langs->trans('Delete'), '', 'delete', '#', '', false);
print dolGetButtonAction($langs->trans('Delete'), '', 'delete', '#', '', false, $params);
} }
} }
print '</div>'; print '</div>';

View File

@ -869,9 +869,9 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
*/ */
/* The fast and low memory method to get and count full list converts the sql into a sql count */ /* The fast and low memory method to get and count full list converts the sql into a sql count */
if ($sall || $search_product_category > 0 || $search_user > 0) { if ($sall || $search_product_category > 0 || $search_user > 0) {
$sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/', 'SELECT COUNT(DISTINCT f.rowid) as nbtotalofrecords FROM', $sql); $sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/Ui', 'SELECT COUNT(DISTINCT f.rowid) as nbtotalofrecords FROM', $sql);
} else { } else {
$sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/', 'SELECT COUNT(f.rowid) as nbtotalofrecords FROM', $sql); $sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/Ui', 'SELECT COUNT(f.rowid) as nbtotalofrecords FROM', $sql);
$sqlforcount = preg_replace('/LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid/', '', $sqlforcount); $sqlforcount = preg_replace('/LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid/', '', $sqlforcount);
} }
$sqlforcount = preg_replace('/GROUP BY.*$/', '', $sqlforcount); $sqlforcount = preg_replace('/GROUP BY.*$/', '', $sqlforcount);

View File

@ -520,13 +520,7 @@ if (!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) {
} }
if ($user->socid == 0 && $action == '') { if ($user->socid == 0 && $action == '') {
if ($user->rights->facture->paiement) { print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $user->rights->facture->paiement && !$disable_delete);
if (!$disable_delete) {
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').'</a>';
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.$title_button.'">'.$langs->trans('Delete').'</a>';
}
}
} }
print '</div>'; print '</div>';

View File

@ -82,6 +82,7 @@ $usercanread = $user->rights->banque->cheque;
$usercancreate = $user->rights->banque->cheque; $usercancreate = $user->rights->banque->cheque;
$usercandelete = $user->rights->banque->cheque; $usercandelete = $user->rights->banque->cheque;
$permissiontodelete = $user->rights->banque->cheque;
/* /*
@ -750,7 +751,7 @@ if ($user->socid == 0 && !empty($object->id) && $object->statut == 0 && $user->r
} }
if ($user->socid == 0 && !empty($object->id) && $user->rights->banque->cheque) { if ($user->socid == 0 && !empty($object->id) && $user->rights->banque->cheque) {
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'&sortfield='.$sortfield.'&sortorder='.$sortorder.'">'.$langs->trans('Delete').'</a>'; print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete);
} }
print '</div>'; print '</div>';

View File

@ -253,9 +253,9 @@ if (!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
if ($action == '') { if ($action == '') {
if ($user->rights->tax->charges->supprimer) { if ($user->rights->tax->charges->supprimer) {
if (!$disable_delete) { if (!$disable_delete) {
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.GETPOST('id', 'int').'&action=delete&token='.newToken().'">'.$langs->trans('Delete').'</a>'; print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', 1);
} else { } else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("CantRemovePaymentWithOneInvoicePaid")).'">'.$langs->trans('Delete').'</a>'; print dolGetButtonAction($langs->trans("CantRemovePaymentWithOneInvoicePaid"), $langs->trans("Delete"), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', 0);
} }
} }
} }

View File

@ -308,9 +308,9 @@ if (!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
if ($action == '') { if ($action == '') {
if ($user->rights->tax->charges->supprimer) { if ($user->rights->tax->charges->supprimer) {
if (!$disable_delete) { if (!$disable_delete) {
print '<a class="butActionDelete" href="card.php?id='.GETPOST('id', 'int').'&action=delete&token='.newToken().'">'.$langs->trans('Delete').'</a>'; print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', 1);
} else { } else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("CantRemovePaymentVATPaid")).'">'.$langs->trans('Delete').'</a>'; print dolGetButtonAction($langs->trans("CantRemovePaymentVATPaid"), $langs->trans("Delete"), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', 0);
} }
} }
} }

View File

@ -409,7 +409,6 @@ $dolibarr_cron_allow_cli='0';
//################################# //#################################
// Value to overwrite path to use shared libraries instead of embedded one // Value to overwrite path to use shared libraries instead of embedded one
//$dolibarr_lib_ADODB_PATH='/usr/share/php/adodb';
//$dolibarr_lib_TCPDF_PATH='/usr/share/php/tcpdf'; //$dolibarr_lib_TCPDF_PATH='/usr/share/php/tcpdf';
//$dolibarr_lib_FPDI_PATH='/usr/share/php/fpdi'; //$dolibarr_lib_FPDI_PATH='/usr/share/php/fpdi';
//$dolibarr_lib_FPDF_PATH='/usr/share/php/fpdf'; //$dolibarr_lib_FPDF_PATH='/usr/share/php/fpdf';

View File

@ -1579,7 +1579,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Delete // Delete
if ($user->rights->societe->contact->supprimer) { if ($user->rights->societe->contact->supprimer) {
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken().''.($backtopage ? '&backtopage='.urlencode($backtopage) : '').'">'.$langs->trans('Delete').'</a>'; print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().($backtopage ? '&backtopage='.urlencode($backtopage) : ''), 'delete', $user->rights->societe->contact->supprimer);
} }
} }

View File

@ -399,15 +399,6 @@ if (isset($extrafields->attributes[$object->table_element]['label']) && is_array
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = p.fk_pays"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = p.fk_pays";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_stcommcontact as st ON st.id = p.fk_stcommcontact"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_stcommcontact as st ON st.id = p.fk_stcommcontact";
if (!empty($search_categ) && $search_categ != '-1') {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_contact as cc ON p.rowid = cc.fk_socpeople"; // We need this table joined to the select in order to filter by categ
}
if (!empty($search_categ_thirdparty) && $search_categ_thirdparty != '-1') {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; // We need this table joined to the select in order to filter by categ
}
if (!empty($search_categ_supplier) && $search_categ_supplier != '-1') {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs2 ON s.rowid = cs2.fk_soc"; // We need this table joined to the select in order to filter by categ
}
if (empty($user->rights->societe->client->voir) && !$socid) { if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
} }
@ -437,23 +428,83 @@ if ($search_priv != '0' && $search_priv != '1') {
} }
} }
if ($search_categ > 0) { $searchCategoryContactList = $search_categ ? array($search_categ) : array();
$sql .= " AND cc.fk_categorie = ".((int) $search_categ); $searchCategoryContactOperator = 0;
// Search for tag/category ($searchCategoryContactList is an array of ID)
if (!empty($searchCategoryContactList)) {
$searchCategoryContactSqlList = array();
$listofcategoryid = '';
foreach ($searchCategoryContactList as $searchCategoryContact) {
if (intval($searchCategoryContact) == -2) {
$searchCategoryContactSqlList[] = "NOT EXISTS (SELECT ck.fk_socpeople FROM ".MAIN_DB_PREFIX."categorie_contact as ck WHERE s.rowid = ck.fk_socpeople)";
} elseif (intval($searchCategoryContact) > 0) {
$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryContact);
}
}
if ($listofcategoryid) {
$searchCategoryContactSqlList[] = " EXISTS (SELECT ck.fk_socpeople FROM ".MAIN_DB_PREFIX."categorie_contact as ck WHERE s.rowid = ck.fk_socpeople AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))";
}
if ($searchCategoryContactOperator == 1) {
if (!empty($searchCategoryContactSqlList)) {
$sql .= " AND (".implode(' OR ', $searchCategoryContactSqlList).")";
}
} else {
if (!empty($searchCategoryContactSqlList)) {
$sql .= " AND (".implode(' AND ', $searchCategoryContactSqlList).")";
}
}
} }
if ($search_categ == -2) { $searchCategoryCustomerList = $search_categ_thirdparty ? array($search_categ_thirdparty) : array();
$sql .= " AND cc.fk_categorie IS NULL"; $searchCategoryCustomerOperator = 0;
// Search for tag/category ($searchCategoryCustomerList is an array of ID)
if (!empty($searchCategoryCustomerList)) {
$searchCategoryCustomerSqlList = array();
$listofcategoryid = '';
foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
if (intval($searchCategoryCustomer) == -2) {
$searchCategoryCustomerSqlList[] = "NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX."categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
} elseif (intval($searchCategoryCustomer) > 0) {
$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryCustomer);
}
}
if ($listofcategoryid) {
$searchCategoryCustomerSqlList[] = " EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX."categorie_societe as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))";
}
if ($searchCategoryCustomerOperator == 1) {
if (!empty($searchCategoryCustomerSqlList)) {
$sql .= " AND (".implode(' OR ', $searchCategoryCustomerSqlList).")";
}
} else {
if (!empty($searchCategoryCustomerSqlList)) {
$sql .= " AND (".implode(' AND ', $searchCategoryCustomerSqlList).")";
}
}
} }
if ($search_categ_thirdparty > 0) { $searchCategorySupplierList = $search_categ_supplier ? array($search_categ_supplier) : array();
$sql .= " AND cs.fk_categorie = ".((int) $search_categ_thirdparty); $searchCategorySupplierOperator = 0;
} // Search for tag/category ($searchCategorySupplierList is an array of ID)
if ($search_categ_thirdparty == -2) { if (!empty($searchCategorySupplierList)) {
$sql .= " AND cs.fk_categorie IS NULL"; $searchCategorySupplierSqlList = array();
} $listofcategoryid = '';
if ($search_categ_supplier > 0) { foreach ($searchCategorySupplierList as $searchCategorySupplier) {
$sql .= " AND cs2.fk_categorie = ".((int) $search_categ_supplier); if (intval($searchCategorySupplier) == -2) {
} $searchCategorySupplierSqlList[] = "NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX."categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc)";
if ($search_categ_supplier == -2) { } elseif (intval($searchCategorySupplier) > 0) {
$sql .= " AND cs2.fk_categorie IS NULL"; $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategorySupplier);
}
}
if ($listofcategoryid) {
$searchCategorySupplierSqlList[] = " EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX."categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))";
}
if ($searchCategorySupplierOperator == 1) {
if (!empty($searchCategorySupplierSqlList)) {
$sql .= " AND (".implode(' OR ', $searchCategorySupplierSqlList).")";
}
} else {
if (!empty($searchCategorySupplierSqlList)) {
$sql .= " AND (".implode(' AND ', $searchCategorySupplierSqlList).")";
}
}
} }
if ($sall) { if ($sall) {
@ -1222,7 +1273,7 @@ while ($i < min($num, $limit)) {
if (isModEnabled('socialnetworks')) { if (isModEnabled('socialnetworks')) {
foreach ($socialnetworks as $key => $value) { foreach ($socialnetworks as $key => $value) {
if ($value['active'] && !empty($arrayfields['p.'.$key]['checked'])) { if ($value['active'] && !empty($arrayfields['p.'.$key]['checked'])) {
print '<td class="tdoverflowmax100">'.dol_print_socialnetworks($arraysocialnetworks[$key], $obj->rowid, $obj->socid, $key, $socialnetworks).'</td>'; print '<td class="tdoverflowmax100">'.(empty($arraysocialnetworks[$key]) ? '' : dol_print_socialnetworks($arraysocialnetworks[$key], $obj->rowid, $obj->socid, $key, $socialnetworks)).'</td>';
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }

View File

@ -97,6 +97,7 @@ $extralabelslines = $extrafields->fetch_name_optionals_label($object->table_elem
$permissionnote = $user->rights->contrat->creer; // Used by the include of actions_setnotes.inc.php $permissionnote = $user->rights->contrat->creer; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->rights->contrat->creer; // Used by the include of actions_dellink.inc.php $permissiondellink = $user->rights->contrat->creer; // Used by the include of actions_dellink.inc.php
$permissiontodelete = ($user->rights->contrat->creer && $object->statut == $object::STATUS_DRAFT) || $user->rights->contrat->supprimer;
$permissiontoadd = $user->rights->contrat->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $permissiontoadd = $user->rights->contrat->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissiontoedit = $permissiontoadd; $permissiontoedit = $permissiontoadd;
$error = 0; $error = 0;
@ -2203,15 +2204,8 @@ if ($action == 'create') {
print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&token='.newToken(), '', true, $params); print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&token='.newToken(), '', true, $params);
} }
// On peut supprimer entite si // Delete
// - Droit de creer + mode brouillon (erreur creation) print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), '', $permissiontodelete, $params);
// - Droit de supprimer
if (($user->rights->contrat->creer && $object->statut == $object::STATUS_DRAFT) || $user->rights->contrat->supprimer) {
print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), '', true, $params);
} else {
$params['attr']['title'] = $langs->trans("NotAllowed");
print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), '', false, $params);
}
} }
print "</div>"; print "</div>";

View File

@ -376,7 +376,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
} }
} }
} else { } else {
$sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql); $sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/Ui', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
$sqlforcount = preg_replace('/LEFT JOIN '.MAIN_DB_PREFIX.'contratdet as cd ON c.rowid = cd.fk_contrat/', '', $sqlforcount); $sqlforcount = preg_replace('/LEFT JOIN '.MAIN_DB_PREFIX.'contratdet as cd ON c.rowid = cd.fk_contrat/', '', $sqlforcount);
$sqlforcount = preg_replace('/LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=cd.fk_product/', '', $sqlforcount); $sqlforcount = preg_replace('/LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=cd.fk_product/', '', $sqlforcount);
$sqlforcount = preg_replace('/AND cp.fk_categorie = '.((int) $search_product_category).'/', '', $sqlforcount); $sqlforcount = preg_replace('/AND cp.fk_categorie = '.((int) $search_product_category).'/', '', $sqlforcount);

View File

@ -41,6 +41,9 @@ if (empty($objectclass) || empty($uploaddir)) {
dol_print_error(null, 'include of actions_massactions.inc.php is done but var $objectclass or $uploaddir was not defined'); dol_print_error(null, 'include of actions_massactions.inc.php is done but var $objectclass or $uploaddir was not defined');
exit; exit;
} }
if (empty($massaction)) {
$massaction = '';
}
// For backward compatibility // For backward compatibility
if (!empty($permtoread) && empty($permissiontoread)) { if (!empty($permtoread) && empty($permissiontoread)) {
@ -53,14 +56,13 @@ if (!empty($permtodelete) && empty($permissiontodelete)) {
$permissiontodelete = $permtodelete; $permissiontodelete = $permtodelete;
} }
// Mass actions. Controls on number of lines checked. // Mass actions. Controls on number of lines checked.
$maxformassaction = (empty($conf->global->MAIN_LIMIT_FOR_MASS_ACTIONS) ? 1000 : $conf->global->MAIN_LIMIT_FOR_MASS_ACTIONS); $maxformassaction = (empty($conf->global->MAIN_LIMIT_FOR_MASS_ACTIONS) ? 1000 : $conf->global->MAIN_LIMIT_FOR_MASS_ACTIONS);
if (!empty($massaction) && is_array($toselect) && count($toselect) < 1) { if ($massaction && is_array($toselect) && count($toselect) < 1) {
$error++; $error++;
setEventMessages($langs->trans("NoRecordSelected"), null, "warnings"); setEventMessages($langs->trans("NoRecordSelected"), null, "warnings");
} }
if (!$error && is_array($toselect) && count($toselect) > $maxformassaction) { if (!$error && isset($toselect) && is_array($toselect) && count($toselect) > $maxformassaction) {
setEventMessages($langs->trans('TooManyRecordForMassAction', $maxformassaction), null, 'errors'); setEventMessages($langs->trans('TooManyRecordForMassAction', $maxformassaction), null, 'errors');
$error++; $error++;
} }
@ -1564,7 +1566,7 @@ if (!$error && ($massaction == 'increaseholiday' || ($action == 'increaseholiday
} }
} }
$parameters['toselect'] = $toselect; $parameters['toselect'] = (empty($toselect) ? array() : $toselect);
$parameters['uploaddir'] = $uploaddir; $parameters['uploaddir'] = $uploaddir;
$parameters['massaction'] = $massaction; $parameters['massaction'] = $massaction;
$parameters['diroutputmassaction'] = isset($diroutputmassaction) ? $diroutputmassaction : null; $parameters['diroutputmassaction'] = isset($diroutputmassaction) ? $diroutputmassaction : null;

View File

@ -4345,7 +4345,7 @@ abstract class CommonObject
} }
/** /**
* Set status of an object * Set status of an object.
* *
* @param int $status Status to set * @param int $status Status to set
* @param int $elementId Id of element to force (use this->id by default if null) * @param int $elementId Id of element to force (use this->id by default if null)

View File

@ -108,7 +108,7 @@ class FormMargin
// calcul des marges // calcul des marges
if (isset($line->fk_remise_except) && isset($conf->global->MARGIN_METHODE_FOR_DISCOUNT)) { // remise if (isset($line->fk_remise_except) && isset($conf->global->MARGIN_METHODE_FOR_DISCOUNT)) { // remise
if ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '1') { // remise globale considérée comme produit if (getDolGlobalString('MARGIN_METHODE_FOR_DISCOUNT') == '1') { // remise globale considérée comme produit
$marginInfos['pa_products'] += $pa; $marginInfos['pa_products'] += $pa;
$marginInfos['pv_products'] += $pv; $marginInfos['pv_products'] += $pv;
$marginInfos['pa_total'] += $pa; $marginInfos['pa_total'] += $pa;
@ -120,7 +120,7 @@ class FormMargin
//} //}
//else //else
$marginInfos['margin_on_products'] += $pv - $pa; $marginInfos['margin_on_products'] += $pv - $pa;
} elseif ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '2') { // remise globale considérée comme service } elseif (getDolGlobalString('MARGIN_METHODE_FOR_DISCOUNT') == '2') { // remise globale considérée comme service
$marginInfos['pa_services'] += $pa; $marginInfos['pa_services'] += $pa;
$marginInfos['pv_services'] += $pv; $marginInfos['pv_services'] += $pv;
$marginInfos['pa_total'] += $pa; $marginInfos['pa_total'] += $pa;
@ -130,7 +130,7 @@ class FormMargin
// $marginInfos['margin_on_services'] += -1 * (abs($pv) - $pa); // $marginInfos['margin_on_services'] += -1 * (abs($pv) - $pa);
//else //else
$marginInfos['margin_on_services'] += $pv - $pa; $marginInfos['margin_on_services'] += $pv - $pa;
} elseif ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '3') { // remise globale prise en compte uniqt sur total } elseif (getDolGlobalString('MARGIN_METHODE_FOR_DISCOUNT') == '3') { // remise globale prise en compte uniqt sur total
$marginInfos['pa_total'] += $pa; $marginInfos['pa_total'] += $pa;
$marginInfos['pv_total'] += $pv; $marginInfos['pv_total'] += $pv;
} }

View File

@ -231,6 +231,8 @@ class FormWebsite
*/ */
public function selectContainer($website, $htmlname = 'pageid', $pageid = 0, $showempty = 0, $action = '', $morecss = 'minwidth200', $excludeids = null) public function selectContainer($website, $htmlname = 'pageid', $pageid = 0, $showempty = 0, $action = '', $morecss = 'minwidth200', $excludeids = null)
{ {
global $conf, $langs;
$this->num = 0; $this->num = 0;
$atleastonepage = (is_array($website->lines) && count($website->lines) > 0); $atleastonepage = (is_array($website->lines) && count($website->lines) > 0);
@ -239,13 +241,18 @@ class FormWebsite
if ($atleastonepage && $action != 'editsource') { if ($atleastonepage && $action != 'editsource') {
$out .= '<select name="'.$htmlname.'" id="'.$htmlname.'" class="maxwidth300'.($morecss ? ' '.$morecss : '').'">'; $out .= '<select name="'.$htmlname.'" id="'.$htmlname.'" class="maxwidth300'.($morecss ? ' '.$morecss : '').'">';
} else { } else {
$out .= '<select name="pageidbis" id="pageid" class="maxwidth300'.($morecss ? ' '.$morecss : '').'" disabled="disabled">'; $out .= '<select name="pageidbis" id="pageid" class="maxwidth300'.($morecss ? ' '.$morecss : '').'"'.($action == 'editsource' ? ' disabled="disabled"' : '').'>';
} }
if ($showempty || !$atleastonepage) { if ($showempty || !$atleastonepage) {
$out .= '<option value="-1">&nbsp;</option>'; $out .= '<option class="optiongrey" value="-1">'.(is_numeric($showempty) ? '&nbsp;' : $showempty).'</option>';
} }
/*if (!empty($conf->use_javascript_ajax)) {
$valueoption = '<span class="classlink">'.img_picto('', 'add', 'class="paddingrightonly"').$langs->trans("AddPage").'</span>';
$out .= '<option value="-2" data-html="'.dol_escape_htmltag($valueoption).'">'.$valueoption.'</option>';
}*/
if ($atleastonepage) { if ($atleastonepage) {
if (empty($pageid) && $action != 'createcontainer') { // Page id is not defined, we try to take one if (empty($pageid) && $action != 'createcontainer') { // Page id is not defined, we try to take one
$firstpageid = 0; $firstpageid = 0;

View File

@ -103,7 +103,8 @@ abstract class Stats
$data[$i][] = $datay[$endyear][($i + $sm) % 12][0]; $data[$i][] = $datay[$endyear][($i + $sm) % 12][0];
$year = $startyear; $year = $startyear;
while ($year <= $endyear) { while ($year <= $endyear) {
$data[$i][] = $datay[$year - (1 - ((int) ($i + $sm) / 12)) + ($sm == 0 ? 1 : 0)][($i + $sm) % 12][1]; // floor(($i + $sm) / 12)) is 0 if we are after the month start $sm and same year, become 1 when we reach january of next year
$data[$i][] = $datay[$year - (1 - floor(($i + $sm) / 12)) + ($sm == 0 ? 1 : 0)][($i + $sm) % 12][1];
$year++; $year++;
} }
} }
@ -204,7 +205,8 @@ abstract class Stats
$data[$i][] = isset($datay[$endyear][($i + $sm) % 12]['label']) ? $datay[$endyear][($i + $sm) % 12]['label'] : $datay[$endyear][($i + $sm) % 12][0]; // set label $data[$i][] = isset($datay[$endyear][($i + $sm) % 12]['label']) ? $datay[$endyear][($i + $sm) % 12]['label'] : $datay[$endyear][($i + $sm) % 12][0]; // set label
$year = $startyear; $year = $startyear;
while ($year <= $endyear) { while ($year <= $endyear) {
$data[$i][] = $datay[$year - (1 - ((int) ($i + $sm) / 12)) + ($sm == 0 ? 1 : 0)][($i + $sm) % 12][1]; // set yval for x=i // floor(($i + $sm) / 12)) is 0 if we are after the month start $sm and same year, become 1 when we reach january of next year
$data[$i][] = $datay[$year - (1 - floor(($i + $sm) / 12)) + ($sm == 0 ? 1 : 0)][($i + $sm) % 12][1]; // set yval for x=i
$year++; $year++;
} }
} }

View File

@ -644,36 +644,41 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof
* This is called when MAIN_DIRECT_STATUS_UPDATE is set and it use tha ajax service objectonoff.php * This is called when MAIN_DIRECT_STATUS_UPDATE is set and it use tha ajax service objectonoff.php
* *
* @param Object $object Object to set * @param Object $object Object to set
* @param string $code Name of constant : status or status_buy for product by example * @param string $code Name of property in object : 'status' or 'status_buy' for product by example
* @param string $field Name of database field : 'tosell' or 'tobuy' for product by example * @param string $field Name of database field : 'tosell' or 'tobuy' for product by example
* @param string $text_on Text if on * @param string $text_on Text if on
* @param string $text_off Text if off * @param string $text_off Text if off
* @param array $input Array of type->list of CSS element to switch. Example: array('disabled'=>array(0=>'cssid')) * @param array $input Array of type->list of CSS element to switch. Example: array('disabled'=>array(0=>'cssid'))
* @param string $morecss More CSS * @param string $morecss More CSS
* @param string $htmlname Name of HTML component. Keep '' or use a different value if you need to use this component several time on same page for same property.
* @return string html for button on/off * @return string html for button on/off
*/ */
function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input = array(), $morecss = '') function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input = array(), $morecss = '', $htmlname = '')
{ {
global $langs; global $langs;
if (empty($htmlname)) {
$htmlname = $code;
}
$out = '<script> $out = '<script>
$(function() { $(function() {
var input = '.json_encode($input).'; var input = '.json_encode($input).';
// Set constant // Set constant
$("#set_'.$code.'_'.$object->id.'").click(function() { $("#set_'.$htmlname.'_'.$object->id.'").click(function() {
console.log("Click managed by ajax_object_onoff"); console.log("Click managed by ajax_object_onoff");
$.get( "'.DOL_URL_ROOT.'/core/ajax/objectonoff.php", { $.get( "'.DOL_URL_ROOT.'/core/ajax/objectonoff.php", {
action: \'set\', action: \'set\',
field: \''.$field.'\', field: \''.dol_escape_js($field).'\',
value: \'1\', value: \'1\',
element: \''.$object->element.'\', element: \''.dol_escape_js($object->element).'\',
id: \''.$object->id.'\', id: \''.$object->id.'\',
token: \''.currentToken().'\' token: \''.currentToken().'\'
}, },
function() { function() {
$("#set_'.$code.'_'.$object->id.'").hide(); $("#set_'.$htmlname.'_'.$object->id.'").hide();
$("#del_'.$code.'_'.$object->id.'").show(); $("#del_'.$htmlname.'_'.$object->id.'").show();
// Enable another element // Enable another element
if (input.disabled && input.disabled.length > 0) { if (input.disabled && input.disabled.length > 0) {
$.each(input.disabled, function(key,value) { $.each(input.disabled, function(key,value) {
@ -693,19 +698,19 @@ function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input =
}); });
// Del constant // Del constant
$("#del_'.$code.'_'.$object->id.'").click(function() { $("#del_'.$htmlname.'_'.$object->id.'").click(function() {
console.log("Click managed by ajax_object_onoff"); console.log("Click managed by ajax_object_onoff");
$.get( "'.DOL_URL_ROOT.'/core/ajax/objectonoff.php", { $.get( "'.DOL_URL_ROOT.'/core/ajax/objectonoff.php", {
action: \'set\', action: \'set\',
field: \''.$field.'\', field: \''.dol_escape_js($field).'\',
value: \'0\', value: \'0\',
element: \''.$object->element.'\', element: \''.dol_escape_js($object->element).'\',
id: \''.$object->id.'\', id: \''.$object->id.'\',
token: \''.currentToken().'\' token: \''.currentToken().'\'
}, },
function() { function() {
$("#del_'.$code.'_'.$object->id.'").hide(); $("#del_'.$htmlname.'_'.$object->id.'").hide();
$("#set_'.$code.'_'.$object->id.'").show(); $("#set_'.$htmlname.'_'.$object->id.'").show();
// Disable another element // Disable another element
if (input.disabled && input.disabled.length > 0) { if (input.disabled && input.disabled.length > 0) {
$.each(input.disabled, function(key,value) { $.each(input.disabled, function(key,value) {
@ -725,8 +730,8 @@ function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input =
}); });
}); });
</script>'; </script>';
$out .= '<span id="set_'.$code.'_'.$object->id.'" class="linkobject '.($object->$code == 1 ? 'hideobject' : '').($morecss ? ' '.$morecss : '').'">'.img_picto($langs->trans($text_off), 'switch_off').'</span>'; $out .= '<span id="set_'.$htmlname.'_'.$object->id.'" class="linkobject '.($object->$code == 1 ? 'hideobject' : '').($morecss ? ' '.$morecss : '').'">'.img_picto($langs->trans($text_off), 'switch_off').'</span>';
$out .= '<span id="del_'.$code.'_'.$object->id.'" class="linkobject '.($object->$code == 1 ? '' : 'hideobject').($morecss ? ' '.$morecss : '').'">'.img_picto($langs->trans($text_on), 'switch_on').'</span>'; $out .= '<span id="del_'.$htmlname.'_'.$object->id.'" class="linkobject '.($object->$code == 1 ? '' : 'hideobject').($morecss ? ' '.$morecss : '').'">'.img_picto($langs->trans($text_on), 'switch_on').'</span>';
return $out; return $out;
} }

View File

@ -153,12 +153,12 @@ function bank_admin_prepare_head($object)
complete_head_from_modules($conf, $langs, $object, $head, $h, 'bank_admin'); complete_head_from_modules($conf, $langs, $object, $head, $h, 'bank_admin');
$head[$h][0] = DOL_URL_ROOT.'/admin/bank_extrafields.php'; $head[$h][0] = DOL_URL_ROOT.'/admin/bank_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields"); $head[$h][1] = $langs->trans("ExtraFields").' ('.$langs->trans("BankAccounts").')';
$head[$h][2] = 'attributes'; $head[$h][2] = 'attributes';
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/admin/bankline_extrafields.php'; $head[$h][0] = DOL_URL_ROOT.'/admin/bankline_extrafields.php';
$head[$h][1] = $langs->trans("BanklineExtraFields"); $head[$h][1] = $langs->trans("ExtraFields").' ('.$langs->trans("BankTransactions").')';
$head[$h][2] = 'bankline_extrafields'; $head[$h][2] = 'bankline_extrafields';
$h++; $h++;

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2000-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2000-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2022 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr> * Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
@ -2535,8 +2535,8 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
if ($tzoutput == 'tzserver') { if ($tzoutput == 'tzserver') {
$to_gmt = false; $to_gmt = false;
$offsettzstring = @date_default_timezone_get(); // Example 'Europe/Berlin' or 'Indian/Reunion' $offsettzstring = @date_default_timezone_get(); // Example 'Europe/Berlin' or 'Indian/Reunion'
$offsettz = 0; // Timezone offset with server timezone, so 0 $offsettz = 0; // Timezone offset with server timezone (because to_gmt is false), so 0
$offsetdst = 0; // Dst offset with server timezone, so 0 $offsetdst = 0; // Dst offset with server timezone (because to_gmt is false), so 0
} elseif ($tzoutput == 'tzuser' || $tzoutput == 'tzuserrel') { } elseif ($tzoutput == 'tzuser' || $tzoutput == 'tzuserrel') {
$to_gmt = true; $to_gmt = true;
$offsettzstring = (empty($_SESSION['dol_tz_string']) ? 'UTC' : $_SESSION['dol_tz_string']); // Example 'Europe/Berlin' or 'Indian/Reunion' $offsettzstring = (empty($_SESSION['dol_tz_string']) ? 'UTC' : $_SESSION['dol_tz_string']); // Example 'Europe/Berlin' or 'Indian/Reunion'
@ -2546,8 +2546,8 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
$user_dt = new DateTime(); $user_dt = new DateTime();
$user_dt->setTimezone($user_date_tz); $user_dt->setTimezone($user_date_tz);
$user_dt->setTimestamp($tzoutput == 'tzuser' ? dol_now() : (int) $time); $user_dt->setTimestamp($tzoutput == 'tzuser' ? dol_now() : (int) $time);
$offsettz = $user_dt->getOffset(); $offsettz = $user_dt->getOffset(); // should include dst ?
} else { // old method (The 'tzuser' was processed like the 'tzuserrel') } else { // with old method (The 'tzuser' was processed like the 'tzuserrel')
$offsettz = (empty($_SESSION['dol_tz']) ? 0 : $_SESSION['dol_tz']) * 60 * 60; // Will not be used anymore $offsettz = (empty($_SESSION['dol_tz']) ? 0 : $_SESSION['dol_tz']) * 60 * 60; // Will not be used anymore
$offsetdst = (empty($_SESSION['dol_dst']) ? 0 : $_SESSION['dol_dst']) * 60 * 60; // Will not be used anymore $offsetdst = (empty($_SESSION['dol_dst']) ? 0 : $_SESSION['dol_dst']) * 60 * 60; // Will not be used anymore
} }
@ -2628,6 +2628,8 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
$format = str_replace('%A', '__A__', $format); $format = str_replace('%A', '__A__', $format);
} }
$useadodb = getDolGlobalInt('MAIN_USE_LEGACY_ADODB_FOR_DATE', 0);
//$useadodb = 1; // To switch to adodb
// Analyze date // Analyze date
$reg = array(); $reg = array();
@ -2647,23 +2649,76 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
$ssec = (!empty($reg[6]) ? $reg[6] : ''); $ssec = (!empty($reg[6]) ? $reg[6] : '');
$time = dol_mktime($shour, $smin, $ssec, $smonth, $sday, $syear, true); $time = dol_mktime($shour, $smin, $ssec, $smonth, $sday, $syear, true);
$ret = adodb_strftime($format, $time + $offsettz + $offsetdst, $to_gmt); if (empty($useadodb)) {
if ($to_gmt) {
$tzo = new DateTimeZone('UTC'); // when to_gmt is true, base for offsettz and offsetdst (so timetouse) is UTC
} else {
$tzo = new DateTimeZone(date_default_timezone_get()); // when to_gmt is false, base for offsettz and offsetdst (so timetouse) is PHP server
}
$dtts = new DateTime();
$dtts->setTimestamp($time);
$dtts->setTimezone($tzo);
$newformat = str_replace(
array('%Y', '%y', '%m', '%d', '%H', '%M', '%S', 'T', 'Z', '__a__', '__A__', '__b__', '__B__'),
array('Y', 'y', 'm', 'd', 'H', 'i', 's', '__£__', '__$__', '__{__', '__}__', '__[__', '__]__'),
$format);
$ret = $dtts->format($newformat);
$ret = str_replace(
array('__£__', '__$__', '__{__', '__}__', '__[__', '__]__'),
array('T', 'Z', '__a__', '__A__', '__b__', '__B__'),
$ret);
} else {
$ret = adodb_strftime($format, $time + $offsettz + $offsetdst, $to_gmt);
}
} else { } else {
// Date is a timestamps // Date is a timestamps
if ($time < 100000000000) { // Protection against bad date values if ($time < 100000000000) { // Protection against bad date values
$timetouse = $time + $offsettz + $offsetdst; // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring. $timetouse = $time + $offsettz + $offsetdst; // TODO We could be able to disable use of offsettz and offsetdst to use only offsettzstring.
$ret = adodb_strftime($format, $timetouse, $to_gmt); // If to_gmt = false then adodb_strftime use TZ of server if (empty($useadodb)) {
if ($to_gmt) {
$tzo = new DateTimeZone('UTC'); // when to_gmt is true, base for offsettz and offsetdst (so timetouse) is UTC
} else {
$tzo = new DateTimeZone(date_default_timezone_get()); // when to_gmt is false, base for offsettz and offsetdst (so timetouse) is PHP server
}
$dtts = new DateTime();
$dtts->setTimestamp($timetouse);
$dtts->setTimezone($tzo);
$newformat = str_replace(
array('%Y', '%y', '%m', '%d', '%H', '%M', '%S', 'T', 'Z', '__a__', '__A__', '__b__', '__B__'),
array('Y', 'y', 'm', 'd', 'H', 'i', 's', '__£__', '__$__', '__{__', '__}__', '__[__', '__]__'),
$format);
$ret = $dtts->format($newformat);
$ret = str_replace(
array('__£__', '__$__', '__{__', '__}__', '__[__', '__]__'),
array('T', 'Z', '__a__', '__A__', '__b__', '__B__'),
$ret);
} else {
$ret = adodb_strftime($format, $timetouse, $to_gmt); // If to_gmt = false then adodb_strftime use TZ of server
}
//var_dump($ret);exit;
} else { } else {
$ret = 'Bad value '.$time.' for date'; $ret = 'Bad value '.$time.' for date';
} }
} }
if (preg_match('/__b__/i', $format)) { if (preg_match('/__b__/i', $format)) {
$timetouse = $time + $offsettz + $offsetdst; // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring. $timetouse = $time + $offsettz + $offsetdst; // TODO We could be able to disable use of offsettz and offsetdst to use only offsettzstring.
// Here ret is string in PHP setup language (strftime was used). Now we convert to $outputlangs. if (empty($useadodb)) {
$month = adodb_strftime('%m', $timetouse, $to_gmt); // If to_gmt = false then adodb_strftime use TZ of server if ($to_gmt) {
$tzo = new DateTimeZone('UTC'); // when to_gmt is true, base for offsettz and offsetdst (so timetouse) is UTC
} else {
$tzo = new DateTimeZone(date_default_timezone_get()); // when to_gmt is false, base for offsettz and offsetdst (so timetouse) is PHP server
}
$dtts = new DateTime();
$dtts->setTimestamp($timetouse);
$dtts->setTimezone($tzo);
$month = $dtts->format("m");
} else {
// After this ret is string in PHP setup language (strftime was used). Now we convert to $outputlangs.
$month = adodb_strftime('%m', $timetouse, $to_gmt); // If to_gmt = false then adodb_strftime use TZ of server
}
$month = sprintf("%02d", $month); // $month may be return with format '06' on some installation and '6' on other, so we force it to '06'. $month = sprintf("%02d", $month); // $month may be return with format '06' on some installation and '6' on other, so we force it to '06'.
if ($encodetooutput) { if ($encodetooutput) {
$monthtext = $outputlangs->transnoentities('Month'.$month); $monthtext = $outputlangs->transnoentities('Month'.$month);
@ -2682,8 +2737,21 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
//print "time=$time offsettz=$offsettz offsetdst=$offsetdst offsettzstring=$offsettzstring"; //print "time=$time offsettz=$offsettz offsetdst=$offsetdst offsettzstring=$offsettzstring";
$timetouse = $time + $offsettz + $offsetdst; // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring. $timetouse = $time + $offsettz + $offsetdst; // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
$w = adodb_strftime('%w', $timetouse, $to_gmt); // If to_gmt = false then adodb_strftime use TZ of server if (empty($useadodb)) {
if ($to_gmt) {
$tzo = new DateTimeZone('UTC');
} else {
$tzo = new DateTimeZone(date_default_timezone_get());
}
$dtts = new DateTime();
$dtts->setTimestamp($timetouse);
$dtts->setTimezone($tzo);
$w = $dtts->format("w");
} else {
$w = adodb_strftime('%w', $timetouse, $to_gmt); // If to_gmt = false then adodb_strftime use TZ of server
}
$dayweek = $outputlangs->transnoentitiesnoconv('Day'.$w); $dayweek = $outputlangs->transnoentitiesnoconv('Day'.$w);
$ret = str_replace('__A__', $dayweek, $ret); $ret = str_replace('__A__', $dayweek, $ret);
$ret = str_replace('__a__', dol_substr($dayweek, 0, 3), $ret); $ret = str_replace('__a__', dol_substr($dayweek, 0, 3), $ret);
} }
@ -2714,7 +2782,6 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
*/ */
function dol_getdate($timestamp, $fast = false, $forcetimezone = '') function dol_getdate($timestamp, $fast = false, $forcetimezone = '')
{ {
//$datetimeobj = new DateTime('@'.$timestamp);
$datetimeobj = new DateTime(); $datetimeobj = new DateTime();
$datetimeobj->setTimestamp($timestamp); // Use local PHP server timezone $datetimeobj->setTimestamp($timestamp); // Use local PHP server timezone
if ($forcetimezone) { if ($forcetimezone) {
@ -3189,7 +3256,7 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli
global $conf, $user, $langs, $mysoc, $hookmanager; global $conf, $user, $langs, $mysoc, $hookmanager;
// Clean phone parameter // Clean phone parameter
$phone = preg_replace("/[\s.-]/", "", trim($phone)); $phone = is_null($phone) ? '' : preg_replace("/[\s.-]/", "", trim($phone));
if (empty($phone)) { if (empty($phone)) {
return ''; return '';
} }
@ -3761,6 +3828,10 @@ function isValidPhone($phone)
*/ */
function dol_strlen($string, $stringencoding = 'UTF-8') function dol_strlen($string, $stringencoding = 'UTF-8')
{ {
if (is_null($string)) {
return 0;
}
if (function_exists('mb_strlen')) { if (function_exists('mb_strlen')) {
return mb_strlen($string, $stringencoding); return mb_strlen($string, $stringencoding);
} else { } else {
@ -5686,6 +5757,11 @@ function price2num($amount, $rounding = '', $option = 0)
{ {
global $langs, $conf; global $langs, $conf;
// Clean parameters
if (is_null($amount)) {
$amount = '';
}
// Round PHP function does not allow number like '1,234.56' nor '1.234,56' nor '1 234,56' // Round PHP function does not allow number like '1,234.56' nor '1.234,56' nor '1 234,56'
// Numbers must be '1234.56' // Numbers must be '1234.56'
// Decimal delimiter for PHP and database SQL requests must be '.' // Decimal delimiter for PHP and database SQL requests must be '.'
@ -6717,6 +6793,10 @@ function picto_required()
*/ */
function dol_string_nohtmltag($stringtoclean, $removelinefeed = 1, $pagecodeto = 'UTF-8', $strip_tags = 0, $removedoublespaces = 1) function dol_string_nohtmltag($stringtoclean, $removelinefeed = 1, $pagecodeto = 'UTF-8', $strip_tags = 0, $removedoublespaces = 1)
{ {
if (is_null($stringtoclean)) {
return '';
}
if ($removelinefeed == 2) { if ($removelinefeed == 2) {
$stringtoclean = preg_replace('/<br[^>]*>(\n|\r)+/ims', '<br>', $stringtoclean); $stringtoclean = preg_replace('/<br[^>]*>(\n|\r)+/ims', '<br>', $stringtoclean);
} }
@ -7019,6 +7099,10 @@ function dol_nl2br($stringtoencode, $nl2brmode = 0, $forxml = false)
*/ */
function dol_htmlentitiesbr($stringtoencode, $nl2brmode = 0, $pagecodefrom = 'UTF-8', $removelasteolbr = 1) function dol_htmlentitiesbr($stringtoencode, $nl2brmode = 0, $pagecodefrom = 'UTF-8', $removelasteolbr = 1)
{ {
if (is_null($stringtoencode)) {
return '';
}
$newstring = $stringtoencode; $newstring = $stringtoencode;
if (dol_textishtml($stringtoencode)) { // Check if text is already HTML or not if (dol_textishtml($stringtoencode)) { // Check if text is already HTML or not
$newstring = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i', '<br>', $newstring); // Replace "<br type="_moz" />" by "<br>". It's same and avoid pb with FPDF. $newstring = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i', '<br>', $newstring); // Replace "<br type="_moz" />" by "<br>". It's same and avoid pb with FPDF.
@ -7213,6 +7297,10 @@ function dol_nboflines_bis($text, $maxlinesize = 0, $charset = 'UTF-8')
*/ */
function dol_textishtml($msg, $option = 0) function dol_textishtml($msg, $option = 0)
{ {
if (is_null($msg)) {
return false;
}
if ($option == 1) { if ($option == 1) {
if (preg_match('/<html/i', $msg)) { if (preg_match('/<html/i', $msg)) {
return true; return true;

View File

@ -563,7 +563,7 @@ function dolSaveLicense($file, $content)
*/ */
function showWebsiteTemplates(Website $website) function showWebsiteTemplates(Website $website)
{ {
global $conf, $langs, $db, $form; global $conf, $langs, $db, $form, $user;
$dirthemes = array('/doctemplates/websites'); $dirthemes = array('/doctemplates/websites');
if (!empty($conf->modules_parts['websitetemplates'])) { // Using this feature slow down application if (!empty($conf->modules_parts['websitetemplates'])) { // Using this feature slow down application
@ -582,11 +582,15 @@ function showWebsiteTemplates(Website $website)
// Title // Title
print '<tr class="liste_titre"><th class="titlefield">'; print '<tr class="liste_titre"><th class="titlefield">';
print $form->textwithpicto($langs->trans("Templates"), $langs->trans("ThemeDir").' : '.join(", ", $dirthemes)); print $form->textwithpicto($langs->trans("Templates"), $langs->trans("ThemeDir").' : '.join(", ", $dirthemes));
print ' ';
print '<a href="'.$_SERVER["PHP_SELF"].'?website='.urlencode($website->ref).'&importsite=1" target="_blank" rel="noopener noreferrer external">';
print img_picto('', 'refresh');
print '</a>';
print '</th>'; print '</th>';
print '<th class="right">'; print '<th class="right">';
$url = 'https://www.dolistore.com/43-web-site-templates'; $url = 'https://www.dolistore.com/43-web-site-templates';
print '<a href="'.$url.'" target="_blank" rel="noopener noreferrer external">'; print '<a href="'.$url.'" target="_blank" rel="noopener noreferrer external">';
print $langs->trans('DownloadMoreSkins'); print img_picto('', 'globe', 'class="pictofixedwidth"').$langs->trans('DownloadMoreSkins');
print '</a>'; print '</a>';
print '</th></tr>'; print '</th></tr>';
@ -645,6 +649,9 @@ function showWebsiteTemplates(Website $website)
print $subdir; print $subdir;
print '<br>'; print '<br>';
print '<span class="opacitymedium">'.dol_print_size(dol_filesize($dirtheme."/".$subdir), 1, 1).' - '.dol_print_date(dol_filemtime($templatedir), 'dayhour', 'tzuserrel').'</span>'; print '<span class="opacitymedium">'.dol_print_size(dol_filesize($dirtheme."/".$subdir), 1, 1).' - '.dol_print_date(dol_filemtime($templatedir), 'dayhour', 'tzuserrel').'</span>';
if ($user->hasRight('website', 'delete')) {
print ' <a href="'.$_SERVER["PHP_SELF"].'?action=deletetemplate&token='.newToken().'&website='.urlencode($website->ref).'&templateuserfile='.urlencode($subdir).'">'.img_picto('', 'delete').'</a>';
}
print '<br><a href="'.$_SERVER["PHP_SELF"].'?action=importsiteconfirm&token='.newToken().'&website='.urlencode($website->ref).'&templateuserfile='.urlencode($subdir).'" class="button">'.$langs->trans("Load").'</a>'; print '<br><a href="'.$_SERVER["PHP_SELF"].'?action=importsiteconfirm&token='.newToken().'&website='.urlencode($website->ref).'&templateuserfile='.urlencode($subdir).'" class="button">'.$langs->trans("Load").'</a>';
print '</div>'; print '</div>';

View File

@ -151,7 +151,7 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode
} }
$date = dol_now(); $date = dol_now();
$yymm = strftime("%y%m", $date); $yymm = dol_print_date($date, "%y%m", 'tzuserrel');
if ($max >= (pow(10, 5) - 1)) { if ($max >= (pow(10, 5) - 1)) {
$num = $max + 1; // If counter > 99999, we do not format on 5 chars, we take number as it is $num = $max + 1; // If counter > 99999, we do not format on 5 chars, we take number as it is

View File

@ -285,7 +285,7 @@ if ($massaction == 'preapproveleave') {
// Allow Pre-Mass-Action hook (eg for confirmation dialog) // Allow Pre-Mass-Action hook (eg for confirmation dialog)
$parameters = array( $parameters = array(
'toselect' => $toselect, 'toselect' => isset($toselect) ? $toselect : array(),
'uploaddir' => isset($uploaddir) ? $uploaddir : null 'uploaddir' => isset($uploaddir) ? $uploaddir : null
); );

View File

@ -214,9 +214,9 @@ print '<div class="tabsAction">';
if (empty($action)) { if (empty($action)) {
if ($user->rights->don->supprimer) { if ($user->rights->don->supprimer) {
if (!$disable_delete) { if (!$disable_delete) {
print '<a class="butActionDelete" href="card.php?id='.$object->id.'&amp;action=delete&token='.newToken().'">'.$langs->trans('Delete').'</a>'; print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), '', 1);
} else { } else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("CantRemovePaymentWithOneInvoicePaid")).'">'.$langs->trans('Delete').'</a>'; print dolGetButtonAction($langs->trans("CantRemovePaymentWithOneInvoicePaid"), $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), '', 1);
} }
} }
} }

View File

@ -283,11 +283,10 @@ if (empty($action) || $action == 'delete_section') {
// Actions buttons // Actions buttons
print '<div class="tabsAction">'; print '<div class="tabsAction">';
if ($user->rights->ecm->setup) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=delete_section&token='.newToken().'">'.$langs->trans('Delete').'</a>'; // Delete
} else { print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), '', $user->rights->ecm->setup);
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans('Delete').'</a>';
}
print '</div>'; print '</div>';
} }

View File

@ -464,21 +464,8 @@ if ($action != 'edit' && $action != 'delete' && $action != 'deletefile') {
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans('ECMAddSection').'</a>'; print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans('ECMAddSection').'</a>';
} }
//if (count($filearrayall) == 0) print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().($module ? '&module='.urlencode($module) : '').'&section='.urlencode($section).($backtopage ? '&backtopage='.urlencode($backtopage) : ''), '', $permtoadd);
//{
if ($permtoadd) {
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete_dir&token='.newToken().($module ? '&module='.$module : '').'&section='.$section.($backtopage ? '&backtopage='.urlencode($backtopage) : '').'">'.$langs->trans('Delete').'</a>';
} else {
print '<a class="butActionDeleteRefused" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans('Delete').'</a>';
}
/*}
else
{
if (count($filearray) > 0)
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("CannotRemoveDirectoryContainsFiles").'">'.$langs->trans('Delete').'</a>';
else
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("CannotRemoveDirectoryContainsFilesOrDirs").'">'.$langs->trans('Delete').'</a>';
}*/
print '</div>'; print '</div>';
} }

View File

@ -424,16 +424,9 @@ if ($action != 'edit') {
if ($user->rights->ecm->setup) { if ($user->rights->ecm->setup) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&section='.urlencode($section).'&urlfile='.urlencode($urlfile).'">'.$langs->trans('Edit').'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&section='.urlencode($section).'&urlfile='.urlencode($urlfile).'">'.$langs->trans('Edit').'</a>';
} }
/*
if ($user->rights->ecm->setup) //print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $user->rights->ecm->setup);
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=deletefile&token='.newToken().'&section='.$section.'&urlfile='.urlencode($urlfile).'">'.$langs->trans('Delete').'</a>';
}
else
{
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans('Delete').'</a>';
}
*/
print '</div>'; print '</div>';
} }

View File

@ -238,12 +238,13 @@ if ($resql) {
*/ */
print '<div class="tabsAction">'; print '<div class="tabsAction">';
// Delete
if ($action == '') { if ($action == '') {
if ($user->rights->expensereport->supprimer) { if ($user->rights->expensereport->supprimer) {
if (!$disable_delete) { if (!$disable_delete) {
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').'</a>'; print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', 1);
} else { } else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($title_button).'">'.$langs->trans('Delete').'</a>'; print dolGetButtonAction($title_button, $langs->trans("Delete"), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', 0);
} }
} }
} }

View File

@ -741,11 +741,9 @@ if ($action == 'create') {
print $langs->trans("AddIntervention").'</a></div>'; print $langs->trans("AddIntervention").'</a></div>';
} }
if ($user->rights->ficheinter->supprimer) { // Delete
print '<div class="inline-block divButAction">'; print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $user->rights->ficheinter->supprimer);
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&id='.$object->id.'">';
print $langs->trans('Delete').'</a></div>';
}
print '</div>'; print '</div>';
} else { } else {
print $langs->trans("ErrorRecordNotFound"); print $langs->trans("ErrorRecordNotFound");

View File

@ -104,6 +104,7 @@ $result = restrictedArea($user, 'ficheinter', $id, 'fichinter');
$permissionnote = $user->rights->ficheinter->creer; // Used by the include of actions_setnotes.inc.php $permissionnote = $user->rights->ficheinter->creer; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->rights->ficheinter->creer; // Used by the include of actions_dellink.inc.php $permissiondellink = $user->rights->ficheinter->creer; // Used by the include of actions_dellink.inc.php
$permissiontodelete = (($object->statut == Fichinter::STATUS_DRAFT && $user->rights->ficheinter->creer) || $user->rights->ficheinter->supprimer);
/* /*
@ -1688,10 +1689,7 @@ if ($action == 'create') {
} }
// Delete // Delete
if (($object->statut == Fichinter::STATUS_DRAFT && $user->rights->ficheinter->creer) || $user->rights->ficheinter->supprimer) { print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete);
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'"';
print '>'.$langs->trans('Delete').'</a></div>';
}
} }
} }
} }

View File

@ -328,7 +328,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$resql = $db->query($sql); $resql = $db->query($sql);
$nbtotalofrecords = $db->num_rows($resql); $nbtotalofrecords = $db->num_rows($resql);
/* The fast and low memory method to get and count full list converts the sql into a sql count */ /* The fast and low memory method to get and count full list converts the sql into a sql count */
/*$sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql); /*$sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/Ui', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
$resql = $db->query($sqlforcount); $resql = $db->query($sqlforcount);
if ($resql) { if ($resql) {
$objforcount = $db->fetch_object($resql); $objforcount = $db->fetch_object($resql);

View File

@ -1621,10 +1621,8 @@ if ($action == 'create') {
} }
} }
//if ($object->statut == Facture::STATUS_DRAFT && ($user->rights->fournisseur->facture->supprimer || $user->rights->supplier_invoice->supprimer)) // Delete
if (($user->rights->fournisseur->facture->supprimer || $user->rights->supplier_invoice->supprimer)) { print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=ask_deleteinvoice&token='.newToken(), 'delete', ($user->rights->fournisseur->facture->supprimer || $user->rights->supplier_invoice->supprimer));
print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?action=ask_deleteinvoice&id=' . $object->id . '&token=' . newToken() . '">' . $langs->trans('Delete') . '</a></div>';
}
print '</div>'; print '</div>';

View File

@ -374,9 +374,9 @@ if ($result > 0) {
if ($user->socid == 0 && $action == '') { if ($user->socid == 0 && $action == '') {
if ($user->rights->fournisseur->facture->supprimer) { if ($user->rights->fournisseur->facture->supprimer) {
if ($allow_delete) { if ($allow_delete) {
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').'</a>'; print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', 1);
} else { } else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.$title_button.'">'.$langs->trans('Delete').'</a>'; print dolGetButtonAction($title_button, $langs->trans("Delete"), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', 0);
} }
} }
} }

View File

@ -420,8 +420,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
* Action bar * Action bar
*/ */
print '<div class="tabsAction">'; print '<div class="tabsAction">';
// Modify
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$id.'">'.$langs->trans('Modify').'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$id.'">'.$langs->trans('Modify').'</a>';
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$id.'">'.$langs->trans('Delete').'</a>';
// Delete
print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete);
print '</div>'; print '</div>';
} }

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
ADOdb Date Library, part of the ADOdb abstraction library ADOdb Date Library, part of the ADOdb abstraction library
See Wiki: https://adodb.org/dokuwiki/doku.php?id=v5:datetime:datetime_index See Wiki: https://adodb.org/dokuwiki/doku.php?id=v5:datetime:datetime_index
Download: https://github.com/ADOdb/ADOdb/blob/master/adodb-time.inc.php Download: https://github.com/ADOdb/ADOdb/blob/master/adodb-time.inc.php
PHP native date functions use integer timestamps for computations. PHP native date functions use integer timestamps for computations.
Because of this, dates are restricted to the years 1901-2038 on Unix Because of this, dates are restricted to the years 1901-2038 on Unix

View File

@ -762,7 +762,7 @@ class JavascriptRenderer
return $uris; return $uris;
} }
if (substr($uri, 0, 1) === '/' || preg_match('/^([a-zA-Z]+:\/\/|[a-zA-Z]:\/|[a-zA-Z]:\\\)/', $uri)) { if ($uri && (substr($uri, 0, 1) === '/' || preg_match('/^([a-zA-Z]+:\/\/|[a-zA-Z]:\/|[a-zA-Z]:\\\)/', $uri))) {
return $uri; return $uri;
} }
return rtrim($root, '/') . "/$uri"; return rtrim($root, '/') . "/$uri";
@ -778,7 +778,7 @@ class JavascriptRenderer
protected function filterAssetArray($array, $type = null) protected function filterAssetArray($array, $type = null)
{ {
$types = array('css', 'js', 'inline_css', 'inline_js', 'inline_head'); $types = array('css', 'js', 'inline_css', 'inline_js', 'inline_head');
$typeIndex = array_search(strtolower($type), $types); $typeIndex = is_null($type) ? false : array_search(strtolower($type), $types);
return $typeIndex !== false ? $array[$typeIndex] : $array; return $typeIndex !== false ? $array[$typeIndex] : $array;
} }

View File

@ -558,7 +558,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
} }
$textLateTitle = $langs->trans("NActionsLate", $board->nbtodolate); $textLateTitle = $langs->trans("NActionsLate", $board->nbtodolate);
$textLateTitle .= ' ('.$langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($board->warning_delay) >= 0 ? '+' : '').ceil($board->warning_delay).' '.$langs->trans("days").')'; $textLateTitle .= ' ('.$langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil(empty($board->warning_delay) ? 0 : $board->warning_delay) >= 0 ? '+' : '').ceil(empty($board->warning_delay) ? 0 : $board->warning_delay).' '.$langs->trans("days").')';
if ($board->id == 'bank_account') { if ($board->id == 'bank_account') {
$textLateTitle .= '<br><span class="opacitymedium">'.$langs->trans("IfYouDontReconcileDisableProperty", $langs->transnoentitiesnoconv("Conciliable")).'</span>'; $textLateTitle .= '<br><span class="opacitymedium">'.$langs->trans("IfYouDontReconcileDisableProperty", $langs->transnoentitiesnoconv("Conciliable")).'</span>';

View File

@ -185,4 +185,3 @@ AlreadyOneBankAccount=Already one bank account defined
SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation=SEPA transfer: 'Payment Type' at 'Credit Transfer' level SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation=SEPA transfer: 'Payment Type' at 'Credit Transfer' level
SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp=When generatin a SEPA XML file for Credit transfers, the section "PaymentTypeInformation" can now be placed inside the "CreditTransferTransactionInformation" section (instead of "Payment" section). We strongly recommend to keep this unchecked to place PaymentTypeInformation at Payment level, as all banks will not necessarily accept it at CreditTransferTransactionInformation level. Contact your bank before placing PaymentTypeInformation at CreditTransferTransactionInformation level. SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp=When generatin a SEPA XML file for Credit transfers, the section "PaymentTypeInformation" can now be placed inside the "CreditTransferTransactionInformation" section (instead of "Payment" section). We strongly recommend to keep this unchecked to place PaymentTypeInformation at Payment level, as all banks will not necessarily accept it at CreditTransferTransactionInformation level. Contact your bank before placing PaymentTypeInformation at CreditTransferTransactionInformation level.
ToCreateRelatedRecordIntoBank=To create missing related bank record ToCreateRelatedRecordIntoBank=To create missing related bank record
BanklineExtraFields=Bank Line Extrafields

View File

@ -23,6 +23,7 @@ Language_da_DK=Danish
Language_de_DE=German Language_de_DE=German
Language_de_AT=German (Austria) Language_de_AT=German (Austria)
Language_de_CH=German (Switzerland) Language_de_CH=German (Switzerland)
Language_de_LU=German (Luxembourg)
Language_el_GR=Greek Language_el_GR=Greek
Language_el_CY=Greek (Cyprus) Language_el_CY=Greek (Cyprus)
Language_en_AE=English (United Arab Emirates) Language_en_AE=English (United Arab Emirates)

View File

@ -66,7 +66,7 @@ ContractRefused=Contract refused
RecruitmentCandidature=Application RecruitmentCandidature=Application
JobPositions=Job positions JobPositions=Job positions
RecruitmentCandidatures=Applications RecruitmentCandidatures=Applications
InterviewToDo=Interview to do InterviewToDo=Contacts to follow
AnswerCandidature=Application answer AnswerCandidature=Application answer
YourCandidature=Your application YourCandidature=Your application
YourCandidatureAnswerMessage=Thanks you for your application.<br>... YourCandidatureAnswerMessage=Thanks you for your application.<br>...

View File

@ -150,4 +150,6 @@ ErrorFaviconSize=Favicon must be sized 16x16, 32x32 or 64x64
FaviconTooltip=Upload an image which needs to be a png (16x16, 32x32 or 64x64) FaviconTooltip=Upload an image which needs to be a png (16x16, 32x32 or 64x64)
NextContainer=Next page/container NextContainer=Next page/container
PreviousContainer=Previous page/container PreviousContainer=Previous page/container
WebsiteMustBeDisabled=The website must have the status "Disabled" WebsiteMustBeDisabled=The website must have the status "%s"
WebpageMustBeDisabled=The web page must have the status "%s"
SetWebsiteOnlineBefore=When website is offline, all pages are offline. Change status of website first.

View File

@ -223,9 +223,9 @@ print '<div class="tabsAction">';
if (empty($action) && !empty($user->rights->loan->delete)) { if (empty($action) && !empty($user->rights->loan->delete)) {
if (!$disable_delete) { if (!$disable_delete) {
print '<a class="butActionDelete" href="card.php?id='.$id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').'</a>'; print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', 1);
} else { } else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("CantRemovePaymentWithOneInvoicePaid")).'">'.$langs->trans('Delete').'</a>'; print dolGetButtonAction($langs->trans("CantRemovePaymentWithOneInvoicePaid"), $langs->trans("Delete"), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', 0);
} }
} }

View File

@ -535,7 +535,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
} }
// Clone // Clone
print dolGetButtonAction('', $langs->trans('ToClone'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.(!empty($object->socid)?'&socid='.$object->socid:'').'&action=clone&token='.newToken(), '', $permissiontoadd); if ($permissiontoadd) {
print dolGetButtonAction('', $langs->trans('ToClone'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.(!empty($object->socid)?'&socid='.$object->socid:'').'&action=clone&token='.newToken(), '', $permissiontoadd);
}
/* /*
if ($permissiontoadd) { if ($permissiontoadd) {
@ -554,8 +556,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
} }
*/ */
// Delete (need delete permission, or if draft, just need create/modify permission) // Delete
print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken(), '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)); $params = array();
print dolGetButtonAction('', $langs->trans("Delete"), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete, $params);
} }
print '</div>'."\n"; print '</div>'."\n";
} }

View File

@ -378,7 +378,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
} }
}*/ }*/
/* The fast and low memory method to get and count full list converts the sql into a sql count */ /* The fast and low memory method to get and count full list converts the sql into a sql count */
$sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql); $sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/Ui', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
$resql = $db->query($sqlforcount); $resql = $db->query($sqlforcount);
if ($resql) { if ($resql) {
$objforcount = $db->fetch_object($resql); $objforcount = $db->fetch_object($resql);

View File

@ -678,7 +678,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Clone // Clone
if ($permissiontoadd) { if ($permissiontoadd) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->fk_soc.'&action=clone&object=mo">'.$langs->trans("ToClone").'</a>'; print dolGetButtonAction($langs->trans("ToClone"), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=mo', 'clone', $permissiontoadd);
} }
// Cancel - Reopen // Cancel - Reopen
@ -703,12 +703,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
} }
} }
// Delete (need delete permission, or if draft, just need create/modify permission) // Delete
if ($permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)) { print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete);
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').'</a>'."\n";
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Delete').'</a>'."\n";
}
} }
print '</div>'."\n"; print '</div>'."\n";
} }

View File

@ -61,6 +61,10 @@ $hookmanager->initHooks(array('surveycard', 'globalcard'));
$expiredate = dol_mktime(0, 0, 0, GETPOST('expiremonth'), GETPOST('expireday'), GETPOST('expireyear')); $expiredate = dol_mktime(0, 0, 0, GETPOST('expiremonth'), GETPOST('expireday'), GETPOST('expireyear'));
$permissiontoread = $user->rights->opensurvey->read;
$permissiontoadd = $user->rights->opensurvey->write;
// permission delete doesn't exists
$permissiontodelete = $user->rights->opensurvey->write;
/* /*
@ -364,26 +368,25 @@ print '</form>'."\n";
/* // Action bar
* Action bar
*/
print '<div class="tabsAction">'; print '<div class="tabsAction">';
if ($action != 'edit' && $user->rights->opensurvey->write) { if ($action != 'edit' && $user->rights->opensurvey->write) {
//Modify button // Modify button
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.urlencode($numsondage).'">'.$langs->trans("Modify").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.urlencode($numsondage).'">'.$langs->trans("Modify").'</a>';
if ($object->status == Opensurveysondage::STATUS_VALIDATED) { if ($object->status == Opensurveysondage::STATUS_VALIDATED) {
//Close button // Close button
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=close&token='.newToken().'&id='.urlencode($numsondage).'">'.$langs->trans("Close").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=close&token='.newToken().'&id='.urlencode($numsondage).'">'.$langs->trans("Close").'</a>';
} }
if ($object->status == Opensurveysondage::STATUS_CLOSED) { if ($object->status == Opensurveysondage::STATUS_CLOSED) {
//Opened button // Re-Open
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=reopen&token='.newToken().'&id='.urlencode($numsondage).'">'.$langs->trans("ReOpen").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=reopen&token='.newToken().'&id='.urlencode($numsondage).'">'.$langs->trans("ReOpen").'</a>';
} }
//Delete button // Delete
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?suppressionsondage=1&action=delete&token='.newToken().'&id='.urlencode($numsondage).'">'.$langs->trans('Delete').'</a>'; print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?suppressionsondage=1&id='.urlencode($numsondage).'&action=delete&token='.newToken(), 'delete', $permissiontodelete);
} }
print '</div>'; print '</div>';

View File

@ -401,7 +401,7 @@ $sql=preg_replace('/,\s*$/','', $sql);
$nbtotalofrecords = ''; $nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
/* The fast and low memory method to get and count full list converts the sql into a sql count */ /* The fast and low memory method to get and count full list converts the sql into a sql count */
$sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql); $sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/Ui', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
$resql = $db->query($sqlforcount); $resql = $db->query($sqlforcount);
if ($resql) { if ($resql) {
$objforcount = $db->fetch_object($resql); $objforcount = $db->fetch_object($resql);

View File

@ -417,17 +417,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
} }
// Clone // Clone
/*if ($permissiontoadd) if ($permissiontoadd) {
{ //print dolGetButtonAction($langs->trans("ToClone"), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=inventory', 'clone', $permissiontoadd);
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=myobject">'.$langs->trans("ToClone").'</a>'."\n";
}*/
// Delete (need delete permission, or if draft, just need create/modify permission)
if ($permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)) {
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').'</a>'."\n";
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Delete').'</a>'."\n";
} }
// Delete
print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete);
} }
print '</div>'."\n"; print '</div>'."\n";
} }

View File

@ -439,9 +439,6 @@ if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_extrafields as ef on (p.rowid = ef.fk_object)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_extrafields as ef on (p.rowid = ef.fk_object)";
} }
if (!empty($searchCategoryProductList) || !empty($catid)) {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; // We'll need this table joined to the select in order to filter by categ
}
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
// multilang // multilang
if (getDolGlobalInt('MAIN_MULTILANGS')) { if (getDolGlobalInt('MAIN_MULTILANGS')) {
@ -506,30 +503,32 @@ if ($catid > 0) {
if ($catid == -2) { if ($catid == -2) {
$sql .= " AND cp.fk_categorie IS NULL"; $sql .= " AND cp.fk_categorie IS NULL";
} }
$searchCategoryProductSqlList = array();
if ($searchCategoryProductOperator == 1) { // Search for tag/category ($searchCategoryProductList is an array of ID)
if (!empty($searchCategoryProductList)) {
$searchCategoryProductSqlList = array();
$listofcategoryid = '';
foreach ($searchCategoryProductList as $searchCategoryProduct) { foreach ($searchCategoryProductList as $searchCategoryProduct) {
if (intval($searchCategoryProduct) == -2) { if (intval($searchCategoryProduct) == -2) {
$searchCategoryProductSqlList[] = "cp.fk_categorie IS NULL"; $searchCategoryProductSqlList[] = "NOT EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck WHERE p.rowid = ck.fk_product)";
} elseif (intval($searchCategoryProduct) > 0) { } elseif (intval($searchCategoryProduct) > 0) {
$searchCategoryProductSqlList[] = "cp.fk_categorie = ".$db->escape($searchCategoryProduct); $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryProduct);
} }
} }
if (!empty($searchCategoryProductSqlList)) { if ($listofcategoryid) {
$sql .= " AND (".implode(' OR ', $searchCategoryProductSqlList).")"; $searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck WHERE p.rowid = ck.fk_product AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))";
} }
} else { if ($searchCategoryProductOperator == 1) {
foreach ($searchCategoryProductList as $searchCategoryProduct) { if (!empty($searchCategoryProductSqlList)) {
if (intval($searchCategoryProduct) == -2) { $sql .= " AND (".implode(' OR ', $searchCategoryProductSqlList).")";
$searchCategoryProductSqlList[] = "cp.fk_categorie IS NULL"; }
} elseif (intval($searchCategoryProduct) > 0) { } else {
$searchCategoryProductSqlList[] = "p.rowid IN (SELECT fk_product FROM ".MAIN_DB_PREFIX."categorie_product WHERE fk_categorie = ".((int) $searchCategoryProduct).")"; if (!empty($searchCategoryProductSqlList)) {
$sql .= " AND (".implode(' AND ', $searchCategoryProductSqlList).")";
} }
}
if (!empty($searchCategoryProductSqlList)) {
$sql .= " AND (".implode(' AND ', $searchCategoryProductSqlList).")";
} }
} }
if ($fourn_id > 0) { if ($fourn_id > 0) {
$sql .= " AND pfp.fk_soc = ".((int) $fourn_id); $sql .= " AND pfp.fk_soc = ".((int) $fourn_id);
} }

View File

@ -730,7 +730,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$nbtotalofrecords++; $nbtotalofrecords++;
}*/ }*/
/* The fast and low memory method to get and count full list converts the sql into a sql count */ /* The fast and low memory method to get and count full list converts the sql into a sql count */
$sqlforcount = preg_replace('/^SELECT[a-z0-9\._\s\(\),]+FROM/i', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql); $sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/Ui', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
$resql = $db->query($sqlforcount); $resql = $db->query($sqlforcount);
$objforcount = $db->fetch_object($resql); $objforcount = $db->fetch_object($resql);
$nbtotalofrecords = $objforcount->nbtotalofrecords; $nbtotalofrecords = $objforcount->nbtotalofrecords;

View File

@ -540,10 +540,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a></div>'."\n"; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a></div>'."\n";
} }
if ($user->rights->stock->supprimer) print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $user->rights->stock->supprimer);
{
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').'</a></div>'."\n";
}
*/ */
} }

View File

@ -315,7 +315,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
} }
}*/ }*/
/* The fast and low memory method to get and count full list converts the sql into a sql count */ /* The fast and low memory method to get and count full list converts the sql into a sql count */
$sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql); $sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/Ui', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
$resql = $db->query($sqlforcount); $resql = $db->query($sqlforcount);
if ($resql) { if ($resql) {
$objforcount = $db->fetch_object($resql); $objforcount = $db->fetch_object($resql);

View File

@ -84,7 +84,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ
$permissiontoread = $user->rights->stocktransfer->stocktransfer->read; $permissiontoread = $user->rights->stocktransfer->stocktransfer->read;
$permissiontoadd = $user->rights->stocktransfer->stocktransfer->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $permissiontoadd = $user->rights->stocktransfer->stocktransfer->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissionnote = $user->rights->stocktransfer->stocktransfer->write; // Used by the include of actions_setnotes.inc.php $permissionnote = $user->rights->stocktransfer->stocktransfer->write; // Used by the include of actions_setnotes.inc.php
$permissiontodelete = $user->rights->stocktransfer->stocktransfer->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); $permissiontodelete = $user->rights->stocktransfer->stocktransfer->delete || ($permissiontoadd && isset($object->status) && $object->status < $object::STATUS_TRANSFERED);
$permissiondellink = $user->rights->stocktransfer->stocktransfer->write; // Used by the include of actions_dellink.inc.php $permissiondellink = $user->rights->stocktransfer->stocktransfer->write; // Used by the include of actions_dellink.inc.php
$upload_dir = $conf->stocktransfer->multidir_output[isset($object->entity) ? $object->entity : 1]; $upload_dir = $conf->stocktransfer->multidir_output[isset($object->entity) ? $object->entity : 1];
@ -964,7 +964,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Clone // Clone
if ($permissiontoadd) { if ($permissiontoadd) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=stocktransfer">'.$langs->trans("ToClone").'</a>'."\n"; print dolGetButtonAction($langs->trans("ToClone"), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=stocktransfer', 'clone', $permissiontoadd);
} }
/* /*
@ -992,14 +992,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
} }
*/ */
// Delete (need delete permission, or if draft, just need create/modify permission) // Delete
if ($object->status < $object::STATUS_TRANSFERED && $permissiontodelete) { print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete);
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').'</a>'."\n";
}
/*else
{
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Delete').'</a>'."\n";
}*/
} }
print '</div>'."\n"; print '</div>'."\n";
} }

View File

@ -1401,7 +1401,7 @@ if ($action == 'create' && $user->rights->projet->creer) {
// Delete // Delete
if ($user->rights->projet->supprimer || ($object->statut == Project::STATUS_DRAFT && $user->rights->projet->creer)) { if ($user->rights->projet->supprimer || ($object->statut == Project::STATUS_DRAFT && $user->rights->projet->creer)) {
if ($userDelete > 0 || ($object->statut == Project::STATUS_DRAFT && $user->rights->projet->creer)) { if ($userDelete > 0 || ($object->statut == Project::STATUS_DRAFT && $user->rights->projet->creer)) {
print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&amp;token='.newToken().'&amp;id='.$object->id, ''); print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, '');
} else { } else {
print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('Delete'), 'default', $_SERVER['PHP_SELF']. '#', '', false); print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('Delete'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
} }

View File

@ -674,14 +674,15 @@ if ($id > 0 || !empty($ref)) {
} }
// Delete // Delete
if ($user->rights->projet->supprimer) { $permissiontodelete = $user->hasRight('projet', 'supprimer');
if ($permissiontodelete) {
if (!$object->hasChildren() && !$object->hasTimeSpent()) { if (!$object->hasChildren() && !$object->hasTimeSpent()) {
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken().'&withproject='.((int) $withproject).'">'.$langs->trans('Delete').'</a>'; print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'&withproject='.((int) $withproject), 'delete', $permissiontodelete);
} else { } else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("TaskHasChild").'">'.$langs->trans('Delete').'</a>'; print dolGetButtonAction($langs->trans("TaskHasChild"), $langs->trans("Delete"), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'&withproject='.((int) $withproject), 'delete', 0);
} }
} else { } else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans('Delete').'</a>'; print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'&withproject='.((int) $withproject), 'delete', $permissiontodelete);
} }
print '</div>'; print '</div>';

View File

@ -116,9 +116,9 @@ if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) { // bo
if (GETPOST('nom', 'alphanohtml')) { if (GETPOST('nom', 'alphanohtml')) {
$nouveauchoix = ''; $nouveauchoix = '';
for ($i = 0; $i < $nbcolonnes; $i++) { for ($i = 0; $i < $nbcolonnes; $i++) {
if (GETPOSTISSET("choix$i") && GETPOST("choix$i") == '1') { if (GETPOSTISSET("choix".$i) && GETPOST("choix".$i) == '1') {
$nouveauchoix .= "1"; $nouveauchoix .= "1";
} elseif (GETPOSTISSET("choix$i") && GETPOST("choix$i") == '2') { } elseif (GETPOSTISSET("choix".$i) && GETPOST("choix".$i) == '2') {
$nouveauchoix .= "2"; $nouveauchoix .= "2";
} else { } else {
$nouveauchoix .= "0"; $nouveauchoix .= "0";

View File

@ -127,7 +127,7 @@ class RecruitmentCandidature extends CommonObject
'remuneration_requested' => array('type'=>'integer', 'label'=>'RequestedRemuneration', 'enabled'=>'1', 'position'=>80, 'notnull'=>0, 'visible'=>-1,), 'remuneration_requested' => array('type'=>'integer', 'label'=>'RequestedRemuneration', 'enabled'=>'1', 'position'=>80, 'notnull'=>0, 'visible'=>-1,),
'remuneration_proposed' => array('type'=>'integer', 'label'=>'ProposedRemuneration', 'enabled'=>'1', 'position'=>81, 'notnull'=>0, 'visible'=>-1,), 'remuneration_proposed' => array('type'=>'integer', 'label'=>'ProposedRemuneration', 'enabled'=>'1', 'position'=>81, 'notnull'=>0, 'visible'=>-1,),
'description' => array('type'=>'html', 'label'=>'Description', 'enabled'=>'1', 'position'=>300, 'notnull'=>0, 'visible'=>3, 'cssview'=>'wordbreak'), 'description' => array('type'=>'html', 'label'=>'Description', 'enabled'=>'1', 'position'=>300, 'notnull'=>0, 'visible'=>3, 'cssview'=>'wordbreak'),
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>1, 'csslist'=>'nowraponall'), 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-4, 'csslist'=>'nowraponall'),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>501, 'notnull'=>0, 'visible'=>-2, 'csslist'=>'nowraponall'), 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>501, 'notnull'=>0, 'visible'=>-2, 'csslist'=>'nowraponall'),
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,),
'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>1010, 'notnull'=>-1, 'visible'=>0,), 'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>1010, 'notnull'=>-1, 'visible'=>0,),

View File

@ -526,7 +526,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Back to draft // Back to draft
if ($object->status == $object::STATUS_VALIDATED) { if ($object->status == $object::STATUS_VALIDATED) {
if ($permissiontoadd) { if ($permissiontoadd) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes">'.$langs->trans("SetToDraft").'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_setdraft&token='.newToken().'&confirm=yes">'.$langs->trans("SetToDraft").'</a>';
} }
} }
@ -565,7 +565,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Clone // Clone
if ($permissiontoadd) { if ($permissiontoadd) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=recruitmentcandidature">'.$langs->trans("ToClone").'</a>'."\n"; print dolGetButtonAction($langs->trans("ToClone"), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=recruitmentcandidature', 'clone', $permissiontoadd);
} }
// Button to convert into a user // Button to convert into a user
@ -592,12 +592,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
} }
} }
// Delete (need delete permission, or if draft, just need create/modify permission) // Delete
if ($permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)) { print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete);
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').'</a>'."\n";
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Delete').'</a>'."\n";
}
} }
print '</div>'."\n"; print '</div>'."\n";
} }

View File

@ -303,7 +303,7 @@ $sql = preg_replace('/,\s*$/', '', $sql);
$nbtotalofrecords = ''; $nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
/* The fast and low memory method to get and count full list converts the sql into a sql count */ /* The fast and low memory method to get and count full list converts the sql into a sql count */
$sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql); $sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/Ui', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
$resql = $db->query($sqlforcount); $resql = $db->query($sqlforcount);
if ($resql) { if ($resql) {
$objforcount = $db->fetch_object($resql); $objforcount = $db->fetch_object($resql);

View File

@ -435,7 +435,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Clone // Clone
if ($permissiontoadd) { if ($permissiontoadd) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=recruitmentjobposition">'.$langs->trans("ToClone").'</a>'."\n"; print dolGetButtonAction($langs->trans("ToClone"), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=recruitmentjobposition', 'clone', $permissiontoadd);
} }
/* /*
@ -452,12 +452,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
} }
} }
// Delete (need delete permission, or if draft, just need create/modify permission) // Delete
if ($permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)) { print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete);
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').'</a>'."\n";
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Delete').'</a>'."\n";
}
} }
print '</div>'."\n"; print '</div>'."\n";
} }

View File

@ -300,7 +300,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
}*/ }*/
/* The fast and low memory method to get and count full list converts the sql into a sql count */ /* The fast and low memory method to get and count full list converts the sql into a sql count */
/* /*
$sqlforcount = preg_replace('/^SELECT[a-z0-9\._\s\(\),]+FROM/i', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql); $sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/Ui', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
print $sqlforcount; print $sqlforcount;
$resql = $db->query($sqlforcount); $resql = $db->query($sqlforcount);
$objforcount = $db->fetch_object($resql); $objforcount = $db->fetch_object($resql);

View File

@ -63,7 +63,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ
$result = restrictedArea($user, 'resource', $object->id, 'resource'); $result = restrictedArea($user, 'resource', $object->id, 'resource');
$permissiontoadd = $user->rights->resource->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $permissiontoadd = $user->rights->resource->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissiontodelete = $user->rights->resource->delete;
/* /*
@ -349,12 +349,7 @@ if ($action == 'create' || $object->fetch($id, $ref) > 0) {
} }
} }
if ($action != "delete" && $action != "create" && $action != "edit") { if ($action != "delete" && $action != "create" && $action != "edit") {
// Delete resource print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete);
if ($user->rights->resource->delete) {
print '<div class="inline-block divButAction">';
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$id.'&action=delete&token='.newToken().'" class="butActionDelete">'.$langs->trans('Delete').'</a>';
print '</div>';
}
} }
} }
print '</div>'; print '</div>';

View File

@ -251,9 +251,9 @@ print '<div class="tabsAction">';
if ($action == '') { if ($action == '') {
if ($user->rights->salaries->delete) { if ($user->rights->salaries->delete) {
if (!$disable_delete) { if (!$disable_delete) {
print '<a class="butActionDelete" href="card.php?id='.GETPOST('id', 'int').'&action=delete&token='.newToken().'">'.$langs->trans('Delete').'</a>'; print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', 1);
} else { } else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("CantRemovePaymentSalaryPaid")).'">'.$langs->trans('Delete').'</a>'; print dolGetButtonAction($langs->trans("CantRemovePaymentSalaryPaid"), $langs->trans("Delete"), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', 0);
} }
} }
} }

View File

@ -478,13 +478,6 @@ $sql .= " region.code_region as region_code, region.nom as region_name";
if ($search_sale && $search_sale != '-1') { if ($search_sale && $search_sale != '-1') {
$sql .= ", sc.fk_soc, sc.fk_user"; $sql .= ", sc.fk_soc, sc.fk_user";
} }
// We'll need these fields in order to filter by categ
if ($search_categ_cus && $search_categ_cus != -1) {
$sql .= ", cc.fk_categorie, cc.fk_soc";
}
if ($search_categ_sup && $search_categ_sup != -1) {
$sql .= ", cs.fk_categorie, cs.fk_soc";
}
// Add fields from extrafields // Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) { if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
@ -505,13 +498,6 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_ty
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_effectif as staff on (staff.id = s.fk_effectif)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_effectif as staff on (staff.id = s.fk_effectif)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as region on (region.code_region = state.fk_region)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as region on (region.code_region = state.fk_region)";
// We'll need this table joined to the select in order to filter by categ
if (!empty($search_categ_cus) && $search_categ_cus != '-1') {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
}
if (!empty($search_categ_sup) && $search_categ_sup != '-1') {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs ON s.rowid = cs.fk_soc"; // We'll need this table joined to the select in order to filter by categ
}
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."c_stcomm as st ON s.fk_stcomm = st.id"; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."c_stcomm as st ON s.fk_stcomm = st.id";
// We'll need this table joined to the select in order to filter by sale // We'll need this table joined to the select in order to filter by sale
if ($search_sale == -2) { if ($search_sale == -2) {
@ -540,26 +526,64 @@ if ($search_sale == -2) {
} elseif ($search_sale > 0) { } elseif ($search_sale > 0) {
$sql .= " AND sc.fk_user = ".((int) $search_sale); $sql .= " AND sc.fk_user = ".((int) $search_sale);
} }
if ($search_categ_cus > 0) { $searchCategoryCustomerList = $search_categ_cus ? array($search_categ_cus) : array();;
$sql .= " AND cc.fk_categorie = ".((int) $search_categ_cus); $searchCategoryCustomerOperator = 0;
// Search for tag/category ($searchCategoryCustomerList is an array of ID)
if (!empty($searchCategoryCustomerList)) {
$searchCategoryCustomerSqlList = array();
$listofcategoryid = '';
foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
if (intval($searchCategoryCustomer) == -2) {
$searchCategoryCustomerSqlList[] = "NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX."categorie_societe as ck WHERE s.rowid = ck.fk_soc)";
} elseif (intval($searchCategoryCustomer) > 0) {
$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryCustomer);
}
}
if ($listofcategoryid) {
$searchCategoryCustomerSqlList[] = " EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX."categorie_societe as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))";
}
if ($searchCategoryCustomerOperator == 1) {
if (!empty($searchCategoryCustomerSqlList)) {
$sql .= " AND (".implode(' OR ', $searchCategoryCustomerSqlList).")";
}
} else {
if (!empty($searchCategoryCustomerSqlList)) {
$sql .= " AND (".implode(' AND ', $searchCategoryCustomerSqlList).")";
}
}
} }
if ($search_categ_sup > 0) { $searchCategorySupplierList = $search_categ_sup ? array($search_categ_sup) : array();
$sql .= " AND cs.fk_categorie = ".((int) $search_categ_sup); $searchCategorySupplierOperator = 0;
// Search for tag/category ($searchCategorySupplierList is an array of ID)
if (!empty($searchCategorySupplierList)) {
$searchCategorySupplierSqlList = array();
$listofcategoryid = '';
foreach ($searchCategorySupplierList as $searchCategorySupplier) {
if (intval($searchCategorySupplier) == -2) {
$searchCategorySupplierSqlList[] = "NOT EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX."categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc)";
} elseif (intval($searchCategorySupplier) > 0) {
$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategorySupplier);
}
}
if ($listofcategoryid) {
$searchCategorySupplierSqlList[] = " EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX."categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))";
}
if ($searchCategorySupplierOperator == 1) {
if (!empty($searchCategorySupplierSqlList)) {
$sql .= " AND (".implode(' OR ', $searchCategorySupplierSqlList).")";
}
} else {
if (!empty($searchCategorySupplierSqlList)) {
$sql .= " AND (".implode(' AND ', $searchCategorySupplierSqlList).")";
}
}
} }
if ($search_categ_cus == -2) {
$sql .= " AND cc.fk_categorie IS NULL";
}
if ($search_categ_sup == -2) {
$sql .= " AND cs.fk_categorie IS NULL";
}
if ($search_all) { if ($search_all) {
$sql .= natural_search(array_keys($fieldstosearchall), $search_all); $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
} }
if (strlen($search_cti)) { if (strlen($search_cti)) {
$sql .= natural_search('s.phone', $search_cti); $sql .= natural_search('s.phone', $search_cti);
} }
if ($search_id > 0) { if ($search_id > 0) {
$sql .= natural_search("s.rowid", $search_id, 1); $sql .= natural_search("s.rowid", $search_id, 1);
} }
@ -698,7 +722,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
dol_print_error($db); dol_print_error($db);
}*/ }*/
/* The fast and low memory method to get and count full list converts the sql into a sql count */ /* The fast and low memory method to get and count full list converts the sql into a sql count */
$sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql); $sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/Ui', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
$resql = $db->query($sqlforcount); $resql = $db->query($sqlforcount);
if ($resql) { if ($resql) {
$objforcount = $db->fetch_object($resql); $objforcount = $db->fetch_object($resql);

View File

@ -158,7 +158,7 @@ if (empty($reshook)) {
if ($result < 0) { if ($result < 0) {
setEventMessages($prodcustprice->error, $prodcustprice->errors, 'mesgs'); setEventMessages($prodcustprice->error, $prodcustprice->errors, 'mesgs');
} else { } else {
setEventMessages($langs->trans('Delete'), null, 'errors'); setEventMessages($langs->trans('RecordDeleted'), null, 'errors');
} }
$action = ''; $action = '';
} }

View File

@ -2003,10 +2003,7 @@ if ($action == 'create') {
} }
// Delete // Delete
if (($object->statut == SupplierProposal::STATUS_DRAFT && $usercancreate) || $usercandelete) { print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', ($object->statut == SupplierProposal::STATUS_DRAFT && $usercancreate) || $usercandelete);
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'"';
print '>'.$langs->trans('Delete').'</a></div>';
}
} }
} }

View File

@ -285,7 +285,7 @@ section.setupsection {
div.tabBar textarea:focus { div.tabBar textarea:focus {
border: 1px solid #aaa !important; border: 1px solid #aaa !important;
} }
input:focus:not(.button):not(.select2-search__field):not(#top-bookmark-search-input):not(.search_component_input):not(.input-search-takepos), input:focus:not(.button):not(.buttonwebsite):not(.select2-search__field):not(#top-bookmark-search-input):not(.search_component_input):not(.input-search-takepos),
select:focus, .select2-container--open [aria-expanded="false"].select2-selection--single { select:focus, .select2-container--open [aria-expanded="false"].select2-selection--single {
/* div.tabBar input:focus, div.tabBar select:focus { */ /* div.tabBar input:focus, div.tabBar select:focus { */
border-bottom: 1px solid #666 !important; border-bottom: 1px solid #666 !important;
@ -620,11 +620,12 @@ table.tableforfield .buttonDelete:not(.bordertransp):not(.buttonpayment) {
-webkit-box-shadow: 0px 0px 1px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1); -webkit-box-shadow: 0px 0px 1px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1);
box-shadow: 0px 0px 1px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1); box-shadow: 0px 0px 1px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1);
} }
.button:disabled, .buttonDelete:disabled, .button.disabled { .button:disabled, .buttonDelete:disabled, .button.disabled, .buttonDelete.disabled {
opacity: 0.4; opacity: 0.4;
box-shadow: none; box-shadow: none;
-webkit-box-shadow: none; -webkit-box-shadow: none;
cursor: auto; cursor: auto;
text-decoration: none;
} }
.buttonRefused { .buttonRefused {
pointer-events: none; pointer-events: none;
@ -5141,7 +5142,7 @@ tr.visible {
.websiteformtoolbar { .websiteformtoolbar {
position: sticky; position: sticky;
top: <?php echo empty($dol_hide_topmenu) ? ($disableimages ? '32px' : '52px') : '0'; ?>; top: <?php echo empty($dol_hide_topmenu) ? ($disableimages ? '32px' : '52px') : '0'; ?>;
z-index: 1000; z-index: 1002; /* Dolibarr menu is 1001, Website menu is 1002 */
} }
.exampleapachesetup { .exampleapachesetup {

View File

@ -4996,7 +4996,7 @@ tr.visible {
.websiteformtoolbar { .websiteformtoolbar {
position: sticky; position: sticky;
top: <?php echo empty($dol_hide_topmenu) ? ($disableimages ? '36px' : '50px') : '0'; ?>; top: <?php echo empty($dol_hide_topmenu) ? ($disableimages ? '36px' : '50px') : '0'; ?>;
z-index: 1000; z-index: 1002; /* Dolibarr menu is 1001, Website menu is 1002 */
} }
.exampleapachesetup { .exampleapachesetup {

View File

@ -452,7 +452,7 @@ $sql .= $hookmanager->resPrint;
$nbtotalofrecords = ''; $nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
/* The fast and low memory method to get and count full list converts the sql into a sql count */ /* The fast and low memory method to get and count full list converts the sql into a sql count */
$sqlforcount = preg_replace('/^SELECT[a-z0-9\._\s\(\),]+FROM/i', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql); $sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/Ui', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
$resql = $db->query($sqlforcount); $resql = $db->query($sqlforcount);
$objforcount = $db->fetch_object($resql); $objforcount = $db->fetch_object($resql);
$nbtotalofrecords = $objforcount->nbtotalofrecords; $nbtotalofrecords = $objforcount->nbtotalofrecords;

View File

@ -470,7 +470,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
} }
}*/ }*/
/* The fast and low memory method to get and count full list converts the sql into a sql count */ /* The fast and low memory method to get and count full list converts the sql into a sql count */
$sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql); $sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/Ui', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
$resql = $db->query($sqlforcount); $resql = $db->query($sqlforcount);
if ($resql) { if ($resql) {
$objforcount = $db->fetch_object($resql); $objforcount = $db->fetch_object($resql);

View File

@ -501,7 +501,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
*/ */
// Delete (need delete permission, or if draft, just need create/modify permission) // Delete (need delete permission, or if draft, just need create/modify permission)
print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken(), '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)); print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken(), '', $permissiontodelete);
} }
print '</div>'."\n"; print '</div>'."\n";
} }

View File

@ -328,7 +328,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
} }
}*/ }*/
/* The fast and low memory method to get and count full list converts the sql into a sql count */ /* The fast and low memory method to get and count full list converts the sql into a sql count */
$sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql); $sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/Ui', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
$resql = $db->query($sqlforcount); $resql = $db->query($sqlforcount);
$objforcount = $db->fetch_object($resql); $objforcount = $db->fetch_object($resql);
$nbtotalofrecords = $objforcount->nbtotalofrecords; $nbtotalofrecords = $objforcount->nbtotalofrecords;

View File

@ -875,10 +875,10 @@ class Website extends CommonObject
if (empty($this->labelStatus) || empty($this->labelStatusShort)) { if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
global $langs; global $langs;
//$langs->load("mymodule"); //$langs->load("mymodule");
$this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Disabled'); $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Offline');
$this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled'); $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Online');
$this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Disabled'); $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Offline');
$this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled'); $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Online');
} }
$statusType = 'status5'; $statusType = 'status5';

View File

@ -838,10 +838,10 @@ class WebsitePage extends CommonObject
if (empty($this->labelStatus) || empty($this->labelStatusShort)) { if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
global $langs; global $langs;
//$langs->load("mymodule"); //$langs->load("mymodule");
$this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Disabled'); $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Offline');
$this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled'); $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Online');
$this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Disabled'); $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Offline');
$this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled'); $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Online');
} }
$statusType = 'status5'; $statusType = 'status5';

View File

@ -420,6 +420,18 @@ if ($action == 'renamefile') { // Must be after include DOL_DOCUMENT_ROOT.'/core
$action = 'file_manager'; $action = 'file_manager';
} }
if ($action == 'setwebsiteonline') {
$website->setStatut($website::STATUS_VALIDATED, null, '', 'WEBSITE_MODIFY', 'status');
header("Location: ".$_SERVER["PHP_SELF"].'?website='.GETPOST('website', 'alphanohtml').'&pageid='.GETPOST('websitepage', 'int'));
exit;
}
if ($action == 'setwebsiteoffline') {
$result = $website->setStatut($website::STATUS_DRAFT, null, '', 'WEBSITE_MODIFY', 'status');
header("Location: ".$_SERVER["PHP_SELF"].'?website='.GETPOST('website', 'alphanohtml').'&pageid='.GETPOST('websitepage', 'int'));
exit;
}
if ($action == 'seteditinline') { if ($action == 'seteditinline') {
dolibarr_set_const($db, 'WEBSITE_EDITINLINE', 1); dolibarr_set_const($db, 'WEBSITE_EDITINLINE', 1);
setEventMessages($langs->trans("FeatureNotYetAvailable"), null, 'warnings'); setEventMessages($langs->trans("FeatureNotYetAvailable"), null, 'warnings');
@ -449,6 +461,35 @@ if ($massaction == 'replace' && GETPOST('confirmmassaction', 'alpha') && !$searc
$massaction = ''; $massaction = '';
} }
if ($action == 'deletetemplate') {
$dirthemes = array('/doctemplates/websites');
if (!empty($conf->modules_parts['websitetemplates'])) { // Using this feature slow down application
foreach ($conf->modules_parts['websitetemplates'] as $reldir) {
$dirthemes = array_merge($dirthemes, (array) ($reldir.'doctemplates/websites'));
}
}
$dirthemes = array_unique($dirthemes);
// Delete template files and dir
$mode = 'importsite';
$action = 'importsite';
if (count($dirthemes)) {
$i = 0;
foreach ($dirthemes as $dir) {
//print $dirroot.$dir;exit;
$dirtheme = DOL_DATA_ROOT.$dir; // This include loop on $conf->file->dol_document_root
if (is_dir($dirtheme)) {
$templateuserfile = GETPOST('templateuserfile');
$imguserfile = preg_replace('/\.zip$/', '', $templateuserfile).'.jpg';
dol_delete_file($dirtheme.'/'.$templateuserfile);
dol_delete_file($dirtheme.'/'.$imguserfile);
}
}
}
}
// Set category // Set category
if ($massaction == 'setcategory' && GETPOST('confirmmassaction', 'alpha') && $usercanedit) { if ($massaction == 'setcategory' && GETPOST('confirmmassaction', 'alpha') && $usercanedit) {
$error = 0; $error = 0;
@ -487,7 +528,8 @@ if ($massaction == 'setcategory' && GETPOST('confirmmassaction', 'alpha') && $us
// Now we reload list // Now we reload list
$listofpages = getPagesFromSearchCriterias($containertype, $algo, $searchkey, 1000, $sortfield, $sortorder, $langcode, $otherfilters, -1); $listofpages = getPagesFromSearchCriterias($containertype, $algo, $searchkey, 1000, $sortfield, $sortorder, $langcode, $otherfilters, -1);
} }
// Set category
// Del category
if ($massaction == 'delcategory' && GETPOST('confirmmassaction', 'alpha') && $usercanedit) { if ($massaction == 'delcategory' && GETPOST('confirmmassaction', 'alpha') && $usercanedit) {
$error = 0; $error = 0;
$nbupdate = 0; $nbupdate = 0;
@ -2720,6 +2762,11 @@ if (!GETPOST('hide_websitemenu')) {
} }
$atleastonepage = (is_array($array) && count($array) > 0); $atleastonepage = (is_array($array) && count($array) > 0);
$websitepage = new WebSitePage($db);
if ($pageid > 0 && ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone')) {
$websitepage->fetch($pageid);
}
//var_dump($objectpage);exit; //var_dump($objectpage);exit;
print '<div class="centpercent websitebar'.(GETPOST('dol_openinpopup', 'aZ09') ? ' hidden' : '').'">'; print '<div class="centpercent websitebar'.(GETPOST('dol_openinpopup', 'aZ09') ? ' hidden' : '').'">';
@ -2730,28 +2777,25 @@ if (!GETPOST('hide_websitemenu')) {
print '<!-- Bar for website -->'; print '<!-- Bar for website -->';
if ($action != 'file_manager') { if ($action != 'file_manager') {
print '<span class="websiteselection hideonsmartphoneimp minwidth100 tdoverflowmax100">'; print '<div class="websiteselection hideonsmartphoneimp minwidth75 tdoverflowmax100 inline-block">';
print $langs->trans("Website").': '; print $langs->trans("Website").': ';
print '</div>';
// Button Add new website
$urltocreatenewwebsite = $_SERVER["PHP_SELF"].'?action=createsite';
print '<span class="websiteselection paddingrightonly">';
print '<a href="'.$urltocreatenewwebsite.'" class=""'.$disabled.' title="'.dol_escape_htmltag($langs->trans("AddWebsite")).'"><span class="fa fa-plus-circle valignmiddle btnTitle-icon"><span></a>';
print '</span>'; print '</span>';
$urltocreatenewwebsite = $_SERVER["PHP_SELF"].'?action=createsite';
if (empty($conf->use_javascript_ajax)) {
print '<span class="websiteselection hideonsmartphoneimp">';
print '<a href="'.$urltocreatenewwebsite.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("AddWebsite")).'"><span class="fa fa-plus-circle valignmiddle btnTitle-icon"><span></a>';
print '</span>';
}
// List of website // List of website
print '<span class="websiteselection">'; print '<span class="websiteselection nopaddingrightimp">';
$out = ''; $out = '';
$out .= '<select name="website" class="minwidth100 width200 maxwidth150onsmartphone" id="website">'; $out .= '<select name="website" class="minwidth100 width200 maxwidth150onsmartphone" id="website">';
if (empty($object->records)) { if (empty($object->records)) {
$out .= '<option value="-1">&nbsp;</option>'; $out .= '<option value="-1">&nbsp;</option>';
} }
if (!empty($conf->use_javascript_ajax)) {
$valueoption = '<span class="classlink">'.img_picto('', 'add', 'class="paddingrightonly"').$langs->trans("AddWebsite").'</span>';
$out .= '<option value="-2" data-html="'.dol_escape_htmltag($valueoption).'">'.$valueoption.'</option>';
}
// Loop on each sites // Loop on each sites
$i = 0; $i = 0;
foreach ($object->records as $key => $valwebsite) { foreach ($object->records as $key => $valwebsite) {
@ -2792,16 +2836,40 @@ if (!GETPOST('hide_websitemenu')) {
} }
print $out; print $out;
if (empty($conf->use_javascript_ajax)) { print '</span>';
print '<input type="image" class="valignmiddle" src="'.img_picto('', 'refresh', '', 0, 1).'" name="refreshsite" value="'.$langs->trans("Load").'">';
// Switch offline/onine
if (!empty($conf->use_javascript_ajax)) {
print '<span class="websiteselection">';
// Do not use ajax, we need a refresh of full page when we change status of a website
//print '<div class="inline-block marginrightonly">';
//print ajax_object_onoff($object, 'status', 'status', 'Online', 'Offline', array(), 'valignmiddle', 'statuswebsite');
//print '</div>';
if ($website->status == $website::STATUS_DRAFT) {
$text_off = 'Offline';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setwebsiteonline&token='.newToken().'&website='.urlencode($website->ref).'&websitepage='.((int) $websitepage->id).'">'.img_picto($langs->trans($text_off), 'switch_off').'</a>';
} else {
$text_off = 'Online';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setwebsiteoffline&token='.newToken().'&website='.urlencode($website->ref).'&websitepage='.((int) $websitepage->id).'">'.img_picto($langs->trans($text_off), 'switch_on').'</a>';
}
print '</span>';
} }
// Refresh / Reload web site (for non javascript browers)
if (empty($conf->use_javascript_ajax)) {
print '<span class="websiteselection">';
print '<input type="image" class="valignmiddle" src="'.img_picto('', 'refresh', '', 0, 1).'" name="refreshsite" value="'.$langs->trans("Load").'">';
print '</span>';
}
print '<span class="websiteselection">';
if ($websitekey && $websitekey != '-1' && ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone' || $action == 'deletesite')) { if ($websitekey && $websitekey != '-1' && ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone' || $action == 'deletesite')) {
print ' &nbsp; '; // Edit website properties
print '<a href="'.$_SERVER["PHP_SELF"].'?website='.urlencode($object->ref).'&pageid='.((int) $pageid).'&action=editcss&token='.newToken().'" class="button bordertransp" title="'.dol_escape_htmltag($langs->trans("EditCss")).'"'.$disabled.'><span class="fa fa-cog paddingrightonly"></span><span class="hideonsmartphone">'.dol_escape_htmltag($langs->trans("EditCss")).'</span></a>';
//print '<input type="submit" class="button bordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditCss")).'" name="editcss">';
print '<a href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$pageid.'&action=editcss&token='.newToken().'" class="button bordertransp" title="'.dol_escape_htmltag($langs->trans("EditCss")).'"'.$disabled.'><span class="fa fa-cog paddingrightonly"></span><span class="hideonsmartphone">'.dol_escape_htmltag($langs->trans("EditCss")).'</span></a>';
// Import web site
$importlabel = $langs->trans("ImportSite"); $importlabel = $langs->trans("ImportSite");
$exportlabel = $langs->trans("ExportSite"); $exportlabel = $langs->trans("ExportSite");
if (!empty($conf->dol_optimize_smallscreen)) { if (!empty($conf->dol_optimize_smallscreen)) {
@ -2815,17 +2883,23 @@ if (!GETPOST('hide_websitemenu')) {
print '<input type="submit" class="button bordertransp"'.$disabled.' value="'.dol_escape_htmltag($importlabel).'" name="importsite">'; print '<input type="submit" class="button bordertransp"'.$disabled.' value="'.dol_escape_htmltag($importlabel).'" name="importsite">';
} }
//print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditMenu")).'" name="editmenu">'; // Export web site
print '<input type="submit" class="button bordertransp"'.$disabledexport.' value="'.dol_escape_htmltag($exportlabel).'" name="exportsite">'; print '<input type="submit" class="button bordertransp"'.$disabledexport.' value="'.dol_escape_htmltag($exportlabel).'" name="exportsite">';
// Clone web site
print '<input type="submit" class="button bordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("CloneSite")).'" name="createfromclone">'; print '<input type="submit" class="button bordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("CloneSite")).'" name="createfromclone">';
// Delete website // Delete website
if ($website->status == $website::STATUS_VALIDATED) { if ($website->status == $website::STATUS_VALIDATED) {
print '<input type="submit" class="buttonDelete bordertransp" name="deletesite" value="'.$langs->trans("Delete").'" disabled="disabled" title="'.dol_escape_htmltag($langs->trans("WebsiteMustBeDisabled")).'">'; $disabled = ' disabled="disabled"';
$title = $langs->trans("WebsiteMustBeDisabled", $langs->transnoentitiesnoconv($website->LibStatut(0, 0)));
$url = '#';
} else { } else {
print '<input type="submit" class="buttonDelete bordertransp" name="deletesite" value="'.$langs->trans("Delete").'">'; $disabled = '';
$title = $langs->trans("Delete");
$url = $_SERVER["PHP_SELF"].'?action=deletesite&token='.newToken().'&website='.urlencode($website->ref);
} }
print '<a href="'.$url.'" class="buttonDelete bordertransp'.($disabled ? ' disabled' : '').'"'.$disabled.' title="'.dol_escape_htmltag($title).'">'.img_picto('', 'delete', 'class=""').'<span class="hideonsmartphone paddingleft">'.$langs->trans("Delete").'</span></a>';
// Regenerate all pages // Regenerate all pages
print '<a href="'.$_SERVER["PHP_SELF"].'?action=regeneratesite&token='.newToken().'&website='.urlencode($website->ref).'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("RegenerateWebsiteContent")).'"><span class="far fa-hdd"></span></a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=regeneratesite&token='.newToken().'&website='.urlencode($website->ref).'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("RegenerateWebsiteContent")).'"><span class="far fa-hdd"></span></a>';
@ -2833,6 +2907,7 @@ if (!GETPOST('hide_websitemenu')) {
// Generate site map // Generate site map
print '<a href="'.$_SERVER["PHP_SELF"].'?action=confirmgeneratesitemaps&token='.newToken().'&website='.urlencode($website->ref).'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("GenerateSitemaps")).'"><span class="fa fa-sitemap"></span></a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=confirmgeneratesitemaps&token='.newToken().'&website='.urlencode($website->ref).'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("GenerateSitemaps")).'"><span class="fa fa-sitemap"></span></a>';
// Find / replace tool
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=replacesite&website='.urlencode($website->ref).'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("ReplaceWebsiteContent")).'"><span class="fa fa-search"></span></a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?mode=replacesite&website='.urlencode($website->ref).'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("ReplaceWebsiteContent")).'"><span class="fa fa-search"></span></a>';
} }
@ -2940,53 +3015,64 @@ if (!GETPOST('hide_websitemenu')) {
print '<!-- Bar for websitepage -->'; print '<!-- Bar for websitepage -->';
print '<div class="centpercent websitebar"'.($style ? ' style="'.$style.'"' : '').'">'; print '<div class="centpercent websitebar"'.($style ? ' style="'.$style.'"' : '').'">';
print '<span class="websiteselection hideonsmartphoneimp minwidth100 tdoverflowmax100">'; print '<div class="websiteselection hideonsmartphoneimp minwidth75 tdoverflowmax100 inline-block">';
print $langs->trans("PageContainer").': '; print $langs->trans("PageContainer").': ';
print '</div>';
// Button Add new web page
print '<span class="websiteselection paddingrightonly">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=createcontainer&token='.newToken().'&website='.urlencode($website->ref).'" class=""'.$disabled.' title="'.dol_escape_htmltag($langs->trans("AddPage")).'"><span class="fa fa-plus-circle valignmiddle btnTitle-icon"></span></a>';
print '</span>'; print '</span>';
print '<span class="websiteselection">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=createcontainer&token='.newToken().'&website='.urlencode($website->ref).'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("AddPage")).'"><span class="fa fa-plus-circle valignmiddle btnTitle-icon"></span></a>';
print '</span>';
//print '<span class="websiteselection">'; $out = '';
if ($action != 'addcontainer') { $s = $formwebsite->selectContainer($website, 'pageid', $pageid, 0, $action, 'minwidth100 maxwidth200onsmartphone');
$out = '';
$s = $formwebsite->selectContainer($website, 'pageid', $pageid, 0, $action, 'maxwidth200onsmartphone'); $out .= '<span class="websiteselection nopaddingrightimp">';
$out .= $s;
$out .= '</span>';
if ($formwebsite->num > 0) { $urltocreatenewpage = $_SERVER["PHP_SELF"].'?action=createcontainer&token='.newToken().'&website='.urlencode($website->ref);
$out .= '<span class="websiteselection">';
$out .= $s;
$out .= '</span>';
$urltocreatenewpage = $_SERVER["PHP_SELF"].'?action=createcontainer&token='.newToken().'&website='.urlencode($website->ref); if (!empty($conf->use_javascript_ajax)) {
$out .= '<script type="text/javascript">';
if (!empty($conf->use_javascript_ajax)) { $out .= 'jQuery(document).ready(function () {';
$out .= '<script type="text/javascript">'; $out .= ' jQuery("#pageid").change(function () {';
$out .= 'jQuery(document).ready(function () {'; $out .= ' console.log("We select "+jQuery("#pageid option:selected").val());';
$out .= ' jQuery("#pageid").change(function () {'; $out .= ' if (jQuery("#pageid option:selected").val() == \'-2\') {';
$out .= ' console.log("We select "+jQuery("#pageid option:selected").val());'; $out .= ' window.location.href = "'.$urltocreatenewpage.'";';
$out .= ' if (jQuery("#pgeid option:selected").val() == \'-2\') {'; $out .= ' } else {';
$out .= ' window.location.href = "'.$urltocreatenewpage.'";'; $out .= ' window.location.href = "'.$_SERVER["PHP_SELF"].'?website='.urlencode($website->ref).'&pageid="+jQuery("#pageid option:selected").val();';
$out .= ' } else {'; $out .= ' }';
$out .= ' window.location.href = "'.$_SERVER["PHP_SELF"].'?website='.urlencode($website->ref).'&pageid="+jQuery("#pageid option:selected").val();'; $out .= ' });';
$out .= ' }'; $out .= '});';
$out .= ' });'; $out .= '</script>';
$out .= '});';
$out .= '</script>';
}
}
print $out;
} else {
print $langs->trans("New");
} }
print $out;
if (!empty($conf->use_javascript_ajax)) {
print '<span class="websiteselection">';
//print '<div class="inline-block marginrightonly">';
if ($object->status == $object::STATUS_DRAFT) { // website is off, we do not allow to change status of page
$text_off = 'SetWebsiteOnlineBefore';
if ($objectpage->status == $objectpage::STATUS_DRAFT) {
print '<span class="valignmiddle disabled opacitymedium">'.img_picto($langs->trans($text_off), 'switch_off').'</span>';
} else {
print '<span class="valignmiddle disabled opacitymedium">'.img_picto($langs->trans($text_off), 'switch_on').'</span>';
}
} else {
print ajax_object_onoff($objectpage, 'status', 'status', 'Online', 'Offline', array(), 'valignmiddle', 'statuswebsitepage');
}
//print '</div>';
print '</span>';
}
print '<span class="websiteselection">'; print '<span class="websiteselection">';
print '<input type="image" class="valignmiddle" src="'.img_picto('', 'refresh', '', 0, 1).'" name="refreshpage" value="'.$langs->trans("Load").'"'.(($atleastonepage && $action != 'editsource') ? '' : ' disabled="disabled"').'>'; print '<input type="image" class="valignmiddle buttonwebsite" src="'.img_picto('', 'refresh', '', 0, 1).'" name="refreshpage" value="'.$langs->trans("Load").'"'.(($action != 'editsource') ? '' : ' disabled="disabled"').'>';
// Print nav arrows // Print nav arrows
$pagepreviousid = 0; $pagepreviousid = 0;
@ -3015,23 +3101,18 @@ if (!GETPOST('hide_websitemenu')) {
} }
if ($pagepreviousid) { if ($pagepreviousid) {
print '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?website='.urlencode($object->ref).'&pageid='.$pagepreviousid.'&action='.$action.'&token='.newToken().'">'.img_previous($langs->trans("PreviousContainer")).'</a>'; print '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?website='.urlencode($object->ref).'&pageid='.((int) $pagepreviousid).'&action='.urlencode($action).'&token='.newToken().'">'.img_previous($langs->trans("PreviousContainer")).'</a>';
} else { } else {
print '<span class="valignmiddle opacitymedium">'.img_previous($langs->trans("PreviousContainer")).'</span>'; print '<span class="valignmiddle opacitymedium">'.img_previous($langs->trans("PreviousContainer")).'</span>';
} }
if ($pagenextid) { if ($pagenextid) {
print '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?website='.urlencode($object->ref).'&pageid='.$pagenextid.'&action='.$action.'&token='.newToken().'">'.img_next($langs->trans("NextContainer")).'</a>'; print '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?website='.urlencode($object->ref).'&pageid='.((int) $pagenextid).'&action='.urlencode($action).'&token='.newToken().'">'.img_next($langs->trans("NextContainer")).'</a>';
} else { } else {
print '<span class="valignmiddle opacitymedium">'.img_next($langs->trans("NextContainer")).'</span>'; print '<span class="valignmiddle opacitymedium">'.img_next($langs->trans("NextContainer")).'</span>';
} }
print '</span>'; print '</span>';
$websitepage = new WebSitePage($db);
if ($pageid > 0 && ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone')) {
$websitepage->fetch($pageid);
}
if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone' || $action == 'deletesite') { if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone' || $action == 'deletesite') {
$disabled = ''; $disabled = '';
if (empty($user->rights->website->write)) { if (empty($user->rights->website->write)) {
@ -3109,15 +3190,15 @@ if (!GETPOST('hide_websitemenu')) {
print '<span class="websiteselection">'; print '<span class="websiteselection">';
print ' &nbsp; '; // Edit web page properties
//print '<input type="submit" class="button bordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditPageMeta")).'" name="editmeta">';
print '<a href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$pageid.'&action=editmeta&token='.newToken().'" class="button bordertransp" title="'.dol_escape_htmltag($langs->trans("EditPageMeta")).'"'.$disabled.'><span class="fa fa-cog paddingrightonly"></span><span class="hideonsmartphone">'.dol_escape_htmltag($langs->trans("EditPageMeta")).'</span></a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$pageid.'&action=editmeta&token='.newToken().'" class="button bordertransp" title="'.dol_escape_htmltag($langs->trans("EditPageMeta")).'"'.$disabled.'><span class="fa fa-cog paddingrightonly"></span><span class="hideonsmartphone">'.dol_escape_htmltag($langs->trans("EditPageMeta")).'</span></a>';
//print '<input type="submit" class="button bordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditHTMLSource")).'" name="editsource">'; // Edit HTML content
print '<a href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$pageid.'&action=editsource&token='.newToken().'" class="button bordertransp"'.$disabled.'>'.dol_escape_htmltag($langs->trans($conf->dol_optimize_smallscreen ? "HTML" : "EditHTMLSource")).'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$pageid.'&action=editsource&token='.newToken().'" class="button bordertransp"'.$disabled.'>'.dol_escape_htmltag($langs->trans($conf->dol_optimize_smallscreen ? "HTML" : "EditHTMLSource")).'</a>';
print '</span>'; print '</span>';
// Switch include dynamic content / edit inline
print '<!-- button EditInLine and ShowSubcontainers -->'."\n"; print '<!-- button EditInLine and ShowSubcontainers -->'."\n";
print '<div class="websiteselectionsection inline-block">'; print '<div class="websiteselectionsection inline-block">';
@ -3210,7 +3291,19 @@ if (!GETPOST('hide_websitemenu')) {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setashome&token='.newToken().'&website='.urlencode($website->ref).'&pageid='.((int) $pageid).'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("SetAsHomePage")).'"><span class="fa fa-home valignmiddle btnTitle-icon"></span></a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setashome&token='.newToken().'&website='.urlencode($website->ref).'&pageid='.((int) $pageid).'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("SetAsHomePage")).'"><span class="fa fa-home valignmiddle btnTitle-icon"></span></a>';
} }
print '<input type="submit" class="button bordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("ClonePage")).'" name="createpagefromclone">'; print '<input type="submit" class="button bordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("ClonePage")).'" name="createpagefromclone">';
print '<input type="submit" class="buttonDelete bordertransp" name="delete" value="'.$langs->trans("Delete").'"'.($atleastonepage ? '' : ' disabled="disabled"').'>';
// Delete
//print '<input type="submit" class="buttonDelete bordertransp" name="delete" value="'.$langs->trans("Delete").'"'.($atleastonepage ? '' : ' disabled="disabled"').'>';
if ($websitepage->status == $websitepage::STATUS_DRAFT || !$atleastonepage) {
$disabled = ' disabled="disabled"';
$title = $langs->trans("WebpageMustBeDisabled", $langs->transnoentitiesnoconv($websitepage->LibStatut(0, 0)));
$url = '#';
} else {
$disabled = '';
$title = '';
$url = $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&website='.urlencode($website->ref);
}
print '<a href="'.$url.'" class="buttonDelete bordertransp'.($disabled ? ' disabled' : '').'"'.$disabled.' title="'.dol_escape_htmltag($title).'">'.img_picto('', 'delete', 'class=""').'<span class="hideonsmartphone paddingleft">'.$langs->trans("Delete").'</span></a>';
} }
} }
@ -3466,13 +3559,16 @@ if ($action == 'editcss') {
print '</td></tr>'; print '</td></tr>';
// Status of web site // Status of web site
print '<!-- Status of website -->'."\n"; if ($action != 'createcontainer') {
print '<tr><td class="fieldrequired">'; if (empty($conf->use_javascript_ajax)) {
print $langs->trans('Status'); print '<!-- Status of web site page -->'."\n";
print '</td><td>'; print '<tr><td class="fieldrequired">';
print ajax_object_onoff($object, 'status', 'status', 'Enabled', 'Disabled'); print $langs->trans('Status');
//print dol_print_date($pagedatecreation, 'dayhour'); print '</td><td>';
print '</td></tr>'; print $form->selectyesno('status', $object->status);
print '</td></tr>';
}
}
// Main language // Main language
print '<tr><td class="tdtop fieldrequired">'; print '<tr><td class="tdtop fieldrequired">';
@ -3851,7 +3947,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties
$pageusermodifid = $objectpage->fk_user_modif; $pageusermodifid = $objectpage->fk_user_modif;
$pageauthoralias = $objectpage->author_alias; $pageauthoralias = $objectpage->author_alias;
$pagestatus = $objectpage->status; $pagestatus = $objectpage->status;
} else { } else { // $action = 'createcontainer'
$type_container = 'page'; $type_container = 'page';
$pageurl = ''; $pageurl = '';
$pagealiasalt = ''; $pagealiasalt = '';
@ -3898,13 +3994,14 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties
} }
if ($action != 'createcontainer') { if ($action != 'createcontainer') {
print '<!-- Status of page -->'."\n"; if (empty($conf->use_javascript_ajax)) {
print '<tr><td class="fieldrequired">'; print '<!-- Status of web site page -->'."\n";
print $langs->trans('Status'); print '<tr><td class="fieldrequired">';
print '</td><td>'; print $langs->trans('Status');
print ajax_object_onoff($objectpage, 'status', 'status', 'Enabled', 'Disabled'); print '</td><td>';
//print dol_print_date($pagedatecreation, 'dayhour'); print $form->selectyesno('status', $objectpage->status);
print '</td></tr>'; print '</td></tr>';
}
} }
// Type of container // Type of container
@ -3915,6 +4012,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties
$formwebsite->selectTypeOfContainer('WEBSITE_TYPE_CONTAINER', (GETPOST('WEBSITE_TYPE_CONTAINER', 'alpha') ? GETPOST('WEBSITE_TYPE_CONTAINER', 'alpha') : $type_container), 0, '', 1); $formwebsite->selectTypeOfContainer('WEBSITE_TYPE_CONTAINER', (GETPOST('WEBSITE_TYPE_CONTAINER', 'alpha') ? GETPOST('WEBSITE_TYPE_CONTAINER', 'alpha') : $type_container), 0, '', 1);
print '</td></tr>'; print '</td></tr>';
// Example/templates of page
if ($action == 'createcontainer') { if ($action == 'createcontainer') {
print '<tr><td class="titlefield fieldrequired">'; print '<tr><td class="titlefield fieldrequired">';
print $langs->trans('WEBSITE_PAGE_EXAMPLE'); print $langs->trans('WEBSITE_PAGE_EXAMPLE');
@ -4149,6 +4247,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
if ($action == 'createcontainer') { if ($action == 'createcontainer') {
print '<div class="center tablecheckboxcreatemanually'.$hiddenmanuallyafterload.'">'; print '<div class="center tablecheckboxcreatemanually'.$hiddenmanuallyafterload.'">';
@ -4177,7 +4276,10 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties
$arraygrabimagesinto = array('root'=>$langs->trans("WebsiteRootOfImages"), 'subpage'=>$langs->trans("SubdirOfPage")); $arraygrabimagesinto = array('root'=>$langs->trans("WebsiteRootOfImages"), 'subpage'=>$langs->trans("SubdirOfPage"));
print $form->selectarray('grabimagesinto', $arraygrabimagesinto, GETPOSTISSET('grabimagesinto') ? GETPOST('grabimagesinto') : 'root', 0, 0, 0, '', 0, 0, 0, '', '', 1); print $form->selectarray('grabimagesinto', $arraygrabimagesinto, GETPOSTISSET('grabimagesinto') ? GETPOST('grabimagesinto') : 'root', 0, 0, 0, '', 0, 0, 0, '', '', 1);
print '<br>'; print '<br>';
print '<input class="button" style="margin-top: 5px" type="submit" name="fetchexternalurl" value="'.dol_escape_htmltag($langs->trans("FetchAndCreate")).'">';
print '<input class="button small" style="margin-top: 5px" type="submit" name="fetchexternalurl" value="'.dol_escape_htmltag($langs->trans("FetchAndCreate")).'">';
print '<input class="button button-cancel small" type="submit" name="preview" value="'.$langs->trans("Cancel").'">';
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
} }

View File

@ -63,19 +63,22 @@ if (empty($action) && empty($id) && empty($ref)) {
$action = 'view'; $action = 'view';
} }
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
// Security check - Protection if external user // Security check - Protection if external user
//if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid; //if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'website', $id); //$result = restrictedArea($user, 'website', $id);
if (empty($user->rights->websiteaccount->read)) {
accessforbidden('NotAllowed');
}
// Permissions // Permissions
$permissionnote = $user->rights->websiteaccount->write; // Used by the include of actions_setnotes.inc.php $permissionnote = $user->rights->websiteaccount->write; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->rights->websiteaccount->write; // Used by the include of actions_dellink.inc.php $permissiondellink = $user->rights->websiteaccount->write; // Used by the include of actions_dellink.inc.php
$permissiontoadd = $user->rights->websiteaccount->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $permissiontoadd = $user->rights->websiteaccount->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissiontodelete = $user->rights->websiteaccount->delete;
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
/* /*
@ -320,8 +323,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
} }
*/ */
if ($user->rights->website->delete) { if ($permissiontodelete) {
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').'</a></div>'."\n"; print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete);
} }
} }
print '</div>'."\n"; print '</div>'."\n";

View File

@ -451,10 +451,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Clone // Clone
if ($permissiontoadd) { if ($permissiontoadd) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=clone&token='.newToken().'&object=workstation">'.$langs->trans("ToClone").'</a>'."\n"; print dolGetButtonAction($langs->trans("ToClone"), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=workstation', 'clone', $permissiontoadd);
} }
// Disable / Enable
if ($permissiontoadd) { if ($permissiontoadd) {
if ($object->status == $object::STATUS_ENABLED) { if ($object->status == $object::STATUS_ENABLED) {
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=disable&token='.newToken().'">'.$langs->trans("Disable").'</a>'."\n"; print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=disable&token='.newToken().'">'.$langs->trans("Disable").'</a>'."\n";
@ -463,13 +463,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
} }
} }
// Delete
// Delete (need delete permission, or if draft, just need create/modify permission) print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete);
if ($permissiontodelete) {
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').'</a>'."\n";
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Delete').'</a>'."\n";
}
} }
print '</div>'."\n"; print '</div>'."\n";
} }

View File

@ -178,6 +178,9 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase
if (preg_match('/\/htdocs\/includes\//', $file['fullname'])) { if (preg_match('/\/htdocs\/includes\//', $file['fullname'])) {
continue; continue;
} }
if (preg_match('/\/htdocs\/install\/doctemplates\/websites\//', $file['fullname'])) {
continue;
}
if (preg_match('/\/htdocs\/custom\//', $file['fullname'])) { if (preg_match('/\/htdocs\/custom\//', $file['fullname'])) {
continue; continue;
} }

View File

@ -362,6 +362,12 @@ class DateLibTest extends PHPUnit\Framework\TestCase
$langs=$this->savlangs; $langs=$this->savlangs;
$db=$this->savdb; $db=$this->savdb;
// Check %Y-%m-%d %H:%M:%S format
$result=dol_print_date('1970-01-01', '%Y-%m-%d %H:%M:%S', true); // A case for compatibility check
print __METHOD__." result=".$result."\n";
$this->assertEquals('1970-01-01 00:00:00', $result);
// Check %Y-%m-%d %H:%M:%S format // Check %Y-%m-%d %H:%M:%S format
$result=dol_print_date(0, '%Y-%m-%d %H:%M:%S', true); $result=dol_print_date(0, '%Y-%m-%d %H:%M:%S', true);
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";