<td class="tagtd maxwidthonsmartphone" style="overflow: hidden; white-space: nowrap;"> <!-- If you remove max-width, the jmobile overflow does not work --> <select name="hidedetails"><option>aaaaaaaaaaaaaaafd sf sf gfd gfds fsd gfd fhfg hf dhfg hg fhfgdhfgdh gh gfdhdgf h gfdh dfhg dfgh dfgh fdgh gfd hfd hfd gs fgdf gaaaa</option><option>gdfs gdf g sdfg dfg fdsg dsfg dfs gdfs gds fgs gdfdf gd</option></select> </td> </tr> </table> <br><hr><br>Example 1 : Standard table/thead/tbody/tr/th-td (no class pair/impair on td) => Use this if you need the drag and drop for lines or for long result tables<br> <?php include_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; $productspecimen = new Product($db); $productspecimen->initAsSpecimen(); $sortfield = 'aaa'; $sortorder = 'ASC'; $tasksarray = array(1, 2, 3); // To force having several lines $tagidfortablednd = 'tablelines3'; if (!empty($conf->use_javascript_ajax)) { include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; } $nav = ''; $nav .= '<form name="dateselect" action="' . $_SERVER["PHP_SELF"] . '?action=show_peruser' . $param . '">'; if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) { $nav .= '<input type="hidden" name="actioncode" value="' . $actioncode . '">'; } if ($status || isset($_GET['status']) || isset($_POST['status'])) { $nav .= '<input type="hidden" name="status" value="' . $status . '">';
/** * testMouvementCreate * * @return int */ public function testMouvementCreate() { global $conf, $user, $langs, $db; $conf = $this->savconf; $user = $this->savuser; $langs = $this->savlangs; $db = $this->savdb; // We create a product for tests $product1 = new Product($db); $product1->initAsSpecimen(); $product1->ref .= ' 1'; $product1->label .= ' 1'; $product1id = $product1->create($user); $product2 = new Product($db); $product2->initAsSpecimen(); $product2->ref .= ' 2'; $product2->label .= ' 2'; $product2id = $product2->create($user); // We create a product for tests $warehouse1 = new Entrepot($db); $warehouse1->initAsSpecimen(); $warehouse1->libelle .= ' 1'; $warehouse1->description .= ' 1'; $warehouse1id = $warehouse1->create($user); $warehouse2 = new Entrepot($db); $warehouse2->initAsSpecimen(); $warehouse2->libelle .= ' 2'; $warehouse2->description .= ' 2'; $warehouse2id = $warehouse2->create($user); $localobject = new MouvementStock($this->savdb); // Do a list of movement into warehouse 1 // Create an input movement (type = 3) of price 9.9 -> shoul dupdate PMP to 9.9 $result = $localobject->_create($user, $product1id, $warehouse1id, 10, 3, 9.9, 'Movement for unit test 1', 'Inventory Code Test'); print __METHOD__ . " result=" . $result . "\n"; $this->assertLessThan($result, 0); // Create an input movement (type = 3) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8 $result = $localobject->_create($user, $product1id, $warehouse1id, 10, 3, 9.699999999999999, 'Movement for unit test 2', 'Inventory Code Test'); print __METHOD__ . " result=" . $result . "\n"; $this->assertLessThan($result, 0); // Create an output movement (type = 2) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8 $result = $localobject->_create($user, $product1id, $warehouse1id, -5, 2, 999, 'Movement for unit test 3', 'Inventory Code Test'); print __METHOD__ . " result=" . $result . "\n"; $this->assertLessThan($result, 0); // Create an output movement (type = 1) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8 $result = $localobject->_create($user, $product1id, $warehouse1id, 1, 0, 0, 'Input from transfer', 'Transfert X'); print __METHOD__ . " result=" . $result . "\n"; $this->assertLessThan($result, 0); // Create an output movement (type = 1) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8 $result = $localobject->_create($user, $product1id, $warehouse1id, -2, 1, 0, 'Output from transfer', 'Transfert Y'); print __METHOD__ . " result=" . $result . "\n"; $this->assertLessThan($result, 0); // Do same but into warehouse 2 // Create an input movement (type = 3) of price 9.9 -> shoul dupdate PMP to 9.9 $result = $localobject->_create($user, $product1id, $warehouse2id, 10, 3, 9.9, 'Movement for unit test 1 wh 2', 'Inventory Code Test 2'); print __METHOD__ . " result=" . $result . "\n"; $this->assertLessThan($result, 0); // Create an input movement (type = 3) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8 $result = $localobject->_create($user, $product1id, $warehouse2id, 10, 3, 9.699999999999999, 'Movement for unit test 2 wh 2', 'Inventory Code Test 2'); print __METHOD__ . " result=" . $result . "\n"; $this->assertLessThan($result, 0); // Create an output movement (type = 2) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8 $result = $localobject->_create($user, $product1id, $warehouse2id, -5, 2, 999, 'Movement for unit test 3 wh 2', 'Inventory Code Test 2'); print __METHOD__ . " result=" . $result . "\n"; $this->assertLessThan($result, 0); // Create an output movement (type = 1) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8 $result = $localobject->_create($user, $product1id, $warehouse2id, 1, 0, 0, 'Input from transfer wh 2', 'Transfert X 2'); print __METHOD__ . " result=" . $result . "\n"; $this->assertLessThan($result, 0); // Create an output movement (type = 1) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8 $result = $localobject->_create($user, $product1id, $warehouse2id, -2, 1, 0, 'Output from transfer wh 2', 'Transfert Y 2'); print __METHOD__ . " result=" . $result . "\n"; $this->assertLessThan($result, 0); return $localobject; }
/** * testCategorieProduct * * @param int $id Id of category * @return int * * @depends testCategorieCreate * The depends says test is run only if previous is ok */ public function testCategorieProduct($id) { global $conf, $user, $langs, $db; $conf = $this->savconf; $user = $this->savuser; $langs = $this->savlangs; $db = $this->savdb; $localobjecttmp = new Categorie($this->savdb); $localobjecttmp->initAsSpecimen(); $localobjecttmp->label = 'Specimen Category for product'; $localobjecttmp->type = 0; // product category $catid = $localobjecttmp->create($user); print __METHOD__ . " catid=" . $catid . "\n"; $this->assertGreaterThan(0, $catid); // Try to create product linked to category $localobject2 = new Product($this->savdb); $localobject2->initAsSpecimen(); $localobject2->ref .= '-CATEG'; $localobject2->tva_npr = 1; $result = $localobject2->create($user); $cat = new Categorie($this->savdb); $cat->id = $catid; $result = $cat->add_type($localobject2, "product"); print __METHOD__ . " result=" . $result . "\n"; $this->assertGreaterThan(0, $result); // Get list of categories for product $localcateg = new Categorie($this->savdb); $listofcateg = $localcateg->containing($localobject2->id, 'product', 'label'); $this->assertTrue(in_array('Specimen Category for product', $listofcateg), 'Categ not found linked to product when it should'); return $id; }
/** * testProductCreate * * @return void */ public function testProductCreate() { global $conf, $user, $langs, $db; $conf = $this->savconf; $user = $this->savuser; $langs = $this->savlangs; $db = $this->savdb; $localobject = new Product($this->savdb); $localobject->initAsSpecimen(); $result = $localobject->create($user); print __METHOD__ . " result=" . $result . "\n"; $this->assertLessThanOrEqual($result, 0); return $result; }
/** * testCategorieProduct * * @param int $id Id of category * @return int * * @depends testCategorieCreate * The depends says test is run only if previous is ok */ public function testCategorieProduct($id) { global $conf,$user,$langs,$db; $conf=$this->savconf; $user=$this->savuser; $langs=$this->savlangs; $db=$this->savdb; $localobjecttmp=new Categorie($this->savdb); $localobjecttmp->initAsSpecimen(); $localobjecttmp->label='Specimen Category for product'; $localobjecttmp->type=0; // product category $catid=$localobjecttmp->create($user); print __METHOD__." catid=".$catid."\n"; $this->assertGreaterThan(0, $catid); // Category $localobject2=new Product($this->savdb); $localobject2->initAsSpecimen(); $localobject2->ref.='-CATEG'; $localobject2->tva_npr=1; $localobject2->catid=$catid; $result=$localobject2->create($user); print __METHOD__." result=".$result."\n"; $this->assertGreaterThan(0, $result); return $id; }