Merge branch '14.0' of git@github.com:Dolibarr/dolibarr.git into develop
Conflicts: htdocs/accountancy/bookkeeping/list.php htdocs/core/actions_massactions.inc.php htdocs/core/lib/functions.lib.php htdocs/core/lib/memory.lib.php htdocs/langs/en_US/holiday.lang htdocs/ticket/card.php
This commit is contained in:
commit
a298a845f1
@ -24,6 +24,7 @@
|
||||
* \ingroup Accountancy (Double entries)
|
||||
* \brief List operation of book keeping
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
@ -333,10 +334,6 @@ if (empty($reshook)) {
|
||||
$filter['t.numero_compte<='] = $search_accountancy_code_end;
|
||||
$param .= '&search_accountancy_code_end='.urlencode($search_accountancy_code_end);
|
||||
}
|
||||
if (!empty($search_accountancy_aux_code)) {
|
||||
$filter['t.subledger_account'] = $search_accountancy_aux_code;
|
||||
$param .= '&search_accountancy_aux_code='.urlencode($search_accountancy_aux_code);
|
||||
}
|
||||
if (!empty($search_accountancy_aux_code_start)) {
|
||||
$filter['t.subledger_account>='] = $search_accountancy_aux_code_start;
|
||||
$param .= '&search_accountancy_aux_code_start='.urlencode($search_accountancy_aux_code_start);
|
||||
@ -533,11 +530,11 @@ if (count($filter) > 0) {
|
||||
$sqlwhere[] = $key."='".$db->idate($value)."'";
|
||||
} elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') {
|
||||
$sqlwhere[] = $key."'".$db->idate($value)."'";
|
||||
} elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=') {
|
||||
} elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=' || $key == 't.subledger_account>=' || $key == 't.subledger_account<=') {
|
||||
$sqlwhere[] = $key."'".$db->escape($value)."'";
|
||||
} elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') {
|
||||
$sqlwhere[] = $key.'='.((int) $value);
|
||||
} elseif ($key == 't.numero_compte') {
|
||||
} elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
|
||||
$sqlwhere[] = $key." LIKE '".$db->escape($value)."%'";
|
||||
} elseif ($key == 't.subledger_account') {
|
||||
$sqlwhere[] = natural_search($key, $value, 0, 1);
|
||||
|
||||
@ -225,6 +225,9 @@ if (!empty($conf->contrat->enabled) && !empty($user->rights->contrat->lire)) {
|
||||
if (!empty($conf->ticket->enabled) && !empty($user->rights->ticket->read)) {
|
||||
$elementList['ticket_send'] = img_picto('', 'ticket', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToTicket'));
|
||||
}
|
||||
if (!empty($conf->expensereport->enabled) && !empty($user->rights->expensereport->lire)) {
|
||||
$elementList['expensereport_send'] = img_picto('', 'trip', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToTExpenseReport'));
|
||||
}
|
||||
if (!empty($conf->agenda->enabled)) {
|
||||
$elementList['actioncomm_send'] = img_picto('', 'action', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendEventPush'));
|
||||
}
|
||||
|
||||
@ -186,7 +186,7 @@ foreach ($fulltree as $key => $val) {
|
||||
? $categstatic->getObjectsInCateg("account", 1) // Categorie::TYPE_ACCOUNT is "bank_account" instead of "account"
|
||||
: $categstatic->getObjectsInCateg($type, 1);
|
||||
|
||||
$counter = "<td class='left' width='40px;'>".(is_countable($elements) ? count($elements) : '0')."</td>";
|
||||
$counter = "<td class='left' width='40px;'>".(is_array($elements) ? count($elements) : '0')."</td>";
|
||||
}
|
||||
|
||||
$color = $categstatic->color ? ' style="background: #'.sprintf("%06s", $categstatic->color).';"' : ' style="background: #bbb"';
|
||||
|
||||
@ -413,7 +413,7 @@ if ($cats < 0) {
|
||||
? $categstatic->getObjectsInCateg("account", 1) // Categorie::TYPE_ACCOUNT is "bank_account" instead of "account"
|
||||
: $categstatic->getObjectsInCateg($type, 1);
|
||||
|
||||
$counter = "<td class='left' width='40px;'>".(is_countable($elements) ? count($elements) : '0')."</td>";
|
||||
$counter = "<td class='left' width='40px;'>".(is_array($elements) ? count($elements) : '0')."</td>";
|
||||
}
|
||||
|
||||
$color = $categstatic->color ? ' style="background: #'.sprintf("%06s", $categstatic->color).';"' : ' style="background: #bbb"';
|
||||
|
||||
@ -903,6 +903,10 @@ if ($resql) {
|
||||
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
// Add $param from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$param .= $hookmanager->resPrint;
|
||||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array(
|
||||
|
||||
@ -829,6 +829,11 @@ if ($resql) {
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
|
||||
// Add $param from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$param .= $hookmanager->resPrint;
|
||||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array(
|
||||
'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
|
||||
|
||||
@ -1660,6 +1660,11 @@ if (empty($reshook)) {
|
||||
$discount->tva_tx = $lines[$i]->tva_tx;
|
||||
$discount->fk_user = $user->id;
|
||||
$discount->description = $desc;
|
||||
$discount->multicurrency_subprice = abs($lines[$i]->multicurrency_subprice);
|
||||
$discount->multicurrency_amount_ht = abs($lines[$i]->multicurrency_total_ht);
|
||||
$discount->multicurrency_amount_tva = abs($lines[$i]->multicurrency_total_tva);
|
||||
$discount->multicurrency_amount_ttc = abs($lines[$i]->multicurrency_total_ttc);
|
||||
|
||||
$discountid = $discount->create($user);
|
||||
if ($discountid > 0) {
|
||||
$result = $object->insert_discount($discountid); // This include link_to_invoice
|
||||
|
||||
@ -100,14 +100,6 @@ if ($action == 'addcontact' && $user->rights->facture->creer) {
|
||||
* View
|
||||
*/
|
||||
|
||||
if (empty($object->id)) {
|
||||
llxHeader();
|
||||
$langs->load('errors');
|
||||
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
|
||||
llxFooter();
|
||||
exit;
|
||||
}
|
||||
|
||||
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('ContactsAddresses');
|
||||
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
|
||||
llxHeader('', $title, $helpurl);
|
||||
|
||||
@ -76,7 +76,7 @@ $search_phone_mobile = GETPOST("search_phone_mobile", 'alpha');
|
||||
$search_fax = GETPOST("search_fax", 'alpha');
|
||||
$search_email = GETPOST("search_email", 'alpha');
|
||||
if (!empty($conf->mailing->enabled)) {
|
||||
$search_no_email = GETPOST("search_no_email", 'int');
|
||||
$search_no_email = GETPOSTISSET("search_no_email") ? GETPOST("search_no_email", 'int') : -1;
|
||||
} else {
|
||||
$search_no_email = -1;
|
||||
}
|
||||
|
||||
@ -1306,6 +1306,12 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == '
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($objectclass == 'Holiday' && ! in_array($objecttmp->statut, array(Holiday::STATUS_DRAFT, Holiday::STATUS_CANCELED, Holiday::STATUS_REFUSED))) {
|
||||
$nbignored++;
|
||||
$resaction .= '<div class="error">'.$langs->trans('ErrorLeaveRequestMustBeDraftCanceledOrRefusedToBeDeleted', $objecttmp->ref).'</div><br>';
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($objectclass == "Task" && $objecttmp->hasChildren() > 0) {
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."projet_task SET fk_task_parent = 0 WHERE fk_task_parent = ".((int) $objecttmp->id);
|
||||
$res = $db->query($sql);
|
||||
@ -1342,8 +1348,10 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == '
|
||||
// Message for elements well deleted
|
||||
if ($nbok > 1) {
|
||||
setEventMessages($langs->trans("RecordsDeleted", $nbok), null, 'mesgs');
|
||||
} elseif ($nbok == 1) {
|
||||
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
|
||||
} elseif ($nbok > 0) {
|
||||
setEventMessages($langs->trans("RecordDeleted", $nbok), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("NoRecordDeleted"), null, 'mesgs');
|
||||
}
|
||||
|
||||
// Message for elements which can't be deleted
|
||||
|
||||
@ -65,9 +65,14 @@ if (!empty($user->socid)) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
|
||||
/*if (empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
|
||||
accessforbidden('Calling this file is allowed only when MAIN_DIRECT_STATUS_UPDATE is set');
|
||||
}*/
|
||||
if (in_array($field, array('status'))) {
|
||||
restrictedArea($user, $element, $id);
|
||||
} elseif ($element == 'product' && in_array($field, array('tosell', 'tobuy', 'tobatch'))) { // Special case for products
|
||||
restrictedArea($user, 'produit|service', $id, 'product&product', '', '', 'rowid');
|
||||
} else {
|
||||
accessforbidden("Bad value for combination of parameters element/field.", 0, 0, 1);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@ -78,15 +83,6 @@ top_httphead();
|
||||
|
||||
print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
|
||||
|
||||
if (in_array($field, array('status'))) {
|
||||
restrictedArea($user, $element, $id);
|
||||
} elseif ($element == 'product' && in_array($field, array('tosell', 'tobuy', 'tobatch'))) { // Special case for products
|
||||
restrictedArea($user, 'produit|service', $id, 'product&product', '', '', 'rowid');
|
||||
} else {
|
||||
accessforbidden("Bad value for combination of parameters element/field.", 0, 0, 1);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Registering new values
|
||||
if (($action == 'set') && !empty($id)) {
|
||||
$triggerkey = strtoupper($element).'_UPDATE';
|
||||
|
||||
@ -237,7 +237,7 @@ class box_funnel_of_prospection extends ModeleBoxes
|
||||
$dolgraph->setBorderColor(array_values($bordercolorseries));
|
||||
$dolgraph->setShowLegend(2);
|
||||
if (!empty($conf->dol_optimize_smallscreen)) {
|
||||
$px1->SetWidth(320);
|
||||
$dolgraph->SetWidth(320);
|
||||
}
|
||||
$dolgraph->setShowPercent(1);
|
||||
$dolgraph->setMirrorGraphValues(true);
|
||||
|
||||
@ -869,7 +869,7 @@ abstract class CommonObject
|
||||
if (!empty($conf->socialnetworks->enabled)) {
|
||||
$outsocialnetwork = '';
|
||||
|
||||
if (!empty($this->socialnetworks) && is_countable($this->socialnetworks) && count($this->socialnetworks) > 0) {
|
||||
if (!empty($this->socialnetworks) && is_array($this->socialnetworks) && count($this->socialnetworks) > 0) {
|
||||
$socialnetworksdict = getArrayOfSocialNetworks();
|
||||
foreach ($this->socialnetworks as $key => $value) {
|
||||
if ($value) {
|
||||
|
||||
@ -8159,9 +8159,9 @@ function verifCond($strToEvaluate)
|
||||
global $leftmenu;
|
||||
global $rights; // To export to dol_eval function
|
||||
|
||||
//print $strRights."<br>\n";
|
||||
//print $strToEvaluate."<br>\n";
|
||||
$rights = true;
|
||||
if ($strToEvaluate !== '') {
|
||||
if (isset($strToEvaluate) && $strToEvaluate !== '') {
|
||||
$str = 'if(!('.$strToEvaluate.')) { $rights = false; }';
|
||||
dol_eval($str); // The dol_eval must contains all the global $xxx used into a condition
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ function dol_setcache($memoryid, $data, $expire = 0)
|
||||
$dolmemcache->add($memoryid, $data, $expire); // This fails if key already exists
|
||||
$rescode = $dolmemcache->getResultCode();
|
||||
if ($rescode == 0) {
|
||||
return is_array($data) ? count($data) : 0;
|
||||
return is_array($data) ? count($data) : (is_scalar($data) ? strlen($data) : 0);
|
||||
} else {
|
||||
return -$rescode;
|
||||
}
|
||||
@ -113,7 +113,7 @@ function dol_setcache($memoryid, $data, $expire = 0)
|
||||
//$dolmemcache->setOption(Memcached::OPT_COMPRESSION, false);
|
||||
$result = $dolmemcache->add($memoryid, $data, false, $expire); // This fails if key already exists
|
||||
if ($result) {
|
||||
return is_array($data) ? count($data) : 0;
|
||||
return is_array($data) ? count($data) : (is_scalar($data) ? strlen($data) : 0);
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -478,7 +478,7 @@ if ($num > 0) {
|
||||
if (empty($obj)) {
|
||||
break;
|
||||
}
|
||||
if (!verifCond($obj->test)) {
|
||||
if (isset($obj->test) && !verifCond($obj->test)) {
|
||||
continue; // Discard line with test = false
|
||||
}
|
||||
|
||||
|
||||
@ -284,6 +284,12 @@ if ($search_user > 0) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."element_contact as ec";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc";
|
||||
}
|
||||
|
||||
// Add table from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
||||
$sql .= " WHERE e.entity IN (".getEntity('expedition').")";
|
||||
if ($search_product_category > 0) {
|
||||
$sql .= " AND cp.fk_categorie = ".((int) $search_product_category);
|
||||
@ -471,6 +477,11 @@ if ($optioncss != '') {
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
|
||||
// Add $param from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$param .= $hookmanager->resPrint;
|
||||
|
||||
$arrayofmassactions = array(
|
||||
'builddoc' => img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
|
||||
//'classifyclose'=>$langs->trans("Close"), TODO massive close shipment ie: when truck is charged
|
||||
|
||||
@ -133,4 +133,5 @@ WatermarkOnDraftHolidayCards=Watermarks on draft leave requests
|
||||
HolidaysToApprove=Holidays to approve
|
||||
NobodyHasPermissionToValidateHolidays=Nobody has permission to validate holidays
|
||||
HolidayBalanceMonthlyUpdate=Monthly update of holiday balance
|
||||
XIsAUsualNonWorkingDay=%s is usualy a NON working day
|
||||
XIsAUsualNonWorkingDay=%s is usualy a NON working day
|
||||
ErrorLeaveRequestMustBeDraftCanceledOrRefusedToBeDeleted=Leave request %s must be draft, canceled or refused to be deleted
|
||||
|
||||
@ -8,21 +8,21 @@ FONTFORPDF=helvetica
|
||||
FONTSIZEFORPDF=10
|
||||
SeparatorDecimal=,
|
||||
SeparatorThousand=Space
|
||||
FormatDateShort=%m/%d/%Y
|
||||
FormatDateShortInput=%m/%d/%Y
|
||||
FormatDateShortJava=MM/dd/yyyy
|
||||
FormatDateShortJavaInput=MM/dd/yyyy
|
||||
FormatDateShortJQuery=mm/dd/yy
|
||||
FormatDateShortJQueryInput=mm/dd/yy
|
||||
FormatDateShort=%d-%m-%Y
|
||||
FormatDateShortInput=%d-%m-%Y
|
||||
FormatDateShortJava=dd-MM-yyyy
|
||||
FormatDateShortJavaInput=dd-MM-yyyy
|
||||
FormatDateShortJQuery=dd-mm-yy
|
||||
FormatDateShortJQueryInput=dd-mm-yy
|
||||
FormatHourShortJQuery=HH:MI
|
||||
FormatHourShort=%I:%M %p
|
||||
FormatHourShortDuration=%H:%M
|
||||
FormatDateTextShort=%b %d, %Y
|
||||
FormatDateText=%B %d, %Y
|
||||
FormatDateHourShort=%m/%d/%Y %I:%M %p
|
||||
FormatDateHourSecShort=%m/%d/%Y %I:%M:%S %p
|
||||
FormatDateHourTextShort=%b %d, %Y, %I:%M %p
|
||||
FormatDateHourText=%B %d, %Y, %I:%M %p
|
||||
FormatDateTextShort=%d %b %Y
|
||||
FormatDateText=%d %B %Y
|
||||
FormatDateHourShort=%d-%m-%Y %I:%M %p
|
||||
FormatDateHourSecShort=%d-%m-%Y %I:%M:%S %p
|
||||
FormatDateHourTextShort=%d %b %Y, %I:%M %p
|
||||
FormatDateHourText=%d %B %Y, %I:%M %p
|
||||
DatabaseConnection=Databaseverbinding
|
||||
NoTemplateDefined=Geen sjabloon beschikbaar voor dit e-mailtype
|
||||
AvailableVariables=Beschikbare substitutievariabelen
|
||||
|
||||
@ -233,7 +233,7 @@ if (empty($reshook)) {
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer) {
|
||||
print '<a class="butAction" href="' . DOL_URL_ROOT . '/product/traduction.php?action=add&token='.newToken().'&id=' . $object->id . '">' . $langs->trans("Add") . '</a>';
|
||||
if ($cnt_trans > 0) {
|
||||
print '<a class="butAction" href="' . DOL_URL_ROOT . '/product/traduction.php?action=edit&token='.newToken().'&id=' . $object->id . '">' . $langs->trans("Update") . '</a>';
|
||||
print '<a class="butAction" href="' . DOL_URL_ROOT . '/product/traduction.php?action=edit&token='.newToken().'&id=' . $object->id . '">' . $langs->trans("Modify") . '</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -513,7 +513,6 @@ if (!empty($conf->global->MAIN_DEFAULT_WORKING_DAYS)) {
|
||||
|
||||
for ($idw = 0; $idw < 7; $idw++) {
|
||||
$dayinloopfromfirstdaytoshow = dol_time_plus_duree($firstdaytoshow, $idw, 'd'); // $firstdaytoshow is a date with hours = 0
|
||||
$dayinloop = dol_time_plus_duree($startday, $idw, 'd');
|
||||
|
||||
// Useless because $dayinloopwithouthours should be same than $dayinloopfromfirstdaytoshow
|
||||
//$tmparray = dol_getdate($dayinloop);
|
||||
|
||||
@ -438,7 +438,7 @@ if (empty($reshook)) {
|
||||
if (!$error) {
|
||||
// Log action in ticket logs table
|
||||
$object->fetch_user($usertoassign);
|
||||
$log_action = $langs->trans('TicketLogAssignedTo', $object->user->getFullName($langs));
|
||||
//$log_action = $langs->trans('TicketLogAssignedTo', $object->user->getFullName($langs));
|
||||
|
||||
setEventMessages($langs->trans('TicketAssigned'), null, 'mesgs');
|
||||
|
||||
@ -493,7 +493,7 @@ if (empty($reshook)) {
|
||||
$object->close($user);
|
||||
|
||||
// Log action in ticket logs table
|
||||
$log_action = $langs->trans('TicketLogClosedBy', $_SESSION['email_customer']);
|
||||
//$log_action = $langs->trans('TicketLogClosedBy', $_SESSION['email_customer']);
|
||||
|
||||
setEventMessages('<div class="confirm">'.$langs->trans('TicketMarkedAsClosed').'</div>', null, 'mesgs');
|
||||
|
||||
@ -579,7 +579,7 @@ if (empty($reshook)) {
|
||||
$res = $object->setStatut(Ticket::STATUS_ASSIGNED);
|
||||
if ($res) {
|
||||
// Log action in ticket logs table
|
||||
$log_action = $langs->trans('TicketLogReopen');
|
||||
//$log_action = $langs->trans('TicketLogReopen');
|
||||
|
||||
$url = 'card.php?action=view&track_id='.$object->track_id;
|
||||
header("Location: ".$url);
|
||||
@ -616,11 +616,11 @@ if (empty($reshook)) {
|
||||
$object->message = $fieldtomodify;
|
||||
$ret = $object->update($user);
|
||||
if ($ret > 0) {
|
||||
$log_action = $langs->trans('TicketInitialMessageModified')." \n";
|
||||
//$log_action = $langs->trans('TicketInitialMessageModified')." \n";
|
||||
// include the Diff class
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/utils_diff.class.php';
|
||||
// output the result of comparing two files as plain text
|
||||
$log_action .= Diff::toString(Diff::compare(strip_tags($oldvalue_message), strip_tags($object->message)));
|
||||
//$log_action .= Diff::toString(Diff::compare(strip_tags($oldvalue_message), strip_tags($object->message)));
|
||||
|
||||
setEventMessages($langs->trans('TicketMessageSuccesfullyUpdated'), null, 'mesgs');
|
||||
} else {
|
||||
@ -684,7 +684,7 @@ if (empty($reshook)) {
|
||||
|
||||
$ret = $object->update($user);
|
||||
if ($ret > 0) {
|
||||
$log_action = $langs->trans('TicketLogPropertyChanged', $oldvalue_label, $newvalue_label);
|
||||
//$log_action = $langs->trans('TicketLogPropertyChanged', $oldvalue_label, $newvalue_label);
|
||||
|
||||
setEventMessages($langs->trans('TicketUpdated'), null, 'mesgs');
|
||||
} else {
|
||||
|
||||
@ -2367,7 +2367,7 @@ if ($action == 'generatesitemaps' && $usercanedit) {
|
||||
}
|
||||
if ($tmpshortlangcode != $shortlangcode) {
|
||||
$xhtmllink = $domtree->createElement('xhtml:link', '');
|
||||
$xhtmllink->setAttribute("rel", "alternante");
|
||||
$xhtmllink->setAttribute("rel", "alternate");
|
||||
$xhtmllink->setAttribute("hreflang", $tmpshortlangcode);
|
||||
$xhtmllink->setAttribute("href", $domainname.($objp->fk_default_home == $tmppage->id ? '/' : (($tmpshortlangcode != substr($object->lang, 0, 2)) ? '/'.$tmpshortlangcode : '').'/'.$tmppage->pageurl.'.php'));
|
||||
$url->appendChild($xhtmllink);
|
||||
|
||||
@ -594,7 +594,7 @@ class SecurityTest extends PHPUnit\Framework\TestCase
|
||||
print __METHOD__." login=".$login."\n";
|
||||
$this->assertEquals($login, 'admin', 'The test to check if pass of user "admin" is "admin" has failed');
|
||||
|
||||
$login=checkLoginPassEntity('admin', 'admin', 1, array('http','dolibarr')); // Should work because of second authetntication method
|
||||
$login=checkLoginPassEntity('admin', 'admin', 1, array('http','dolibarr')); // Should work because of second authentication method
|
||||
print __METHOD__." login=".$login."\n";
|
||||
$this->assertEquals($login, 'admin');
|
||||
|
||||
@ -749,42 +749,42 @@ class SecurityTest extends PHPUnit\Framework\TestCase
|
||||
$url = 'https://www.dolibarr.fr'; // This is a redirect 301 page
|
||||
$tmp = getURLContent($url, 'GET', '', 0); // We do NOT follow
|
||||
print __METHOD__." url=".$url."\n";
|
||||
$this->assertEquals(301, $tmp['http_code'], 'GET url 301 without following -> 301');
|
||||
$this->assertEquals(301, $tmp['http_code'], 'Should GET url 301 without following -> 301');
|
||||
|
||||
$url = 'https://www.dolibarr.fr'; // This is a redirect 301 page
|
||||
$tmp = getURLContent($url); // We DO follow
|
||||
$tmp = getURLContent($url); // We DO follow a page with return 300 so result should be 200
|
||||
print __METHOD__." url=".$url."\n";
|
||||
$this->assertEquals(200, $tmp['http_code'], 'GET url 301 with following -> 200'); // Test error if return does not contains 'not supported'
|
||||
$this->assertEquals(200, $tmp['http_code'], 'Should GET url 301 with following -> 200 but we get '.$tmp['http_code']);
|
||||
|
||||
$url = 'http://localhost';
|
||||
$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL
|
||||
print __METHOD__." url=".$url."\n";
|
||||
$this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that resolves to a local URL'); // Test we receive an error because localtest.me is not an external URL
|
||||
$this->assertEquals(400, $tmp['http_code'], 'Should GET url to '.$url.' that resolves to a local URL'); // Test we receive an error because localtest.me is not an external URL
|
||||
|
||||
$url = 'http://127.0.0.1';
|
||||
$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL
|
||||
print __METHOD__." url=".$url."\n";
|
||||
$this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.0.1 is not an external URL
|
||||
$this->assertEquals(400, $tmp['http_code'], 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.0.1 is not an external URL
|
||||
|
||||
$url = 'http://127.0.2.1';
|
||||
$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL
|
||||
print __METHOD__." url=".$url."\n";
|
||||
$this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.2.1 is not an external URL
|
||||
$this->assertEquals(400, $tmp['http_code'], 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.2.1 is not an external URL
|
||||
|
||||
$url = 'https://169.254.0.1';
|
||||
$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL
|
||||
print __METHOD__." url=".$url."\n";
|
||||
$this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that is a local URL'); // Test we receive an error because 169.254.0.1 is not an external URL
|
||||
$this->assertEquals(400, $tmp['http_code'], 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 169.254.0.1 is not an external URL
|
||||
|
||||
$url = 'http://[::1]';
|
||||
$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL
|
||||
print __METHOD__." url=".$url."\n";
|
||||
$this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that is a local URL'); // Test we receive an error because [::1] is not an external URL
|
||||
$this->assertEquals(400, $tmp['http_code'], 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because [::1] is not an external URL
|
||||
|
||||
/*$url = 'localtest.me';
|
||||
$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL
|
||||
print __METHOD__." url=".$url."\n";
|
||||
$this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that resolves to a local URL'); // Test we receive an error because localtest.me is not an external URL
|
||||
$this->assertEquals(400, $tmp['http_code'], 'Should GET url to '.$url.' that resolves to a local URL'); // Test we receive an error because localtest.me is not an external URL
|
||||
*/
|
||||
|
||||
return 0;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user