diff --git a/.travis.yml b/.travis.yml index 6422e33a7e9..1469894dfc3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -95,13 +95,13 @@ notifications: install: - | - echo "Updating Composer" - rm $TRAVIS_BUILD_DIR/composer.json - rm $TRAVIS_BUILD_DIR/composer.lock + echo "Updating Composer (version 2.5 is bugged and generate phpunit error Exception: Serialization of 'Closure' is not allowed)" + #rm $TRAVIS_BUILD_DIR/composer.json + #rm $TRAVIS_BUILD_DIR/composer.lock composer -V - composer self-update - composer -n init - composer -n config vendor-dir htdocs/includes + composer self-update 2.4.4 + #composer -n init + #composer -n config vendor-dir htdocs/includes composer -n config -g vendor-dir htdocs/includes echo diff --git a/htdocs/core/boxes/box_members_by_type.php b/htdocs/core/boxes/box_members_by_type.php index 2e25da59564..9fcfb7e325a 100644 --- a/htdocs/core/boxes/box_members_by_type.php +++ b/htdocs/core/boxes/box_members_by_type.php @@ -92,6 +92,7 @@ class box_members_by_type extends ModeleBoxes if ($user->rights->adherent->lire) { $MembersToValidate = array(); + $MembersPending = array(); $MembersValidated = array(); $MembersUpToDate = array(); $MembersExcluded = array(); @@ -169,34 +170,63 @@ class box_members_by_type extends ModeleBoxes } $this->db->free($result); } + // Members pendding (Waiting for first subscription) + $sql = "SELECT count(*) as somme , d.fk_adherent_type"; + $sql .= " FROM " . MAIN_DB_PREFIX . "adherent as d, " . MAIN_DB_PREFIX . "adherent_type as t"; + $sql .= " WHERE d.entity IN (" . getEntity('adherent') . ")"; + $sql .= " AND d.statut = 1 AND (d.datefin IS NULL AND t.subscription = 1)"; + $sql .= " AND t.rowid = d.fk_adherent_type"; + $sql .= " GROUP BY d.fk_adherent_type"; + + dol_syslog("index.php::select nb of uptodate members by type", LOG_DEBUG); + $result = $this->db->query($sql); + if ($result) { + $num2 = $this->db->num_rows($result); + $i = 0; + while ($i < $num2) { + $objp = $this->db->fetch_object($result); + $MembersPending[$objp->fk_adherent_type] = $objp->somme; + $i++; + } + $this->db->free($result); + } $line = 0; $this->info_box_contents[$line][] = array( 'td' => 'class=""', 'text' => '', ); + // Draft $labelstatus = $staticmember->LibStatut($staticmember::STATUS_DRAFT, 0, 0, 1); $this->info_box_contents[$line][] = array( 'td' => 'class="right tdoverflowmax100" width="15%" title="'.dol_escape_htmltag($labelstatus).'"', 'text' => $labelstatus ); - $labelstatus = $langs->trans("UpToDate"); + // Pending (Waiting for first subscription) + $labelstatus = $staticmember->LibStatut($staticmember::STATUS_VALIDATED, 1, 0, 1); + $this->info_box_contents[$line][] = array( + 'td' => 'class="right tdoverflowmax100" width="15%" title="'.dol_escape_htmltag($labelstatus).'"', + 'text' => $labelstatus + ); + // Up to date $labelstatus = $staticmember->LibStatut($staticmember::STATUS_VALIDATED, 1, dol_now() + 86400, 1); $this->info_box_contents[$line][] = array( 'td' => 'class="right tdoverflowmax100" width="15%" title="'.dol_escape_htmltag($labelstatus).'"', 'text' => $labelstatus, ); - $labelstatus = $langs->trans("OutOfDate"); + // Expired $labelstatus = $staticmember->LibStatut($staticmember::STATUS_VALIDATED, 1, dol_now() - 86400, 1); $this->info_box_contents[$line][] = array( 'td' => 'class="right tdoverflowmax100" width="15%" title="'.dol_escape_htmltag($labelstatus).'"', 'text' => $labelstatus ); + // Excluded $labelstatus = $staticmember->LibStatut($staticmember::STATUS_EXCLUDED, 0, 0, 1); $this->info_box_contents[$line][] = array( 'td' => 'class="right tdoverflowmax100" width="15%" title="'.dol_escape_htmltag($labelstatus).'"', 'text' => $labelstatus ); + // Resiliated $labelstatus = $staticmember->LibStatut($staticmember::STATUS_RESILIATED, 0, 0, 1); $this->info_box_contents[$line][] = array( 'td' => 'class="right tdoverflowmax100" width="15%" title="'.dol_escape_htmltag($labelstatus).'"', @@ -205,7 +235,8 @@ class box_members_by_type extends ModeleBoxes $line++; foreach ($AdherentType as $key => $adhtype) { $SumToValidate += isset($MembersToValidate[$key]) ? $MembersToValidate[$key] : 0; - $SumValidated += isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0) : 0; + $SumPending += isset($MembersPending[$key]) ? $MembersPending[$key] : 0; + $SumExpired += isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0) - (isset($MembersPending[$key]) ? $MembersPending[$key] : 0): 0; $SumUpToDate += isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0; $SumExcluded += isset($MembersExcluded[$key]) ? $MembersExcluded [$key] : 0; $SumResiliated += isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0; @@ -220,6 +251,11 @@ class box_members_by_type extends ModeleBoxes 'text' => (isset($MembersToValidate[$key]) && $MembersToValidate[$key] > 0 ? $MembersToValidate[$key] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_DRAFT, 1, 0, 3), 'asis' => 1, ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="right"', + 'text' => (isset($MembersPending[$key]) && $MembersPending[$key] > 0 ? $MembersPending[$key] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, 0, 3), + 'asis' => 1, + ); $this->info_box_contents[$line][] = array( 'td' => 'class="right"', 'text' => (isset($MembersUpToDate[$key]) && $MembersUpToDate[$key] > 0 ? $MembersUpToDate[$key] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, $now, 3), @@ -260,6 +296,11 @@ class box_members_by_type extends ModeleBoxes 'text' => $SumToValidate.' '.$staticmember->LibStatut(Adherent::STATUS_DRAFT, 1, 0, 3), 'asis' => 1 ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="liste_total right"', + 'text' => $SumPending.' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, 0, 3), + 'asis' => 1 + ); $this->info_box_contents[$line][] = array( 'td' => 'class="liste_total right"', 'text' => $SumUpToDate.' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, $now, 3), @@ -267,7 +308,7 @@ class box_members_by_type extends ModeleBoxes ); $this->info_box_contents[$line][] = array( 'td' => 'class="liste_total right"', - 'text' => $SumValidated.' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, 1, 3), + 'text' => $SumExpired.' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, 1, 3), 'asis' => 1 ); $this->info_box_contents[$line][] = array( diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index e9e621bcb7d..d1b0ca0164c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -9600,6 +9600,12 @@ abstract class CommonObject } } + // Delete linked object + $res = $this->deleteObjectLinked(); + if ($res < 0) { + $error++; + } + if (!$error && !empty($this->isextrafieldmanaged)) { $result = $this->deleteExtraFields(); if ($result < 0) { diff --git a/htdocs/core/class/validate.class.php b/htdocs/core/class/validate.class.php index 9d8832c36ce..31cf6300aff 100644 --- a/htdocs/core/class/validate.class.php +++ b/htdocs/core/class/validate.class.php @@ -191,7 +191,7 @@ class Validate */ public function isMinLength($string, $length) { - if (!strlen($string) < $length) { + if (strlen($string) < $length) { $this->error = $this->outputLang->trans('RequireMinLength', $length); return false; } diff --git a/htdocs/core/js/lib_foot.js.php b/htdocs/core/js/lib_foot.js.php index 3310554e530..c037b86a7b9 100644 --- a/htdocs/core/js/lib_foot.js.php +++ b/htdocs/core/js/lib_foot.js.php @@ -110,6 +110,7 @@ if (!defined('JS_JQUERY_DISABLE_DROPDOWN')) { console.log("toggle dropdown dt a"); //$(this).parent().parent().find(\'dd ul\').slideToggle(\'fast\'); + $(".ulselectedfields").removeClass("open"); $(this).parent().parent().find(\'dd ul\').toggleClass("open"); if ($(this).parent().parent().find(\'dd ul\').hasClass("open")) { diff --git a/htdocs/core/modules/modAsset.class.php b/htdocs/core/modules/modAsset.class.php index 3a7caa1cb57..a0fb405887e 100644 --- a/htdocs/core/modules/modAsset.class.php +++ b/htdocs/core/modules/modAsset.class.php @@ -63,7 +63,7 @@ class modAsset extends DolibarrModules $this->descriptionlong = "Asset module to manage assets module and depreciation charge on Dolibarr"; // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z' - $this->version = 'experimental'; + $this->version = 'development'; // Key used in llx_const table to save module status enabled/disabled (where ASSETS is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); // Name of image file used for this module. diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index ecc8c22ab1f..4a7d7f0a661 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -498,7 +498,7 @@ $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfi $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; -print ''."\n"; +print '
'."\n"; // Fields title search // -------------------------------------------------------------------- @@ -865,6 +865,9 @@ while ($i < $imaxinloop) { if (!$i) { $totalarray['type'][$totalarray['nbfield']] = 'duration'; } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'fd.duree'; + } $totalarray['val']['fd.duree'] += $obj->duree; } // Action column diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index 0cde40ba20a..ea560012afc 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -27,6 +27,7 @@ Permission56003=Delete tickets Permission56004=Manage tickets Permission56005=See tickets of all third parties (not effective for external users, always be limited to the third party they depend on) +Tickets=Tickets TicketDictType=Ticket - Types TicketDictCategory=Ticket - Groupes TicketDictSeverity=Ticket - Severities diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index 8e60b2a296c..c235dec7e63 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -55,6 +55,9 @@ global $langs, $user; // Libraries require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"; require_once '../lib/mymodule.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; + + //require_once "../class/myclass.class.php"; // Translations diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 2fe7d983513..afd7b4860fb 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -853,7 +853,7 @@ class MyObject extends CommonObject //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); global $action, $hookmanager; - $hookmanager->initHooks(array('myobjectdao')); + $hookmanager->initHooks(array($this->element.'dao')); $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 78dd11c9fd0..936633508fa 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -500,11 +500,11 @@ llxHeader("", $title, $help_url); $titleboth = $langs->trans("LeadsOrProjects"); $titlenew = $langs->trans("NewLeadOrProject"); // Leads and opportunities by default -if (empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { +if (!getDolGlobalInt('PROJECT_USE_OPPORTUNITIES')) { $titleboth = $langs->trans("Projects"); $titlenew = $langs->trans("NewProject"); } -if ($conf->global->PROJECT_USE_OPPORTUNITIES == 2) { // 2 = leads only +if (getDolGlobalInt('PROJECT_USE_OPPORTUNITIES') == 2) { // 2 = leads only $titleboth = $langs->trans("Leads"); $titlenew = $langs->trans("NewLead"); } diff --git a/htdocs/projet/class/taskstats.class.php b/htdocs/projet/class/taskstats.class.php index 5794d585101..c3b3a5b716a 100644 --- a/htdocs/projet/class/taskstats.class.php +++ b/htdocs/projet/class/taskstats.class.php @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + include_once DOL_DOCUMENT_ROOT.'/core/class/stats.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; @@ -195,7 +196,7 @@ class TaskStats extends Stats } - /** + /** * Return the Task amount by month for a year * * @param int $year Year to scan @@ -208,7 +209,7 @@ class TaskStats extends Stats return array(); } - /** + /** * Return average of entity by month * @param int $year year number * @return int value diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index ceddeedfd33..94ed0edaffd 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -191,7 +191,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_project_ref = ''; $search_project_label = ''; $search_task_label = ''; - $search_user = 0; + $search_user = -1; $search_valuebilled = ''; $search_product_ref = ''; $toselect = array(); @@ -1446,7 +1446,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser print $langs->trans('InvoiceToUse'); print ''; print ''; print ''; /*print ''; @@ -1561,7 +1561,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser if (empty($search_user)) { $search_user = $user->id; } - $sql .= " AND t.fk_user = ".((int) $search_user); + if ($search_user > 0) $sql .= " AND t.fk_user = ".((int) $search_user); } if ($search_note) { diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 6be323a1a7a..ccc1fde97eb 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -1094,7 +1094,7 @@ function Print(id, gift){ function TakeposPrinting(id){ var receipt; console.log("TakeposPrinting" + id); - $.get("receipt.php?facid="+id, function(data, status){ + $.get("receipt.php?facid="+id, function(data, status) { receipt=data.replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, ''); $.ajax({ type: "POST", diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php index 400d05415aa..39fe2113071 100644 --- a/htdocs/takepos/receipt.php +++ b/htdocs/takepos/receipt.php @@ -85,7 +85,7 @@ $hookmanager->initHooks(array('takeposfrontend'), $facid); $reshook = $hookmanager->executeHooks('TakeposReceipt', $parameters, $object); if (!empty($hookmanager->resPrint)) { print $hookmanager->resPrint; - exit; + return; // Receipt page can be called by the takepos/send.php page that use ob_start/end so we must use return and not exit to stop page } // IMPORTANT: This file is sended to 'Takepos Printing' application. Keep basic file. No external files as css, js... If you need images use absolute path. diff --git a/htdocs/takepos/send.php b/htdocs/takepos/send.php index ffa7e0c5c35..7397c962555 100644 --- a/htdocs/takepos/send.php +++ b/htdocs/takepos/send.php @@ -69,19 +69,19 @@ if ($action == "send") { include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; $formmail = new FormMail($db); $outputlangs = new Translate('', $conf); - $model_id = $conf->global->TAKEPOS_EMAIL_TEMPLATE_INVOICE; + $model_id = getDolGlobalString('TAKEPOS_EMAIL_TEMPLATE_INVOICE'); $arraydefaultmessage = $formmail->getEMailTemplate($db, 'facture_send', $user, $outputlangs, $model_id); $subject = $arraydefaultmessage->topic; ob_start(); // turn on output receipt - include 'receipt.php'; + include DOL_DOCUMENT_ROOT.'/takepos/receipt.php'; $receipt = ob_get_contents(); // get the contents of the output buffer ob_end_clean(); $msg = "".$arraydefaultmessage->content."
".$receipt.""; $sendto = $email; $from = $mysoc->email; - $mail = new CMailFile($subject, $sendto, $from, $msg, array(), array(), array(), '', '', 0, 1); + $mail = new CMailFile($subject, $sendto, $from, $msg, array(), array(), array(), '', '', 0, 1, '', '', '', '', '', '', DOL_DOCUMENT_ROOT.'/documents/takepos/temp'); if ($mail->error || !empty($mail->errors)) { setEventMessages($mail->error, $mail->errors, 'errors'); } else { diff --git a/test/phpunit/AdminLibTest.php b/test/phpunit/AdminLibTest.php index 6649aa19798..4df1a6933e1 100644 --- a/test/phpunit/AdminLibTest.php +++ b/test/phpunit/AdminLibTest.php @@ -46,6 +46,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; */ class AdminLibTest extends PHPUnit\Framework\TestCase { + protected $backupGlobalsBlacklist = array('conf', 'user', 'langs', 'db'); protected $savconf; protected $savuser; protected $savlangs; @@ -69,6 +70,7 @@ class AdminLibTest extends PHPUnit\Framework\TestCase $this->savdb=$db; print __METHOD__." db->type=".$db->type." user->id=".$user->id; + //print " - db ".$db->db; print "\n"; } diff --git a/test/phpunit/phpunittest.xml b/test/phpunit/phpunittest.xml index 84b31a8dd3b..8157d3f3e7a 100644 --- a/test/phpunit/phpunittest.xml +++ b/test/phpunit/phpunittest.xml @@ -1,8 +1,8 @@
'; - $form->selectInvoice('invoice', '', 'invoiceid', 24, 0, $langs->trans('NewInvoice'), 1, 0, 0, 'maxwidth500', '', 'all'); + $form->selectInvoice($projectstatic->thirdparty->id, '', 'invoiceid', 24, 0, $langs->trans('NewInvoice'), 1, 0, 0, 'maxwidth500', '', 'all'); print '