/**
  * Upload de lexeme+wordform em texto simples (lexeme POS wordform) 
  * Parâmetro data informa: idLanguage
  * @param type $data
  * @param type $file 
  */
 public function uploadLexemeWordform($data, $file)
 {
     $idLanguage = $data->idLanguage;
     $pos = new POS();
     $POS = $pos->listAll()->asQuery()->chunkResult('POS', 'idPOS');
     $wf = new Wordform();
     $transaction = $this->beginTransaction();
     try {
         $lineNum = 0;
         $rows = file($file->getTmpName());
         foreach ($rows as $row) {
             $lineNum++;
             $row = trim($row);
             $fields = explode(' ', $row);
             $idPOS = $POS[$fields[1]];
             if ($idPOS != '') {
                 $l = str_replace("'", "\\'", $fields[0]);
                 $lexeme = $this->getCriteria()->select('idLexeme')->where("(name = '{$l}') and (idPOS = {$idPOS}) and (idLanguage = {$idLanguage})")->asQuery()->getResult();
                 $idLexeme = $lexeme[0]['idLexeme'];
                 if ($idLexeme == '') {
                     $this->setPersistent(false);
                     $this->setData((object) ['name' => $fields[0], 'idLanguage' => $idLanguage, 'idPOS' => $idPOS]);
                     parent::save();
                     $idLexeme = $this->getId();
                 }
                 $w = str_replace("'", "\\'", $fields[2]);
                 $wordform = $wf->getCriteria()->select('idWordform')->where("(form = '{$w}') and (idLexeme = {$idLexeme})")->asQuery()->getResult();
                 $idWordform = $wordform[0]['idWordForm'];
                 if ($idWordform == '') {
                     $wf->setPersistent(false);
                     $wf->setData((object) ['form' => $fields[2], 'idLexeme' => $idLexeme]);
                     $wf->save();
                 }
             }
         }
         $transaction->commit();
     } catch (\EModelException $e) {
         // rollback da transação em caso de algum erro
         $transaction->rollback();
         throw new EModelException($e->getMessage() . ' LineNum: ' . $lineNum);
     }
     return $result;
 }
 /**
  * 	Enter description here ...
  *
  * 	@param	string	$action		Action type
  */
 function getLoginPageOptions($parameters, &$object, &$action = '', $hook)
 {
     global $conf, $user, $langs;
     $langs->load("pos@pos");
     if (strstr($_SERVER["REQUEST_URI"], 'pos/frontend/index')) {
         $this->getInstanceDao();
         dol_include_once('/pos/class/mobile_detect.php');
         dol_include_once('/pos/class/pos.class.php');
         $terminals = POS::select_Terminals();
         if (sizeof($terminals)) {
             $result = '<select class="flat" id="terminal" name="terminal">' . "\n";
             $detect = new Mobile_Detect();
             $i = 0;
             foreach ($terminals as $terminal) {
                 if ($detect->isMobile()) {
                     if ($terminal["tactil"] == 2) {
                         $result .= "<option value='" . $terminal["rowid"] . "'>" . $terminal["name"] . "</option>\n";
                     }
                 } else {
                     $result .= "<option value='" . $terminal["rowid"] . "'>" . $terminal["name"] . "</option>\n";
                 }
                 $i++;
             }
             $result .= '</select>' . "\n";
         } else {
             $result .= '<label>' . $langs->trans("NotHasTerminal") . '</label>';
         }
         $divformat = '<div class="terminalBox"><strong><label for="Terminal">' . $langs->trans('Terminal') . '</label></strong>';
         $divformat .= $result;
         $divformat .= '</div>';
         $this->results['options']['div'] = $divformat;
         $tableformat = '<tr><td class="loginfield nowrap" valign="middle"><strong><label for="Terminal">' . $langs->trans('Terminal') . '</label></strong></td>';
         $tableformat .= '<td valign="top" nowrap="nowrap">';
         $tableformat .= $result;
         $tableformat .= '</td></tr>';
         $this->results['options']['table'] = $tableformat;
         return 1;
     }
 }
Example #3
0
 public static function buildFromJSON($vo_json)
 {
     $o_pos = new POS();
     if (array_key_exists("pos_vendor_name", $vo_json)) {
         $o_pos->setVendorName($vo_json["pos_vendor_name"]);
     }
     if (array_key_exists("pos_make", $vo_json)) {
         $o_pos->setMake($vo_json["pos_make"]);
     }
     if (array_key_exists("pos_model", $vo_json)) {
         $o_pos->setModel($vo_json["pos_model"]);
     }
     if (array_key_exists("pos_vendor_contact_name", $vo_json)) {
         $o_pos->setVendorContactName($vo_json["pos_vendor_contact_name"]);
     }
     if (array_key_exists("pos_version", $vo_json)) {
         $o_pos->setVersion($vo_json["pos_version"]);
     }
     if (array_key_exists("pos_type", $vo_json)) {
         $o_pos->setType($vo_json["pos_type"]);
     }
     if (array_key_exists("pos_vendor_phone_number", $vo_json)) {
         $o_pos->setVendorPhoneNumber($vo_json["pos_vendor_phone_number"]);
     }
     return $o_pos;
 }
    echo $langs->trans("CashS");
    ?>
</label>
					<select name='terminal'>
					<!-- <select name='terminal'> -->
					<!--<option value='-1'><?php 
    $langs->trans("Choose");
    ?>
</option> -->
        
<?php 
    if ($user->id == 3 || $user->id == 9) {
        $detect = new Mobile_Detect();
        $i = 0;
        foreach ($terminals as $terminal) {
            if (POS::checkUserTerminal($user->id, $terminal["rowid"])) {
                if ($detect->isMobile()) {
                    if ($terminal["tactil"] == 2) {
                        print "<option value='" . $terminal["rowid"] . "'>" . $terminal["name"] . "</option>\n";
                    }
                } else {
                    print "<option value='" . $terminal["rowid"] . "'>" . $terminal["name"] . "</option>\n";
                }
            }
            $i++;
        }
    }
    if ($user->id == 1) {
        print "<option value='2'>Terminal Quinta Avenida 1</option>";
    }
    if ($user->id == 2) {
            } elseif ($action == 'getLocalTax') {
                if (sizeof($data)) {
                    $data = $data['data'];
                    $result = POS::getLocalTax($data);
                    echo json_encode($result);
                }
            } elseif ($action == 'getNotes') {
                $mode = $data['data'];
                $result = POS::getNotes($mode);
                echo json_encode($result);
            } elseif ($action == 'getWarehouse') {
                $result = POS::getWarehouse();
                echo json_encode($result);
            } elseif ($action == 'checkPassword') {
                $pass = $data['data']['pass'];
                $login = $data['data']['login'];
                $result = POS::checkPassword($login, $pass);
                echo json_encode($result);
            } elseif ($action == 'searchCoupon') {
                $customerId = $data['data'];
                $result = POS::searchCoupon($customerId);
                echo json_encode($result);
            } elseif ($action == 'addPrint') {
                $addprint = $data['data'];
                $result = POS::addPrint($addprint);
                echo json_encode($result);
            }
        }
    }
}
echo $html;
Example #6
0
 /**
  * builds a location object from JSON object
  * @param type $vo_json JSON representation of the location object
  * @return Location the location object 
  * @author Rob Kurst <*****@*****.**>
  */
 static function buildFromJSON($vo_json)
 {
     $o_location = new Location();
     if (array_key_exists("location_annual_revenue", $vo_json)) {
         $o_location->setAnnualRevenue($vo_json["location_annual_revenue"]);
     }
     if (array_key_exists("location_contact_name", $vo_json)) {
         $o_location->setContactName($vo_json["location_contact_name"]);
     }
     if (array_key_exists("location_contact_email", $vo_json)) {
         $o_location->setContactEmail($vo_json["location_contact_email"]);
     }
     if (array_key_exists("location_efax", $vo_json)) {
         $o_location->setEFax($vo_json["location_efax"]);
     }
     if (array_key_exists("location_contact_mobile", $vo_json)) {
         $o_location->setContactMobile($vo_json["location_contact_mobile"]);
     }
     if (array_key_exists("location_contact_title", $vo_json)) {
         $o_location->setContactTitle($vo_json["location_contact_title"]);
     }
     if (array_key_exists("location_contact_same_as_owner", $vo_json)) {
         $o_location->setContactSameAsOwner($vo_json["location_contact_same_as_owner"]);
     }
     if (array_key_exists("location_fax", $vo_json)) {
         $o_location->setFax($vo_json["location_fax"]);
     }
     if (array_key_exists("location_industry", $vo_json)) {
         $o_location->setIndustry($vo_json["location_industry"]);
     }
     if (array_key_exists("location_ownership", $vo_json)) {
         $o_location->setOwnership($vo_json["location_ownership"]);
     }
     if (array_key_exists("location_years_in_business", $vo_json)) {
         $o_location->setYearsInBusiness($vo_json["location_years_in_business"]);
     }
     if (array_key_exists("location_organization_mission", $vo_json)) {
         $o_location->setOrganizationMission($vo_json["location_organization_mission"]);
     }
     if (array_key_exists("location_entity_start_date", $vo_json)) {
         $o_location->setEntityStartDate(date("m/d/Y H:i:s", strtotime($vo_json["location_entity_start_date"])));
     }
     if (array_key_exists("location_entity_state", $vo_json)) {
         $o_location->setEntityState($vo_json["location_entity_state"]);
     }
     if (array_key_exists("location_alternative_fax", $vo_json)) {
         $o_location->setAlternativeFax($vo_json["location_alternative_fax"]);
     }
     if (array_key_exists("location_year_incorporated", $vo_json)) {
         $o_location->setYearIncorporated($vo_json["location_year_incorporated"]);
     }
     if (array_key_exists("location_description_of_products_and_services", $vo_json)) {
         $o_location->setDescriptionOfProductsAndServices($vo_json["location_description_of_products_and_services"]);
     }
     if (array_key_exists("location_length_of_current_ownership", $vo_json)) {
         $o_location->setLengthOfCurrentOwnership($vo_json["location_length_of_current_ownership"]);
     }
     if (array_key_exists("location_quantity_of_locations", $vo_json)) {
         $o_location->setQuantityOfLocation($vo_json["location_quantity_of_locations"]);
     }
     if (array_key_exists("location_waive_pg", $vo_json)) {
         $o_location->setWaivePg($vo_json["location_waive_pg"]);
     }
     if (array_key_exists("location_partner_biller_id", $vo_json)) {
         $o_location->setPartnerBillerId($vo_json["location_partner_biller_id"]);
     }
     if (array_key_exists("location_partner_reseller_id", $vo_json)) {
         $o_location->setPartnerResellerId($vo_json["location_partner_reseller_id"]);
     }
     if (array_key_exists("location_partner_sub_account_id", $vo_json)) {
         $o_location->setPartnerSubAccountId($vo_json["location_partner_sub_account_id"]);
     }
     if (array_key_exists("location_program_pricing", $vo_json)) {
         $o_location->setProgramPricing($vo_json["location_program_pricing"]);
     }
     if (array_key_exists("location_program_details", $vo_json)) {
         $o_location->setProgramDetails($vo_json["location_program_details"]);
     }
     if (array_key_exists("location_lead_sources", $vo_json)) {
         $o_lead_sources = $vo_json["location_lead_sources"];
         for ($n_index = 0, $n_size = count($o_lead_sources); $n_index < $n_size; $n_index++) {
             $o_location->addLeadSource($o_lead_sources[$n_index]);
         }
     }
     if (array_key_exists("location_sales_agent_name", $vo_json)) {
         $o_location->setSalesAgentName($vo_json["location_sales_agent_name"]);
     }
     if (array_key_exists("location_parent_id", $vo_json)) {
         $o_location->setParentId($vo_json["location_parent_id"]);
     }
     if (array_key_exists("location_additional_description", $vo_json)) {
         $o_location->setAdditionalDescription($vo_json["location_additional_description"]);
     }
     if (array_key_exists("location_description", $vo_json)) {
         $o_location->setDescription($vo_json["location_description"]);
     }
     if (array_key_exists("location_new_visa_utility_acceptor", $vo_json)) {
         $o_location->setNewVisaUtilityAcceptor($vo_json["location_new_visa_utility_acceptor"]);
     }
     if (array_key_exists("location_tax_exempt", $vo_json)) {
         $o_location->setTaxExempt($vo_json["location_tax_exempt"]);
     }
     if (array_key_exists("location_total_customers", $vo_json)) {
         $o_location->setTotalCustomers($vo_json["location_total_customers"]);
     }
     if (array_key_exists("location_utility_ownership", $vo_json)) {
         $o_location->setUtilityOwnership($vo_json["location_utility_ownership"]);
     }
     if (array_key_exists("location_terminals", $vo_json)) {
         $o_terminals = $vo_json["location_terminals"];
         for ($n_index = 0, $n_size = count($o_terminals); $n_index < $n_size; $n_index++) {
             $o_location->addTerminal($o_terminals[$n_index]);
         }
     }
     if (array_key_exists("location_principal_contacts", $vo_json)) {
         $o_contacts = $vo_json["location_principal_contacts"];
         for ($n_index = 0, $n_size = count($o_contacts); $n_index < $n_size; $n_index++) {
             $o_contact = PrincipalContact::buildFromJSON($o_contacts[$n_index]);
             $o_location->addPrincipalContact($o_contact);
         }
     }
     if (array_key_exists("location_bc_details", $vo_json) && $vo_json["location_bc_details"] != null) {
         $o_location->setBankCardDetails(BankCardDetails::buildFromJSON($vo_json["location_bc_details"]));
     }
     if (array_key_exists("location_ach_details", $vo_json) && $vo_json["location_ach_details"] != null) {
         $o_location->setAchDetails(ACHDetails::buildFromJSON($vo_json["location_ach_details"]));
     }
     if (array_key_exists("location_moto", $vo_json) && $vo_json["location_moto"] != null) {
         $o_location->setMoto(MOTO::buildFromJSON($vo_json["location_moto"]));
     }
     if (array_key_exists("location_internet", $vo_json) && $vo_json["location_internet"] != null) {
         $o_location->setInternet(Internet::buildFromJSON($vo_json["location_internet"]));
     }
     if (array_key_exists("location_pos", $vo_json) && $vo_json["location_pos"] != null) {
         $o_location->setPos(POS::buildFromJSON($vo_json["location_pos"]));
     }
     if (array_key_exists("location_dba_address", $vo_json)) {
         $o_dba_address = Address::buildFromJSON($vo_json["location_dba_address"]);
         $o_location->setDBAAddress($o_dba_address);
     }
     if (array_key_exists("location_chargeback_fax", $vo_json)) {
         $o_location->setChargebackFax($vo_json["location_chargeback_fax"]);
     }
     return $o_location;
 }
            $action = 'send';
            $modelmail = 'body';
            print '<br>';
            print_titre($langs->trans($titre));
            $formmail->fromtype = 'user';
            $formmail->fromid = $user->id;
            $formmail->fromname = $conf->global->MAIN_INFO_SOCIETE_NOM;
            $formmail->frommail = $conf->global->MAIN_INFO_SOCIETE_MAIL;
            $formmail->withfrom = 0;
            $formmail->withto = empty($_POST["sendto"]) ? 1 : GETPOST('sendto');
            $formmail->withtocc = 0;
            $formmail->withtoccsocid = 0;
            $formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC;
            $formmail->withtocccsocid = 0;
            $formmail->withtopic = $conf->global->MAIN_INFO_SOCIETE_NOM . ': ' . $langs->trans("CopyOfCloseCash") . ' ' . $closeid;
            $formmail->withfile = 0;
            $formmail->withbody = POS::FillMailCloseCashBody($closeid);
            $formmail->withdeliveryreceipt = 0;
            $formmail->withcancel = 1;
            $formmail->param['action'] = $action;
            $formmail->param['models'] = $modelmail;
            $formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $id;
            $formmail->show_form();
            print '<br>';
        }
    } else {
        dol_print_error($db);
    }
}
llxFooter();
$db->close();
Example #8
0
<?php

$sdl = new StoresDataLoader($db);
$stores = new Stores($db);
$pos = new POS($db);
$getset->setStandardValue("exact_search", false);
switch ($getset->header(FORM_ACTION)) {
    case FORM_ACTION_SAVE . "_store":
        require_once __DIR__ . '/edit/save_store.php';
        $result = $sdl->get($getset->header("search"), $getset->header("value"), $getset->header("exact_search"));
        break;
    case FORM_ACTION_SAVE . "_pos":
        require_once __DIR__ . '/edit/save_pos.php';
        $result = $sdl->get($getset->header("search"), $getset->header("value"), $getset->header("exact_search"));
        break;
    case FORM_ACTION_CREATE:
        $result = $sdl->get("", "");
        break;
    case FORM_ACTION_DELETE . "_store":
        $stores->delete_Store($getset->header("delete_id"));
        $result = $sdl->get($getset->header("search"), $getset->header("value"), $getset->header("exact_search"));
        $result = null;
        break;
    case FORM_ACTION_DELETE . "_pos":
        $pos->delete_POS($getset->header("delete_id"));
        $result = $sdl->get($getset->header("search"), $getset->header("value"), $getset->header("exact_search"));
        break;
    case FORM_ACTION_SEARCH:
        $result = $sdl->get($getset->header("search"), $getset->header("value"), $getset->header("exact_search"));
        break;
    default:
:</label><input onclick="this.select()" type="text" name="id_product_name" id="id_product_name" class=""></li>
                    <br clear="all" />
					<li><label><?php 
echo $langs->trans("Reference");
?>
:</label><input onclick="this.select()" type="text" name="id_product_ref" id="id_product_ref" class=""></li>
                    <br clear="all" />
					<li><label><?php 
echo $langs->trans("PricePVP");
?>
:</label><input onclick="this.select()" type="text" name="id_product_price" class="numKeyboard" id="id_product_price" class=""></li>
					<br clear="all" />
				</ul>
				<div style="margin-left:5%;">	
					<?php 
$taxes = POS::select_VAT();
foreach ($taxes as $tax) {
    echo "<div class='btnselect btnminiselect tax_types'><a title='" . $tax['id'] . "' id='taxtype" . $tax['id'] . "'>" . $tax['label'] . "</a></div>";
}
?>
				</div>
                    <input type="button" id="id_btn_add_product" value="<?php 
echo $langs->trans("New");
?>
" class="btn3dbig" onclick="" style="display:inline-block">
						
			</div>	
		</div>
		
		<div id="idClient" class="bloqueOpciones" style="display:none" title="<?php 
echo $langs->trans("AddCustomer");
    if (GETPOST('action', 'string') == 'mail') {
        include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
        $formmail = new FormMail($db);
        $action = 'send';
        $modelmail = 'body';
        print '<br>';
        print_titre($langs->trans($titre));
        $formmail->fromtype = 'user';
        $formmail->fromid = $user->id;
        $formmail->fromname = $conf->global->MAIN_INFO_SOCIETE_NOM;
        $formmail->frommail = $conf->global->MAIN_INFO_SOCIETE_MAIL;
        $formmail->withfrom = 0;
        $formmail->withto = empty($_POST["sendto"]) ? 1 : GETPOST('sendto');
        $formmail->withtocc = 0;
        $formmail->withtoccsocid = 0;
        $formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC;
        $formmail->withtocccsocid = 0;
        $formmail->withtopic = $conf->global->MAIN_INFO_SOCIETE_NOM . ': ' . $langs->trans("CopyOfTicket") . ' ' . $object->ticketnumber;
        $formmail->withfile = 0;
        $formmail->withbody = POS::fillMailTicketBody($id);
        $formmail->withdeliveryreceipt = 0;
        $formmail->withcancel = 1;
        $formmail->param['action'] = $action;
        $formmail->param['models'] = $modelmail;
        $formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $id;
        $formmail->show_form();
        print '<br>';
    }
}
llxFooter();
$db->close();