Commit 055e4e2ef597890a378883251334f0b646286412

Authored by Alexandre
1 parent 02f039f3

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

ROADMAP: https://projects.irap.omp.eu/projects/labinvent/roadmap
README-LABINVENT.md
... ... @@ -50,9 +50,9 @@ Logiciel testé et validé sur les configurations suivantes :
50 50  
51 51 VERSION ACTUELLE
52 52  
53   -Date: 18/05/2016
54   -Version: 2.2.2.1
55   -Demande (terminée): Bugfixes nombre catégorie/sous-catégorie associé
  53 +Date: 19/05/2016
  54 +Version: 2.2.3.0
  55 +Demande (terminée): https://projects.irap.omp.eu/issues/3642
56 56  
57 57 Version majeure en cours (2.2): https://projects.irap.omp.eu/versions/106
58 58  
... ...
src/Controller/MaterielsController.php
... ... @@ -204,6 +204,8 @@ class MaterielsController extends AppController
204 204  
205 205 $this->set(compact('s_sur_categories', 's_categories', 's_sous_categories', 's_groupes_thematiques', 's_groupes_metiers', 's_organismes'));
206 206  
  207 + $resultTri = $this->request->session()->read("resultTri");
  208 +
207 209 // some data POSTED (au moins le champ de recherche generale) ?
208 210 if ( isset($this->request->data['s_all']) || isset($this->request->data['s_all_2']) || isset($this->request->data['s_designation'])) {
209 211 $generalFieldConditions = NULL;
... ... @@ -316,12 +318,6 @@ class MaterielsController extends AppController
316 318  
317 319 // CONSTRUCTION DE LA REQUETE SQL COMPLETE = $specificFieldsConditions OR $generalFieldConditions (mais entre chaque champ, c'est un AND)
318 320 // by default, no sort
319   - $order = [];
320   -
321   - if (isset($this->passedArgs[0]) && isset($this->passedArgs[1])) {
322   - $order = $this->passedArgs[0];
323   - $order .= ' '.$this->passedArgs[1];
324   - }
325 321  
326 322 if (isset($this->request->data['s_all_2']) && $this->request->data['s_all_2'] != '') {
327 323 $conditions = $generalFieldConditions;
... ... @@ -333,19 +329,34 @@ class MaterielsController extends AppController
333 329 $conditions = $specificFieldsConditions;
334 330 }
335 331  
336   - $lastResults = $this->Materiels->find('all', ['limit' => 1000, 'order' => $order, 'conditions' => $conditions])->toArray();
337   -
338   - $this->set('_results', $lastResults);
339   - $this->request->session()->write("result", $lastResults);
  332 + $lastResults = $this->Materiels->find('all', ['limit' => 1000, 'conditions' => $conditions]);
340 333  
341   - $getSortLinkForColumnTitle = function ($label, $fieldName) {
342   - return "<th>
343   - <input type='submit' class='sortable-submit-title' value='$label' onclick='url=document.URL; url=url.slice(0, url.lastIndexOf(\"/find\")+5); $(\"form\").attr(\"action\", url+\"/$fieldName/ASC\");'/>
344   - </th>";
345   - };
346   - $this->set('getSortLinkForColumnTitle', $getSortLinkForColumnTitle);
  334 + $_results = $this->paginate($lastResults);
347 335  
  336 + $this->set(compact('_results'));
  337 + $this->set('_serialize', ['_results']);
  338 +
  339 + //pour l'export
  340 + $this->request->session()->write("result", $lastResults->toArray());
  341 +
348 342 } // end if()
  343 + else if (isset($resultTri) && strstr($this->request->here(), 'sort') != false && strstr($this->request->here(), 'direction') != false) {
  344 + $findedMateriel = [];
  345 +
  346 + foreach($resultTri as $r) {
  347 + array_push($findedMateriel, $r->id);
  348 + }
  349 + $res = $this->Materiels->find('all', ['limit' => 1000]);
  350 + for($i = 0; $i < sizeof($findedMateriel); $i++) {
  351 + $res->orWhere(['id =' => $findedMateriel[$i]]);
  352 + }
  353 +
  354 + $_results = $this->paginate($res);
  355 + $this->set(compact('_results'));
  356 +
  357 + //pour l'export
  358 + $this->request->session()->write("result", $res->toArray());
  359 + }
349 360 }
350 361  
351 362 /**
... ... @@ -446,7 +457,7 @@ class MaterielsController extends AppController
446 457  
447 458 $materiels = $this->Materiels->find('all')->where(['Materiels.id' => $selectedMateriels[0]]);
448 459  
449   - for ($j = 1; $j < sizeof($selectedMateriels); $j++) {
  460 + for ($j = 0; $j < sizeof($selectedMateriels); $j++) {
450 461 $materiels->orWhere(['Materiels.id' => $selectedMateriels[$j]]);
451 462 }
452 463  
... ... @@ -652,6 +663,53 @@ class MaterielsController extends AppController
652 663 $this->response->header(['Content-type: application/xml', 'Content-Disposition: attachment; filename="'.$filename.'"']);
653 664 $this->response->sendHeaders();
654 665  
  666 +
  667 + /*
  668 + * SIMPLE LABEL FOR PRINTER DYMO LabelWriter 450 : NO LOGO
  669 + */
  670 + /*
  671 + '<?xml version="1.0" encoding="utf-8"?>
  672 + <DieCutLabel Version="8.0" Units="twips">
  673 + <PaperOrientation>Landscape</PaperOrientation>
  674 + <Id>MultiPurpose11355</Id>
  675 + <PaperName>11355 Multi-Purpose</PaperName>
  676 + <DrawCommands>
  677 + <RoundRectangle X="0" Y="0" Width="1080" Height="2880" Rx="180" Ry="180"/>
  678 + </DrawCommands>
  679 + <ObjectInfo>
  680 + <TextObject>
  681 + <Name>TEXTE</Name>
  682 + <ForeColor Alpha="255" Red="0" Green="0" Blue="0"/>
  683 + <BackColor Alpha="0" Red="255" Green="255" Blue="255"/>
  684 + <LinkedObjectName></LinkedObjectName>
  685 + <Rotation>Rotation0</Rotation>
  686 + <IsMirrored>False</IsMirrored>
  687 + <IsVariable>False</IsVariable>
  688 + <HorizontalAlignment>Left</HorizontalAlignment>
  689 + <VerticalAlignment>Middle</VerticalAlignment>
  690 + <TextFitMode>None</TextFitMode>
  691 + <UseFullFontHeight>True</UseFullFontHeight>
  692 + <Verticalized>False</Verticalized>
  693 + <StyledText>
  694 + <Element>
  695 + <String>'
  696 + ."$numeroLab"."\n"
  697 + ."$dateAcquisition"."\n"
  698 + ."$organisme"."\n"
  699 + .'</String>
  700 + <Attributes>
  701 + <Font Family="Lucida Grande" Size="10" Bold="False" Italic="False" Underline="False" Strikeout="False"/>
  702 + <ForeColor Alpha="255" Red="0" Green="0" Blue="0"/>
  703 + </Attributes>
  704 + </Element>
  705 + </StyledText>
  706 + </TextObject>
  707 + <Bounds X="326.4" Y="57.59995" Width="2467.2" Height="940.8"/>
  708 + </ObjectInfo>
  709 + </DieCutLabel>'
  710 + ."\n"
  711 + */
  712 +
655 713 /*
656 714 * ETIQUETTE (19x51 mm)
657 715 *
... ...
src/Template/Layout/default.ctp
... ... @@ -93,7 +93,7 @@ $cakeDescription = &#39;Labinvent 2.0&#39;;
93 93 </i></td>
94 94 <td id="version">
95 95 <!-- VERSION M.m.f.b (version (M)ajeure, version (m)ineure, numero de nouvelle (f)onctionnalite, numero de (b)ugfix) -->
96   - <font color="black">VERSION 2.2.2 (18/05/2016)</font>
  96 + <font color="black">VERSION 2.2.3.0 (19/05/2016)</font>
97 97 </td>
98 98 </tr>
99 99 </table>
... ...
src/Template/Materiels/find.ctp
... ... @@ -199,28 +199,21 @@ if ($r) {
199 199 style="text-decoration: underline;">Résultats <?php if ($r) echo '('.sizeof($_results).')'; ?></span>
200 200 </h3>
201 201 <div id="result" <?php if (!$r) echo 'style="display: none;"'; ?>>
202   - <?php if (isset($_results) && sizeof($_results) != 0) { ?>
  202 + <?php if (isset($_results) && sizeof($_results) != 0) {
  203 +
  204 + $this->request->session()->write("resultTri", $_results);
  205 +
  206 + ?>
203 207 <table cellpadding="0" cellspacing="0">
204 208 <thead>
205 209 <tr>
206   - <!--Désignation-->
207   - <?php echo $getSortLinkForColumnTitle('Désignation','designation');?>
208   -
209   - <!--Numéro IRAP-->
210   - <?php echo $getSortLinkForColumnTitle('Numéro interne (labo)','numero_laboratoire'); ?>
211   -
212   - <!--Catégorie-->
213   - <?php echo $getSortLinkForColumnTitle('Catégorie','Categorie.id');?>
214   -
215   - <!--Responsable-->
216   - <?php echo $getSortLinkForColumnTitle('Responsable','nom_responsable'); ?>
217   -
218   - <!--Statut-->
219   - <?php echo $getSortLinkForColumnTitle('Statut','status'); ?>
220   -
221   - <!--Date-->
222   - <?php echo $getSortLinkForColumnTitle('Date','date_acquisition'); ?>
223   -
  210 +
  211 + <th><?= $this->Paginator->sort('designation','Désignation') ?></th>
  212 + <th><?= $this->Paginator->sort('numero_laboratoire', 'N° interne (labo)') ?></th>
  213 + <th><?= $this->Paginator->sort('categorie_id', 'Catégorie') ?></th>
  214 + <th><?= $this->Paginator->sort('nom_responsable', 'Responsable') ?></th>
  215 + <th><?= $this->Paginator->sort('status', 'Statut') ?></th>
  216 + <th><?= $this->Paginator->sort('date_acquisition', 'Date') ?></th>
224 217 <th style="width: 20px;"></th>
225 218 <th style="width: 20px;"></th>
226 219 <th style="width: 20px;"></th>
... ...