Reorder fields in open cart product form - field

This .xml file and vqmod created my new custom post field in the products post type of my openchart.
<modification>
<id>Custom Field - unit_price</id>
<version>1</version>
<vqmver>1.0.8</vqmver>
<author>Jonathan de Jong - tigerton.se</author>
<file name="admin/language/english/catalog/product.php">
<operation>
<search position="after"><![CDATA[
$_['entry_model'] = 'Model:';
]]></search>
<add><![CDATA[
$_['entry_unit_price'] = 'unit_price:';
]]></add>
</operation>
</file>
<file name="admin/model/catalog/product.php">
<operation>
<search position="replace"><![CDATA[
$this->db->query("INSERT INTO " . DB_PREFIX . "product SET model = '" . $this->db->escape($data['model']) . "', sku = '" . $this->db->escape($data['sku']) . "', upc = '" . $this->db->escape($data['upc']) . "', location = '" . $this->db->escape($data['location']) . "', quantity = '" . (int)$data['quantity'] . "', minimum = '" . (int)$data['minimum'] . "', subtract = '" . (int)$data['subtract'] . "', stock_status_id = '" . (int)$data['stock_status_id'] . "', date_available = '" . $this->db->escape($data['date_available']) . "', manufacturer_id = '" . (int)$data['manufacturer_id'] . "', shipping = '" . (int)$data['shipping'] . "', price = '" . (float)$data['price'] . "', points = '" . (int)$data['points'] . "', weight = '" . (float)$data['weight'] . "', weight_class_id = '" . (int)$data['weight_class_id'] . "', length = '" . (float)$data['length'] . "', width = '" . (float)$data['width'] . "', height = '" . (float)$data['height'] . "', length_class_id = '" . (int)$data['length_class_id'] . "', status = '" . (int)$data['status'] . "', tax_class_id = '" . $this->db->escape($data['tax_class_id']) . "', sort_order = '" . (int)$data['sort_order'] . "', date_added = NOW()");
]]></search>
<add><![CDATA[
$this->db->query("INSERT INTO " . DB_PREFIX . "product SET model = '" . $this->db->escape($data['model']) . "', sku = '" . $this->db->escape($data['sku']) . "', upc = '" . $this->db->escape($data['upc']) . "', location = '" . $this->db->escape($data['location']) . "', quantity = '" . (int)$data['quantity'] . "', minimum = '" . (int)$data['minimum'] . "', subtract = '" . (int)$data['subtract'] . "', stock_status_id = '" . (int)$data['stock_status_id'] . "', date_available = '" . $this->db->escape($data['date_available']) . "', manufacturer_id = '" . (int)$data['manufacturer_id'] . "', shipping = '" . (int)$data['shipping'] . "', price = '" . (float)$data['price'] . "', points = '" . (int)$data['points'] . "', weight = '" . (float)$data['weight'] . "', weight_class_id = '" . (int)$data['weight_class_id'] . "', length = '" . (float)$data['length'] . "', width = '" . (float)$data['width'] . "', height = '" . (float)$data['height'] . "', length_class_id = '" . (int)$data['length_class_id'] . "', unit_price = '" . $this->db->escape($data['unit_price']) . "', status = '" . (int)$data['status'] . "', tax_class_id = '" . $this->db->escape($data['tax_class_id']) . "', sort_order = '" . (int)$data['sort_order'] . "', date_added = NOW()");
]]></add>
</operation>
<operation>
<search position="replace"><![CDATA[
$this->db->query("UPDATE " . DB_PREFIX . "product SET model = '" . $this->db->escape($data['model']) . "', sku = '" . $this->db->escape($data['sku']) . "', upc = '" . $this->db->escape($data['upc']) . "', location = '" . $this->db->escape($data['location']) . "', quantity = '" . (int)$data['quantity'] . "', minimum = '" . (int)$data['minimum'] . "', subtract = '" . (int)$data['subtract'] . "', stock_status_id = '" . (int)$data['stock_status_id'] . "', date_available = '" . $this->db->escape($data['date_available']) . "', manufacturer_id = '" . (int)$data['manufacturer_id'] . "', shipping = '" . (int)$data['shipping'] . "', price = '" . (float)$data['price'] . "', points = '" . (int)$data['points'] . "', weight = '" . (float)$data['weight'] . "', weight_class_id = '" . (int)$data['weight_class_id'] . "', length = '" . (float)$data['length'] . "', width = '" . (float)$data['width'] . "', height = '" . (float)$data['height'] . "', length_class_id = '" . (int)$data['length_class_id'] . "', status = '" . (int)$data['status'] . "', tax_class_id = '" . $this->db->escape($data['tax_class_id']) . "', sort_order = '" . (int)$data['sort_order'] . "', date_modified = NOW() WHERE product_id = '" . (int)$product_id . "'");
]]></search>
<add><![CDATA[
$this->db->query("UPDATE " . DB_PREFIX . "product SET model = '" . $this->db->escape($data['model']) . "', sku = '" . $this->db->escape($data['sku']) . "', upc = '" . $this->db->escape($data['upc']) . "', location = '" . $this->db->escape($data['location']) . "', quantity = '" . (int)$data['quantity'] . "', minimum = '" . (int)$data['minimum'] . "', subtract = '" . (int)$data['subtract'] . "', stock_status_id = '" . (int)$data['stock_status_id'] . "', date_available = '" . $this->db->escape($data['date_available']) . "', manufacturer_id = '" . (int)$data['manufacturer_id'] . "', shipping = '" . (int)$data['shipping'] . "', price = '" . (float)$data['price'] . "', points = '" . (int)$data['points'] . "', weight = '" . (float)$data['weight'] . "', weight_class_id = '" . (int)$data['weight_class_id'] . "', length = '" . (float)$data['length'] . "', width = '" . (float)$data['width'] . "', height = '" . (float)$data['height'] . "', length_class_id = '" . (int)$data['length_class_id'] . "', unit_price = '" . $this->db->escape($data['unit_price']) . "', status = '" . (int)$data['status'] . "', tax_class_id = '" . $this->db->escape($data['tax_class_id']) . "', sort_order = '" . (int)$data['sort_order'] . "', date_modified = NOW() WHERE product_id = '" . (int)$product_id . "'");
]]></add>
</operation>
</file>
<file name="admin/controller/catalog/product.php">
<operation>
<search position="after"><![CDATA[
$this->data['entry_model'] = $this->language->get('entry_model');
]]></search>
<add><![CDATA[
$this->data['entry_unit_price'] = $this->language->get('entry_unit_price');
]]></add>
</operation>
<operation>
<search position="before"><![CDATA[
if (isset($this->request->post['sku'])) {
]]></search>
<add><![CDATA[
if (isset($this->request->post['unit_price'])) {
$this->data['unit_price'] = $this->request->post['unit_price'];
} elseif (!empty($product_info)) {
$this->data['unit_price'] = $product_info['unit_price'];
} else {
$this->data['unit_price'] = '';
}
]]></add>
</operation>
</file>
<file name="admin/view/template/catalog/product_form.tpl">
<operation>
<search position="after" offset="10"><![CDATA[
<td><?php echo $entry_weight_class; ?></td>
]]></search>
<add><![CDATA[
<tr>
<td><?php echo $entry_unit_price; ?></td>
<td><input type="text" name="unit_price" value="<?php echo $unit_price; ?>" /></td>
</td>
</tr>
]]></add>
</operation>
</file>
<file name="catalog/controller/product/product.php">
<operation error="skip">
<search position="after"><![CDATA[
$this->data['text_model'] = $this->language->get('text_model');
]]></search>
<add><![CDATA[
$this->data['text_unit_price'] = $this->language->get('text_unit_price');
]]></add>
</operation>
</file>
<file name="catalog/language/english/product/product.php">
<operation error="skip">
<search position="after"><![CDATA[
$_['tab_related'] = 'Related Products';
]]></search>
<add><![CDATA[
$_['text_unit_price'] = 'unit_price:';
]]></add>
</operation>
</file>
<file name="catalog/language/english/product/product.php">
<operation error="skip">
<search position="after"><![CDATA[
$_['tab_related'] = 'Relaterade produkter';
]]></search>
<add><![CDATA[
$_['text_unit_price'] = 'unit_price:';
]]></add>
</operation>
</file>
<file name="catalog/controller/product/product.php">
<operation error="skip">
<search position="after"><![CDATA[
$this->data['manufacturer'] = $product_info['manufacturer'];
]]></search>
<add><![CDATA[
$this->data['unit_price'] = $product_info['unit_price'];
]]></add>
</operation>
</file>
</modification>
which works great!
the thing is that it's one of the last ones now
Is there a way I can make it the next field to 'price' field?
if so, how?

Within this section:
<file name="admin/view/template/catalog/product_form.tpl">
<operation>
<search position="after" offset="10"><![CDATA[
<td><?php echo $entry_weight_class; ?></td>
]]></search>
<add><![CDATA[
<tr>
<td><?php echo $entry_unit_price; ?></td>
<td><input type="text" name="unit_price" value="<?php echo $unit_price; ?>" /></td>
</td> <!-- <- ALSO REMOVE THAT LINE FROM YOUR XML FILE... -->
</tr>
]]></add>
</operation>
</file>
change the <search> part to:
<search position="after" offset="3"><![CDATA[<td><?php echo $entry_price; ?></td>]]></search>
Play with the offset - it means how many lines after the one that is found the add part will be added. I guess it should be 3, but maybe You would have to adjust it a little (maybe only to 2).

Related

How can I perfom an update with jena fuseki?

I've wrote this query that normally works
String query2 = "PREFIX publ: <http://www.ps7-wia2.com/publications/>\n" +
"PREFIX pub: <http://www.ps7-wia2.com/publications#>" +
"DELETE { publ: " + id + " pub:like ?o }\n" +
"INSERT { publ: " + id + " pub:like " + nbLikes + " }\n" +
"WHERE {publ:" + id + " pub:like ?o .}\n";
RDFConnection conn2 = RDFConnectionFactory.connect(DATABASE);
QueryExecution qExec2 = conn2.query(query2) ;
conn2.close();
qExec2.close();
And when I execute I encounter this error
org.apache.jena.query.QueryParseException: Encountered " "delete" "DELETE "" at line 2, column 52.
Was expecting one of:
"base" ...
"prefix" ...
"select" ...
"json" ...
"describe" ...
"construct" ...
"ask" ...
```
In SPARQL, query and update are parsed separately; they are separate languages which use many of the same elements but have different syntax for their functionality ("SELECT" vs "INSERT" etc).
Use update(...).

Opportunity Send Email

I tried to find a solution to my problem but I couldn't.
I have written some code to send an automatic email from Opportunity Salesforce and I write a test class but the code coverage doesn't go over 39%.
This is a code:
public class OpportunityEmail {
public static Boolean sendOppEmail(Opportunity opp){
OrgWideEmailAddress iOrgWideEmailAddress;
OrgWideEmailAddress iOrgWideEmailAddressAlert;
iOrgWideEmailAddress = OrgWideEmailAddressHelper.getByAddress(Label.SendPartnerOppEmail);
iOrgWideEmailAddressAlert = OrgWideEmailAddressHelper.getByAddress(Label.SendPartnerOppEmailAlert);
Boolean hasError = false;
Map<Id, Opportunity> mpOpp = new Map<Id, Opportunity>();
String msg = Label.OpportunitySendEmailSuccess;
Boolean myRet = false ;
System.debug(opp);
try {
Opportunity lstOpp = [select AccountId,Primary_Contact__c,CustomerAccount__c,SendEmailDone__c from Opportunity where id =: opp.Id];
Account accPrt = [select CompanyEmail__c from Account where id =: opp.AccountId];
String primContcSped = '';
if(opp.Primary_Contact__c != null){
Contact primContc = [select Email from Contact where id =: opp.Primary_Contact__c];
primContcSped = primContc.Email;
}
Account accCust = [select Account.Name,
Account.VATNumber__c,
Account.FiscalCode__c,
Account.Phone,
Account.Mobile__c,
Account.CompanyEmail__c,
Account.SDICode__c,
Account.BillingStreet,
Account.BillingPostalCode,
Account.BillingCity,
Account.BillingStateCode,
Account.BillingState,
Account.ShippingStreet,
Account.ShippingPostalCode,
Account.ShippingCity,
Account.ShippingStateCode,
Account.ShippingState from Account where id =: opp.CustomerAccount__c];
String Template = OpportunityEmail__c.getValues('Template1').TemplateEmail__c;
EmailTemplate eT = [select id, DeveloperName, Body, HtmlValue, Subject from EmailTemplate where Name =: Template];
Id TemplateId = eT.Id ;
String subject = eT.Subject;
String HtmlBody = eT.HtmlValue;
Id account = opp.Id;
String address = accPrt.CompanyEmail__c;
String ccaddress = '';
if(primContcSped != null){
ccaddress = primContcSped;
}
String ReplyToEmail = OpportunityEmail__c.getValues('Operation').ReplyToEmail__c;
String Customer = accCust.Name + '<br>' +
'P.Iva: ' + accCust.VATNumber__c + '<br>' +
'Cod.Fiscale: ' + accCust.FiscalCode__c + '<br>' +
'Telefono: ' + accCust.Phone + '<br>' +
'Mobile: ' + accCust.Mobile__c + '<br>' +
'Email: ' + accCust.CompanyEmail__c + '<br>' +
'SDI: ' + accCust.SDICode__c + '<br><br>' +
'Sede Legale: ' + '<br>' +
accCust.BillingStreet + ', ' + accCust.BillingPostalCode + ' ' + accCust.BillingCity + ' (' + accCust.BillingStateCode + ') ' + '<br><br>' +
'Sede Operativa: ' + '<br>' +
accCust.ShippingStreet + ', ' + accCust.ShippingPostalCode + ' ' + accCust.ShippingCity + ' (' + accCust.ShippingStateCode + ') ';
String Description = '';
if(opp.Description != null){
Description = opp.Description;
}
String ItemTable = '';
if(opp.HardwareBundle__c != null){
ItemTable = '<table style="width:30%;border: 1px solid black;"> <tr> <th style="text-align: left;border: 1px solid black;"> Service/Products </th> </tr>';
List<Schema.PicklistEntry> fieldResult = Opportunity.HardwareBundle__c.getDescribe().getPicklistValues();
Opportunity lstBund = [select HardwareBundle__c from Opportunity where id =: opp.Id];
String[] tmpBund = lstBund.HardwareBundle__c.split(';');
for(String s : tmpBund){
for(Schema.PicklistEntry f : fieldResult) {
if (f.getValue() == s){
ItemTable = ItemTable + '<tr> <td style = "text-align: left;">'+ f.getLabel()+'</td></tr>';
break;
}
}
}
ItemTable = ItemTable + '</table>';
}
subject = subject.replace('CustomerAccount', accCust.Name);
HtmlBody = HtmlBody.replace('{Customer1}', Customer);
HtmlBody = HtmlBody.replace('ItemTable', ItemTable);
HtmlBody = HtmlBody.replace('{!Description}', Description);
EmailManager.sendMailCcAdd(TemplateId, account, address, ccaddress, iOrgWideEmailAddress, ReplyToEmail, subject, HtmlBody);
lstOpp.SendEmailDone__c = true;
update lstOpp;
myRet = true ;
} catch (Exception e) {
String data = 'STACK TRACE:\n' +e.getStackTraceString() + '\nMESSAGE:\n' + e.getMessage()+ '\nLine:\n' + e.getLineNumber();
CustomLogHelper.addNewLog('OpportunityEmail.sendOppEmail',data);
CustomLogHelper.saveCurrentCustomLog();
hasError = true;
mpOpp.put(opp.id, opp);
msg = Label.OpportunitySendEmailFail +', Error: '+ data;
}
return myRet;
}
}
And this is a test class code
#isTest
private class OpportunityEmailTest2 {
#testSetup static void setup(){
EmailTemplate validEmailTemplate = new EmailTemplate();
validEmailTemplate.isActive = true;
validEmailTemplate.Name = 'PartnerEmail';
validEmailTemplate.DeveloperName = 'PartnerEmail';
validEmailTemplate.TemplateType = 'custom';
validEmailTemplate.FolderId = UserInfo.getUserId();
validEmailTemplate.IsActive = true;
validEmailTemplate.HtmlValue = 'Test email';
validEmailTemplate.Subject = 'Soggetto Email Test';
insert validEmailTemplate;
}
#isTest static void OpportunityEmailTest1() {
RecordType aRT = new RecordType();
aRT = [SELECT id, Name from RecordType where Name ='Company'];
Account accCust = new Account();
accCust.SDIPec__c = '1901837#gmail.com';
accCust.SDICode__c = '0000000';
accCust.Phone = '0233498737';
accCust.Mobile__c = '3452229458';
accCust.CompanyEmail__c = 'comp#gmail.com';
accCust.Name = 'Cuenta test1';
accCust.CommercialName__c = 'Cuenta test1';
accCust.VATNumber__c = '03442194837';
accCust.FiscalCode__c = 'RBNMHL70D15A059E';
accCust.BillingStreet = 'Via Pesciatina 129 Fraz. Lunata';
accCust.BillingPostalCode = '00187';
accCust.BillingCity = 'Legnano';
accCust.BillingStateCode = 'MI';
accCust.BillingState = 'Milan';
accCust.BillingCountryCode = 'IT';
accCust.ShippingStreet = 'Via Pesciatina 129 Fraz. Lunata';
accCust.ShippingPostalCode = '00187';
accCust.ShippingCity = 'Legnano';
accCust.ShippingStateCode = 'MI';
accCust.ShippingState = 'Milan';
accCust.RecordType = aRT;
insert accCust;
Account accPart = new Account();
accPart.SDIPec__c = '20190130#gmail.com';
accPart.SDICode__c = '0000000';
accPart.VATNumber__c = '03446283948';
accPart.FiscalCode__c = 'BRTLMN83C16B406T';
accPart.Name = 'Cuenta test2';
accPart.CommercialName__c = 'Cuenta test2';
accPart.CompanyEmail__c = 'CompanyEmail__2#gmail.com';
accPart.BillingStreet = 'VIA DE FLAGILLA 24';
accPart.BillingPostalCode = '00187';
accPart.BillingCity = 'ROMA';
accPart.BillingStateCode = 'RM';
accPart.BillingCountryCode = 'IT';
accPart.ShippingStreet = 'VIA DE FLAGILLA 24';
accPart.ShippingPostalCode = '00187';
accPart.ShippingCity = 'ROMA';
accPart.ShippingStateCode = 'RM';
accPart.RecordType = aRT;
insert accPart;
Contact pryCont = new Contact();
pryCont.LastName = 'Contact Test';
pryCont.MobilePhone = '3452229384';
pryCont.Email = 'contactemail#email.it';
insert pryCont;
Opportunity iOpport = new Opportunity();
iOpport.Name = 'Test Opportunity Email';
iOpport.StageName = 'Proposal';
iOpport.CloseDate = Date.today();
//iOpport.RecordTypeId = '0120N000000RUeXQAW'; //PROD
//iOpport.RecordTypeId = '0121w0000009fgJAAQ'; //PARTIAL COPY
iOpport.RecordTypeId = '0121w0000006dPnAAI'; //MYDEV
iOpport.AccountId = accPart.Id;
iOpport.CustomerAccount__c = accCust.Id;
iOpport.Primary_Contact__c = pryCont.Id;
iOpport.Description = 'Descrizione test';
iOpport.HardwareBundle__c = 'BD05';
iOpport.OpportunityHardware__c = true;
iOpport.SendEmailDone__c = false;
insert iOpport;
OpportunityEmail.sendOppEmail(iOpport);
OrgWideEmailAddress iOrgWideEmailAddress;
iOrgWideEmailAddress = OrgWideEmailAddressHelper.getByAddress(Label.SendPartnerOppEmail);
String Template = 'PartnerEmail';
EmailTemplate eT = [select id, DeveloperName, Body, HtmlValue, Subject from EmailTemplate where Name =: Template LIMIT 1];
Id TemplateId = eT.Id ;
String subject = eT.Subject;
String HtmlBody = eT.HtmlValue;
Id account = iOpport.Id;
String address = accPart.CompanyEmail__c;
String ccaddress = pryCont.Email;
String ReplyToEmail = 'replayemail#email.com';
String Customer = accCust.Name + '<br>' +
'P.Iva: ' + accCust.VATNumber__c + '<br>' +
'Cod.Fiscale: ' + accCust.FiscalCode__c + '<br>' +
'Telefono: ' + accCust.Phone + '<br>' +
'Mobile: ' + accCust.Mobile__c + '<br>' +
'Email: ' + accCust.CompanyEmail__c + '<br>' +
'SDI: ' + accCust.SDICode__c + '<br><br>' +
'Sede Legale: ' + '<br>' +
accCust.BillingStreet + ', ' + accCust.BillingPostalCode + ' ' + accCust.BillingCity + ' (' + accCust.BillingStateCode + ') ' + '<br><br>' +
'Sede Operativa: ' + '<br>' +
accCust.ShippingStreet + ', ' + accCust.ShippingPostalCode + ' ' + accCust.ShippingCity + ' (' + accCust.ShippingStateCode + ') ';
String Description = iOpport.Description;
String ItemTable = iOpport.HardwareBundle__c;
EmailManager.sendMailCcAdd(TemplateId, account, address, ccaddress, iOrgWideEmailAddress, ReplyToEmail, subject, HtmlBody);
}
}
I understood that the part of code not cover is this:
String Template = OpportunityEmail__c.getValues('Template1').TemplateEmail__c;
EmailTemplate eT = [select id, DeveloperName, Body, HtmlValue, Subject from EmailTemplate where Name =: Template];
Id TemplateId = eT.Id ;
String subject = eT.Subject;
String HtmlBody = eT.HtmlValue;
Id account = opp.Id;
String address = accPrt.CompanyEmail__c;
String ccaddress = '';
if(primContcSped != null){
ccaddress = primContcSped;
}
String ReplyToEmail = OpportunityEmail__c.getValues('Operation').ReplyToEmail__c;
String Customer = accCust.Name + '<br>' +
'P.Iva: ' + accCust.VATNumber__c + '<br>' +
'Cod.Fiscale: ' + accCust.FiscalCode__c + '<br>' +
'Telefono: ' + accCust.Phone + '<br>' +
'Mobile: ' + accCust.Mobile__c + '<br>' +
'Email: ' + accCust.CompanyEmail__c + '<br>' +
'SDI: ' + accCust.SDICode__c + '<br><br>' +
'Sede Legale: ' + '<br>' +
accCust.BillingStreet + ', ' + accCust.BillingPostalCode + ' ' + accCust.BillingCity + ' (' + accCust.BillingStateCode + ') ' + '<br><br>' +
'Sede Operativa: ' + '<br>' +
accCust.ShippingStreet + ', ' + accCust.ShippingPostalCode + ' ' + accCust.ShippingCity + ' (' + accCust.ShippingStateCode + ') ';
String Description = '';
if(opp.Description != null){
Description = opp.Description;
}
String ItemTable = '';
if(opp.HardwareBundle__c != null){
ItemTable = '<table style="width:30%;border: 1px solid black;"> <tr> <th style="text-align: left;border: 1px solid black;"> Service/Products </th> </tr>';
List<Schema.PicklistEntry> fieldResult = Opportunity.HardwareBundle__c.getDescribe().getPicklistValues();
Opportunity lstBund = [select HardwareBundle__c from Opportunity where id =: opp.Id];
String[] tmpBund = lstBund.HardwareBundle__c.split(';');
for(String s : tmpBund){
for(Schema.PicklistEntry f : fieldResult) {
if (f.getValue() == s){
ItemTable = ItemTable + '<tr> <td style = "text-align: left;">'+ f.getLabel()+'</td></tr>';
break;
}
}
}
ItemTable = ItemTable + '</table>';
}
subject = subject.replace('CustomerAccount', accCust.Name);
HtmlBody = HtmlBody.replace('{Customer1}', Customer);
HtmlBody = HtmlBody.replace('ItemTable', ItemTable);
HtmlBody = HtmlBody.replace('{!Description}', Description);
EmailManager.sendMailCcAdd(TemplateId, account, address, ccaddress, iOrgWideEmailAddress, ReplyToEmail, subject, HtmlBody);
lstOpp.SendEmailDone__c = true;
update lstOpp;'
But I don't understand which is a solution.
Thank you so much for your help!
String Template = OpportunityEmail__c.getValues('Template1').TemplateEmail__c;
In this line, I see that you are trying to access a Custom Setting OpportunityEmail__c. Custom Settings behave just like data, which means that you need to insert it in the test method before you can use it.
Your other option is to use a Custom Metadata Type instead, which can be retrieved from the environment via a SOQL query.

#MTASA Server Error: Attempt to index a nil value

I really don't know what is wrong here. This is the error I am getting:
s_interior_admin.lua:944: attempt to index local 'interiors'
And here is my code:
local interiors = exports["official-interiors"].getInteriorsList() --/MAXIME
interior = interiors[tonumber(interiorId)]
if interior then
local ix = interior[2]
local iy = interior[3]
local iz = interior[4]
local optAngle = interior[5]
local interiorw = interior[1]
local rot = getPedRotation(thePlayer)
local id = SmallestID()
local query = mysql:query_free("INSERT INTO interiors SET creator='"..getElementData( thePlayer, "account:username" ).."', id=" .. id .. ",x='" .. x .. "', y='" .. y .."', z='" .. z .."', type='" .. inttype .. "', owner='" .. owner .. "', locked='" .. locked .. "', cost='" .. cost .. "', name='" .. mysql:escape_string( name) .. "', interior='" .. interiorw .. "', interiorx='" .. ix .. "', interiory='" .. iy .. "', interiorz='" .. iz .. "', dimensionwithin='" .. dimension .. "', interiorwithin='" .. interiorwithin .. "', angle='" .. optAngle .. "', angleexit='" .. rot .. "', createdDate=NOW()")
if (query) then
if tonumber(inttype) == 1 then
mysql:query_free("INSERT INTO `interior_business` SET `intID`='"..id.."' ")
end
outputChatBox("Created Interior with ID " .. id .. ".", thePlayer, 255, 194, 14)
exports.logs:dbLog(thePlayer, 4, { "in"..tostring(id) } , "ADDINTERIOR T:".. inttype .." I:"..interiorId.." C:"..cost)
reloadOneInterior(id, false, false)
local adminUsername = getElementData(thePlayer, "account:username")
local hiddenAdmin = getElementData(thePlayer, "hiddenadmin")
local adminTitle = exports.global:getPlayerAdminTitle(thePlayer)
if hiddenAdmin == 0 then
exports.global:sendMessageToAdmins("[INTERIOR]: "..adminTitle.." ".. getPlayerName(thePlayer):gsub("_", " ").. " ("..adminUsername..") has created Interior #"..id.." with name '"..name.."', type "..inttype..", price: $"..cost..").")
else
exports.global:sendMessageToAdmins("[INTERIOR]: A hidden admin has created Interior #"..id.." with name '"..name.."', type "..inttype..", price: $"..cost..").")
end
exports["interior-manager"]:addInteriorLogs(id, commandName.." - id "..interiorId.." - price $"..cost.." - name "..name, thePlayer)
return true
else
outputChatBox("Failed to create interior - Invalid characters used in name of the interior.", thePlayer, 255, 0, 0)
end
else
outputChatBox("Failed to create interior - There is no such interior (" .. ( interiorID or "??" ) .. ").", thePlayer, 255, 0, 0)
end
end
end
end
exports["official-interiors"].getInteriorsList() --/MAXIME
returns nil
hence
local interiors = exports["official-interiors"].getInteriorsList() --/MAXIME
interior = interiors[tonumber(interiorId)]
causes an error because you are not allowed to index a nil value.

Formula references data that are not shown

I need some help with my Google Sheets... I don't understand why but my data are capricious...
I use a simple ={'Mysheet'!A1:D} and I get only the first cell.
Please find a link to a copy of my sheet. The problem is in 'Up&Down OR'
https://docs.google.com/spreadsheets/d/1HJ_bqQtsjWe9RxaDzLUypY-D9dyuqWNpw2pG0XHVYjI/edit?usp=sharing
most likely there is some residue from the script you are usiing but you can always reference original:
=QUERY(Encodage!A1:AAA ;"select C, " & params!K1 & ", " & params!L1 & ", " & params!M1 & " where A = FALSE AND B = '1OR' ORDER BY " & params!K1 & " + " & params!L1 & " + " & params!M1 & " LIMIT 10 LABEL " & params!K1 & " '" & INDIRECT("Encodage!"& params!K1 & "1") & "', " & params!L1 & " '" & INDIRECT("Encodage!"& params!L1 & "1") & "', " & params!M1 & " '" & INDIRECT("Encodage!"& params!M1 & "1") & "'" ;1)

Pellet doesn't include my SWRL rules

I build an ontology which uses SWRL rules to inference. When I do a SQWRL querying in Protege it works fine. The problem is, when i want to use Pellet with Jena, it seems like Pellet doesn't include the SWRL rules in the querying. I include Pellet like this:
InputStream in = new FileInputStream(new File("D:\\Fakultet\\WeatherHealthcast1.owl"));
Model model = ModelFactory.createDefaultModel();
model.read(in, null);
OntModel ontology = ModelFactory.createOntologyModel(PelletReasonerFactory.THE_SPEC, model);
// Create a new query
String queryString =
"PREFIX WeatherHealthcast: <http://www.semanticweb.org/ontologies/2011/2/WeatherHealthcast.owl#> " +
"PREFIX foaf: <http://xmlns.com/foaf/0.1/> " +
"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> " +
"SELECT ?disease " +
"WHERE { " +
" ?person rdf:type WeatherHealthcast:Person." +
" ?person foaf:firstName ?fn." +
" ?person foaf:lastName ?ln." +
" FILTER regex(str(?fn), \"Viktor\")." +
" FILTER regex(str(?ln), \"Taneski\")." +
" ?disease rdf:type WeatherHealthcast:Disease. " +
" ?person WeatherHealthcast:suffersFrom ?disease." +
"}";
Query query = QueryFactory.create(queryString);
// Execute the query and obtain results
QueryExecution qe = QueryExecutionFactory.create(query, ontology);
ResultSet resultSet = qe.execSelect();
System.out.println("TEST");
while (resultSet.hasNext())
{
QuerySolution result = resultSet.next();
RDFNode disease = result.get("disease");
Resource resource = disease.asResource();
System.out.println(" { Suffers from: " + resource.getLocalName() + " . }");
}
I also tried this:
Reasoner r = PelletReasonerFactory.theInstance().create();
InfModel inferenceModel = ModelFactory.createInfModel(r, model);
but no progress. Any ideas? I need this for my diploma thesis. Thanks
As far as I know, pellet cannot support SQWRL. On the other hand, it supports SWRL but with some restrictions (see http://clarkparsia.com/pellet/faq/rules).
I might be late but I think you should switch to owl full in order to get all your rules included in the reasoning.

Resources