diff --git a/README-LABINVENT.md b/README-LABINVENT.md index b67ece8..f9053f3 100755 --- a/README-LABINVENT.md +++ b/README-LABINVENT.md @@ -50,9 +50,9 @@ Logiciel testé et validé sur les configurations suivantes : VERSION ACTUELLE -Date: 18/05/2016 -Version: 2.2.2.1 -Demande (terminée): Bugfixes nombre catégorie/sous-catégorie associé +Date: 19/05/2016 +Version: 2.2.3.0 +Demande (terminée): https://projects.irap.omp.eu/issues/3642 Version majeure en cours (2.2): https://projects.irap.omp.eu/versions/106 diff --git a/src/Controller/MaterielsController.php b/src/Controller/MaterielsController.php index fbec810..584c5b8 100755 --- a/src/Controller/MaterielsController.php +++ b/src/Controller/MaterielsController.php @@ -204,6 +204,8 @@ class MaterielsController extends AppController $this->set(compact('s_sur_categories', 's_categories', 's_sous_categories', 's_groupes_thematiques', 's_groupes_metiers', 's_organismes')); + $resultTri = $this->request->session()->read("resultTri"); + // some data POSTED (au moins le champ de recherche generale) ? if ( isset($this->request->data['s_all']) || isset($this->request->data['s_all_2']) || isset($this->request->data['s_designation'])) { $generalFieldConditions = NULL; @@ -316,12 +318,6 @@ class MaterielsController extends AppController // CONSTRUCTION DE LA REQUETE SQL COMPLETE = $specificFieldsConditions OR $generalFieldConditions (mais entre chaque champ, c'est un AND) // by default, no sort - $order = []; - - if (isset($this->passedArgs[0]) && isset($this->passedArgs[1])) { - $order = $this->passedArgs[0]; - $order .= ' '.$this->passedArgs[1]; - } if (isset($this->request->data['s_all_2']) && $this->request->data['s_all_2'] != '') { $conditions = $generalFieldConditions; @@ -333,19 +329,34 @@ class MaterielsController extends AppController $conditions = $specificFieldsConditions; } - $lastResults = $this->Materiels->find('all', ['limit' => 1000, 'order' => $order, 'conditions' => $conditions])->toArray(); - - $this->set('_results', $lastResults); - $this->request->session()->write("result", $lastResults); + $lastResults = $this->Materiels->find('all', ['limit' => 1000, 'conditions' => $conditions]); - $getSortLinkForColumnTitle = function ($label, $fieldName) { - return " - - "; - }; - $this->set('getSortLinkForColumnTitle', $getSortLinkForColumnTitle); + $_results = $this->paginate($lastResults); + $this->set(compact('_results')); + $this->set('_serialize', ['_results']); + + //pour l'export + $this->request->session()->write("result", $lastResults->toArray()); + } // end if() + else if (isset($resultTri) && strstr($this->request->here(), 'sort') != false && strstr($this->request->here(), 'direction') != false) { + $findedMateriel = []; + + foreach($resultTri as $r) { + array_push($findedMateriel, $r->id); + } + $res = $this->Materiels->find('all', ['limit' => 1000]); + for($i = 0; $i < sizeof($findedMateriel); $i++) { + $res->orWhere(['id =' => $findedMateriel[$i]]); + } + + $_results = $this->paginate($res); + $this->set(compact('_results')); + + //pour l'export + $this->request->session()->write("result", $res->toArray()); + } } /** @@ -446,7 +457,7 @@ class MaterielsController extends AppController $materiels = $this->Materiels->find('all')->where(['Materiels.id' => $selectedMateriels[0]]); - for ($j = 1; $j < sizeof($selectedMateriels); $j++) { + for ($j = 0; $j < sizeof($selectedMateriels); $j++) { $materiels->orWhere(['Materiels.id' => $selectedMateriels[$j]]); } @@ -652,6 +663,53 @@ class MaterielsController extends AppController $this->response->header(['Content-type: application/xml', 'Content-Disposition: attachment; filename="'.$filename.'"']); $this->response->sendHeaders(); + + /* + * SIMPLE LABEL FOR PRINTER DYMO LabelWriter 450 : NO LOGO + */ + /* + ' + + Landscape + MultiPurpose11355 + 11355 Multi-Purpose + + + + + + TEXTE + + + + Rotation0 + False + False + Left + Middle + None + True + False + + + ' + ."$numeroLab"."\n" + ."$dateAcquisition"."\n" + ."$organisme"."\n" + .' + + + + + + + + + + ' + ."\n" + */ + /* * ETIQUETTE (19x51 mm) * diff --git a/src/Template/Layout/default.ctp b/src/Template/Layout/default.ctp index 10fd3e6..aa3bd40 100755 --- a/src/Template/Layout/default.ctp +++ b/src/Template/Layout/default.ctp @@ -93,7 +93,7 @@ $cakeDescription = 'Labinvent 2.0'; - VERSION 2.2.2 (18/05/2016) + VERSION 2.2.3.0 (19/05/2016) diff --git a/src/Template/Materiels/find.ctp b/src/Template/Materiels/find.ctp index 900a1c4..ff5ae8f 100644 --- a/src/Template/Materiels/find.ctp +++ b/src/Template/Materiels/find.ctp @@ -199,28 +199,21 @@ if ($r) { style="text-decoration: underline;">Résultats
> - + request->session()->write("resultTri", $_results); + + ?> - - - - - - - - - - - - - - - - - - + + + + + + + -- libgit2 0.21.2
Paginator->sort('designation','Désignation') ?>Paginator->sort('numero_laboratoire', 'N° interne (labo)') ?>Paginator->sort('categorie_id', 'Catégorie') ?>Paginator->sort('nom_responsable', 'Responsable') ?>Paginator->sort('status', 'Statut') ?>Paginator->sort('date_acquisition', 'Date') ?>