setDBO(VoxelCareDB::getDatabase()); } function SetId($id) { $this->_id = (int)$id; $this->_item = null; $this->_attributes=null; } function getOrderIdFromUUID($uuid) { if (!$uuid) return ''; $sql = "SELECT id FROM #__vxc_order WHERE uuid = ". $this->_db->Quote($uuid); $this->_db->setQuery($sql); return $this->_db->loadResult(); } function store(&$data) { $table =& $this->getTable('order'); $table->reset(); $id = (int)$data['id']; $table->load($id); if (!$table->bind($data)) return false; if (!$table->check()) return false; if (!$table->store(true)) return false; $this->SetId($table->id); $data['id'] = $this->_id; return true; } function getAttributes() { if (empty($this->_attributes)) { $orderid = $this->_id; if (!$orderid) $orderid = 0; $db =& $this->_db; $extraNewFields =''; if (LegacyHelper::getNewMode()) $extraNewFields = ' at.update_uuid update_uuid,at.name name,at.value value,'; $sql = "SELECT at.id id,at.type type, $extraNewFields at.value_left value_left, at.value_right value_right, at.memo_left memo_left, at.memo_right memo_right, ty.name typename, dt.name datatypename, atvl.name mvalueleft, atvr.name mvalueright FROM #__vxc_attribute at LEFT JOIN #__vxc_attributetype ty ON ty.id = at.type LEFT JOIN #__vxc_datatype dt ON dt.id = ty.datatype LEFT JOIN #__vxc_attributetypevalue atvl ON atvl.id=at.value_left LEFT JOIN #__vxc_attributetypevalue atvr ON atvr.id=at.value_right WHERE at.orderid = $orderid ORDER BY at.id "; $db->setQuery($sql); $this->_attributes =& $db->loadObjectList(); } if ($this->_item) { $this->_item->attributes =& $this->_attributes; } return $this->_attributes; } function getData() { if (empty($this->_item)) { $db =& $this->_db; $newModeFields = ''; $newJoins = ''; $oldModeFields =''; if (LegacyHelper::getNewMode()) { $newModeFields = "o.uuid uuid, CONCAT_WS(' ',NULLIF(CONCAT_WS(' ',NULLIF(c.name,''),NULLIF(c.middlename,''),NULLIF(c.surname,'')),''),NULLIF(atfirst.value,''),NULLIF(atmiddle.value,''),NULLIF(atlast.value,'')) customerfullname,"; $newJoins = " LEFT JOIN jos_vxc_attribute atfirst ON atfirst.orderid = o.id AND atfirst.name = 'patient.firstName' LEFT JOIN jos_vxc_attribute atmiddle ON atmiddle.orderid = o.id AND atmiddle.name = 'patient.middleName' LEFT JOIN jos_vxc_attribute atlast ON atlast.orderid = o.id AND atlast.name = 'patient.lastName' "; } else { $oldModeFields = "CONCAT_WS(' ',NULLIF(c.name,''),NULLIF(c.middlename,''),NULLIF(c.surname,'')) customerfullname,"; } $sql = "SELECT o.id id,o.user user, o.customer customer, $newModeFields o.reference reference, o.creationdate creationdate, $oldModeFields o.currentStep currentStep, o.completedSteps completedSteps, o.delegatedesign delegatedesign, o.deleted deleted, o.state state, o.manufactured_date manufactured_date, o.checked_date checked_date, o.batch batch, o.price price, o.paid_amount paid_amount, o.manu_state, o.error_desc error_desc, o.patient_price patient_price, o.franchise_to_company_fee franchise_to_company_fee, o.voxelcare_to_franchise_fee voxelcare_to_franchise_fee, o.shipping_address shipping_address, o.last_save_user last_save_user, o.reviewers reviewers, os.nameid statenameid, os.name statename, b.taxpercent taxpercent, b.shipping_date shipping_date, b.payment_date payment_date, b.payment_user payment_user, b.tracking_number tracking_number, b.est_shipping_date est_shipping_date, b.shipping_address batch_shipping_address, pm.nameid payment_methodnameid , bs.nameid batchstatenameid, bs.name batchstatename, ms.nameid manu_statenameid, ms.name manu_statename, u.username userusername, u.name username, u.review_predesign userpredesignreview, uf.franchise franchise, f.name franchisename, r.id receiptid, r.paid receiptpaid, ua.company address_company, ua.address address_address, ua.city address_city, ua.province address_province, ua.pcode address_pcode, ua.country address_country, ua.phone address_phone, ua2.company batch_address_company, ua2.address batch_address_address, ua2.city batch_address_city, ua2.province batch_address_province, ua2.pcode batch_address_pcode, ua2.country batch_address_country, ua2.phone batch_address_phone FROM #__vxc_order o LEFT JOIN #__vxc_orderstate os ON os.id = o.state LEFT JOIN #__vxc_customer c ON c.id = o.customer LEFT JOIN #__vxc_receipt r ON r.orderid = o.id LEFT JOIN #__vxc_batch b ON b.id = o.batch LEFT JOIN #__vxc_paymentmethod pm ON pm.id = b.payment_method LEFT JOIN #__vxc_batchstate bs ON bs.id = b.state LEFT JOIN #__vxc_user u ON u.id = o.user LEFT JOIN #__vxc_userfranchise uf ON uf.userid = u.id LEFT JOIN #__vxc_franchise f ON f.id = uf.franchise LEFT JOIN #__vxc_manustate ms ON ms.id = o.manu_state LEFT JOIN #__vxc_useraddress ua ON ua.id = o.shipping_address LEFT JOIN #__vxc_useraddress ua2 ON ua2.id = b.shipping_address " .$newJoins . " WHERE o.id = ".$this->_id; $db->setQuery($sql); $row = $db->loadObject(); if (!$row) { $row = new stdClass(); $row->id = 0; $row->user = null; $row->creationdate = null; $row->reference = null; $row->currentStep = 0; $row->completedSteps = 0; $row->delegatedesign = 0; $row->deleted = null; $row->readOnly = false; $row->currentprice = 0; $row->paid_amount =null; $row->price = 0; $row->patient_price =0; $row->franchise_to_company_fee = 0; $row->voxelcare_to_franchise_fee = 0; $row->forcedWritable = false; } else { $modelUser = new vxcModelUser(); $row->forcedWritable = false; $franchise = SiteOptionsHelper::getFranchiseName(); if ($franchise == 'tecnoinsole') { switch($row->statenameid) { case 'CONFIRMED': case 'CHECKED': case 'MANUFACTURING': case 'MANUFACTURED': case 'SHIPPED': $row->forcedWritable = $modelUser->checkPrivilege('Can check orders'); break; } } $row->readOnly =(($row->statenameid!='INCOMPLETED') && ($row->statenameid!='COMPLETED') && ($row->statenameid!='PREDESIGNING') && ($row->statenameid!='PENDING_APPROVAL') && ($row->error_desc === null)) && !$row->forcedWritable; $row->currentprice = $this->getCurrentCompanyPrice(); switch($row->statenameid) { case 'INCOMPLETED': case 'COMPLETED': case 'PRECONFIRMED': case 'PREDESIGNING': case 'PENDING_APPROVAL': $row->price = round($row->currentprice,2); $vat = $modelUser->getVAT(); $row->paid_amount =round( (1.0 + $vat/100.0 )*$row->price ,2); break; } } $this->_item = $row; } return $this->_item; } function getPricesFromOrderSQL($id) { return "SELECT a.id atid ,p.attvalue atvid, p.company_price company_price, p.patient_price patient_price, p.franchise_to_company_fee franchise_to_company_fee, p.voxelcare_to_franchise_fee voxelcare_to_franchise_fee FROM #__vxc_attribute a LEFT JOIN #__vxc_order o ON o.id = a.orderid LEFT JOIN #__vxc_userfranchise uf ON uf.userid = o.user LEFT JOIN #__vxc_attributetype at ON a.type = at.id LEFT JOIN #__vxc_pricing p ON p.franchise = uf.franchise WHERE a.orderid = ". $id ." AND (p.user = o.user OR p.user IS NULL) AND (p.attvalue = a.value_left OR p.attvalue = a.value_right OR p.attvalue IS NULL) ORDER BY a.id , p.attvalue DESC, p.user DESC, p.company_price DESC"; } function getCurrentCompanyPrice() { $this->getCurrentPrices($companyPrice,$aux1,$aux2,$aux3); return $companyPrice; } function getPPRCurrentPrices(&$companyPrice, &$patientPrice, &$companyFee, &$franchiseFee) { $companyPrice = 0; $atts =& $this->getAttributes(); $ShoeSize = -1; $numberOfInsoles = 1; $varianteName = ''; foreach($atts as $att) switch($att->typename) { case 'PPR_ShoeSize': $ShoeSize = (int) $att->value_left; if ($att->value_right) { $ShoeSizeR = (int) $att->value_right; if ($ShoeSizeR > $ShoeSize) $ShoeSize = $ShoeSizeR; } break; case 'PPR_EinlagenVarianten': $varianteName = $att->mvalueleft; break; case 'PPR_NumberInsoles': $numberOfInsoles = (int) $att->value_left; break; } if (!$numberOfInsoles) $numberOfInsoles = 1; // 0-> prefab standard , 1-> prefab advanced, 2-> individuell, 3->positive $varianten = -1; switch($varianteName) { case 'Prefab Standard': $varianten = 0; break; case 'Prefab Advanced': $varianten = 1; break; case 'Foambox positive': case 'Individuell': $varianten = 2; break; case 'Positive cast': $varianten = 3; break; } // Si no es un positivo (plantilla de eva) if ($varianten!= 3) { if ($ShoeSize != -1 && $ShoeSize != 0) { foreach($atts as $att) { $price = 0; switch($att->typename) { case 'PPR_SurfaceMilling': switch($att->mvalueleft) { case 'Rough 2.0mm': $price = -2.0; break; case 'Fine 1.0mm': $price = 2.0; break; } break; case 'PPR_Produkt': switch($att->mvalueleft) { case 'Leisten': if ($ShoeSize <= 31) $price = 20.0; else if ($ShoeSize <= 39) $price = 21.0; else if ($ShoeSize <= 44) $price = 22.0; else $price = 23.0; break; case 'Einlage - Einseitig': break; case 'Einlage - Beidseitig': $price = 5.0; break; } break; case 'PPR_MatMono': switch($varianten) { case 0: switch($att->mvalueleft) { case 'PUP-Mono dunkelblau': case 'PUP-Mono weiß': $price = 44.0; break; default: if ($ShoeSize <= 31) $price = 19.0; else if ($ShoeSize <= 39) $price = 21.0; else if ($ShoeSize <= 44) $price = 22.0; else $price = 23.0; } break; case 1: switch($att->mvalueleft) { case 'PUP-Mono dunkelblau': case 'PUP-Mono weiß': $price = 44.0; break; default: if ($ShoeSize <= 39) $price = 30.0; else $price = 32.0; } break; case 2: switch($att->mvalueleft) { case 'PUP-Mono dunkelblau': case 'PUP-Mono weiß': $price = 44.0; break; default: if ($ShoeSize <= 31) $price =27.0; else if ($ShoeSize <= 39) $price = 29.0; else if ($ShoeSize <= 44) $price = 31.0; else $price = 32.0; } break; } break; case 'PPR_MatCombi': switch($varianten) { case 0: switch($att->mvalueleft) { case 'PUP-Combi dunkelblau/weiß': case 'PUP-Combi hellblau/weiß': $price = 44.0; break; default: if ($ShoeSize <= 31) $price = 22.0; else if ($ShoeSize <= 39) $price = 24.0; else if ($ShoeSize <= 44) $price = 25.0; else $price = 26.0; } break; case 1: switch($att->mvalueleft) { case 'PUP-Combi dunkelblau/weiß': case 'PUP-Combi hellblau/weiß': $price = 44.0; break; default: if ($ShoeSize <= 39) $price = 32.0; else $price = 34.0; } break; case 2: switch($att->mvalueleft) { case 'PUP-Combi dunkelblau/weiß': case 'PUP-Combi hellblau/weiß': $price = 44.0; break; default: if ($ShoeSize <= 31) $price = 30.0; else if ($ShoeSize <= 39) $price = 32.0; else if ($ShoeSize <= 44) $price = 34.0; else $price = 35.0; } break; } break; case 'PPR_MatTri': switch($varianten) { case 0: switch($att->mvalueleft) { case 'PUP-Tri hellblau/dunkelblau/weiß': $price = 44.0; break; case 'Quattro weiß/schwarz/blau/schwarz': if ($ShoeSize <= 31) $price = 22.0; else if ($ShoeSize <= 39) $price = 24.0; else if ($ShoeSize <= 44) $price = 25.0; else $price = 26.0; break; case '40/25 Sh;Grau/Orange;EVA/EVA': case '50/20 Sh;Blau/Hellblau;EVA/EVA': case '50/30 Sh;Blau/Rot;EVA/EVA': case 'Duo 40/30 grau/rot': case 'Duo 40/35 blau/grün': case 'Duo 30/35 blau/grün': case 'Duo 40/35 weiß/grün': if ($ShoeSize <= 31) $price = 20.0; else if ($ShoeSize <= 39) $price = 22.0; else if ($ShoeSize <= 44) $price = 23.0; else $price = 24.0; break; default: if ($ShoeSize <= 31) $price = 21.0; else if ($ShoeSize <= 39) $price = 23.0; else if ($ShoeSize <= 44) $price = 24.0; else $price = 25.0; } break; case 1: if ($ShoeSize <= 39) $price = 33.0; else $price = 35.0; break; case 2: switch($att->mvalueleft) { case 'PUP-Tri hellblau/dunkelblau/weiß': $price = 44.0; break; case 'Quattro weiß/schwarz/blau/schwarz': if ($ShoeSize <= 31) $price = 30.0; else if ($ShoeSize <= 39) $price = 32.0; else if ($ShoeSize <= 44) $price = 34.0; else $price = 35.0; break; case '40/25 Sh;Grau/Orange;EVA/EVA': case '50/20 Sh;Blau/Hellblau;EVA/EVA': case '50/30 Sh;Blau/Rot;EVA/EVA': case 'Duo 40/30 grau/rot': case 'Duo 40/35 blau/grün': case 'Duo 30/35 blau/grün': case 'Duo 40/35 weiß/grün': if ($ShoeSize <= 31) $price = 28.0; else if ($ShoeSize <= 39) $price = 30.0; else if ($ShoeSize <= 44) $price = 32.0; else $price = 33.0; break; default: if ($ShoeSize <= 31) $price = 29.0; else if ($ShoeSize <= 39) $price = 31.0; else if ($ShoeSize <= 44) $price = 33.0; else $price = 34.0; } break; } break; case 'PPR_ProductionBlock': switch ($att->mvalueleft) { case 'INSOLEFINISHED': $price = 3.0; break; } break; } $companyPrice += $price; } } } else // Precio del positivo { if ($ShoeSize <= 31) $price = 20.0; else if ($ShoeSize <= 39) $price = 21.0; else if ($ShoeSize <= 44) $price = 22.0; else if ($ShoeSize > 44) $price = 23.0; $companyPrice = $price; } $companyPrice *= $numberOfInsoles; $patientPrice = $companyPrice; $companyFee=0; $franchiseFee=0; } function getRotterdamCurrentPrices(&$companyPrice, &$patientPrice, &$companyFee, &$franchiseFee) { //$atts =& $this->getAttributes(); $patientPrice = $companyPrice = 45.0; $companyFee=0; $franchiseFee=0; } function getIndiaCurrentPrices(&$companyPrice, &$patientPrice, &$companyFee, &$franchiseFee) { $companyPrice = 0; $atts =& $this->getAttributes(); $patientPrice = $companyPrice = 0.0; $companyFee=0; $franchiseFee=0; } function getMaterials($cid) { $sql = "SELECT at.orderid orderid, atvl.name matleft, atvr.name matright FROM #__vxc_attribute at LEFT JOIN #__vxc_attributetype ty ON ty.id = at.type LEFT JOIN #__vxc_attributetypevalue atvl ON atvl.id=at.value_left LEFT JOIN #__vxc_attributetypevalue atvr ON atvr.id=at.value_right WHERE ty.name = 'InsoleOptions' AND at.orderid IN ( " . implode(',',$cid) . ") "; $this->_db->setQuery($sql); $mats = array(); $res = $this->_db->loadAssocList(); if(count($res)>0) foreach( $res as $atv) { $orderId = $atv['orderid']; for ($i=0;$i<2;$i++) { $varName = ($i==0)?'matleft': 'matright'; $mat = ''; switch($atv[$varName]) { case 'POSITIVO': $mat = 'PU'; break; case 'TERMOCARBONO15': $mat = 'FIBRA'; break; case '3DCONFORTBI3055': case 'EVABI3055': $mat = 'EVABI'; break; case '3DCONFORTBI4055SPORT': $mat = 'EVABI4055SPORT'; break; case 'EVAMONO30': case '3DCONFORTMONO30': $mat = 'EVAMONO30'; break; case 'EVAMONO40': case '3DCONFORTMONO40': $mat = 'EVAMONO40'; break; case 'EVAMONO55': $mat = 'EVAMONO55'; break; case 'TERMOPOLIET3': $mat = 'POLIET3'; break; case 'TERMOPOLIET4': $mat = 'POLIET4'; break; case 'TERMOPOLIPRO2': $mat = 'PP2'; break; case 'TERMOPOLIPRO3': $mat = 'PP3'; break; case 'TERMOPOLIPRO4': $mat = 'PP4'; break; case 'TERMOPOLIPRO5': $mat = 'PP5'; break; case 'MECAABS': $mat = 'MECAABS'; break; case 'MECAPOLIEHD': $mat = 'MECAPOLIEHD'; break; case 'MECAPOLIPRO': $mat = 'MECAPOLIPRO'; break; case 'MECAPOLIPRO3SIDED': $mat = 'MECAPOLIPRO3SIDED'; break; case 'TERMORESINAFLEX': $mat = 'RESINAFLEX'; break; case 'TERMORESINAFLUX': $mat = 'RESINAFLUX'; break; case 'TERMORESINAFLUXFLEX': $mat = 'RESINAFLUXFLEX'; break; case 'TERMORESINAHERFLEX': $mat = 'RESINAHERFLEX'; break; } if ($mat) { if (!$mats[$orderId]) $mats[$orderId] = array(); $mats[$orderId][] = $mat; } } } return $mats; } function getTecnoInsoleCurrentPrices(&$companyPrice, &$patientPrice, &$companyFee, &$franchiseFee) { $onlyOneFoot = false; $modelSettings = new vxcModelSettings(); $specialPrices = trim($modelSettings->getVar('specialPrices','')); $palmillaPrice= $modelSettings->getVar('palmillaPrice',25.0); $positivePrice= $modelSettings->getVar('positivePrice',23.364); $fiberPrice = $modelSettings->getVar('fiberPrice',51.402); $evaPrice = $modelSettings->getVar('evaPrice',37.383); $comfortPrice = $modelSettings->getVar('comfortPrice',34.0); $comfortSportPrice = $modelSettings->getVar('comfortSportPrice',33.95); $unfinishedEvaPrice =$modelSettings->getVar('unfinishedEvaPrice',21.0); $unfinishedComfortPrice = $modelSettings->getVar('unfinishedComfortPrice',20.0); $unfinishedMecanizadoPrice = $modelSettings->getVar('unfinishedMecanizadoPrice',25.0); $resinPrice = $modelSettings->getVar('resinPrice',40.0); $ppPrice = $modelSettings->getVar('ppPrice',40.0); $mecanizadoPrice = $modelSettings->getVar('mecanizadoPrice',40.0); $extraMaterialPrice = $modelSettings->getVar('extraMaterialPrice',1.0); $evaGripPrice = $modelSettings->getVar('evaGripPrice',0.9); $forroSanitPrice = $modelSettings->getVar('forroSanitPrice',2.2); $forroMicrofibraPrice = $modelSettings->getVar('forroMicrofibraPrice',2.0); $forroMicrofibraPerforadaPrice = $modelSettings->getVar('forroMicrofibraPerforadaPrice',3.0); $forroPiel = $modelSettings->getVar('forroPiel',3.0); $shellPPColorBlackPrice = $modelSettings->getVar('shellPPColorBlackPrice',1.8); $shellPPColorOtherPrice = $modelSettings->getVar('shellPPColorOtherPrice',5.0); $mecanizado3CarasPrice = $modelSettings->getVar('mecanizado3carasPrice',40.0); $invalidPrice = $modelSettings->getVar('invalidPrice',9999); if ($this->_id) { $sql = "SELECT u.username FROM #__vxc_order o LEFT JOIN #__vxc_user u ON u.id = o.user WHERE o.id = ".$this->_id; $this->_db->setQuery($sql); $userName = $this->_db->loadResult(); $specialPricesArray = explode(',',$specialPrices); for ($i=0;$igetAttributes(); $unfinished = false; $hasExtraMaterial = false; $shellColor = ''; foreach($atts as $att) { switch($att->typename) { case 'InsoleOptions': for ($foot = 0;$foot<2;$foot++) { $value = $foot==0?$att->mvalueleft:$att->mvalueright; switch($value) { case 'FORRADOEVA2': case 'FORRADOEVA3': case 'FORRADOSHOCKICEL': case 'FORRADOPORONMEMORY': case 'FORRADOPLASTAZOTE': $hasExtraMaterial = true; break; } } break; case 'TI_PS_FORRADOEvaGrip25_3mm': case 'TI_PS_FORRADOTEC35RF25GRIS': case 'TI_PS_FORRADOTEC2SANVERDE': case 'TI_PS_FORRADOTEC3SANVERDE': case 'TI_PS_FORRADOTEC3AZULCOB': case 'TI_PS_FORRADOTEC3VARIOS': case 'TI_PS_FORRADOEST2VARIOS': case 'TI_PS_FORRADOEST3VARIOS': case 'TI_PS_FORRADOMICFCAMEL': case 'TI_PS_FORRADOMICFTABACO': case 'TI_PS_FORRADOMICFCRUDO': case 'TI_PS_FORRADOMICFPERFBEIGE': case 'TI_PS_FORRADOMICFVARIOS': case 'TI_PS_FORRADOPIEL': if ($att->value_left=='1'|| $att->value_right=='1') $hasExtraMaterial=true; break; case 'TI_PS_AntepieDescargas': if ($att->value_left=='2'|| $att->value_right=='2') $hasExtraMaterial=true; break; case 'TI_PS_RetropieTaloPoron': case 'TI_PS_AntepieAlmendraMetaExt': case 'TI_PS_AntepieBarraMetaExt': if ($att->value_left=='1'|| $att->value_right=='1') $hasExtraMaterial=true; break; case 'TI_PS_Unfinished': if ($att->value_left=='1') $unfinished = true; break; case 'TI_PS_PolyMaterialColor': $shellColor = $att->mvalueleft; break; } } $companyPrice = 0; $hasEvaGrip = false; $hasForroSanit = false; $hasForroMicrofibra = false; $hasForroMicrofibraPerforada = false; $hasForroPiel = false; foreach($atts as $att) { switch($att->typename) { case 'TI_PS_Palmilla': if ($att->value_left=='1') { $companyPrice = $patientPrice = $palmillaPrice; return; } break; case 'TI_PS_InsoleFoot': if ($att->value_left =='1' || $att->value_left=='2') $onlyOneFoot = true; break; case 'TI_PS_FORRADOTEC3AZULCOB': case 'TI_PS_FORRADOTEC3VARIOS': case 'TI_PS_FORRADOTEC35RF25GRIS': case 'TI_PS_FORRADOEvaGrip25_3mm': if ($att->value_left =='1' || $att->value_right =='1') $hasEvaGrip = true; break; case 'TI_PS_FORRADOTEC2SANVERDE': case 'TI_PS_FORRADOTEC3SANVERDE': if ($att->value_left =='1' || $att->value_right =='1') $hasForroSanit = true; break; case 'TI_PS_FORRADOMICFCAMEL': case 'TI_PS_FORRADOMICFTABACO': case 'TI_PS_FORRADOMICFCRUDO': case 'TI_PS_FORRADOMICFVARIOS': if ($att->value_left =='1' || $att->value_right =='1') $hasForroMicrofibra = true; break; case 'TI_PS_FORRADOMICFPERFBEIGE': if ($att->value_left =='1' || $att->value_right =='1') $hasForroMicrofibraPerforada = true; break; case 'TI_PS_FORRADOPIEL': if ($att->value_left =='1' || $att->value_right =='1') $hasForroPiel = true; break; case 'InsoleOptions': for ($foot = 0;$foot<2;$foot++) { $price = 0; $value = $foot==0?$att->mvalueleft:$att->mvalueright; switch($value) { case 'POSITIVO': $price = $positivePrice; break; case 'TERMOCARBONO15': $price = $fiberPrice; break; case 'EVABI3055': case 'EVAMONO30': case 'EVAMONO40': case 'EVAMONO55': if ($unfinished) { $price = $unfinishedEvaPrice; if ($hasExtraMaterial) $price += $extraMaterialPrice; } else $price = $evaPrice; break; case '3DCONFORTMONO30': case '3DCONFORTMONO40': case '3DCONFORTBI3055': $price = $unfinished?$unfinishedComfortPrice: $comfortPrice; break; case '3DCONFORTBI4055SPORT': $price = $comfortSportPrice; break; case 'TERMOPOLIET3': case 'TERMOPOLIET4': case 'TERMOPOLIPRO2': case 'TERMOPOLIPRO3': case 'TERMOPOLIPRO4': case 'TERMOPOLIPRO5': $price = $ppPrice; break; case 'MECAABS': case 'MECAPOLIEHD': case 'MECAPOLIPRO': if ($unfinished) { $price = $unfinishedMecanizadoPrice; if ($hasExtraMaterial) $price += $extraMaterialPrice; } else $price = $mecanizadoPrice; switch($shellColor) { case 'POLYCOLORBLACK': $price += $shellPPColorBlackPrice; break; case 'POLYCOLOROTHER': $price += $shellPPColorOtherPrice; break; } break; case 'MECAPOLIPRO3SIDED': $price = $mecanizado3CarasPrice; break; case 'TERMORESINAFLEX': case 'TERMORESINAFLUX': case 'TERMORESINAFLUXFLEX': case 'TERMORESINAHERFLEX': $price = $resinPrice; break; } if ($price) $companyPrice += $price*0.5; } break; } } if ($hasEvaGrip) $companyPrice += $evaGripPrice; if ($hasForroSanit) $companyPrice += $forroSanitPrice; if ($hasForroMicrofibra) $companyPrice += $forroMicrofibraPrice; if ($hasForroMicrofibraPerforada) $companyPrice += $forroMicrofibraPerforadaPrice; if ($hasForroPiel) $companyPrice += $forroPiel; if (!$companyPrice) $companyPrice = $invalidPrice; $patientPrice = $companyPrice; $companyFee=0; $franchiseFee=0; } function getNewCurrentPrices(&$companyPrice, &$patientPrice, &$companyFee, &$franchiseFee) { if (!$this->_id) return; $json = new Services_JSON(); $companyPrice = $patientPrice = 0; $companyFee = $franchiseFee = 0; $modelSettings = new vxcModelJSONSettings(); $sql = "SELECT u.id id , u.username username FROM #__vxc_order o LEFT JOIN #__vxc_user u ON u.id = o.user WHERE o.id = ".$this->_id; $this->_db->setQuery($sql); $row = $this->_db->loadAssoc(); if (!$row) return; $userId = $row["id"]; $userName = $row["username"]; $modelUser = new vxcModelUser(); $modelUser->SetId($userId); $userSettings = $modelUser->getSettings(); $prices = $modelSettings->getVar("prices"); $logText = "Getting prices for order ".$this->_id." user $userId ($userName). General structure: ".$json->encode($prices); if ($userSettings && $userSettings->{"prices"}) { $logText .= "\nUser prices: ".$json->encode($userSettings->{"prices"}); $modelSettings->mergeSettings($prices,$userSettings->{"prices"}); $logText .= "\nMerged prices: ".$json->encode($prices); } LogHelper::log($logText); if ($prices) { $invalidPrice = 9999; $specialPrices = $prices->special; if ($prices->invalid) $invalidPrice = $prices->invalid->value; if ($specialPrices && $specialPrices->{$userName}) { $companyPrice = $patientPrice = (float) $specialPrices->{$userName}; return; } $orderAttributes = $this->getAttributes(); $pricesParamsStr = ''; $insoleAmount = 1; foreach($orderAttributes as $attribute) { switch($attribute->name) { case "insoleOptions.insoleAmount": if ($attribute->value) $insoleAmount = (int) $attribute->value; break; case "prices.params": $pricesParamsStr = $attribute->value; break; } } if ($pricesParamsStr) { $orderPrices = $json->decode($pricesParamsStr); if ($orderPrices && $prices) { $poolOrderPrices = array(); $this->GeneratePoolFromParams($orderPrices,$poolOrderPrices); $priceStruct = array(); foreach($poolOrderPrices as $key => $value) { $valueParts = explode(".",$value); $refPart =& $prices; for ($j=0;$j{$valueParts[$j]}; $curVar =& $refPart; if (!$curVar) continue; $varLevel = 0; if (isset($curVar->level)) $varLevel =$curVar->level; $varValue = $curVar->value; $varType = "add"; if ($curVar->type) $varType =$curVar->type; if (!$priceStruct[$varLevel]) $priceStruct[$varLevel] = array('add'=>array(),'mult'=>array(),'set'=>array()); switch($varType) { case 'set': $priceStruct[$varLevel]["set"][] = $varValue; break; case 'mult': $priceStruct[$varLevel]["mult"][] = $varValue; break; default: $priceStruct[$varLevel]["add"][] = $varValue; } } $price = 0; for ($l=0;$l_id) return false; $sql = "SELECT `uuid` FROM jos_vxc_order WHERE id=".$this->_id; $this->_db->setQuery($sql); $orderUUID = $this->_db->loadResult(); if ($orderUUID) return true; else return false; } function getCurrentPrices(&$companyPrice, &$patientPrice, &$companyFee, &$franchiseFee) { $franchise = SiteOptionsHelper::getFranchiseName(); if (LegacyHelper::getNewMode() && $this->isMVC()) return $this->getNewCurrentPrices($companyPrice,$patientPrice,$companyFee,$franchiseFee); switch($franchise) { case 'ppr': $this->getPPRCurrentPrices($companyPrice,$patientPrice, $companyFee,$franchiseFee); break; case 'rotterdam': $this->getRotterdamCurrentPrices($companyPrice,$patientPrice,$companyFee,$franchiseFee); break; case 'tecnoinsole': $this->getTecnoInsoleCurrentPrices($companyPrice,$patientPrice,$companyFee,$franchiseFee); break; case 'india': $this->getIndiaCurrentPrices($companyPrice,$patientPrice,$companyFee,$franchiseFee); break; case 'lafoot': $sql = "SELECT u.username FROM #__vxc_order o LEFT JOIN #__vxc_user u ON u.id = o.user WHERE o.id = ".$this->_id; $this->_db->setQuery($sql); $userName = $this->_db->loadResult(); switch($userName) { case 'PSA': case 'Melanie Oonk': $atts =& $this->getAttributes(); if (count($atts)>0) foreach($atts as $att) if ($att->typename=='Lafoot_BasisModel') { switch($att->mvalueleft) { case 'Running CAD': case 'Sports general': case 'Sport walking': case 'Sport soft': $companyFee=0; $franchiseFee=0; $companyPrice = $patientPrice = 115.0; return; } } break; } default: $sql = $this->getPricesFromOrderSQL($this->_id); $this->_db->setQuery($sql); $prices =& $this->_db->loadObjectList(); $companyPrice=0; $patientPrice=0; $companyFee=0; $franchiseFee=0; $atId = -1; foreach($prices as $price) { if ($price->atid != $atId) { $atId = $price->atid; $cpfound = false; $ppfound = false; $cffound = false; $fffound = false; } if (!$cpfound && $price->company_price !== null) { $companyPrice += $price->company_price; $cpfound = true; } if (!$ppfound && $price->patient_price !== null) { $patientPrice += $price->patient_price; $ppfound = true; } if (!$cffound && $price->franchise_to_company_fee !== null) { $companyFee += $price->franchise_to_company_fee; $cffound = true; } if (!$fffound && $price->voxelcare_to_franchise_fee !== null) { $franchiseFee += $price->voxelcare_to_franchise_fee; $fffound = true; } } } } function getTypeIdByName($name) { $db =& $this->_db; $sql = "SELECT ty.id id FROM #__vxc_attributetype ty WHERE ty.name = ".$db->Quote($name)." AND ty.deleted is not true"; $db->setQuery($sql); return $db->loadResult(); } function setAttributeMemo($atName,$memoLeft=null,$memoRight=null) { $this->setAttribute($atName,null,null,$memoLeft,$memoRight); } function setAttribute($atName,$valueLeft=null,$valueRight=null, $memoLeft=null, $memoRight=null) { $db =& $this->_db; $orderId = $this->_id; $typeid = $this->getTypeIdByName($atName); $table =& $this->getTable('attribute'); $order =& $this->getData(); $oldValueStr =''; $newValueStr =''; $storeOldValue =$order->forcedWritable; if ($storeOldValue) { $sql = "SELECT id,value_left,value_right,memo_left,memo_right FROM #__vxc_attribute WHERE orderid = $orderId AND type = $typeid"; $this->_db->setQuery($sql); $oldValues =& $this->_db->loadObjectList(); if (count($oldValues)>0) foreach($oldValues as $oldValue) { if ($oldValue->value_left!==null) $oldValueStr.= "VL:".$oldValue->value_left.","; if ($oldValue->value_right!==null) $oldValueStr.= "VR:".$oldValue->value_right.","; if ($oldValue->memo_left!==null) $oldValueStr.= "ML:".$oldValue->memo_left.","; if ($oldValue->memo_right!==null) $oldValueStr.= "MR:".$oldValue->memo_right.","; } } $sql = "DELETE FROM #__vxc_attribute WHERE orderid = $orderId AND type = $typeid"; $this->_db->execute($sql); if ( ($valueLeft!==null && $valueLeft!=='') || ($valueRight!==null && $valueRight!=='')|| ($memoLeft!==null && $memoLeft!=='')|| ($memoRight!==null && $memoRight!=='')) { $table->reset(); $table->set('id',null); $table->set('orderid',$orderId); $table->set('value_left',$valueLeft); $table->set('value_right',$valueRight); $table->set('memo_left',$memoLeft); $table->set('memo_right',$memoRight); $table->set('type',$typeid); $newValueStr .= "VL:".$valueLeft.",VR:".$valueRight.",ML:".$memoLeft.",MR:".$memoRight; if ($table->check()) $table->store(false); } if ($storeOldValue) { $texto = 'Force Writable At '.$atName.' ('.$typeid.') OldValues:'.$oldValueStr. ' NewValues:'.$newValueStr; $this->saveLog($order->statenameid,$texto,ADMIN_VISLEVEL); } } function setAttributeM($atName, $valuesLeft,$valuesRight=null, $memoLeft=null, $memoRight=null) { $orderId = $this->_id; $typeid = $this->getTypeIdByName($atName); $table =& $this->getTable('attribute'); $order =& $this->getData(); $oldValueStr =''; $newValueStr =''; $storeOldValue =$order->forcedWritable; if ($storeOldValue) { $sql = "SELECT at.id id,at.value_left value_left, at.value_right value_right, at.memo_left memo_left, at.memo_right memo_right FROM #__vxc_attribute at WHERE at.orderid = $orderId AND at.type = $typeid"; $this->_db->setQuery($sql); $oldValues =& $this->_db->loadObjectList(); if (count($oldValues)>0) foreach($oldValues as $oldValue) { if ($oldValue->value_left!==null) $oldValueStr.= "VL:".$oldValue->value_left.","; if ($oldValue->value_right!==null) $oldValueStr.= "VR:".$oldValue->value_right.","; if ($oldValue->memo_left!==null) $oldValueStr.= "ML:".$oldValue->memo_left.","; if ($oldValue->memo_right!==null) $oldValueStr.= "MR:".$oldValue->memo_right.","; } } $sql = "DELETE FROM #__vxc_attribute WHERE orderid = $orderId AND type = $typeid"; $this->_db->execute($sql); $maxCount = max(count($valuesLeft),count($valuesRight),count($memoLeft),count($memoRight)); if ($maxCount>0) { for($i=0;$i<$maxCount;$i++) { $table->reset(); $table->set('id',null); $table->set('orderid',$orderId); if ($valuesLeft && $valuesLeft[$i]) { $table->set('value_left',$valuesLeft[$i]); if ($storeOldValue) $newValueStr .= 'VL:'.$valuesLeft[$i].','; } else { $table->set('value_left',''); if ($storeOldValue) $newValueStr .= 'VL:,'; } if ($valuesRight && $valuesRight[$i]) { $table->set('value_right',$valuesRight[$i]); if ($storeOldValue) $newValueStr .= 'VR:'.$valuesRight[$i].','; } else { $table->set('value_right',''); if ($storeOldValue) $newValueStr .= 'VR:,'; } if ($memoLeft && $memoLeft[$i]) { $table->set('memo_left',$memoLeft[$i]); if ($storeOldValue) $newValueStr .= 'ML:'.$memoLeft[$i].','; } else { $table->set('memo_left',''); if ($storeOldValue) $newValueStr .= 'ML:,'; } if ($memoRight && $memoRight[$i]) { $table->set('memo_right',$memoRight[$i]); if ($storeOldValue) $newValueStr .= 'MR:'.$memoLeft[$i].','; } else { $table->set('memo_right',''); if ($storeOldValue) $newValueStr .= 'MR:,'; } $table->set('type',$typeid); if ($table->check()) $table->store(); } } if ($storeOldValue) { $texto = 'Force Writable AtM '.$atName.' ('.$typeid.') OldValues:'.$oldValueStr. ' NewValues:'.$newValueStr; $this->saveLog($order->statenameid,$texto,ADMIN_VISLEVEL); } } function getInsoleCoverAtIds($orderIds) { $db =& $this->_db; if (!count($orderIds)) return array(); $sql = "SELECT at.orderid orderid, at.id id,at.type type, at.value_left value_left, at.value_right value_right, at.memo_left memo_left, at.memo_right memo_right, ty.name typename FROM #__vxc_attribute at LEFT JOIN #__vxc_attributetype ty ON ty.id = at.type WHERE at.orderid IN (". implode(',',$orderIds). ") AND ty.name = 'InsoleCADCoverProject' ORDER BY at.orderid ASC,at.id ASC "; $db->setQuery($sql); $list=& $db->loadObjectList(); // Cogemos el atributo con menor id (debería haber uno solo) $returnArray = array(); foreach($list as $obj) if (!$returnArray[$obj->orderid]) $returnArray[$obj->orderid] = $obj; return $returnArray; } function getInsoleAtIds($orderIds) { $db =& $this->_db; if (!count($orderIds)) return array(); $returnArray = array(); $sql = "SELECT at.orderid orderid, at.id id,at.type type, at.value_left value_left, at.value_right value_right, at.memo_left memo_left, at.memo_right memo_right, ty.name typename FROM #__vxc_attribute at LEFT JOIN #__vxc_attributetype ty ON ty.id = at.type WHERE at.orderid IN (". implode(',',$orderIds). ") AND ty.name = 'InsoleCADProject' ORDER BY at.orderid ASC,at.id ASC"; $db->setQuery($sql); $list =& $db->loadObjectList(); // Cogemos el atributo con menor id (debería haber uno solo) foreach($list as $obj) if (!$returnArray[$obj->orderid]) $returnArray[$obj->orderid] = $obj; $sql = "SELECT at.orderid orderid, at.id id, at.value value FROM #__vxc_attribute at WHERE at.orderid IN (". implode(',',$orderIds). ") AND at.name = 'cad.insoleCADProject' ORDER BY at.orderid ASC,at.id ASC"; $db->setQuery($sql); if ($list = $db->loadObjectList()) { // Cogemos el atributo con menor id (debería haber uno solo) foreach($list as $obj) if (!$returnArray[$obj->orderid]) $returnArray[$obj->orderid] = $obj; } return $returnArray; } function getInsoleCADAt() { $atts =& $this->getAttributes(); foreach($atts as $attribute) if ($attribute->typename == "InsoleCADProject") return $attribute->id; return null; } function getInsoleCADCoverAt() { $atts =& $this->getAttributes(); foreach($atts as $attribute) if ($attribute->typename == "InsoleCADCoverProject") return $attribute->id; return null; } function getAttributeByTypeName($typename) { $atts =& $this->getAttributes(); foreach($atts as $attribute) if ($attribute->typename == $typename) return $attribute; return null; } function saveAnamnesis(&$post,$layout) { switch($layout) { case 'default': $this->setAttributeMemo('MotivoConsulta',$post['MotivoConsulta']); $this->setAttributeMemo('HistoriaLesiones',$post['HistoriaLesiones']); $this->setAttributeMemo('HistoriaAntFam',$post['HistoriaAntFam']); $this->setAttributeMemo('TrataAntAct',$post['TrataAntAct']); $this->setAttributeMemo('OtrosDatosInt',$post['OtrosDatosInt']); $this->setAttributeMFromPost2F($post,'LocDolor'); $this->setAttribute('IntDolor',$post['IntDolor']); $this->setAttribute('EvoDolor',$post['EvoDolor']); $this->setAttribute('TipoActividad',$post['TipoActividad']); $this->setAttributeM('TipoDolor',$post['TipoDolor']); $this->setAttributeM('DescCalzado',$post['DescCalzado']); $this->setAttributeM('AntMedQuir',$post['AntMedQuir']); $this->setAttributeM('CompTests',$post['CompTests']); break; case 'default_ppr': $this->setAttribute('PPRA_Intensitat',$post['PPRA_Intensitat']); $this->setAttributeMemo('PPRA_GrundBesuches',trim($post['PPRA_GrundBesuches'])); $this->setAttributeMFromPost2F($post,'PPRA_OrtLage'); $this->setAttributeM('PPRA_ArtUrsache',$post['PPRA_ArtUrsache']); $this->setAttribute('PPRA_Dauer',$post['PPRA_Dauer']); $this->setAttributeMemo('PPRA_DiabetesI',trim($post['PPRA_DiabetesI'])); $this->setAttributeMemo('PPRA_DiabetesII',trim($post['PPRA_DiabetesII'])); $this->setAttributeMemo('PPRA_NervenSystem',trim($post['PPRA_NervenSystem'])); $this->setAttributeMemo('PPRA_Kreislauf',trim($post['PPRA_Kreislauf'])); $this->setAttributeMemo('PPRA_Bewegung',trim($post['PPRA_Bewegung'])); $this->setAttributeMemo('PPRA_Haut',trim($post['PPRA_Haut'])); $this->setAttributeMemo('PPRA_Sonstiges',trim($post['PPRA_Sonstiges'])); break; case 'default_rotterdam': $this->setAttribute('ROT_AN_Specialisme',trim($post['ROT_AN_Specialisme'])); $this->setAttribute('ROT_AN_SpecialismeOthers',trim($post['ROT_AN_SpecialismeOthers'])); $this->setAttribute('ROT_AN_Specialist',trim($post['ROT_AN_Specialist'])); $this->setAttribute('ROT_AN_Indication',trim($post['ROT_AN_Indication'])); $this->setAttributeMemo('ROT_AN_Remarks',trim($post['ROT_AN_Remarks'])); $this->setAttribute('ROT_AN_ReasonVisit',trim($post['ROT_AN_ReasonVisit'])); $this->setAttribute('ROT_AN_ReasonVisitOthers',trim($post['ROT_AN_ReasonVisitOthers'])); $this->setAttribute('ROT_AN_PainWhere',trim($post['ROT_AN_PainWhere'])); $this->setAttribute('ROT_AN_PainWhereOthers',trim($post['ROT_AN_PainWhereOthers'])); $this->setAttribute('ROT_AN_FootLength',trim($post['ROT_AN_FootLength'])); $this->setAttribute('ROT_AN_ShoeSizeEU',trim($post['ROT_AN_ShoeSizeEU'])); $this->setAttribute('ROT_AN_ShoeBrand',trim($post['ROT_AN_ShoeBrand'])); $this->setAttribute('ROT_AN_ShoeType',trim($post['ROT_AN_ShoeType'])); $this->setAttribute('ROT_AN_Weight',trim($post['ROT_AN_Weight'])); break; case 'default_lafoot': $this->setAttribute('LafootA_ProblemArea1',trim($post['LafootA_ProblemArea1'][0]),trim($post['LafootA_ProblemArea1'][1])); $this->setAttribute('LafootA_ProblemArea2',trim($post['LafootA_ProblemArea2'][0]),trim($post['LafootA_ProblemArea2'][1])); $this->setAttribute('LafootA_ProblemArea3',trim($post['LafootA_ProblemArea3'][0]),trim($post['LafootA_ProblemArea3'][1])); $this->setAttribute('LafootA_ProblemDesc1',trim($post['LafootA_ProblemDesc1'][0]),trim($post['LafootA_ProblemDesc1'][1])); $this->setAttribute('LafootA_ProblemDesc2',trim($post['LafootA_ProblemDesc2'][0]),trim($post['LafootA_ProblemDesc2'][1])); $this->setAttribute('LafootA_ProblemDesc3',trim($post['LafootA_ProblemDesc3'][0]),trim($post['LafootA_ProblemDesc3'][1])); $this->setAttribute('LafootA_ProblemSince',trim($post['LafootA_ProblemSince'][0]),trim($post['LafootA_ProblemSince'][1])); $this->setAttribute('LafootA_ProblemSince2',trim($post['LafootA_ProblemSince2'][0]),trim($post['LafootA_ProblemSince2'][1])); $this->setAttribute('LafootA_ProblemSince3',trim($post['LafootA_ProblemSince3'][0]),trim($post['LafootA_ProblemSince3'][1])); $this->setAttribute('LafootA_Sport1',trim($post['LafootA_Sport1'])); $this->setAttribute('LafootA_Sport2',trim($post['LafootA_Sport2'])); $this->setAttribute('LafootA_TrainFreq',trim($post['LafootA_TrainFreq'])); $this->setAttribute('LafootA_RelevantVoor',trim($post['LafootA_RelevantVoor'])); $this->setAttribute('LafootA_OccProblemsAnders',trim($post['LafootA_OccProblemsAnders'])); $this->setAttribute('LafootA_Specialties',trim($post['LafootA_Specialties'])); $this->setAttribute('LafootA_SpecialtiesSports',trim($post['LafootA_SpecialtiesSports'])); $this->setAttribute('LafootA_WeightIndication',trim($post['LafootA_WeightIndication'])); $this->setAttributeMemo('LafootA_AnalysisDoel',trim($post['LafootA_AnalysisDoel'])); $this->setAttributeMemo('LafootA_Remarks',trim($post['LafootA_Remarks'])); $this->setAttributeMemo('LafootA_AnalysisReason',trim($post['LafootA_AnalysisReason'])); $this->setAttribute('LafootA_AnalysisType',trim($post['LafootA_AnalysisType'])); $this->setAttribute('LafootA_OccProblems',trim($post['LafootA_OccProblems'])); break; case 'default_india': $attsSingle = array( 'IND_AN_Diabetes', 'IND_AN_DiabeticNeuro', 'IND_AN_VascularDecease', 'IND_AN_Retinopathy', 'IND_AN_Nefropathy', 'IND_AN_Cardiopathy', 'IND_AN_ProblemsSince', 'IND_AN_PainIntensity', 'IND_AN_Scoliosis', 'IND_AN_LegLengthDis', 'IND_AN_PelvicObli', 'IND_AN_ShoulderObli', 'IND_AN_Other' ); $attsSingleMemo = array('IND_AN_ReasonVisit', 'IND_AN_PrevHistory', 'IND_AN_FamBackground', 'IND_AN_CurPrevTreat', 'IND_AN_ResumeDiag'); $attsDoubleMultiple = array('IND_AN_FootDisorders', 'IND_AN_PainLocation', 'IND_AN_Sensitivity', 'IND_AN_Hypersensitivity' ); $attsDouble = array( ); foreach($attsSingle as $att) $this->setAttribute($att,trim($post[$att]),trim($post[$att])); foreach($attsDoubleMultiple as $att) $this->setAttributeM($att,$post[$att][0],$post[$att][1]); foreach($attsSingleMemo as $att) $this->setAttributeMemo($att,trim($post[$att]),trim($post[$att])); foreach($attsDouble as $att) $this->setAttribute($att,trim($post[$att][0]),trim($post[$att][1])); break; } } function setAttributeFromPost2F(&$post,$atName) { $this->setAttribute($atName,$post[$atName]['L'],$post[$atName]['R']); } function setAttributeMFromPost2F(&$post,$atName) { $this->setAttributeM($atName,$post[$atName]['L'],$post[$atName]['R']); } function saveProductSel(&$post, $layout) { $attsSingle = array(); $attsDouble = array(); $attsMultipleSingle = array(); switch($layout) { case 'default_jjcorne': break; case 'default': break; case 'default_india': $attsSingle[] = 'IND_Produkt'; // $attsSingle[] = 'PPR_EinlagenVarianten'; $attsSingle[] = 'IND_InsoleType'; $attsSingle[] = 'IND_MatMono'; $attsSingle[] = 'IND_MatCombi'; $attsSingle[] = 'IND_MatTri'; $attsSingle[] = 'IND_Model'; $attsMultipleSingle[] = 'IND_ShoeType'; $attsSingle[] = 'IND_Activity'; // $attsSingle[] = 'IND_CustomModel'; $attsSingle[] = 'IND_BrandsoleType'; // $attsSingle[] = 'PPR_InsoleCup'; $attsDouble[] = 'ShoeSizeEU'; $attsDouble[] = 'IND_HeelHeight'; $attsDouble[] = 'IND_HeelThickness'; $attsDouble[] = 'IND_InsoleThickness'; $attsDouble[] = 'IND_Pelot'; $attsDouble[] = 'IND_PelotMM'; $attsDouble[] = 'IND_PelotII'; $attsDouble[] = 'IND_PelotIIMM'; $attsDouble[] = 'IND_TPelot'; $attsDouble[] = 'IND_TPelotMM'; $attsDouble[] = 'IND_Rctb'; $attsDouble[] = 'IND_RctbMM'; $attsDouble[] = 'IND_HeelSupport'; $attsDouble[] = 'IND_HeelSupportMM'; $attsDouble[] = 'IND_RaiseMiddle'; $attsDouble[] = 'IND_RaiseMiddleMM'; $attsDouble[] = 'IND_WedgeVarus'; $attsDouble[] = 'IND_WedgeVarusMM'; $attsDouble[] = 'IND_WedgeValgus'; $attsDouble[] = 'IND_WedgeValgusMM'; $attsDouble[] = 'IND_ToeElement'; $attsDouble[] = 'IND_ToeElementMM'; $attsDouble[] = 'IND_Wedge'; $attsDouble[] = 'IND_WedgeMM'; $attsDouble[] = 'IND_HeelSpurHole'; $attsDouble[] = 'IND_HeelSpurHoleMM'; $attsDouble[] = 'IND_RaiseMedialArch'; $attsDouble[] = 'IND_RaiseMedialArchMM'; break; case 'default_rotterdam': $attsSingle[] = 'ROT_PR_InsoleModel'; $attsSingle[] = 'ROT_PR_Brandsole'; $attsDouble[] = 'ROT_PR_HeelHeight'; $attsDouble[] = 'ROT_PR_HeelThickness'; $attsDouble[] = 'ROT_PR_InsoleThickness'; $attsDouble[] = 'ROT_PR_PelotII'; $attsDouble[] = 'ROT_PR_PelotIIMM'; $attsDouble[] = 'ROT_PR_TPelot'; $attsDouble[] = 'ROT_PR_TPelotMM'; $attsDouble[] = 'ROT_PR_Rctb'; $attsDouble[] = 'ROT_PR_RctbMM'; $attsDouble[] = 'ROT_PR_DistalPronation'; $attsDouble[] = 'ROT_PR_DistalPronationMM'; $attsDouble[] = 'ROT_PR_HeelSupport'; $attsDouble[] = 'ROT_PR_HeelSupportMM'; $attsDouble[] = 'ROT_PR_RaiseInsoleMiddle'; $attsDouble[] = 'ROT_PR_RaiseInsoleMiddleMM'; $attsDouble[] = 'ROT_PR_WedgeVarus'; $attsDouble[] = 'ROT_PR_WedgeVarusMM'; $attsDouble[] = 'ROT_PR_WedgeValgus'; $attsDouble[] = 'ROT_PR_WedgeValgusMM'; $attsDouble[] = 'ROT_PR_Wedge'; $attsDouble[] = 'ROT_PR_WedgeMM'; $attsDouble[] = 'ROT_PR_HeelSpurHole'; $attsDouble[] = 'ROT_PR_HeelSpurHoleMM'; $attsDouble[] = 'ROT_PR_MedialArchRaise'; $attsDouble[] = 'ROT_PR_MedialArchRaiseMM'; break; case 'default_jjpodo': $attsSingle[] = 'PODO_InsoleType'; $attsSingle[] = 'PODO_Brandsole'; $attsSingle[] = 'PPR_Produkt'; $attsSingle[] = 'PODO_MatMono'; $attsSingle[] = 'PODO_CoverMaterial'; $attsSingle[] = 'PODO_InsoleBasis'; $attsDouble[] = 'PPR_ShoeSize'; $attsDouble[] = 'PODO_InsoleThickness'; $attsDouble[] = 'PODO_HeelHeight'; $attsDouble[] = 'PODO_F_RCMS'; $attsDouble[] = 'PODO_F_RCMSMM'; $attsDouble[] = 'PODO_F_RCTB'; $attsDouble[] = 'PODO_F_RCTBMM'; $attsDouble[] = 'PODO_F_ProRCTB'; $attsDouble[] = 'PODO_F_ProRCTBMM'; $attsDouble[] = 'PODO_F_SupRCTB'; $attsDouble[] = 'PODO_F_SupRCTBMM'; $attsDouble[] = 'PODO_F_ACT'; $attsDouble[] = 'PODO_F_ACTMM'; $attsDouble[] = 'PODO_F_RCTC'; $attsDouble[] = 'PODO_F_RCTCMM'; $attsDouble[] = 'PODO_F_SubAntro'; $attsDouble[] = 'PODO_F_SubAntroMM'; $attsDouble[] = 'PODO_F_SubAntroII_IV'; $attsDouble[] = 'PODO_F_SubAntroII_IVMM'; $attsDouble[] = 'PODO_F_SupSubAntro'; $attsDouble[] = 'PODO_F_SupSubAntroMM'; $attsDouble[] = 'PODO_F_ProSubAntro'; $attsDouble[] = 'PODO_F_ProSubAntroMM'; $attsDouble[] = 'PODO_F_SAkort'; $attsDouble[] = 'PODO_F_SAkortMM'; $attsDouble[] = 'PODO_F_SAlang'; $attsDouble[] = 'PODO_F_SAlangMM'; $attsDouble[] = 'PODO_F_PA'; $attsDouble[] = 'PODO_F_PAMM'; $attsDouble[] = 'PODO_F_PASC'; $attsDouble[] = 'PODO_F_PASCMM'; $attsDouble[] = 'PODO_F_SD'; $attsDouble[] = 'PODO_F_SDMM'; $attsDouble[] = 'PODO_F_PT'; $attsDouble[] = 'PODO_F_PTMM'; $attsDouble[] = 'PODO_F_MiC'; $attsDouble[] = 'PODO_F_MiCMM'; $attsDouble[] = 'PODO_F_SN'; $attsDouble[] = 'PODO_F_SNMM'; $attsDouble[] = 'PODO_F_HAikort'; $attsDouble[] = 'PODO_F_HAikortMM'; $attsDouble[] = 'PODO_F_HAilang'; $attsDouble[] = 'PODO_F_HAilangMM'; $attsDouble[] = 'PODO_F_SS'; $attsDouble[] = 'PODO_F_SSMM'; $attsDouble[] = 'PODO_F_SCbol'; $attsDouble[] = 'PODO_F_SCbolMM'; $attsDouble[] = 'PODO_F_SChol'; $attsDouble[] = 'PODO_F_SCholMM'; $attsDouble[] = 'PODO_F_StabPosterior'; $attsDouble[] = 'PODO_F_StabPosteriorMM'; $attsDouble[] = 'PODO_F_PPSa'; $attsDouble[] = 'PODO_F_PPSaMM'; $attsDouble[] = 'PODO_F_SPSa'; $attsDouble[] = 'PODO_F_SPSaMM'; $attsDouble[] = 'PODO_F_CV'; $attsDouble[] = 'PODO_F_CVMM'; $attsDouble[] = 'PODO_F_AnP'; $attsDouble[] = 'PODO_F_AnPMM'; $attsDouble[] = 'PODO_F_SPSi'; $attsDouble[] = 'PODO_F_SPSiMM'; $attsDouble[] = 'PODO_F_HeelThickness'; $attsDouble[] = 'PODO_F_HeelThicknessMM'; $attsDouble[] = 'PODO_3D_PelotII'; $attsDouble[] = 'PODO_3D_PelotIIMM'; $attsDouble[] = 'PODO_3D_TPelot'; $attsDouble[] = 'PODO_3D_TPelotMM'; $attsDouble[] = 'PODO_3D_RCTB'; $attsDouble[] = 'PODO_3D_RCTBMM'; $attsDouble[] = 'PODO_3D_MiC'; $attsDouble[] = 'PODO_3D_MiCMM'; $attsDouble[] = 'PODO_3D_DistalPro'; $attsDouble[] = 'PODO_3D_DistalProMM'; $attsDouble[] = 'PODO_3D_HeelSupport'; $attsDouble[] = 'PODO_3D_HeelSupportMM'; $attsDouble[] = 'PODO_3D_HeelSupportII';$attsDouble[] = 'PODO_3D_HeelSupportIIMM'; $attsDouble[] = 'PODO_3D_WedgeVarus'; $attsDouble[] = 'PODO_3D_WedgeVarusMM'; $attsDouble[] = 'PODO_3D_WedgeValgus'; $attsDouble[] = 'PODO_3D_WedgeValgusMM'; $attsDouble[] = 'PODO_3D_Wedge'; $attsDouble[] = 'PODO_3D_WedgeMM'; $attsDouble[] = 'PODO_3D_HeelSpurHole'; $attsDouble[] = 'PODO_3D_HeelSpurHoleMM'; $attsDouble[] = 'PODO_3D_HeelThickness';$attsDouble[] = 'PODO_3D_HeelThicknessMM'; break; case 'default_ppr': // Codigo para limpiar el diseño si se ha cambiado de ruta /* $atVarianten =& $this->getAttributeByTypeName('PPR_EinlagenVarianten'); if ($atVarianten) $oldVarianten = $atVarianten->value_left; else $oldVarianten = ''; $newVarianten = trim($post['PPR_EinlagenVarianten']); if ($oldVarianten != $newVarianten) $this->clearDesign(); */ $attsSingle[] = 'PPR_Produkt'; $attsSingle[] = 'PPR_EinlagenVarianten'; $attsSingle[] = 'PPR_MatMono'; $attsSingle[] = 'PPR_MatCombi'; $attsSingle[] = 'PPR_MatTri'; $attsSingle[] = 'PPR_Model'; $attsSingle[] = 'PPR_CustomModel'; $attsSingle[] = 'PPR_BrandsoleType'; $attsSingle[] = 'PPR_InsoleCup'; $attsDouble[] = 'PPR_ShoeSize'; $attsDouble[] = 'PPR_HeelHeight'; $attsDouble[] = 'PPR_HeelThickness'; $attsDouble[] = 'PPR_InsoleThickness'; $attsDouble[] = 'PPR_Pelot'; $attsDouble[] = 'PPR_PelotMM'; $attsDouble[] = 'PPR_PelotII'; $attsDouble[] = 'PPR_PelotIIMM'; $attsDouble[] = 'PPR_TPelot'; $attsDouble[] = 'PPR_TPelotMM'; $attsDouble[] = 'PPR_Rctb'; $attsDouble[] = 'PPR_RctbMM'; $attsDouble[] = 'PPR_HeelSupport'; $attsDouble[] = 'PPR_HeelSupportMM'; $attsDouble[] = 'PPR_RaiseMiddle'; $attsDouble[] = 'PPR_RaiseMiddleMM'; $attsDouble[] = 'PPR_WedgeVarus'; $attsDouble[] = 'PPR_WedgeVarusMM'; $attsDouble[] = 'PPR_WedgeValgus'; $attsDouble[] = 'PPR_WedgeValgusMM'; $attsDouble[] = 'PPR_ToeElement'; $attsDouble[] = 'PPR_ToeElementMM'; $attsDouble[] = 'PPR_Wedge'; $attsDouble[] = 'PPR_WedgeMM'; $attsDouble[] = 'PPR_HeelSpurHole'; $attsDouble[] = 'PPR_HeelSpurHoleMM'; $attsDouble[] = 'PPR_RaiseMedialArch'; $attsDouble[] = 'PPR_RaiseMedialArchMM'; $attsDouble[] = 'PPR_Zehensteg'; $attsDouble[] = 'PPR_ZehenstegMM'; $attsDouble[] = 'PPR_RuckPelotMedial'; $attsDouble[] = 'PPR_RuckPelotMedialMM'; $attsDouble[] = 'PPR_RuckPelotLateral'; $attsDouble[] = 'PPR_RuckPelotLateralMM'; $attsDouble[] = 'PPR_MittelPelotte'; $attsDouble[] = 'PPR_MittelPelotteMM'; $attsDouble[] = 'PPR_ThicknessRemovalMM'; break; } foreach($attsSingle as $att) $this->setAttribute($att,trim($post[$att]),trim($post[$att])); foreach($attsDouble as $att) $this->setAttribute($att,trim($post[$att][0]),trim($post[$att][1])); foreach($attsMultipleSingle as $att) $this->setAttributeM($att,$post[$att],$post[$att]); } function saveExploration(&$post,$layout) { switch($layout) { case 'default': $this->setAttributeFromPost2F($post,'MovArtCaderaABD'); $this->setAttributeFromPost2F($post,'MovArtCaderaADD'); $this->setAttributeFromPost2F($post,'MovArtCaderaRotInterna'); $this->setAttributeFromPost2F($post,'MovArtCaderaRotExterna'); $this->setAttributeFromPost2F($post,'MovArtCaderaFlexion'); $this->setAttributeFromPost2F($post,'MovArtCaderaExtension'); $this->setAttributeFromPost2F($post,'MovArtRodillaFlexion'); $this->setAttributeFromPost2F($post,'MovArtRodillaExtension'); $this->setAttributeFromPost2F($post,'MovArtTPAFlexionPlantar'); $this->setAttributeFromPost2F($post,'MovArtTPAFlexionDorsal'); $this->setAttributeFromPost2F($post,'MovArtASAEversion'); $this->setAttributeFromPost2F($post,'MovArtASAInversion'); $this->setAttributeFromPost2F($post,'MovArtMedioTarEversion'); $this->setAttributeFromPost2F($post,'MovArtMedioTarInversion'); $this->setAttributeFromPost2F($post,'MovArt1RadioFlexionPlantar'); $this->setAttributeFromPost2F($post,'MovArt1RadioFlexionDorsal'); $this->setAttributeFromPost2F($post,'MovArt5RadioFlexionPlantar'); $this->setAttributeFromPost2F($post,'MovArt5RadioFlexionDorsal'); $this->setAttributeFromPost2F($post,'MovArtMetaHalluxFlexionPlantar'); $this->setAttributeFromPost2F($post,'MovArtMetaHalluxFlexionDorsal'); $this->setAttributeFromPost2F($post,'MovArtMetaMenorFlexionPlantar'); $this->setAttributeFromPost2F($post,'MovArtMetaMenorFlexionDorsal'); $this->setAttributeMFromPost2F($post,'PatronHiperqueratosis'); $this->setAttributeMFromPost2F($post,'AlteracionesUngueales'); $this->setAttributeMFromPost2F($post,'AlteracionesDigitales'); $this->setAttributeFromPost2F($post,'AlturaALI'); $this->setAttributeFromPost2F($post,'ValMusTricepsSural'); $this->setAttributeFromPost2F($post,'ValMusSoleo'); $this->setAttributeFromPost2F($post,'ValMusTibialAnterior'); $this->setAttributeFromPost2F($post,'ValMusTibialPosterior'); $this->setAttributeFromPost2F($post,'ValMusPerLatLargo'); $this->setAttributeFromPost2F($post,'ValMusPerLatCorto'); $this->setAttributeFromPost2F($post,'ValMusExtensores'); $this->setAttributeFromPost2F($post,'ValMusFlexores'); $this->setAttributeFromPost2F($post,'AspectoGlobalPie'); $this->setAttributeMFromPost2F($post,'DeformidadDigital'); $this->setAttributeFromPost2F($post,'AlteracionesPlanoTransverso'); $this->setAttributeFromPost2F($post,'AlteracionesPlanoFrontal'); $this->setAttributeFromPost2F($post,'LocEspacialEjeRot'); $this->setAttributeFromPost2F($post,'AlteracionesRodilla'); $this->setAttributeFromPost2F($post,'PosicionRodillas'); $this->setAttributeFromPost2F($post,'AlturaHombros'); $this->setAttributeFromPost2F($post,'AlturaEspinasIliacas'); $this->setAttributeFromPost2F($post,'AlturaHuecosPopliteos'); $this->setAttributeFromPost2F($post,'AlturaMaleolos'); $this->setAttributeFromPost2F($post,'AnalisisPRCA'); $this->setAttributeFromPost2F($post,'AnalisisPNCA'); $this->setAttributeFromPost2F($post,'DeformidadesOseasHaglund'); $this->setAttributeFromPost2F($post,'DeformidadesMusculo'); $this->setAttributeFromPost2F($post,'OtrasDeformidades'); $this->setAttributeFromPost2F($post,'PosicionCoM'); $this->setAttributeFromPost2F($post,'AlteracionesRodillaSagital'); $this->setAttributeFromPost2F($post,'AlteracionesArcoLongitudinal'); $this->setAttributeFromPost2F($post,'MecanismoWindlass'); $this->setAttributeFromPost2F($post,'TestResistSupi'); $this->setAttributeFromPost2F($post,'TestElevacion1Radio'); $this->setAttributeFromPost2F($post,'TestMaximaPronacion'); $this->setAttributeFromPost2F($post,'TestPuntillasSingle'); $this->setAttribute('TestPuntillasBilateral',$post['TestPuntillasBilateral']); $this->setAttributeFromPost2F($post,'TestColeman'); $this->setAttributeFromPost2F($post,'TestLachman'); $this->setAttribute('PruebaAllis',$post['PruebaAllis']); $this->setAttributeFromPost2F($post,'LongitudFemur'); $this->setAttributeFromPost2F($post,'LongitudTibia'); $this->setAttributeMemo('JuicioDiag',$post['JuicioDiag']); $this->setAttributeMemo('SolicitudPruebas',$post['SolicitudPruebas']); $this->setAttributeMemo('TratamientosInst',$post['TratamientosInst']); break; case 'default_india': $attsSingle = array(); $this->setAttributeMemo('IND_EX_ProposedTreatment',$post['IND_EX_ProposedTreatment']); $attsDouble = array( "IND_AN_DigitDeformity", "IND_AN_HalluxValgus", "IND_AN_BoneProm", "IND_AN_MetaHeadProm", "IND_AN_SubMetaTissLeak", "IND_AN_MarkedTend", "IND_AN_FallenFoot", "IND_AN_CharcotFoot", "IND_AN_Callos", "IND_AN_Fisuras", "IND_AN_PreulcerousLesion", "IND_AN_TouchZones", "IND_AN_RedZones", "IND_AN_HotZones", "IND_AN_Maceration", "IND_AN_Inflamation", "IND_AN_Dryness", "IND_AN_BreakingNails", "IND_AN_EuprosadedNails", "IND_AN_NailedNails", "IND_AN_SwollenBorders", "IND_AN_FungicInfection", 'AnalisisPRCA', 'AnalisisPNCA', 'IND_EX_HipAbduction', 'IND_EX_HipAdduction', 'IND_EX_HipIntRot', 'IND_EX_HipExtRot', 'IND_EX_HipAnt', 'IND_EX_HipRetro', 'IND_EX_KneeGenuVarum', 'IND_EX_KneeGenuValgum', 'IND_EX_KneeFlexion', 'IND_EX_KneeExtension', 'IND_EX_UpAnkleDor', 'IND_EX_UpAnklePlan', 'IND_EX_LowAnkleInv', 'IND_EX_LowAnkleEver', 'IND_EX_TotalAnkleDor', 'IND_EX_TotalAnklePlan', 'IND_EX_TotalAnkleAb', 'IND_EX_TotalAnkleAd', 'IND_EX_MetaJointVDor', 'IND_EX_MetaJointVPlan', 'IND_EX_MetaJointIDor', 'IND_EX_MetaJointIPlan' ); $attsDoubleMultiple = array('AlteracionesDigitales'); foreach($attsSingle as $att) $this->setAttribute($att,trim($post[$att]),trim($post[$att])); foreach($attsDouble as $att) $this->setAttribute($att,trim($post[$att][0]),trim($post[$att][1])); foreach($attsDoubleMultiple as $att) $this->setAttributeM($att,$post[$att][0],$post[$att][1]); break; case 'default_lafoot': foreach($post as $key=> $value) { switch($key) { case 'LafootE_Plan': case 'LafootE_Evaluatie': case 'LafootE_FootTypeSpecific': $this->setAttributeMemo($key,trim($value)); break; case 'LafootE_FootPresIsoStand': case 'LafootE_FootPresIsoWalk': $this->setAttributeMemo($key,trim($value[0]),trim($value[1])); break; case 'LafootA_FootLength': case 'LafootA_FootType': case 'LafootA_LandingPhase': case 'LafootA_GaitLine': case 'LafootA_GaitLineDesc': case 'LafootA_NewShoeSize': $this->setAttribute($key,trim($value[0]),trim($value[1])); break; default: $this->setAttribute($key,trim($value)); break; } } break; case 'default_rotterdam': $this->setAttributeFromPost2F($post,'ROT_EX_StabilityToeOri'); $this->setAttributeFromPost2F($post,'ROT_EX_StabilityHeelOri'); $this->setAttributeFromPost2F($post,'ROT_EX_DorsalFlexionRestricted'); $this->setAttributeFromPost2F($post,'ROT_EX_CalcaPos'); $this->setAttributeFromPost2F($post,'ROT_EX_MobiHalluxPos'); break; case 'default_ppr': $this->setAttributeFromPost2F($post,'PPRE_HAbduk'); $this->setAttributeFromPost2F($post,'PPRE_HAdduk'); $this->setAttributeFromPost2F($post,'PPRE_HInnen'); $this->setAttributeFromPost2F($post,'PPRE_HAussen'); $this->setAttributeFromPost2F($post,'PPRE_HAnt'); $this->setAttributeFromPost2F($post,'PPRE_HRetro'); $this->setAttributeFromPost2F($post,'PPRE_KVarus'); $this->setAttributeFromPost2F($post,'PPRE_KValgus'); $this->setAttributeFromPost2F($post,'PPRE_KFlexion'); $this->setAttributeFromPost2F($post,'PPRE_KExtension'); $this->setAttributeFromPost2F($post,'PPRE_OSGPlantar'); $this->setAttributeFromPost2F($post,'PPRE_OSGDorsal'); $this->setAttributeFromPost2F($post,'PPRE_USGSup'); $this->setAttributeFromPost2F($post,'PPRE_USGPro'); $this->setAttributeFromPost2F($post,'PPRE_FPlantar'); $this->setAttributeFromPost2F($post,'PPRE_FDorsal'); $this->setAttributeFromPost2F($post,'PPRE_FAbduk'); $this->setAttributeFromPost2F($post,'PPRE_FAdduk'); $this->setAttributeFromPost2F($post,'PPRE_MGSVPlantar'); $this->setAttributeFromPost2F($post,'PPRE_MGSVDorsal'); $this->setAttributeFromPost2F($post,'PPRE_MGSIPlantar'); $this->setAttributeFromPost2F($post,'PPRE_MGSIDorsal'); $this->setAttributeMFromPost2F($post,'PPRE_Hypersensibilitat'); $this->setAttributeMFromPost2F($post,'PPRE_Sensibilitat'); $this->setAttributeMFromPost2F($post,'PPRE_ZehenDeform'); $this->setAttributeMFromPost2F($post,'PPRE_Fussfehlstellungen'); $this->setAttribute('PPRE_Skoliose',trim($post['PPRE_Skoliose'])); $this->setAttribute('PPRE_Beinlangen',trim($post['PPRE_Beinlangen'])); $this->setAttribute('PPRE_Becken',trim($post['PPRE_Becken'])); $this->setAttribute('PPRE_Schulters',trim($post['PPRE_Schulters'])); $this->setAttribute('PPRE_Sonstiges',trim($post['PPRE_Sonstiges'])); break; } } function setManuAction($action) { $order =& $this->getData(); $oldState = $order->manu_statenameid; $newState = $oldState; switch($oldState) { case '': switch($action) { case 'START': $newState='INITIAL'; break; case 'MILL': $newState = 'MILLED'; break; case 'FINISH': $newState = 'FINISHED'; break; case 'PRINT_LABEL': $newState= 'PRINTED_LABELS'; break; } break; case 'INITIAL': switch($action) { case 'MILL': $newState = 'MILLED'; break; case 'CANCEL': $newState = ''; break; case 'FINISH': $newState = 'FINISHED'; break; case 'PRINT_LABEL': $newState= 'PRINTED_LABELS'; break; } break; case 'PRINTED_LABELS': switch($action) { case 'START': $newState='INITIAL'; break; case 'CANCEL': $newState=''; break; case 'MILL': $newState = 'MILLED'; break; case 'FINISH': $newState = 'FINISHED'; break; } break; case 'MILLED': switch($action) { case 'CANCEL': $newState = ''; break; case 'FINISH': $newState = 'FINISHED'; break; } break; case 'FINISHED': switch($action) { case 'CANCEL': $newState = ''; break; } break; } if ($newState !=$oldState) { $sql = "UPDATE #__vxc_order SET manu_state = (SELECT id FROM #__vxc_manustate WHERE nameid = ".$this->_db->Quote($newState).") WHERE id = ".$this->_id; $this->_db->execute($sql); $this->saveLog($order->statenameid,JText::_('Manufacturing').': '.JText::_($order->manu_statename)); } } function saveNewAttributes($options) { if (!$this->_id) return false; $sql = "SELECT `uuid` FROM jos_vxc_order WHERE id = ".$this->_id; $this->_db->setQuery($sql); $orderUUID = $this->_db->loadResult(); if (!$orderUUID) return; // Reseteamos los updateUUID de los atributos para que si hacen algun cambio en local, prevalezca el estado // al pagar $newUpdateUUID = LegacyHelper::generateUUID(); foreach($options->attributes as $at) { $sql = "DELETE FROM #__vxc_attribute WHERE `orderid` = ".$this->_id ." AND `name`=". $this->_db->Quote($at->name); $this->_db->Execute($sql); $sql = "INSERT INTO #__vxc_attribute(`orderid`,`name`,`update_uuid`,`value`) VALUES(".$this->_id.",". $this->_db->Quote($at->name) . ", ". $this->_db->Quote($newUpdateUUID) . ", ". $this->_db->Quote($at->value) . ")"; $this->_db->Execute($sql); } $sql = "INSERT INTO jos_vxc_orderupdateuuid(order_uuid,update_uuid) VALUES ('".$orderUUID."','".$newUpdateUUID."')"; $this->_db->Execute($sql); } function doPayActions() { $sql = "SELECT `uuid` FROM jos_vxc_order WHERE id = ".$this->_id; $this->_db->setQuery($sql); $orderUUID = $this->_db->loadResult(); if (!$orderUUID) return; // Reseteamos los updateUUID de los atributos para que si hacen algun cambio en local, prevalezca el estado // al pagar $newUpdateUUID = LegacyHelper::generateUUID(); $sql = "UPDATE #__vxc_attribute SET update_uuid = '$newUpdateUUID' WHERE orderid = ".$this->_id; $this->_db->Execute($sql); $sql = "INSERT INTO jos_vxc_orderupdateuuid(order_uuid,update_uuid) VALUES ('".$orderUUID."','".$newUpdateUUID."')"; $this->_db->Execute($sql); } function setAction($action,$reason='') { $order =& $this->getData(); $oldState = $order->statenameid; $newState = $oldState; switch($oldState) { case '': switch($action) { case 'START': $newState='INCOMPLETED'; break; case 'CONFIRMDELEGATE': $newState = 'PREDESIGNING'; break; } break; case 'INCOMPLETED': switch($action) { case 'CONFIRMDELEGATE': $newState = 'PREDESIGNING'; break; case 'SAVEDLASTSTEP': $newState = 'COMPLETED'; break; } break; case 'COMPLETED': switch($action) { case 'UNCOMPLETE': case 'MISSEDDATA': $newState = 'INCOMPLETED'; break; case 'CONFIRMDELEGATE': $newState = 'PREDESIGNING'; break; case 'PAY': $this->doPayActions(); $newState = 'CONFIRMED'; break; case 'PREPAY': $newState = 'PRECONFIRMED'; break; case 'ENDMANUFACTURING': $newState = 'MANUFACTURED'; $this->setManuAction('FINISH'); break; case 'MARKASBAD': $this->setError($reason); $this->saveLog($oldState, $reason); break; case 'MARKASGOOD': $newState = 'CHECKED'; break; } break; case 'PRECONFIRMED': switch($action) { case 'MISSEDDATA': $newState = 'INCOMPLETED'; break; case 'PAY': $this->doPayActions(); $newState = 'CONFIRMED'; break; case 'ENDMANUFACTURING': $newState = 'MANUFACTURED'; $this->setManuAction('FINISH'); break; } break; case 'CHECKED': switch($action) { case 'ENDMANUFACTURING': $newState = 'MANUFACTURED'; $this->setManuAction('FINISH'); break; case 'STARTMANUFACTURING': $newState = 'MANUFACTURING'; $this->setManuAction('START'); break; } break; case 'CONFIRMED': switch($action) { case 'MARKASBAD': $this->setError($reason); $this->saveLog($oldState, $reason); break; case 'MARKASGOOD': $newState = 'CHECKED'; break; case 'ENDMANUFACTURING': $newState = 'MANUFACTURED'; $this->setManuAction('FINISH'); break; case 'SHIPPED': $newState = 'SHIPPED'; break; } break; case 'PREDESIGNING': switch($action) { case 'FINISHPREDESIGN': if (SiteOptionsHelper::useFastRoute()) { // $newState = 'COMPLETED'; // En la nueva ruta vamos a intentar no usar el rol de prediseño sino, únicamente el de revisión } else { if ($order->userpredesignreview) $newState = 'PENDING_APPROVAL'; else { if ($order->completedSteps ==TOTAL_STEPS) $newState = 'COMPLETED'; else $newState = 'INCOMPLETED'; } } break; case 'APPROVEDESIGN': if ($order->completedSteps ==TOTAL_STEPS) $newState = 'COMPLETED'; else $newState = 'INCOMPLETED'; break; case 'SAVEDLASTSTEP': $newState = 'COMPLETED'; break; case 'ENDMANUFACTURING': $newState = 'MANUFACTURED'; $this->setManuAction('FINISH'); break; } break; case 'PENDING_APPROVAL': switch($action) { case 'MISSEDDATA': $newState = 'INCOMPLETED'; break; case 'APPROVEDESIGN': if ($order->completedSteps ==TOTAL_STEPS) $newState = 'COMPLETED'; else $newState = 'INCOMPLETED'; break; case 'SAVEDLASTSTEP': $newState = 'COMPLETED'; break; case 'ENDMANUFACTURING': $newState = 'MANUFACTURED'; $this->setManuAction('FINISH'); break; } break; case 'MANUFACTURING': switch($action) { case 'ENDMANUFACTURING': $newState = 'MANUFACTURED'; $this->setManuAction('FINISH'); break; case 'CANCELMANUFACTURING': $newState = 'CHECKED'; $this->setManuAction('CANCEL'); break; case 'SHIPPED': $newState = 'SHIPPED'; break; } break; case 'MANUFACTURED': switch($action) { case 'SHIPPED': $newState = 'SHIPPED'; break; } break; } if ($newState !=$oldState) { $sql = "UPDATE #__vxc_order SET state = (SELECT id FROM #__vxc_orderstate WHERE nameid = ".$this->_db->Quote($newState).") WHERE id = ".$this->_id; $this->_db->execute($sql); $this->_item = null; } $this->saveLog($newState,$action. ': '.$reason); } // Visibilidades definidas en siteoptionshelper function saveLog($state,$info='',$visibility_level=PUBLIC_VISLEVEL) { $info = trim($info); if ($info!='') $info =$this->_db->Quote(trim($info)); else $info = 'NULL'; $userId =LegacyHelper::getUserId(); if (!$userId) $userId = "NULL"; $orderId = $this->_id; if (!$orderId) $orderId = "0"; $sql = "INSERT INTO #__vxc_orderlog(userid,orderid,state,logdate,info,visibility_level) VALUES(".$userId.",".$orderId.", (SELECT id FROM #__vxc_orderstate WHERE nameid=".$this->_db->Quote($state)."), current_timestamp(), ".$info.",".$visibility_level.")"; $this->_db->Execute($sql); } function saveDesign(&$post) { $delegate = (((int)$post['design'])==1); if ($delegate) { $this->setAction('CONFIRMDELEGATE'); } $design =$delegate?"TRUE":"FALSE"; $sql = "UPDATE #__vxc_order SET delegatedesign=$design WHERE id = " . $this->_id; $this->_db->execute($sql); } function setError($reason) { if ($reason===null) $reason = 'NULL'; else $reason = $this->_db->Quote(trim($reason)); $sql = "UPDATE #__vxc_order SET error_desc = " .$reason. " WHERE id = " . $this->_id; $this->_db->Execute($sql); } function getBatchId() { $sql = "SELECT o.batch FROM #__vxc_order o WHERE o.id = ".$this->_id; $this->_db->setQuery($sql); return $this->_db->loadResult(); } function createNew($orderData) { $table =& $this->getTable('order'); $db =& $this->_db; $sql = "SELECT id FROM #__vxc_orderstate WHERE nameid = 'INCOMPLETED'"; $db->setQuery($sql); $stateIncompletedId = $db->loadResult(); $table->reset(); $table->id = null; $dateNow = new JDate(); $table->batch=null; $table->creationdate = $dateNow->toMySQL(); $table->state = $stateIncompletedId; $table->delegatedesign= 0; $table->manufactured_date = null; $table->manufacturing_date = null; $table->user = null; $table->checked_date = null; $table->checking_user = null; $table->predesigned_date = null; $table->predesigning_user = null; $table->last_save_user = null; $table->reviewers = null; $table->error_desc = null; $table->manu_state =null; $table->paid_amount = null; $table->price = null; $table->patient_price = null; $table->franchise_to_company_fee = null; $table->voxelcare_to_franchise_fee = null; $table->shipping_address = null; $table->deleted =null; $table->archived = null; foreach($orderData as $key => $value) $table->set($key, $value); if (!$table->check()) return false; if (!$table->store(true)) return false; return $table->id; } function _getMVCFile($filename,&$data) { $mvcMiddlewareURL = LegacyHelper::getMiddlewareServiceURL(); if (!$mvcMiddlewareURL) return false; $statusCode = 0; $headers = array(); $url = $mvcMiddlewareURL ."/getFile?path=".urlencode($filename); $storageService = LegacyHelper::getStorageService(); if ($storageService) $url .= "&storageService=".urlencode($storageService); $data = LegacyHelper::httpRequest('GET',$url,null,null,$statusCode,$headers); return ($statusCode==200); } function _copyMVCFile($srcPath,$dstPath) { $mvcMiddlewareURL = LegacyHelper::getMiddlewareServiceURL(); if (!$mvcMiddlewareURL) return false; $statusCode = 0; $headers = array(); $url = $mvcMiddlewareURL ."/copyFile?srcpath=".urlencode($srcPath)."&dstpath=".urlencode($dstPath); $storageService = LegacyHelper::getStorageService(); if ($storageService) $url .= "&storageService=".urlencode($storageService); $responseStr = LegacyHelper::httpRequest('GET',$url,null,null,$statusCode,$headers); return ($statusCode==200); } function _setMVCFile($filename,&$data) { $mvcMiddlewareURL = LegacyHelper::getMiddlewareServiceURL(); if (!$mvcMiddlewareURL) return false; $url = $mvcMiddlewareURL .'/putFile?path='.urlencode($filename); $storageService = LegacyHelper::getStorageService(); if ($storageService) $url .= "&storageService=".urlencode($storageService); $statusCode = 0; $headers = array(); $responseStr = LegacyHelper::httpRequest('PUT', $url, $data , null,$statusCode,$headers); return ($statusCode==200); } function _checkMVCFile($filename) { $mvcMiddlewareURL = LegacyHelper::getMiddlewareServiceURL(); if (!$mvcMiddlewareURL) return false; $json = new Services_JSON(); $statusCode = 0; $headers = array(); $url = $mvcMiddlewareURL ."/existsFile?path=".urlencode($filename); $storageService = LegacyHelper::getStorageService(); if ($storageService) $url .= "&storageService=".urlencode($storageService); $responseStr = LegacyHelper::httpRequest('GET',$url,null,null,$statusCode,$headers); if ($statusCode == 200) { $response = $json->decode($responseStr); if ($response && $response->result== "ok" && $response->data && ($response->data->exists===true || $response->data->exists=="true" || $response->data->exists===TRUE)) return true; } return false; } function duplicate() { $modelVoxelService = new vxcModelVoxelService(); $mvcMiddlewareURL = LegacyHelper::getMiddlewareServiceURL(); $table =& $this->getTable('order'); $db =& $this->_db; $sql = "SELECT id FROM #__vxc_orderstate WHERE nameid = 'INCOMPLETED'"; $db->setQuery($sql); $stateIncompletedId = $db->loadResult(); $table->reset(); $id = $this->_id; $table->load($id); $table->id = null; $dateNow = new JDate(); $table->batch=null; $table->creationdate = $dateNow->toMySQL(); $table->state = $stateIncompletedId; $table->delegatedesign= 0; $table->manufactured_date = null; $table->manufacturing_date = null; $table->checked_date = null; $table->checking_user = null; $table->predesigned_date = null; $table->predesigning_user = null; $table->last_save_user = null; $table->reviewers = null; $table->error_desc = null; $table->manu_state =null; $table->paid_amount = null; $table->price = null; $table->patient_price = null; $table->franchise_to_company_fee = null; $table->voxelcare_to_franchise_fee = null; $table->shipping_address = null; $table->deleted =null; $table->charged =0; $table->archived = null; if (!$table->check()) return false; if (!$table->store(true)) return false; $orderid = $table->id; // Averiguamos si el pedido a duplicar es nuevo o viejo $oldOrder = false; $sql = "SELECT o.`uuid` uuid FROM jos_vxc_order o WHERE o.id = ".$id; $this->_db->setQuery($sql); if (!($this->_db->loadResult())) $oldOrder = true; if (!$oldOrder) { $newOrderUUID = LegacyHelper::generateUUID(); $newUpdateUUID = LegacyHelper::generateUUID(); } if (LegacyHelper::getNewMode() && !$oldOrder) { // Actualizamos el pedido con un nuevo id $sql = "UPDATE #__vxc_order SET `uuid` = '".$newOrderUUID."' WHERE id = ".$orderid; $this->_db->Execute($sql); $sql = "INSERT #__vxc_orderupdateuuid(`order_uuid`,`update_uuid`) VALUES ('".$newOrderUUID."','".$newUpdateUUID."');"; $this->_db->Execute($sql); } $attributes =& $this->getAttributes(); $resources = array(); foreach($attributes as $att) { $type = $att->type; if (!$type) $type="0"; $value_left = $att->value_left; if ($value_left) $value_left=$db->Quote($value_left); else $value_left="NULL"; $value_right = $att->value_right; if ($value_right) $value_right=$db->Quote($value_right); else $value_right="NULL"; $memo_left = $att->memo_left; if ($memo_left) $memo_left=$db->Quote($memo_left); else $memo_left="NULL"; $memo_right = $att->memo_right; if ($memo_right) $memo_right=$db->Quote($memo_right); else $memo_right="NULL"; $atname = $att->name; if ($atname) $atname = $db->Quote($atname); else $atname = 'NULL'; $atvalue = $att->value; if ($atvalue) $atvalue = $db->Quote($atvalue); else $atvalue = 'NULL'; $extraFields = ''; $extraValues = ''; if (LegacyHelper::getNewMode() && !$oldOrder) { $extraFields = ",`update_uuid`, `name`, `value` "; if ($att->update_uuid) $extraValues = ",'".$newUpdateUUID."', ".$atname." , ".$atvalue." "; else $extraValues = ",NULL, ".$atname." , ".$atvalue." "; } $sql = "INSERT INTO #__vxc_attribute(`type`,`orderid`,`value_left`,`value_right`,`memo_left`,`memo_right` $extraFields) VALUES($type,$orderid,$value_left,$value_right,$memo_left,$memo_right $extraValues)"; $db->Execute($sql); $atId = $db->insertid(); $isFileType = false; if ($att->datatypename == "IMAGE" || $att->datatypename == "FILE") $isFileType = true; else if ($att->update_uuid) { switch($att->name) { case 'intake.apd': case 'intake.foambox': case 'intake.brandsole': case 'intake.blueprint': case 'intake.bb1data': case 'intake.textured3DData': case 'intake.dynHeightmap': case 'cad.insoleCADProject': $isFileType = true; } } if ($isFileType) { $hasFiles = false; if ($mvcMiddlewareURL) { vxcModelOrderAttribute::GetRelativeFilenames($att->id,$oldFileLeft,$oldFileRight,$oldFileExtra); vxcModelOrderAttribute::GetRelativeThumbs($att->id,$oldThumbLeft,$oldThumbRight); vxcModelOrderAttribute::GetRelativeFilenames($atId,$fileLeft,$fileRight,$fileExtra); vxcModelOrderAttribute::GetRelativeThumbs($atId,$thumbLeft,$thumbRight); if ($this->_checkMVCFile($oldFileLeft)) { $this->_copyMVCFile($oldFileLeft,$fileLeft); $hasFiles = true; } if ($this->_checkMVCFile($oldFileRight)) { $this->_copyMVCFile($oldFileRight,$fileRight); $hasFiles = true; } if ($this->_checkMVCFile($oldFileExtra)) { $this->_copyMVCFile($oldFileExtra,$fileExtra); $hasFiles = true; } if ($this->_checkMVCFile($oldThumbLeft)) { $this->_copyMVCFile($oldThumbLeft,$thumbLeft); $hasFiles = true; } if ($this->_checkMVCFile($oldThumbRight)) { $this->_copyMVCFile($oldThumbRight,$thumbRight); $hasFiles = true; } } else { vxcModelOrderAttribute::GetFilenames($att->id,$oldFileLeft,$oldFileRight,$oldFileExtra); vxcModelOrderAttribute::GetThumbs($att->id,$oldThumbLeft,$oldThumbRight); vxcModelOrderAttribute::GetFilenames($atId,$fileLeft,$fileRight,$fileExtra); vxcModelOrderAttribute::GetThumbs($atId,$thumbLeft,$thumbRight); if (@file_exists($oldFileLeft)) { @copy($oldFileLeft,$fileLeft); $hasFiles = true; } if (@file_exists($oldFileRight)){ @copy($oldFileRight,$fileRight); $hasFiles = true; } if (@file_exists($oldFileExtra)){ @copy($oldFileExtra,$fileExtra); $hasFiles = true; } if (@file_exists($oldThumbLeft)){ @copy($oldThumbLeft,$thumbLeft); $hasFiles = true; } if (@file_exists($oldThumbRight)) { @copy($oldThumbRight,$thumbRight); $hasFiles = true; } } if ($hasFiles) $resources[] = array('src'=>$att->id,'dst'=>$atId); } } $this->SetId($table->id); $attributes =& $this->getAttributes(); foreach($attributes as $att) { if ($att->name == "cad.insoleCADProject" || $att->typename=='InsoleCADProject' || $att->typename=='InsoleCADCoverProject') { $finds = array(); $replaces = array(); foreach($resources as $resource) { $src = $resource['src']; $dst = $resource['dst']; $finds[] =""; $finds[] =""; $finds[] =""; $replaces[] = ""; $replaces[] = ""; $replaces[] = ""; } if ($mvcMiddlewareURL) { vxcModelOrderAttribute::GetRelativeFilenames($att->id,$fileLeft,$fileRight,$fileExtra); $project = ''; if ($this->_getMVCFile($fileLeft,$project)) { $project = str_replace($finds,$replaces,$project); $this->_setMVCFile($fileLeft,$project); } } else { vxcModelOrderAttribute::GetFilenames($att->id,$fileLeft,$fileRight,$fileExtra); $project = @file_get_contents($fileLeft,FILE_TEXT ); $project = str_replace($finds,$replaces,$project); @file_put_contents($fileLeft,$project); } } } return true; } function GeneratePoolFromParams(&$cadParams,&$pool,$fullkey='') { if (!$cadParams) return; if (!is_object($cadParams)) $pool[$fullkey] = $cadParams; else { if ($fullkey) $fullkey .= "."; foreach(get_object_vars($cadParams) as $key => $cadParam) $this->GeneratePoolFromParams($cadParam,$pool,$fullkey . $key); } } function DeleteAttributesByTypeName($typeName) { $sql = "DELETE FROM #__vxc_attribute WHERE orderid = ".$this->_id." AND type = (SELECT id FROM #__vxc_attributetype WHERE name = ".$this->_db->Quote($typeName) .")"; $this->_db->Execute($sql); } function getManuOptions($layout) { $vars = array(); $atts =& $this->getAttributes(); switch($layout) { case 'default_india': case 'default_newtecnoinsole': case 'default_tecnoinsole': case 'default': $vars['tipoinsole'] = ''; $vars['mecamat'] = array(); $vars['termomat'] = array(); $vars['termopoliprothick'] = array(); $vars['termoresinatipo'] = array(); $vars['termopostmedio'] = array(array(),array()); $vars['tipoeva'] = array(); $vars['evamonothick'] = array(); $vars['evabithick'] = array(); $vars['forrado'] = array(array(),array()); foreach($atts as $att) { if (!$vars[$att->typename]) $vars[$att->typename] = array(); $dtv = array(); $dtv['value_left'] = $att->value_left; $dtv['value_right'] = $att->value_right; $dtv['memo_left'] = $att->memo_left; $dtv['memo_right'] = $att->memo_right; $vars[$att->typename][] = $dtv; switch($att->typename) { case 'InsoleOptions': if (strpos($att->mvalueleft,'POSITIVO')===0) $vars['tipoinsole'] = 'positivo'; elseif (strpos($att->mvalueleft,'3DCONFORT')===0) $vars['tipoinsole'] = '3dconfort'; elseif ( (strpos($att->mvalueleft,'TERMOPOST')!==0 && strpos($att->mvalueleft,'TERMO')===0) || (strpos($att->mvalueright,'TERMOPOST')!==0 && strpos($att->mvalueright,'TERMO')===0) ) { $vars['tipoinsole'] = 'termo'; } elseif (strpos($att->mvalueleft,'EVA')===0 ||strpos($att->mvalueright,'EVA')===0 ) $vars['tipoinsole'] = 'eva'; elseif (strpos($att->mvalueleft,'MECAPOLIPRO3SIDED')===0 ||strpos($att->mvalueright,'MECAPOLIPRO3SIDED')===0 ) $vars['tipoinsole'] = 'mecanizado3caras'; elseif (strpos($att->mvalueleft,'MECA')===0 ||strpos($att->mvalueright,'MECA')===0 ) $vars['tipoinsole'] = 'mecanizado'; for ($footIndex =0;$footIndex<2;$footIndex++) { $mvalue = ($footIndex==0)?$att->mvalueleft:$att->mvalueright; switch($mvalue) { case 'MECAPOLIEHD': case 'MECAABS': case 'MECAPOLIPRO': $vars['mecamat'][$footIndex] = $mvalue; break; case 'TERMOPOLIPRO2': case 'TERMOPOLIPRO3': case 'TERMOPOLIPRO4': case 'TERMOPOLIPRO5': $vars['termopoliprothick'][$footIndex] = $mvalue; $vars['termomat'][$footIndex] = 'polipro'; break; case 'TERMOCARBONO15': $vars['termomat'][$footIndex] = 'carbono'; break; case 'TERMORESINAFLUXFLEX': case 'TERMORESINAFLUX': case 'TERMORESINAFLEX': case 'TERMORESINAHERFLEX': $vars['termomat'][$footIndex] = 'resina'; $vars['termoresinatipo'][$footIndex] = $mvalue; break; case 'FORRADOPORONMEMORY': case 'FORRADOSHOCKICEL': case 'FORRADOEVA2': case 'FORRADOEVA3': case 'FORRADOPIEL': case 'FORRADOPLASTAZOTE': if (!$vars['forrado'][$footIndex]) $vars['forrado'][$footIndex] = array(); $vars['forrado'][$footIndex][]= $mvalue; break; case 'EVAMONO30': case 'EVAMONO40': case 'EVAMONO55': $vars['evamonothick'][$footIndex] = $mvalue; $vars['tipoeva'][$footIndex] = 'mono'; break; case 'EVABI3055': $vars['tipoeva'][$footIndex] = 'bi'; $vars['evabithick'][$footIndex] = 'EVABI3055'; break; case '3DCONFORTMONO30': $vars['evamonothick'][$footIndex] = 'EVAMONO30'; $vars['tipoeva'][$footIndex] = 'mono'; break; case '3DCONFORTMONO40': $vars['evamonothick'][$footIndex] = 'EVAMONO40'; $vars['tipoeva'][$footIndex] = 'mono'; break; case '3DCONFORTBI3055': $vars['tipoeva'][$footIndex] = 'bi'; $vars['evabithick'][$footIndex] = 'EVABI3055'; break; case '3DCONFORTBI4055SPORT': $vars['tipoeva'][$footIndex] = 'bi'; $vars['evabithick'][$footIndex] = 'EVABI4055SPORT'; break; case 'TERMOPOSTMEDICACU': case 'TERMOPOSTMEDIALI': case 'TERMOPOSTMEDIFASCIAL': if (!$vars['termopostmedio'][$footIndex]) $vars['termopostmedio'][$footIndex] = array(); $vars['termopostmedio'][$footIndex][]= $mvalue; break; } } break; case 'TI_PS_Material': switch($att->value_left) { case 'MECAPP': $vars['tipoinsole'] = 'mecanizado'; break; case 'MECAPP3SIDED': $vars['tipoinsole'] = 'mecanizado3caras'; break; case 'POS': $vars['tipoinsole'] = 'positivo'; break; case 'PP': case 'RES': case 'FIB': $vars['tipoinsole'] = 'termo'; break; case 'EVA': $vars['tipoinsole'] = 'eva'; break; case '3DCONFORT': $vars['tipoinsole'] = '3dconfort'; break; } break; } } break; default: foreach($atts as $att) { if (!$vars[$att->typename]) $vars[$att->typename] = array(); $dtv = array(); $dtv['value_left'] = $att->value_left; $dtv['value_right'] = $att->value_right; $dtv['memo_left'] = $att->memo_left; $dtv['memo_right'] = $att->memo_right; $vars[$att->typename][] = $dtv; } } return $vars; } function saveManuOptions(&$post,$layout) { switch($layout) { case 'default_india': $insoleOptions = array(); if ($post['TI_PS_InsoleFoot']==1) { $footStart =0; $footEnd = 1; }elseif ($post['TI_PS_InsoleFoot']==2) { $footStart =1; $footEnd = 2; } else { $footStart =0; $footEnd = 2; } for ($footIndex=$footStart;$footIndex<$footEnd;$footIndex++) { $insoleOptions[$footIndex] = array(); switch($post['tipoinsole']) { case 'eva': switch($post['tipoeva'][$footIndex]) { case 'mono': if ($post['evamonothick'][$footIndex]) $insoleOptions[$footIndex][] = $post['evamonothick'][$footIndex]; break; case 'bi': $insoleOptions[$footIndex][] = 'EVABI3055'; break; } break; } if (is_array($post['termopostmedio'][$footIndex])) foreach($post['termopostmedio'][$footIndex] as $f) $insoleOptions[$footIndex][] = $f; if (is_array($post['forrado'][$footIndex])) foreach($post['forrado'][$footIndex] as $f) $insoleOptions[$footIndex][] = $f; $insoleOptions[$footIndex] = $this->TranslateAttValueNamesToId($insoleOptions[$footIndex]); } $this->setAttribute('IND_InsoleType',trim($post['IND_InsoleType']),trim($post['IND_InsoleType'])); $this->setAttributeM('InsoleOptions',$insoleOptions[0],$insoleOptions[1]); $this->setAttributeMemo('InsoleOptionsComments',trim($post['InsoleOptionsComments'][0]),trim($post['InsoleOptionsComments'][1])); $this->setAttributeMemo('TI_PS_ShippingAddress',trim($post['TI_PS_ShippingAddress'])); $this->setAttribute('ShoeSizeEU',trim($post['ShoeSizeEU'][0]),trim($post['ShoeSizeEU'][1])); $this->setAttribute('TI_PS_RetropieMedialHS',trim($post['TI_PS_RetropieMedialHS'][0]),trim($post['TI_PS_RetropieMedialHS'][1])); $this->setAttribute('TI_PS_RetropieMedialHSGrados',trim($post['TI_PS_RetropieMedialHSGrados'][0]),trim($post['TI_PS_RetropieMedialHSGrados'][1])); $this->setAttribute('TI_PS_RetropieMedialHSMM',trim($post['TI_PS_RetropieMedialHSMM'][0]),trim($post['TI_PS_RetropieMedialHSMM'][1])); $this->setAttribute('TI_PS_RetropieLateralHS',trim($post['TI_PS_RetropieLateralHS'][0]),trim($post['TI_PS_RetropieLateralHS'][1])); $this->setAttribute('TI_PS_RetropieLateralHSGrados',trim($post['TI_PS_RetropieLateralHSGrados'][0]),trim($post['TI_PS_RetropieLateralHSGrados'][1])); $this->setAttribute('TI_PS_RetropieLateralHSMM',trim($post['TI_PS_RetropieLateralHSMM'][0]),trim($post['TI_PS_RetropieLateralHSMM'][1])); $this->setAttribute('TI_PS_RetropieRecrecido',trim($post['TI_PS_RetropieRecrecido'][0]),trim($post['TI_PS_RetropieRecrecido'][1])); $this->setAttribute('TI_PS_RetropieRecrecidoMM',trim($post['TI_PS_RetropieRecrecidoMM'][0]),trim($post['TI_PS_RetropieRecrecidoMM'][1])); $this->setAttribute('TI_PS_RetropieTaloPoron',trim($post['TI_PS_RetropieTaloPoron'][0]),trim($post['TI_PS_RetropieTaloPoron'][1])); $this->setAttribute('TI_PS_RetropieTaloEsta',trim($post['TI_PS_RetropieTaloEsta'][0]),trim($post['TI_PS_RetropieTaloEsta'][1])); $this->setAttribute('TI_PS_RetropieTaloEstaMM',trim($post['TI_PS_RetropieTaloEstaMM'][0]),trim($post['TI_PS_RetropieTaloEstaMM'][1])); $this->setAttribute('TI_PS_RetropieTaloCorta',trim($post['TI_PS_RetropieTaloCorta'][0]),trim($post['TI_PS_RetropieTaloCorta'][1])); $this->setAttribute('TI_PS_RetropieTaloCortaMM',trim($post['TI_PS_RetropieTaloCortaMM'][0]),trim($post['TI_PS_RetropieTaloCortaMM'][1])); $this->setAttribute('TI_PS_RetropieAlzaMM',trim($post['TI_PS_RetropieAlzaMM'][0]),trim($post['TI_PS_RetropieAlzaMM'][1])); $this->setAttribute('TI_PS_RetropieAlza',trim($post['TI_PS_RetropieAlza'][0]),trim($post['TI_PS_RetropieAlza'][1])); $this->setAttribute('TI_PS_PartesBlandasMolde',trim($post['TI_PS_PartesBlandasMolde'][0]),trim($post['TI_PS_PartesBlandasMolde'][1])); if (!$post['TI_PS_PartesBlandasMedial'][0]) $post['TI_PS_PartesBlandasMedial'][0] =0; if (!$post['TI_PS_PartesBlandasMedial'][1]) $post['TI_PS_PartesBlandasMedial'][1] =0; if (!$post['TI_PS_PartesBlandasLateral'][0]) $post['TI_PS_PartesBlandasLateral'][0] =0; if (!$post['TI_PS_PartesBlandasLateral'][1]) $post['TI_PS_PartesBlandasLateral'][1] =0; if (!$post['TI_PS_PartesBlandasTalonLateral'][0]) $post['TI_PS_PartesBlandasTalonLateral'][0] =0; if (!$post['TI_PS_PartesBlandasTalonLateral'][1]) $post['TI_PS_PartesBlandasTalonLateral'][1] =0; $this->setAttribute('TI_PS_PartesBlandasMedial',trim($post['TI_PS_PartesBlandasMedial'][0]),trim($post['TI_PS_PartesBlandasMedial'][1])); $this->setAttribute('TI_PS_PartesBlandasLateral',trim($post['TI_PS_PartesBlandasLateral'][0]),trim($post['TI_PS_PartesBlandasLateral'][1])); $this->setAttribute('TI_PS_PartesBlandasTalonLateral',trim($post['TI_PS_PartesBlandasTalonLateral'][0]),trim($post['TI_PS_PartesBlandasTalonLateral'][1])); $this->setAttribute('TI_PS_PartesBlandasMedialMM',trim($post['TI_PS_PartesBlandasMedialMM'][0]),trim($post['TI_PS_PartesBlandasMedialMM'][1])); $this->setAttribute('TI_PS_PartesBlandasLateralMM',trim($post['TI_PS_PartesBlandasLateralMM'][0]),trim($post['TI_PS_PartesBlandasLateralMM'][1])); $this->setAttribute('TI_PS_PartesBlandasTalonLateralMM',trim($post['TI_PS_PartesBlandasTalonLateralMM'][0]),trim($post['TI_PS_PartesBlandasTalonLateralMM'][1])); $this->setAttribute('TI_PS_AntepieBarra',trim($post['TI_PS_AntepieBarra'][0]),trim($post['TI_PS_AntepieBarra'][1])); $this->setAttribute('TI_PS_AntepieBarraMM',trim($post['TI_PS_AntepieBarraMM'][0]),trim($post['TI_PS_AntepieBarraMM'][1])); $this->setAttribute('TI_PS_AntepieAlmendra',trim($post['TI_PS_AntepieAlmendra'][0]),trim($post['TI_PS_AntepieAlmendra'][1])); $this->setAttribute('TI_PS_AntepieAlmendraMM',trim($post['TI_PS_AntepieAlmendraMM'][0]),trim($post['TI_PS_AntepieAlmendraMM'][1])); $this->setAttribute('TI_PS_AntepieDescargas',trim($post['TI_PS_AntepieDescargas'][0]),trim($post['TI_PS_AntepieDescargas'][1])); $this->setAttribute('TI_PS_AntepieCabezaM1',trim($post['TI_PS_AntepieCabezaM1'][0]),trim($post['TI_PS_AntepieCabezaM1'][1])); $this->setAttribute('TI_PS_AntepieCabezaM2',trim($post['TI_PS_AntepieCabezaM2'][0]),trim($post['TI_PS_AntepieCabezaM2'][1])); $this->setAttribute('TI_PS_AntepieCabezaM3',trim($post['TI_PS_AntepieCabezaM3'][0]),trim($post['TI_PS_AntepieCabezaM3'][1])); $this->setAttribute('TI_PS_AntepieCabezaM4',trim($post['TI_PS_AntepieCabezaM4'][0]),trim($post['TI_PS_AntepieCabezaM4'][1])); $this->setAttribute('TI_PS_AntepieCabezaM5',trim($post['TI_PS_AntepieCabezaM5'][0]),trim($post['TI_PS_AntepieCabezaM5'][1])); $this->setAttribute('TI_PS_AntepieDescSubDecMM',trim($post['TI_PS_AntepieDescSubDecMM'][0]),trim($post['TI_PS_AntepieDescSubDecMM'][1])); $this->setAttribute('TI_PS_AntepieDescSubDecPoron',trim($post['TI_PS_AntepieDescSubDecPoron'][0]),trim($post['TI_PS_AntepieDescSubDecPoron'][1])); $this->setAttribute('TI_PS_AntepieDescSubCutOutMM',trim($post['TI_PS_AntepieDescSubCutOutMM'][0]),trim($post['TI_PS_AntepieDescSubCutOutMM'][1])); $this->setAttribute('TI_PS_AntepieDescSubCutOutPoron',trim($post['TI_PS_AntepieDescSubCutOutPoron'][0]),trim($post['TI_PS_AntepieDescSubCutOutPoron'][1])); $this->setAttribute('TI_PS_AntepieCunaPro',trim($post['TI_PS_AntepieCunaPro'][0]),trim($post['TI_PS_AntepieCunaPro'][1])); $this->setAttribute('TI_PS_AntepieCunaProMM',trim($post['TI_PS_AntepieCunaProMM'][0]),trim($post['TI_PS_AntepieCunaProMM'][1])); $this->setAttribute('TI_PS_AntepieCunaSup',trim($post['TI_PS_AntepieCunaSup'][0]),trim($post['TI_PS_AntepieCunaSup'][1])); $this->setAttribute('TI_PS_AntepieCunaSupMM',trim($post['TI_PS_AntepieCunaSupMM'][0]),trim($post['TI_PS_AntepieCunaSupMM'][1])); $this->setAttribute('TI_PS_AntepieBalanceInv',trim($post['TI_PS_AntepieBalanceInv'][0]),trim($post['TI_PS_AntepieBalanceInv'][1])); $this->setAttribute('TI_PS_AntepieBalanceEver',trim($post['TI_PS_AntepieBalanceEver'][0]),trim($post['TI_PS_AntepieBalanceEver'][1])); $this->setAttribute('TI_PS_AntepieBalanceInvGrados',trim($post['TI_PS_AntepieBalanceInvGrados'][0]),trim($post['TI_PS_AntepieBalanceInvGrados'][1])); $this->setAttribute('TI_PS_AntepieBalanceEverGrados',trim($post['TI_PS_AntepieBalanceEverGrados'][0]),trim($post['TI_PS_AntepieBalanceEverGrados'][1])); $this->setAttribute('TI_PS_AntepieBajarALI', trim($post['TI_PS_AntepieBajarALI'][0]),trim($post['TI_PS_AntepieBajarALI'][1])); $this->setAttribute('TI_PS_AntepieBajarALIInt', trim($post['TI_PS_AntepieBajarALIInt'][0]),trim($post['TI_PS_AntepieBajarALIInt'][1])); // Codigo para limpiar el diseño si ha cambaido el modo Palmilla /* $atPalmilla =& $this->getAttributeByTypeName('TI_PS_Palmilla'); $oldPalmillaActive = ($atPalmilla && $atPalmilla->value_left=='1'); $newPalmillaActive = trim($post['TI_PS_Palmilla']) == '1'; if ($oldPalmillaActive != $newPalmillaActive) $this->clearDesign(); */ $this->setAttribute('TI_PS_AntepieKineticWedge',trim($post['TI_PS_AntepieKineticWedge'][0]),trim($post['TI_PS_AntepieKineticWedge'][1])); $this->setAttribute('TI_PS_FORRADO34',trim($post['TI_PS_FORRADO34'][0]),trim($post['TI_PS_FORRADO34'][1])); $this->setAttribute('TI_PS_FORRADOColorEVA2',trim($post['TI_PS_FORRADOColorEVA2'][0]),trim($post['TI_PS_FORRADOColorEVA2'][1])); $this->setAttribute('TI_PS_FORRADOColorEVA3',trim($post['TI_PS_FORRADOColorEVA3'][0]),trim($post['TI_PS_FORRADOColorEVA3'][1])); $this->setAttribute('TI_PS_FORRADOColorShockIcel',trim($post['TI_PS_FORRADOColorShockIcel'][0]),trim($post['TI_PS_FORRADOColorShockIcel'][1])); $this->setAttribute('TI_PS_Palmilla',trim($post['TI_PS_Palmilla'])); $this->setAttribute('TI_PS_PalmillaAlmendra',trim($post['TI_PS_PalmillaAlmendra'][0]),trim($post['TI_PS_PalmillaAlmendra'][1])); $this->setAttribute('TI_PS_PalmillaAlmendraMM',trim($post['TI_PS_PalmillaAlmendraMM'][0]),trim($post['TI_PS_PalmillaAlmendraMM'][1])); $this->setAttribute('TI_PS_PalmillaBarra',trim($post['TI_PS_PalmillaBarra'][0]),trim($post['TI_PS_PalmillaBarra'][1])); $this->setAttribute('TI_PS_PalmillaBarraMM',trim($post['TI_PS_PalmillaBarraMM'][0]),trim($post['TI_PS_PalmillaBarraMM'][1])); $this->setAttribute('TI_PS_PalmillaHerradura',trim($post['TI_PS_PalmillaHerradura'][0]),trim($post['TI_PS_PalmillaHerradura'][1])); $this->setAttribute('TI_PS_PalmillaDescargaM1',trim($post['TI_PS_PalmillaDescargaM1'][0]),trim($post['TI_PS_PalmillaDescargaM1'][1])); $this->setAttribute('TI_PS_PalmillaDescargaM2',trim($post['TI_PS_PalmillaDescargaM2'][0]),trim($post['TI_PS_PalmillaDescargaM2'][1])); $this->setAttribute('TI_PS_PalmillaDescargaM3',trim($post['TI_PS_PalmillaDescargaM3'][0]),trim($post['TI_PS_PalmillaDescargaM3'][1])); $this->setAttribute('TI_PS_PalmillaDescargaM4',trim($post['TI_PS_PalmillaDescargaM4'][0]),trim($post['TI_PS_PalmillaDescargaM4'][1])); $this->setAttribute('TI_PS_PalmillaDescargaM5',trim($post['TI_PS_PalmillaDescargaM5'][0]),trim($post['TI_PS_PalmillaDescargaM5'][1])); $this->setAttribute('TI_PS_AntepieBalanceInvInt',trim($post['TI_PS_AntepieBalanceInvInt'][0]),trim($post['TI_PS_AntepieBalanceInvInt'][1])); $this->setAttribute('TI_PS_AntepieBalanceEverInt',trim($post['TI_PS_AntepieBalanceEverInt'][0]),trim($post['TI_PS_AntepieBalanceEverInt'][1])); $this->setAttribute('TI_PS_PalmillaAlza',trim($post['TI_PS_PalmillaAlza'][0]),trim($post['TI_PS_PalmillaAlza'][1])); $this->setAttribute('TI_PS_PalmillaAlzaMM',trim($post['TI_PS_PalmillaAlzaMM'][0]),trim($post['TI_PS_PalmillaAlzaMM'][1])); $this->setAttribute('TI_PS_InsoleFoot',trim($post['TI_PS_InsoleFoot'])); break; case 'default_newtecnoinsole': case 'default_tecnoinsole': case 'default': $insoleOptions = array(); if ($post['TI_PS_InsoleFoot']==1) { $footStart =0; $footEnd = 1; }elseif ($post['TI_PS_InsoleFoot']==2) { $footStart =1; $footEnd = 2; } else { $footStart =0; $footEnd = 2; } for ($footIndex=$footStart;$footIndex<$footEnd;$footIndex++) { $insoleOptions[$footIndex] = array(); switch($post['tipoinsole']) { case 'mecanizado3caras': $insoleOptions[$footIndex][] = 'MECAPOLIPRO3SIDED'; break; case 'mecanizado': $insoleOptions[$footIndex][] = $post['mecamat'][$footIndex]; break; case 'positivo': $insoleOptions[$footIndex][] = 'POSITIVO'; break; case 'eva': switch($post['tipoeva'][$footIndex]) { case 'mono': if ($post['evamonothick'][$footIndex]) $insoleOptions[$footIndex][] = $post['evamonothick'][$footIndex]; break; case 'bi': if ($post['evabithick'][$footIndex]) $insoleOptions[$footIndex][] = $post['evabithick'][$footIndex]; else $insoleOptions[$footIndex][] = 'EVABI3055'; break; } break; case '3dconfort': switch($post['tipoeva'][$footIndex]) { case 'mono': if ($post['evamonothick'][$footIndex]) { switch($post['evamonothick'][$footIndex]) { case 'EVAMONO30': $insoleOptions[$footIndex][] = '3DCONFORTMONO30'; break; case 'EVAMONO40': $insoleOptions[$footIndex][] = '3DCONFORTMONO40'; break; } } break; case 'bi': if ($post['evabithick'][$footIndex]) { switch($post['evabithick'][$footIndex]) { case 'EVABI3055': $insoleOptions[$footIndex][] = '3DCONFORTBI3055'; break; case 'EVABI4055SPORT': $insoleOptions[$footIndex][] = '3DCONFORTBI4055SPORT'; break; } } else $insoleOptions[$footIndex][] = '3DCONFORTBI3055'; break; } break; case 'termo': switch($post['termomat'][$footIndex]) { case 'polipro': if ($post['termopoliprothick'][$footIndex]) $insoleOptions[$footIndex][] = $post['termopoliprothick'][$footIndex]; break; case 'carbono': $insoleOptions[$footIndex][] = "TERMOCARBONO15"; break; case 'resina': if ($post['termoresinatipo'][$footIndex]) $insoleOptions[$footIndex][] = $post['termoresinatipo'][$footIndex]; break; case 'polieti': if ($post['termopolietithick'][$footIndex]) $insoleOptions[$footIndex][] = $post['termopolietithick'][$footIndex]; break; } break; } if (is_array($post['termopostmedio'][$footIndex])) foreach($post['termopostmedio'][$footIndex] as $f) $insoleOptions[$footIndex][] = $f; if (is_array($post['forrado'][$footIndex])) foreach($post['forrado'][$footIndex] as $f) $insoleOptions[$footIndex][] = $f; $insoleOptions[$footIndex] = $this->TranslateAttValueNamesToId($insoleOptions[$footIndex]); } $this->setAttributeM('InsoleOptions',$insoleOptions[0],$insoleOptions[1]); $this->setAttributeMemo('InsoleOptionsComments',trim($post['InsoleOptionsComments'][0]),trim($post['InsoleOptionsComments'][1])); $this->setAttributeMemo('TI_PS_ShippingAddress',trim($post['TI_PS_ShippingAddress'])); $this->setAttribute('TI_PS_Gender',trim($post['TI_PS_Gender'])); $this->setAttribute('TI_PS_FiberMaterial',trim($post['TI_PS_FiberMaterial'][0]),trim($post['TI_PS_FiberMaterial'][1])); $this->setAttribute('TI_PS_PolyMaterialColor',trim($post['TI_PS_PolyMaterialColor']),trim($post['TI_PS_PolyMaterialColor'])); $this->setAttribute('TI_PS_MediopieRellenoAFascial',trim($post['TI_PS_MediopieRellenoAFascial'][0]),trim($post['TI_PS_MediopieRellenoAFascial'][1])); $this->setAttribute('TI_PS_MakeHoles',trim($post['TI_PS_MakeHoles'][0]),trim($post['TI_PS_MakeHoles'][1])); $this->setAttribute('TI_PS_Unfinished',trim($post['TI_PS_Unfinished']),trim($post['TI_PS_Unfinished'])); $this->setAttribute('TI_PS_Tratamiento',trim($post['TI_PS_Tratamiento']),trim($post['TI_PS_Tratamiento'])); $this->setAttribute('TI_PS_Material',trim($post['TI_PS_Material']),trim($post['TI_PS_Material'])); $this->setAttribute('ShoeSizeEU',trim($post['ShoeSizeEU'][0]),trim($post['ShoeSizeEU'][1])); $this->setAttribute('TI_PS_RetropieMedialHS',trim($post['TI_PS_RetropieMedialHS'][0]),trim($post['TI_PS_RetropieMedialHS'][1])); $this->setAttribute('TI_PS_RetropieMedialHSGrados',trim($post['TI_PS_RetropieMedialHSGrados'][0]),trim($post['TI_PS_RetropieMedialHSGrados'][1])); $this->setAttribute('TI_PS_RetropieMedialHSMM',trim($post['TI_PS_RetropieMedialHSMM'][0]),trim($post['TI_PS_RetropieMedialHSMM'][1])); $this->setAttribute('TI_PS_RetropieLateralHS',trim($post['TI_PS_RetropieLateralHS'][0]),trim($post['TI_PS_RetropieLateralHS'][1])); $this->setAttribute('TI_PS_RetropieLateralHSGrados',trim($post['TI_PS_RetropieLateralHSGrados'][0]),trim($post['TI_PS_RetropieLateralHSGrados'][1])); $this->setAttribute('TI_PS_RetropieLateralHSMM',trim($post['TI_PS_RetropieLateralHSMM'][0]),trim($post['TI_PS_RetropieLateralHSMM'][1])); $this->setAttribute('TI_PS_RetropieRecrecido',trim($post['TI_PS_RetropieRecrecido'][0]),trim($post['TI_PS_RetropieRecrecido'][1])); $this->setAttribute('TI_PS_RetropieRecrecidoPoron',trim($post['TI_PS_RetropieRecrecidoPoron'][0]),trim($post['TI_PS_RetropieRecrecidoPoron'][1])); $this->setAttribute('TI_PS_RetropieRecrecidoMM',trim($post['TI_PS_RetropieRecrecidoMM'][0]),trim($post['TI_PS_RetropieRecrecidoMM'][1])); $this->setAttribute('TI_PS_RetropieTaloPoron',trim($post['TI_PS_RetropieTaloPoron'][0]),trim($post['TI_PS_RetropieTaloPoron'][1])); // Forros $this->setAttribute('TI_PS_FORRADOEvaGrip25_3mm',trim($post['TI_PS_FORRADOEvaGrip25_3mm'][0]),trim($post['TI_PS_FORRADOEvaGrip25_3mm'][1])); $this->setAttribute('TI_PS_FORRADOTEC35RF25GRIS',trim($post['TI_PS_FORRADOTEC35RF25GRIS'][0]),trim($post['TI_PS_FORRADOTEC35RF25GRIS'][1])); $this->setAttribute('TI_PS_FORRADOTEC2SANVERDE',trim($post['TI_PS_FORRADOTEC2SANVERDE'][0]),trim($post['TI_PS_FORRADOTEC2SANVERDE'][1])); $this->setAttribute('TI_PS_FORRADOTEC3SANVERDE',trim($post['TI_PS_FORRADOTEC3SANVERDE'][0]),trim($post['TI_PS_FORRADOTEC3SANVERDE'][1])); $this->setAttribute('TI_PS_FORRADOTEC3AZULCOB',trim($post['TI_PS_FORRADOTEC3AZULCOB'][0]),trim($post['TI_PS_FORRADOTEC3AZULCOB'][1])); $this->setAttribute('TI_PS_FORRADOTEC3VARIOS',trim($post['TI_PS_FORRADOTEC3VARIOS'][0]),trim($post['TI_PS_FORRADOTEC3VARIOS'][1])); $this->setAttribute('TI_PS_FORRADOEST2VARIOS',trim($post['TI_PS_FORRADOEST2VARIOS'][0]),trim($post['TI_PS_FORRADOEST2VARIOS'][1])); $this->setAttribute('TI_PS_FORRADOEST3VARIOS',trim($post['TI_PS_FORRADOEST3VARIOS'][0]),trim($post['TI_PS_FORRADOEST3VARIOS'][1])); $this->setAttribute('TI_PS_FORRADOMICFCAMEL',trim($post['TI_PS_FORRADOMICFCAMEL'][0]),trim($post['TI_PS_FORRADOMICFCAMEL'][1])); $this->setAttribute('TI_PS_FORRADOMICFTABACO',trim($post['TI_PS_FORRADOMICFTABACO'][0]),trim($post['TI_PS_FORRADOMICFTABACO'][1])); $this->setAttribute('TI_PS_FORRADOMICFCRUDO',trim($post['TI_PS_FORRADOMICFCRUDO'][0]),trim($post['TI_PS_FORRADOMICFCRUDO'][1])); $this->setAttribute('TI_PS_FORRADOMICFPERFBEIGE',trim($post['TI_PS_FORRADOMICFPERFBEIGE'][0]),trim($post['TI_PS_FORRADOMICFPERFBEIGE'][1])); $this->setAttribute('TI_PS_FORRADOMICFVARIOS',trim($post['TI_PS_FORRADOMICFVARIOS'][0]),trim($post['TI_PS_FORRADOMICFVARIOS'][1])); $this->setAttribute('TI_PS_FORRADOPIEL',trim($post['TI_PS_FORRADOPIEL'][0]),trim($post['TI_PS_FORRADOPIEL'][1])); $this->setAttribute('TI_PS_RetropiePostEsta',($post['TI_PS_RetropiePostEsta'][0]),($post['TI_PS_RetropiePostEsta'][1])); $this->setAttribute('TI_PS_RetropieTaloEsta',trim($post['TI_PS_RetropieTaloEsta'][0]),trim($post['TI_PS_RetropieTaloEsta'][1])); $this->setAttribute('TI_PS_RetropieTaloEstaMM',trim($post['TI_PS_RetropieTaloEstaMM'][0]),trim($post['TI_PS_RetropieTaloEstaMM'][1])); $this->setAttribute('TI_PS_RetropieTaloCorta',trim($post['TI_PS_RetropieTaloCorta'][0]),trim($post['TI_PS_RetropieTaloCorta'][1])); $this->setAttribute('TI_PS_RetropieTaloCortaMM',trim($post['TI_PS_RetropieTaloCortaMM'][0]),trim($post['TI_PS_RetropieTaloCortaMM'][1])); $this->setAttribute('TI_PS_RetropieAlzaMM',trim($post['TI_PS_RetropieAlzaMM'][0]),trim($post['TI_PS_RetropieAlzaMM'][1])); $this->setAttribute('TI_PS_RetropieAlza',trim($post['TI_PS_RetropieAlza'][0]),trim($post['TI_PS_RetropieAlza'][1])); $this->setAttribute('TI_PS_PartesBlandasMolde',trim($post['TI_PS_PartesBlandasMolde'][0]),trim($post['TI_PS_PartesBlandasMolde'][1])); if (!$post['TI_PS_PartesBlandasMedial'][0]) $post['TI_PS_PartesBlandasMedial'][0] =0; if (!$post['TI_PS_PartesBlandasMedial'][1]) $post['TI_PS_PartesBlandasMedial'][1] =0; if (!$post['TI_PS_PartesBlandasLateral'][0]) $post['TI_PS_PartesBlandasLateral'][0] =0; if (!$post['TI_PS_PartesBlandasLateral'][1]) $post['TI_PS_PartesBlandasLateral'][1] =0; if (!$post['TI_PS_PartesBlandasTalonLateral'][0]) $post['TI_PS_PartesBlandasTalonLateral'][0] =0; if (!$post['TI_PS_PartesBlandasTalonLateral'][1]) $post['TI_PS_PartesBlandasTalonLateral'][1] =0; $this->setAttribute('TI_PS_PartesBlandasMedial',trim($post['TI_PS_PartesBlandasMedial'][0]),trim($post['TI_PS_PartesBlandasMedial'][1])); $this->setAttribute('TI_PS_PartesBlandasLateral',trim($post['TI_PS_PartesBlandasLateral'][0]),trim($post['TI_PS_PartesBlandasLateral'][1])); $this->setAttribute('TI_PS_PartesBlandasTalonLateral',trim($post['TI_PS_PartesBlandasTalonLateral'][0]),trim($post['TI_PS_PartesBlandasTalonLateral'][1])); $this->setAttribute('TI_PS_PartesBlandasMedialMM',trim($post['TI_PS_PartesBlandasMedialMM'][0]),trim($post['TI_PS_PartesBlandasMedialMM'][1])); $this->setAttribute('TI_PS_PartesBlandasLateralMM',trim($post['TI_PS_PartesBlandasLateralMM'][0]),trim($post['TI_PS_PartesBlandasLateralMM'][1])); $this->setAttribute('TI_PS_PartesBlandasTalonLateralMM',trim($post['TI_PS_PartesBlandasTalonLateralMM'][0]),trim($post['TI_PS_PartesBlandasTalonLateralMM'][1])); $this->setAttribute('TI_PS_AntepieBarra',trim($post['TI_PS_AntepieBarra'][0]),trim($post['TI_PS_AntepieBarra'][1])); $this->setAttribute('TI_PS_AntepieBarraMM',trim($post['TI_PS_AntepieBarraMM'][0]),trim($post['TI_PS_AntepieBarraMM'][1])); $this->setAttribute('TI_PS_AntepieAlmendra',trim($post['TI_PS_AntepieAlmendra'][0]),trim($post['TI_PS_AntepieAlmendra'][1])); $this->setAttribute('TI_PS_AntepieAlmendraMM',trim($post['TI_PS_AntepieAlmendraMM'][0]),trim($post['TI_PS_AntepieAlmendraMM'][1])); $this->setAttribute('TI_PS_AntepieDescargas',trim($post['TI_PS_AntepieDescargas'][0]),trim($post['TI_PS_AntepieDescargas'][1])); $this->setAttribute('TI_PS_AntepieCabezaM1',trim($post['TI_PS_AntepieCabezaM1'][0]),trim($post['TI_PS_AntepieCabezaM1'][1])); $this->setAttribute('TI_PS_AntepieCabezaM2',trim($post['TI_PS_AntepieCabezaM2'][0]),trim($post['TI_PS_AntepieCabezaM2'][1])); $this->setAttribute('TI_PS_AntepieCabezaM3',trim($post['TI_PS_AntepieCabezaM3'][0]),trim($post['TI_PS_AntepieCabezaM3'][1])); $this->setAttribute('TI_PS_AntepieCabezaM4',trim($post['TI_PS_AntepieCabezaM4'][0]),trim($post['TI_PS_AntepieCabezaM4'][1])); $this->setAttribute('TI_PS_AntepieCabezaM5',trim($post['TI_PS_AntepieCabezaM5'][0]),trim($post['TI_PS_AntepieCabezaM5'][1])); $this->setAttribute('TI_PS_AntepieCabezaCutOutM1',trim($post['TI_PS_AntepieCabezaCutOutM1'][0]),trim($post['TI_PS_AntepieCabezaCutOutM1'][1])); $this->setAttribute('TI_PS_AntepieCabezaCutOutM2',trim($post['TI_PS_AntepieCabezaCutOutM2'][0]),trim($post['TI_PS_AntepieCabezaCutOutM2'][1])); $this->setAttribute('TI_PS_AntepieCabezaCutOutM3',trim($post['TI_PS_AntepieCabezaCutOutM3'][0]),trim($post['TI_PS_AntepieCabezaCutOutM3'][1])); $this->setAttribute('TI_PS_AntepieCabezaCutOutM4',trim($post['TI_PS_AntepieCabezaCutOutM4'][0]),trim($post['TI_PS_AntepieCabezaCutOutM4'][1])); $this->setAttribute('TI_PS_AntepieCabezaCutOutM5',trim($post['TI_PS_AntepieCabezaCutOutM5'][0]),trim($post['TI_PS_AntepieCabezaCutOutM5'][1])); $this->setAttribute('TI_PS_AntepieDescHerrEVAMM',trim($post['TI_PS_AntepieDescHerrEVAMM'][0]),trim($post['TI_PS_AntepieDescHerrEVAMM'][1])); $this->setAttribute('TI_PS_AntepieDescHerrEVAMetas',trim($post['TI_PS_AntepieDescHerrEVAMetas'][0]),trim($post['TI_PS_AntepieDescHerrEVAMetas'][1])); $this->setAttribute('TI_PS_AntepieDescHerrEVAPoron',trim($post['TI_PS_AntepieDescHerrEVAPoron'][0]),trim($post['TI_PS_AntepieDescHerrEVAPoron'][1])); $this->setAttribute('TI_PS_AntepieDescSubDecMM',trim($post['TI_PS_AntepieDescSubDecMM'][0]),trim($post['TI_PS_AntepieDescSubDecMM'][1])); $this->setAttribute('TI_PS_AntepieDescSubDecPoron',trim($post['TI_PS_AntepieDescSubDecPoron'][0]),trim($post['TI_PS_AntepieDescSubDecPoron'][1])); $this->setAttribute('TI_PS_AntepieDescSubCutOutMM',trim($post['TI_PS_AntepieDescSubCutOutMM'][0]),trim($post['TI_PS_AntepieDescSubCutOutMM'][1])); $this->setAttribute('TI_PS_AntepieDescSubCutOutPoron',trim($post['TI_PS_AntepieDescSubCutOutPoron'][0]),trim($post['TI_PS_AntepieDescSubCutOutPoron'][1])); $this->setAttribute('TI_PS_AntepieCunaPro',trim($post['TI_PS_AntepieCunaPro'][0]),trim($post['TI_PS_AntepieCunaPro'][1])); $this->setAttribute('TI_PS_AntepieCunaProMM',trim($post['TI_PS_AntepieCunaProMM'][0]),trim($post['TI_PS_AntepieCunaProMM'][1])); $this->setAttribute('TI_PS_AntepieCunaSup',trim($post['TI_PS_AntepieCunaSup'][0]),trim($post['TI_PS_AntepieCunaSup'][1])); $this->setAttribute('TI_PS_AntepieCunaSupMM',trim($post['TI_PS_AntepieCunaSupMM'][0]),trim($post['TI_PS_AntepieCunaSupMM'][1])); $this->setAttribute('TI_PS_AntepieMortonRigid',trim($post['TI_PS_AntepieMortonRigid'][0]),trim($post['TI_PS_AntepieMortonRigid'][1])); $this->setAttribute('TI_PS_AntepieMortonEVA',trim($post['TI_PS_AntepieMortonEVA'][0]),trim($post['TI_PS_AntepieMortonEVA'][1])); $this->setAttribute('TI_PS_AntepieMortonEVAMM',trim($post['TI_PS_AntepieMortonEVAMM'][0]),trim($post['TI_PS_AntepieMortonEVAMM'][1])); $this->setAttribute('TI_PS_AntepieBalanceInv',trim($post['TI_PS_AntepieBalanceInv'][0]),trim($post['TI_PS_AntepieBalanceInv'][1])); $this->setAttribute('TI_PS_AntepieBalanceEver',trim($post['TI_PS_AntepieBalanceEver'][0]),trim($post['TI_PS_AntepieBalanceEver'][1])); $this->setAttribute('TI_PS_AntepieBalanceInvGrados',trim($post['TI_PS_AntepieBalanceInvGrados'][0]),trim($post['TI_PS_AntepieBalanceInvGrados'][1])); $this->setAttribute('TI_PS_AntepieBalanceEverGrados',trim($post['TI_PS_AntepieBalanceEverGrados'][0]),trim($post['TI_PS_AntepieBalanceEverGrados'][1])); $this->setAttribute('TI_PS_AntepieBajarALI', trim($post['TI_PS_AntepieBajarALI'][0]),trim($post['TI_PS_AntepieBajarALI'][1])); $this->setAttribute('TI_PS_AntepieBajarALIInt', trim($post['TI_PS_AntepieBajarALIInt'][0]),trim($post['TI_PS_AntepieBajarALIInt'][1])); $this->setAttribute('TI_PS_AntepieBarraMetaExt',trim($post['TI_PS_AntepieBarraMetaExt'][0]),trim($post['TI_PS_AntepieBarraMetaExt'][1])); $this->setAttribute('TI_PS_AntepieBarraMetaExtMetas',trim($post['TI_PS_AntepieBarraMetaExtMetas'][0]),trim($post['TI_PS_AntepieBarraMetaExtMetas'][1])); $this->setAttribute('TI_PS_AntepieExpansion',trim($post['TI_PS_AntepieExpansion'][0]),trim($post['TI_PS_AntepieExpansion'][1])); $this->setAttribute('TI_PS_AntepieAlmendraMetaExt', trim($post['TI_PS_AntepieAlmendraMetaExt'][0]),trim($post['TI_PS_AntepieAlmendraMetaExt'][1])); $this->setAttribute('TI_PS_AntepieAlmendraMetaExtMetas',trim($post['TI_PS_AntepieAlmendraMetaExtMetas'][0]),trim($post['TI_PS_AntepieAlmendraMetaExtMetas'][1])); // Codigo para limpiar el diseño si ha cambaido el modo Palmilla /* $atPalmilla =& $this->getAttributeByTypeName('TI_PS_Palmilla'); $oldPalmillaActive = ($atPalmilla && $atPalmilla->value_left=='1'); $newPalmillaActive = trim($post['TI_PS_Palmilla']) == '1'; if ($oldPalmillaActive != $newPalmillaActive) $this->clearDesign(); */ $this->setAttribute('TI_PS_InsoleThickness',trim($post['TI_PS_InsoleThickness'][0]),trim($post['TI_PS_InsoleThickness'][1])); $this->setAttribute('TI_PS_PolycupThicknessMM',trim($post['TI_PS_PolycupThicknessMM'][0]),trim($post['TI_PS_PolycupThicknessMM'][1])); //$this->setAttribute('TI_PS_MecaArmazonTipo',trim($post['TI_PS_MecaArmazonTipo'][0]),trim($post['TI_PS_MecaArmazonTipo'][1])); //$this->setAttribute('TI_PS_MecaArmazonGaitPlate',trim($post['TI_PS_MecaArmazonGaitPlate'][0]),trim($post['TI_PS_MecaArmazonGaitPlate'][1])); $this->setAttribute('TI_PS_MecaArmazonGaitPlateType',trim($post['TI_PS_MecaArmazonGaitPlateType'][0]),trim($post['TI_PS_MecaArmazonGaitPlateType'][1])); $this->setAttribute('TI_PS_AntepieKineticWedge',trim($post['TI_PS_AntepieKineticWedge'][0]),trim($post['TI_PS_AntepieKineticWedge'][1])); $this->setAttribute('TI_PS_AntepieDescHerraEVA',trim($post['TI_PS_AntepieDescHerraEVA'][0]),trim($post['TI_PS_AntepieDescHerraEVA'][1])); $this->setAttribute('TI_PS_FORRADO34',trim($post['TI_PS_FORRADO34'][0]),trim($post['TI_PS_FORRADO34'][1])); $this->setAttribute('TI_PS_FORRADOColorEVA2',trim($post['TI_PS_FORRADOColorEVA2'][0]),trim($post['TI_PS_FORRADOColorEVA2'][1])); $this->setAttribute('TI_PS_FORRADOColorEVA3',trim($post['TI_PS_FORRADOColorEVA3'][0]),trim($post['TI_PS_FORRADOColorEVA3'][1])); $this->setAttribute('TI_PS_FORRADOColorShockIcel',trim($post['TI_PS_FORRADOColorShockIcel'][0]),trim($post['TI_PS_FORRADOColorShockIcel'][1])); $this->setAttribute('TI_PS_Palmilla',trim($post['TI_PS_Palmilla'])); $this->setAttribute('TI_PS_PalmillaAlmendra',trim($post['TI_PS_PalmillaAlmendra'][0]),trim($post['TI_PS_PalmillaAlmendra'][1])); $this->setAttribute('TI_PS_PalmillaAlmendraMM',trim($post['TI_PS_PalmillaAlmendraMM'][0]),trim($post['TI_PS_PalmillaAlmendraMM'][1])); $this->setAttribute('TI_PS_PalmillaBarra',trim($post['TI_PS_PalmillaBarra'][0]),trim($post['TI_PS_PalmillaBarra'][1])); $this->setAttribute('TI_PS_PalmillaBarraMM',trim($post['TI_PS_PalmillaBarraMM'][0]),trim($post['TI_PS_PalmillaBarraMM'][1])); $this->setAttribute('TI_PS_PalmillaHerradura',trim($post['TI_PS_PalmillaHerradura'][0]),trim($post['TI_PS_PalmillaHerradura'][1])); $this->setAttribute('TI_PS_PalmillaDescargaM1',trim($post['TI_PS_PalmillaDescargaM1'][0]),trim($post['TI_PS_PalmillaDescargaM1'][1])); $this->setAttribute('TI_PS_PalmillaDescargaM2',trim($post['TI_PS_PalmillaDescargaM2'][0]),trim($post['TI_PS_PalmillaDescargaM2'][1])); $this->setAttribute('TI_PS_PalmillaDescargaM3',trim($post['TI_PS_PalmillaDescargaM3'][0]),trim($post['TI_PS_PalmillaDescargaM3'][1])); $this->setAttribute('TI_PS_PalmillaDescargaM4',trim($post['TI_PS_PalmillaDescargaM4'][0]),trim($post['TI_PS_PalmillaDescargaM4'][1])); $this->setAttribute('TI_PS_PalmillaDescargaM5',trim($post['TI_PS_PalmillaDescargaM5'][0]),trim($post['TI_PS_PalmillaDescargaM5'][1])); $this->setAttribute('TI_PS_RetropieInternalHeelCup',trim($post['TI_PS_RetropieInternalHeelCup'][0]),trim($post['TI_PS_RetropieInternalHeelCup'][1])); $this->setAttribute('TI_PS_RetropieInternalHeelCupMM',trim($post['TI_PS_RetropieInternalHeelCupMM'][0]),trim($post['TI_PS_RetropieInternalHeelCupMM'][1])); $this->setAttribute('TI_PS_RetropieExternalHeelCup',trim($post['TI_PS_RetropieExternalHeelCup'][0]),trim($post['TI_PS_RetropieExternalHeelCup'][1])); $this->setAttribute('TI_PS_RetropieExternalHeelCupMM',trim($post['TI_PS_RetropieExternalHeelCupMM'][0]),trim($post['TI_PS_RetropieExternalHeelCupMM'][1])); $this->setAttribute('TI_PS_RetropieTotalHeelCup',trim($post['TI_PS_RetropieTotalHeelCup'][0]),trim($post['TI_PS_RetropieTotalHeelCup'][1])); $this->setAttribute('TI_PS_RetropieTotalHeelCupMM',trim($post['TI_PS_RetropieTotalHeelCupMM'][0]),trim($post['TI_PS_RetropieTotalHeelCupMM'][1])); $this->setAttribute('TI_PS_MediopieAletaInterna',trim($post['TI_PS_MediopieAletaInterna'][0]),trim($post['TI_PS_MediopieAletaInterna'][1])); $this->setAttribute('TI_PS_MediopieAletaExterna',trim($post['TI_PS_MediopieAletaExterna'][0]),trim($post['TI_PS_MediopieAletaExterna'][1])); $this->setAttribute('TI_PS_AntepieBalanceInvInt',trim($post['TI_PS_AntepieBalanceInvInt'][0]),trim($post['TI_PS_AntepieBalanceInvInt'][1])); $this->setAttribute('TI_PS_AntepieBalanceEverInt',trim($post['TI_PS_AntepieBalanceEverInt'][0]),trim($post['TI_PS_AntepieBalanceEverInt'][1])); $this->setAttribute('TI_PS_PalmillaAlza',trim($post['TI_PS_PalmillaAlza'][0]),trim($post['TI_PS_PalmillaAlza'][1])); $this->setAttribute('TI_PS_PalmillaAlzaMM',trim($post['TI_PS_PalmillaAlzaMM'][0]),trim($post['TI_PS_PalmillaAlzaMM'][1])); $this->setAttribute('TI_PS_InsoleFoot',trim($post['TI_PS_InsoleFoot'])); $this->setAttribute('TI_PS_MediopieRefArco',($post['TI_PS_MediopieRefArco'][0]),($post['TI_PS_MediopieRefArco'][1])); $this->setAttribute('TI_PS_MediopieRefArcoSolMM',trim($post['TI_PS_MediopieRefArcoSolMM'][0]),trim($post['TI_PS_MediopieRefArcoSolMM'][1])); $this->setAttribute('TI_PS_MediopieEstALEMM',($post['TI_PS_MediopieEstALEMM'][0]),($post['TI_PS_MediopieEstALEMM'][1])); $this->setAttribute('TI_PS_MediopieRefArcoWaveMM',trim($post['TI_PS_MediopieRefArcoWaveMM'][0]),trim($post['TI_PS_MediopieRefArcoWaveMM'][1])); $this->setAttribute('TI_PS_MediopieRefArcoWaveNOndas',trim($post['TI_PS_MediopieRefArcoWaveNOndas'][0]),trim($post['TI_PS_MediopieRefArcoWaveNOndas'][1])); $this->setAttribute('TI_PS_MediopieBalanceEVA',trim($post['TI_PS_MediopieBalanceEVA'][0]),trim($post['TI_PS_MediopieBalanceEVA'][1])); $this->setAttribute('TI_PS_MediopieBalanceEVAGrados',trim($post['TI_PS_MediopieBalanceEVAGrados'][0]),trim($post['TI_PS_MediopieBalanceEVAGrados'][1])); $this->setAttribute('TI_PS_MediopieBalanceEVAInt',trim($post['TI_PS_MediopieBalanceEVAInt'][0]),trim($post['TI_PS_MediopieBalanceEVAInt'][1])); $this->setAttribute('TI_PS_MediopieDescensoArcoALI',trim($post['TI_PS_MediopieDescensoArcoALI'][0]),trim($post['TI_PS_MediopieDescensoArcoALI'][1])); $this->setAttribute('TI_PS_MediopieDescensoArcoALIInt',trim($post['TI_PS_MediopieDescensoArcoALIInt'][0]),trim($post['TI_PS_MediopieDescensoArcoALIInt'][1])); $this->setAttribute('TI_PS_MediopieDescensoArcoALIMM',trim($post['TI_PS_MediopieDescensoArcoALIMM'][0]),trim($post['TI_PS_MediopieDescensoArcoALIMM'][1])); $this->setAttribute('TI_PS_MediopieDescensoArcoALE',trim($post['TI_PS_MediopieDescensoArcoALE'][0]),trim($post['TI_PS_MediopieDescensoArcoALE'][1])); $this->setAttribute('TI_PS_MediopieDescensoArcoALEInt',trim($post['TI_PS_MediopieDescensoArcoALEInt'][0]),trim($post['TI_PS_MediopieDescensoArcoALEInt'][1])); $this->setAttribute('TI_PS_MediopieDescensoArcoALEMM',trim($post['TI_PS_MediopieDescensoArcoALEMM'][0]),trim($post['TI_PS_MediopieDescensoArcoALEMM'][1])); $this->setAttribute('TI_PS_MediopieBalanceEVATipo',trim($post['TI_PS_MediopieBalanceEVATipo'][0]),trim($post['TI_PS_MediopieBalanceEVATipo'][1])); break; case 'default_jjpodo': $this->setAttributeMemo('PODO_Remarks',trim($post['PODO_Remarks'])); $this->setAttribute('PODO_Finishing',trim($post['PODO_Finishing'])); $this->setAttribute('PODO_NumInsoles',trim($post['PODO_NumInsoles'])); break; case 'default_ppr': $this->setAttributeMemo('PPR_Sonstiges',trim($post['PPR_Sonstiges'])); $this->setAttribute('PPR_SurfaceMilling',trim($post['PPR_SurfaceMilling'])); $this->setAttribute('PPR_ProductionBlock',trim($post['PPR_ProductionBlock'])); $this->setAttribute('PPR_NumberInsoles',trim($post['PPR_NumberInsoles'])); break; case 'default_rotterdam': $this->setAttribute('ROT_MO_CoveredInsole',trim($post['ROT_MO_CoveredInsole']),trim($post['ROT_MO_CoveredInsole'])); $this->setAttribute('ROT_MO_Material',trim($post['ROT_MO_Material']),trim($post['ROT_MO_Material'])); $this->setAttribute('ROT_MO_Covering',trim($post['ROT_MO_Covering']),trim($post['ROT_MO_Covering'])); break; case 'default_lafoot': $this->setAttribute('Lafoot_BasisModel',trim($post['Lafoot_BasisModel'])); $this->setAttribute('Lafoot_EVAMaterial',trim($post['Lafoot_EVAMaterial'])); $this->setAttribute('Lafoot_Covering',trim($post['Lafoot_Covering'])); $this->setAttribute('Lafoot_Looplab',trim($post['Lafoot_Looplab'])); $this->setAttribute('Lafoot_AdjustMArch',trim($post['Lafoot_AdjustMArch'][0]),trim($post['Lafoot_AdjustMArch'][1])); $this->setAttribute('Lafoot_HeelCupLocation',trim($post['Lafoot_HeelCupLocation'][0]),trim($post['Lafoot_HeelCupLocation'][1])); $this->setAttribute('Lafoot_HeelCupMM',trim($post['Lafoot_HeelCupMM'][0]),trim($post['Lafoot_HeelCupMM'][1])); $this->setAttribute('Lafoot_MTPSupport',trim($post['Lafoot_MTPSupport'][0]),trim($post['Lafoot_MTPSupport'][1])); $this->setAttribute('Lafoot_GeneralHeight',trim($post['Lafoot_GeneralHeight'][0]),trim($post['Lafoot_GeneralHeight'][1])); $this->setAttribute('Lafoot_Hielheffing',trim($post['Lafoot_Hielheffing'][0]),trim($post['Lafoot_Hielheffing'][1])); $this->setAttribute('Lafoot_CorrZone',trim($post['Lafoot_CorrZone'][0]),trim($post['Lafoot_CorrZone'][1])); $this->setAttribute('Lafoot_CorrLocation',trim($post['Lafoot_CorrLocation'][0]),trim($post['Lafoot_CorrLocation'][1])); $this->setAttribute('Lafoot_CorrMM',trim($post['Lafoot_CorrMM'][0]),trim($post['Lafoot_CorrMM'][1])); $this->setAttribute('Lafoot_CushioningLocation',trim($post['Lafoot_CushioningLocation'][0]),trim($post['Lafoot_CushioningLocation'][1])); $this->setAttribute('Lafoot_LowerMTP',trim($post['Lafoot_LowerMTP'][0]),trim($post['Lafoot_LowerMTP'][1])); $this->setAttribute('Lafoot_NewShoeBrand',trim($post['Lafoot_NewShoeBrand'])); $this->setAttribute('Lafoot_OtherNewShoe',trim($post['Lafoot_OtherNewShoe'])); $this->setAttribute('Lafoot_NewShoeSize',trim($post['Lafoot_NewShoeSize'])); $this->setAttributeMemo('Lafoot_AnotherRemarks',trim($post['Lafoot_AnotherRemarks'])); break; } } function TranslateAttValueNamesToId($insoleOptions) { if (!is_array($insoleOptions) || count($insoleOptions)==0) return array(); $insoleOptionsS = array(); foreach($insoleOptions as $insoleOption) $insoleOptionsS[] = $this->_db->Quote($insoleOption); $sql = "SELECT vl.id id FROM #__vxc_attributetypevalue vl WHERE vl.name IN ( ".implode(',',$insoleOptionsS).")"; $this->_db->setQuery($sql); $res = $this->_db->loadObjectList(); $ids = array(); foreach($res as $obj) $ids[] = $obj->id; return $ids; } function getUsers() { $data =& $this->getData(); $franchiseId = $data->franchise; if (!$franchiseId) return array(); $sql = "SELECT u.id id , u.name name FROM #__vxc_user u LEFT JOIN #__vxc_userfranchise uf ON uf.userid = u.id WHERE uf.franchise = $franchiseId AND uf.deleted IS NOT TRUE ORDER BY u.name"; $this->_db->setQuery($sql); return $this->_db->loadObjectList(); } function deleteAttsByType($typeName) { if (!$this->_id) return; $sql = "DELETE a FROM #__vxc_attribute a, #__vxc_attributetype ty WHERE a.type = ty.id AND a.orderid = ". $this->_id ." AND ty.name = '".$typeName."'"; $this->_db->Execute($sql); } function clearDesign() { if (!$this->_id) return; $att =& $this->getAttributeByTypeName('InsoleCADProject'); if ($att && $att->id) { $sql = "DELETE FROM #__vxc_attribute WHERE id = ". $att->id; $this->_db->Execute($sql); } $att =& $this->getAttributeByTypeName('InsoleCADCoverProject'); if ($att && $att->id) { $sql = "DELETE FROM #__vxc_attribute WHERE id = ". $att->id; $this->_db->Execute($sql); } } function _getInsoleOptionsWhereClause($insoleOptions=array(),$productOptions=array()) { $cond = array(); $sqlMats = ''; if (count($insoleOptions)>0) foreach($insoleOptions as $mat) { if ($sqlMats) $sqlMats .=" OR "; $sqlMats .=" vl.name = ".$this->_db->Quote($mat) . " OR " ." vr.name = ".$this->_db->Quote($mat) ; } if ($sqlMats) { $sqlMats = " EXISTS( SELECT * FROM #__vxc_attribute at LEFT JOIN #__vxc_attributetype ty ON ty.id = at.type AND ty.name = 'InsoleOptions' LEFT JOIN #__vxc_attributetypevalue vl ON vl.id = at.value_left LEFT JOIN #__vxc_attributetypevalue vr ON vr.id = at.value_right WHERE at.orderid = o.id AND ($sqlMats) ) "; $cond[] = "(".$sqlMats.")"; } $sqlMats2 = ''; if (count($productOptions)>0) foreach($productOptions as $mat) { if ($sqlMats2) $sqlMats2 .=" OR "; $sqlMats2 .=" at.value = ".$this->_db->Quote($mat) ; } if ($sqlMats2) { $sqlMats2 = " EXISTS( SELECT * FROM #__vxc_attribute at WHERE at.orderid = o.id AND at.name=".$this->_db->Quote("general.product"). " AND ($sqlMats2) ) "; $cond[] = "(".$sqlMats2.")"; } if (count($cond)>0) return "(". implode(" OR ",$cond). ")"; else return ""; } function getOrderDistribution($insoleCategories) { $distribution = array(); for ($i=0;$i_id; $insoleOptionsClause = $this->_getInsoleOptionsWhereClause($options,$productOptions); if ($insoleOptionsClause) $sql .= " AND ". $insoleOptionsClause; $this->_db->setQuery($sql); $count = $this->_db->loadResult(); if ($count>0) $distribution[$name] = $count; } return $distribution; } function setArchived($value) { $sqlValue = $value?'TRUE':'FALSE'; $sql = "UPDATE #__vxc_order SET archived = $sqlValue WHERE id = " . $this->_id; $this->_db->Execute($sql); $action = ($value)?'archived':'unarchived'; $order =& $this->getData(); $this->saveLog($order->statenameid,'Order '.$action,FRANCHISEMAN_VISLEVEL); } function CheckUpdateUUID($atUpdateUUID) { $sql = "SELECT o.`uuid` uuid FROM jos_vxc_order o WHERE o.id = ".$this->_id; $this->_db->setQuery($sql); $orderUUID = $this->_db->loadResult(); if ($orderUUID) { // Comprobamos si el updateUUID esta en la lista de updateUUIDS para ese pedido $sql = "INSERT IGNORE INTO jos_vxc_orderupdateuuid(order_uuid, update_uuid) VALUES('".$orderUUID."','".$atUpdateUUID."');"; $this->_db->Execute($sql); } } function postHttps($url,$data) { $params=""; foreach ($data as $key => $value) { if ($params!="") $params.="&"; $params.=urlencode($key)."=".urlencode($value); } $ch = curl_init (); curl_setopt ($ch, CURLOPT_URL,$url); curl_setopt ($ch, CURLOPT_FAILONERROR, 1); curl_setopt ($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT ,300); curl_setopt($ch, CURLOPT_TIMEOUT, 300); curl_setopt ($ch, CURLOPT_POST, 1); // set POST method curl_setopt ($ch, CURLOPT_POSTFIELDS, $params); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0); $result = curl_exec ($ch); curl_close ($ch); return $result; } function outsource($outsourceParams) { if (!$outsourceParams || !$this->_id) return false; $mvcMiddlewareURL = LegacyHelper::getMiddlewareServiceURL(); $where = $outsourceParams["destination"]; $legacyDestination =true; $path = '/mvc/importOrder'; if (!$where && isset($outsourceParams["host"])) { $legacyDestination = false; $where = $outsourceParams["host"]; if (isset($outsourceParams["port"])) $where .= (":".$outsourceParams["port"]); if (isset($outsourceParams['path'])) $where .= $path; } $dstUser = $outsourceParams["user"]; if (!$where || !$dstUser) { echo "ERROR: Missing outsourcing data"; return false; } $schema =& LegacyHelper::getPersistentSchema(); if (!$schema) return false; if ($where[strlen($where)-1]!='/') $where .= "/"; $protocol = 'http'; if (isset($outsourceParams['protocol']) && $outsourceParams['protocol']) $protocol = $outsourceParams['protocol']; $url = $protocol . '://'. $where; if ($legacyDestination) $url .= 'index.php?option=com_vxc&controller=default&task=importOrder'; echo "URL: ".$url; $order =& $this->getData(); $order->attributes =& $this->getAttributes(); $orderData = new stdClass(); $franchiseName = SiteOptionsHelper::getFranchiseName(); $franchiseReleaseName = $franchiseName; $franchisePrefix = LegacyHelper::getFranchisePrefix(); foreach($outsourceParams as $key=> $value) $orderData->{$key} = $value; $orderData->from = $franchiseName; $orderData->sourceId = $this->_id; $orderData->checked_date = $order->checked_date; $orderData->payment_date = $order->payment_date; $orderData->payment_methodnameid = $order->payment_methodnameid; $orderData->attributes = array(); $orderData->bigData = new stdClass(); $orderData->thumbs = new stdClass(); $orderData->franchiseReleaseName = $franchiseReleaseName; $orderData->franchisePrefix = $franchisePrefix; $ats = LegacyHelper::getElementsByAttribute($schema,'outsource',TRUE); $persistentNames = array(); $outsourceData = array(); $outsourceThumbs = array(); foreach($ats as $fullkey => $node) { $atName = LegacyHelper::getDBNameFromFullkey($fullkey); $persistentNames[] = $atName; if ($node && isset($node['_attributes'])) { $atAts = $node['_attributes']; if ( isset($atAts['outsourceData']) && $atAts['outsourceData']==TRUE) $outsourceData[$atName] = 1; if ( isset($atAts['outsourceThumbs']) && $atAts['outsourceThumbs']==TRUE) $outsourceThumbs[$atName] = 1; } } foreach($order->attributes as $at) if (in_array($at->name,$persistentNames)) { // Tengo que transmitir este attributo $orderData->attributes[$at->name] = $at->value; if (isset($outsourceData[$at->name])) { // Tenemos que pasar tambien los datos vxcModelOrderAttribute::GetRelativeFilenames($at->id,$fileLeft,$fileRight,$fileExtra); $dataFileLeft = null; $dataFileRight = null; $dataFileExtra = null; $this->_getMVCFile($fileLeft,$dataFileLeft); $this->_getMVCFile($fileRight,$dataFileRight); $this->_getMVCFile($fileExtra,$dataFileExtra); $dataFiles = new stdClass(); $dataFiles->left = $dataFileLeft; if ($dataFileLeft!==null) { $dataFiles->left = base64_encode($dataFiles->left); //$dataFiles->left = str_split($dataFiles->left,1024); } $dataFiles->right = $dataFileRight; if ($dataFileRight!==null) { $dataFiles->right = base64_encode($dataFiles->right); //$dataFiles->right = str_split($dataFiles->right,1024); } $dataFiles->extra = $dataFileExtra; if ($dataFileExtra!==null) { $dataFiles->extra = base64_encode($dataFiles->extra); //$dataFiles->extra = str_split($dataFiles->extra,1024); } $orderData->bigData->{$at->name} = $dataFiles; } if (isset($outsourceThumbs[$at->name])) { vxcModelOrderAttribute::GetRelativeThumbs($at->id,$thumbLeft,$thumbRight); $dataThumbLeft = null; $dataThumbRight = null; $this->_getMVCFile($thumbLeft,$dataThumbLeft); $this->_getMVCFile($thumbRight,$dataThumbRight); $dataThumbs =new stdClass(); $dataThumbs->left = $dataThumbLeft; if ($dataThumbLeft!==null) { vxcbase64::encode($dataThumbs->left); //$dataThumbs->left = str_split($dataThumbs->left,1024); } $dataThumbs->right = $dataThumbRight; if ($dataThumbRight!==null) { vxcbase64::encode($dataThumbs->right); //$dataThumbs->right = str_split($dataThumbs->right,1024); } $orderData->thumbs->{$at->name} = $dataThumbs; } } $json = new Services_JSON(); $data = array(); $data['data'] = $json->encode($orderData); $response = $this->postHttps($url,$data); if (!$response) return false; $res = $json->decode($response); if (!$res) return false; if ($res->status !="OK") { echo "Error string: ". $res->errorString; return false; } return true; } function importOrder($dataJSON, &$errorStr, &$created) { if (!$dataJSON) { $errorStr = "No data sent"; return false; } $json = new Services_JSON(); $data = $json->decode($dataJSON); if (!$data) { $errorStr = "Error parsing JSON"; return false; } $dstUser = $data->user; if (!$dstUser) { $errorStr = "No destination user received"; return false; } $sql = "SELECT id FROM jos_vxc_user WHERE username = '$dstUser'"; $this->_db->setQuery($sql); $userId = $this->_db->loadResult(); if (!$userId) { $errorStr = "User $dstUser not found in the destination franchise"; return false; } $sourceOrderId = $data->sourceId; $sourceOrderFranchise = $data->from; // Comprobamsos si ya existe un pedido con ese mismo sourceId $sql = "SELECT o.id id, o.`uuid` `uuid` FROM jos_vxc_order o LEFT JOIN jos_vxc_attribute a ON a.orderid = o.id AND a.name = 'general.outsourcedFromOrderId' LEFT JOIN jos_vxc_attribute a2 ON a2.orderid = o.id AND a2.name = 'general.outsourcedFromFranchise' WHERE a.value = '$sourceOrderId' AND a2.value = '$sourceOrderFranchise' AND o.deleted IS NOT TRUE"; $this->_db->setQuery($sql); $row = $this->_db->loadObject(); if ($row) { $orderId = $row->id; $orderUUID = $row->uuid; } else { $orderId = ''; $orderUUID = LegacyHelper::generateUUID(); } if (!$orderId) { $created = true; $reference = "VX: ".$data->from. " ($sourceOrderId)"; $paymentMethodNameId = $data->payment_methodnameid; $sql = "SELECT id FROM jos_vxc_paymentmethod WHERE nameid = '$paymentMethodNameId'"; $this->_db->setQuery($sql); $paymentMethod = $this->_db->loadResult(); // Creamos el batch relacionado $modelBatch = new vxcModelBatch(); // Creamos el batch $dataBatch = array(); $dataBatch['id'] = null; $dataBatch['payment_date'] = ($data->payment_date)?$data->payment_date: $data->checked_date; $dataBatch['payment_user'] = $userId; $dataBatch['payment_method'] = $paymentMethod; $dataBatch['state'] = 1; $modelBatch->store($dataBatch); $batchId = $dataBatch['id']; if (!$batchId) { $errorStr = "Couldn't create batch"; return false; } $sql = "SELECT id FROM jos_vxc_orderstate WHERE nameid = 'CHECKED'"; $this->_db->setQuery($sql); $stateCheckedId = $this->_db->loadResult(); $orderData = array(); $orderData["uuid"] =$orderUUID; $orderData["user"] =$userId; $orderData["reference"] =$reference; $orderData["state"] = $stateCheckedId; $orderData["batch"] = $batchId; $orderData["checked_date"] = $data->checked_date; $newOrderId = $this->createNew($orderData); if (!$newOrderId) { $errorStr = "Couldn't create order on destination franchise"; return false; } $orderId = $newOrderId; } else { $created = false; // Borramos los atributos de ese pedido $sql = "DELETE FROM jos_vxc_attribute WHERE orderid = $orderId"; $this->_db->Execute($sql); // Borramos los update uuid $sql = "DELETE FROM jos_vxc_orderupdateuuid WHERE order_uuid = '".mysql_real_escape_string($orderUUID)."'"; $this->_db->Execute($sql); } $this->SetId($orderId); // Genero un update UUUID para los atributos que importo $updateUUID = LegacyHelper::generateUUID(); $mvcMiddlewareURL = LegacyHelper::getMiddlewareServiceURL(); $data->attributes->{"general.outsourcedFromOrderId"} = $sourceOrderId; $data->attributes->{"general.outsourcedFromFranchise"} = $sourceOrderFranchise; foreach($data->attributes as $key => $value) { if ($key=="cad.insoleCADProject") $sql = "INSERT INTO jos_vxc_attribute(orderid,type,name,value,update_uuid) VALUES ($orderId,11,'".mysql_real_escape_string($key)."','".mysql_real_escape_string($value)."','".mysql_real_escape_string($updateUUID)."')"; else $sql = "INSERT INTO jos_vxc_attribute(orderid,name,value,update_uuid) VALUES ($orderId,'".mysql_real_escape_string($key)."','".mysql_real_escape_string($value)."','".mysql_real_escape_string($updateUUID)."')"; $this->_db->Execute($sql); $atId = $this->_db->insertid(); if (isset($data->bigData) && isset($data->bigData->{$key})) { // Guardamos los ficheros de datos relacionados con el atributo $dataLeft = ($data->bigData->{$key}->left)?base64_decode($data->bigData->{$key}->left):null; $dataRight =($data->bigData->{$key}->right)?base64_decode($data->bigData->{$key}->right):null; $dataExtra =($data->bigData->{$key}->extra)?base64_decode($data->bigData->{$key}->extra):null; if ($mvcMiddlewareURL) { vxcModelOrderAttribute::GetRelativeFilenames($atId,$fileLeft,$fileRight,$fileExtra); if ($dataLeft!==null) $this->_setMVCFile($fileLeft,$dataLeft); if ($dataRight!==null) $this->_setMVCFile($fileRight,$dataRight); if ($dataExtra!==null) $this->_setMVCFile($fileExtra,$dataExtra); } else { vxcModelOrderAttribute::GetFilenames($atId,$fileLeft,$fileRight,$fileExtra); if ($dataLeft!==null) { @file_put_contents($fileLeft,$dataLeft); @chmod($fileLeft,0666); } if ($dataRight!==null) { @file_put_contents($fileRight,$dataRight); @chmod($fileRight,0666); } if ($dataExtra!==null) { @file_put_contents($fileExtra,$dataExtra); @chmod($fileExtra,0666); } } } if (isset($data->thumbs) && isset($data->thumbs->{$key})) { // Guardamos los ficheros de thumbnail relacionados con el atributo $dataThumbLeft = ($data->thumbs->{$key}->left)?base64_decode($data->thumbs->{$key}->left):null; $dataThumbRight =($data->thumbs->{$key}->right)?base64_decode($data->thumbs->{$key}->right):null; if ($mvcMiddlewareURL) { vxcModelOrderAttribute::GetRelativeThumbs($atId,$thumbLeft,$thumbRight); if ($dataThumbLeft!==null) $this->_setMVCFile($thumbLeft,$dataThumbLeft); if ($dataThumbRight!==null) $this->_setMVCFile($thumbRight,$dataThumbRight); } else { vxcModelOrderAttribute::GetThumbs($atId,$thumbLeft,$thumbRight); if ($dataThumbLeft!==null) { @file_put_contents($thumbLeft,$dataThumbLeft); @chmod($thumbLeft,0666); } if ($dataThumbRight!==null) { @file_put_contents($thumbRight,$dataThumbRight); @chmod($thumbRight,0666); } } } } $sql = "INSERT INTO jos_vxc_orderupdateuuid(order_uuid, update_uuid) VALUES ('".mysql_real_escape_string($orderUUID)."','".mysql_real_escape_string($updateUUID)."')"; $this->_db->Execute($sql); return $orderId; } function getOrdersFromIMOrder($params,$res) { $imcustom_order_id = $params['imcustom_order_id']; $imserver = $params['imserver']; $sql = "SELECT o.id id,o.batch batch,a3.value imcustom_order_detail_id,o.user userId FROM jos_vxc_order o LEFT JOIN jos_vxc_attribute a1 ON a1.orderid = o.id AND a1.name = 'general.customOrderId' LEFT JOIN jos_vxc_attribute a2 ON a2.orderid = o.id AND a2.name = 'general.imCustomServer' LEFT JOIN jos_vxc_attribute a3 ON a3.orderid = o.id AND a3.name = 'general.imCustomOrderDetail' WHERE a1.value = ".$this->_db->Quote($imcustom_order_id) . " AND a2.value = ".$this->_db->Quote($imserver) . " AND o.deleted IS NOT TRUE"; $this->_db->setQuery($sql); $rows = $this->_db->loadObjectList(); $userId = ''; $orders = array(); if (count($rows)>0) { foreach ($rows as $row) { $order = new stdClass(); $order->id = $row->id; $order->batch = $row->batch; $order->imcustom_order_detail_id = $row->imcustom_order_detail_id; $userId = $row->userId; $orders[] = $order; } } $res->result = "ok"; $res->data = new stdClass(); $res->data->userId = $userId; $res->data->orders = $orders; } function getOrderIdFromIMOrderDetail($imcustom_order_detail_id, $imserver) { $sql = "SELECT o.id id FROM jos_vxc_order o LEFT JOIN jos_vxc_attribute a1 ON a1.orderid = o.id AND a1.name = 'general.imCustomOrderDetail' LEFT JOIN jos_vxc_attribute a2 ON a2.orderid = o.id AND a2.name = 'general.imCustomServer' WHERE a1.value = ".$this->_db->Quote($imcustom_order_detail_id) . " AND a2.value = ".$this->_db->Quote($imserver) . " AND o.deleted IS NOT TRUE"; $this->_db->setQuery($sql); return $this->_db->loadResult(); } }// class