diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 1b2f376c33f..8b2ba49d1bc 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -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); diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index f1d641029d0..033220d4a15 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -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')); } diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index 708fb3a3e83..c585217dfda 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -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 = "".(is_countable($elements) ? count($elements) : '0').""; + $counter = "".(is_array($elements) ? count($elements) : '0').""; } $color = $categstatic->color ? ' style="background: #'.sprintf("%06s", $categstatic->color).';"' : ' style="background: #bbb"'; diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 5912d63c7cf..327876f17c2 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -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 = "".(is_countable($elements) ? count($elements) : '0').""; + $counter = "".(is_array($elements) ? count($elements) : '0').""; } $color = $categstatic->color ? ' style="background: #'.sprintf("%06s", $categstatic->color).';"' : ' style="background: #bbb"'; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 1ccbd22d511..3cdbd0bbffd 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -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( diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index b0685b8b64b..6c708b36c51 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -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"), diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 555155e345e..5941ac1668b 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -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 diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php index 6354c0bf5fd..43897172779 100644 --- a/htdocs/compta/facture/contact.php +++ b/htdocs/compta/facture/contact.php @@ -100,14 +100,6 @@ if ($action == 'addcontact' && $user->rights->facture->creer) { * View */ -if (empty($object->id)) { - llxHeader(); - $langs->load('errors'); - echo '
'.$langs->trans("ErrorRecordNotFound").'
'; - llxFooter(); - exit; -} - $title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('ContactsAddresses'); $helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes"; llxHeader('', $title, $helpurl); diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index f333d67b336..7cbf6f02348 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -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; } diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 80ba0b671eb..913c0cb768e 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -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 .= '
'.$langs->trans('ErrorLeaveRequestMustBeDraftCanceledOrRefusedToBeDeleted', $objecttmp->ref).'

'; + 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 diff --git a/htdocs/core/ajax/objectonoff.php b/htdocs/core/ajax/objectonoff.php index 05843abed9d..5bac89345ce 100644 --- a/htdocs/core/ajax/objectonoff.php +++ b/htdocs/core/ajax/objectonoff.php @@ -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 ''."\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'; diff --git a/htdocs/core/boxes/box_funnel_of_prospection.php b/htdocs/core/boxes/box_funnel_of_prospection.php index fd89e732937..89ed2215732 100644 --- a/htdocs/core/boxes/box_funnel_of_prospection.php +++ b/htdocs/core/boxes/box_funnel_of_prospection.php @@ -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); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index cc74c30c191..9d1800af742 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -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) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 36e6f300819..be8bb90b1be 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8159,9 +8159,9 @@ function verifCond($strToEvaluate) global $leftmenu; global $rights; // To export to dol_eval function - //print $strRights."
\n"; + //print $strToEvaluate."
\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 } diff --git a/htdocs/core/lib/memory.lib.php b/htdocs/core/lib/memory.lib.php index 032d567d35b..0c056ddbc2e 100644 --- a/htdocs/core/lib/memory.lib.php +++ b/htdocs/core/lib/memory.lib.php @@ -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; } diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index aba6558f20d..4393d248d3f 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -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 } diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index ac5704511ef..6866c8a5039 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -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 diff --git a/htdocs/langs/en_US/holiday.lang b/htdocs/langs/en_US/holiday.lang index 835cb67f090..dceaef59081 100644 --- a/htdocs/langs/en_US/holiday.lang +++ b/htdocs/langs/en_US/holiday.lang @@ -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 \ No newline at end of file +XIsAUsualNonWorkingDay=%s is usualy a NON working day +ErrorLeaveRequestMustBeDraftCanceledOrRefusedToBeDeleted=Leave request %s must be draft, canceled or refused to be deleted diff --git a/htdocs/langs/nl_NL/main.lang b/htdocs/langs/nl_NL/main.lang index 3043bba6410..21f5b0b1230 100644 --- a/htdocs/langs/nl_NL/main.lang +++ b/htdocs/langs/nl_NL/main.lang @@ -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 diff --git a/htdocs/product/traduction.php b/htdocs/product/traduction.php index 9ee6365d2fd..65906a0cc0f 100644 --- a/htdocs/product/traduction.php +++ b/htdocs/product/traduction.php @@ -233,7 +233,7 @@ if (empty($reshook)) { if ($user->rights->produit->creer || $user->rights->service->creer) { print '' . $langs->trans("Add") . ''; if ($cnt_trans > 0) { - print '' . $langs->trans("Update") . ''; + print '' . $langs->trans("Modify") . ''; } } } diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index 08304cecaab..c3fcbdfafb1 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -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); diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 16ef0f7bd77..559a9b8d001 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -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('
'.$langs->trans('TicketMarkedAsClosed').'
', 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 { diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 7a6c24c58f7..112b1d80117 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -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); diff --git a/test/phpunit/SecurityTest.php b/test/phpunit/SecurityTest.php index fe091b0fe47..d1e67b04a37 100644 --- a/test/phpunit/SecurityTest.php +++ b/test/phpunit/SecurityTest.php @@ -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;