Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 447,098
» Latest member: kenseycehn
» Forum threads: 1,742
» Forum posts: 9,035

Full Statistics

Online Users
There are currently 567 online users.
» 5 Member(s) | 562 Guest(s)
seekerpleasure

Latest Threads
2024#1 GlycoGuard - 100% ...
Forum: Open Discussions
Last Post: Rodneiy
2 hours ago
» Replies: 0
» Views: 3
[RESUELTO] - Tipo de impu...
Forum: Administrator Support
Last Post: joebordes
Yesterday, 05:49 PM
» Replies: 13
» Views: 7,888
little bug trasformin LEA...
Forum: Administrator Support
Last Post: payalbatra
04-23-2024, 06:57 AM
» Replies: 4
» Views: 3,585
como manejar github en un...
Forum: International
Last Post: ntermacabre
04-10-2024, 03:52 AM
» Replies: 2
» Views: 1,219
whatsapp
Forum: User Support
Last Post: Yash
04-03-2024, 09:26 AM
» Replies: 2
» Views: 6,085
PRODUCTS IN ACCOUNTS BY O...
Forum: User Support
Last Post: joebordes
03-31-2024, 11:04 PM
» Replies: 1
» Views: 365
Attachment in e-mail not ...
Forum: User Support
Last Post: julikarole
03-13-2024, 05:59 AM
» Replies: 2
» Views: 1,155
Mail Manager - Options Se...
Forum: Administrator Support
Last Post: joebordes
03-06-2024, 11:52 PM
» Replies: 16
» Views: 18,367
Intermittent issues after...
Forum: User Support
Last Post: joebordes
03-06-2024, 11:44 PM
» Replies: 9
» Views: 1,659
Custom Columns in Mail Ma...
Forum: Modules/Extension Support
Last Post: joebordes
03-06-2024, 11:42 PM
» Replies: 1
» Views: 2,177

 
  ExactOnline for coreBOS
Posted by: Guido1982 - 11-28-2015, 04:12 PM - Forum: Modules/Extension Support - Replies (37)

I've created this repo on github. Right now it's quite a mess, but I'm getting there. Take a look at the files:


Which is where I'm setting up the OAuth dance (which was an enormous pain in the ass), but now it seems to be okay. I'm now in the process of creating an API class and severall classes for updating and reading accounts, invoices etc.

In the end I want to create workflow tasks for this and register this module with only a backend settings menu where you could enter you client_id, secret etc.

Print this item

  Creating a new module: basic steps?
Posted by: Guido1982 - 11-28-2015, 09:45 AM - Forum: Modules/Extension Support - Replies (14)

I took a look at this link for creating a new module and have some questions. First off let me explain what my module should do:

  • It'll create a connection to Exact Online accounting software via their API. For this I only need a settings template where a user can set the client ID, client secret, division, return url and maybe some options.
  • I'm going to create some workflow tasks that will read the credentials from the database and use them to connect with Exact Online. On every invoice save, for example this will be used to establish the connection and send the invoice.
  • Later on I'd like to create a cron that reads from exact if invioces are paid (it has a bank link so in Exact this is automated) and set invoices in coreBOS to paid as well.

Now for the questions:
  • I understand the vtlib module creation will auto-create tables and include the module name here. The only table I need is one where I can store the values in the settings page. Can I use the auto-created one for this? Or better to create table manually?
  • I'm guessing the TPL files for the settings page go in the same folder as normal TPL file templates, but how do I create a link in the settings page?
  • What exactly are the modules' 'event handlers'? This seems like a workflow task?
EDIT: Add attachment PDF with original vTiger tutorial for creating module



Attached Files
.pdf   VtigerCRM_5.2.0_Vtlib.pdf (Size: 1.42 MB / Downloads: 8)
Print this item

  I don't understand the 'getFieldNames()' function in the workflow tasks
Posted by: Guido1982 - 11-24-2015, 09:44 PM - Forum: coreBOS Development - Replies (2)

I've been studying the workflow task in the development wiki, and the suggested github commit on adding tags, but I don't understand the 'getFieldNames' method. It simply returns an array (are the values database columns in the tasks table?), and later on they get cheched on as if they were class attributes. Is this some magic function in the system that checks if a particular entry in the database is there or something? Something that is automatically invoked when the workflow starts?

Print this item

  Where does the function 'getSalesEntityType' come from?
Posted by: Guido1982 - 11-24-2015, 08:59 PM - Forum: coreBOS Development - Replies (5)

I was studying this example from the documentation, and noticed this function called 'getSalesEntityType' that checks the entitytype on the id pulled in from the 'data' object. Since no files were included in this function file, I can't see how where this function comes from, although I can understand what it does from the name, I'd rather have a better understanding so I know what I'm doing when writing my own workflow methods. Can anyone explain?

Print this item

  For anyone looking for development tips
Posted by: Guido1982 - 11-24-2015, 08:39 PM - Forum: coreBOS - No Replies

Maybe you ended up here on the forum via Google or whatever, a good place to start is: http://corebos.org/documentation/ if you are looking for general instruction on classes, methods and vtlib.

Print this item

  Empezando con triggers o workflows
Posted by: unaitwo - 11-24-2015, 04:51 PM - Forum: Spanish - Replies (6)

Hola estoy intentado crear un sistema que tras que el usuario introduzca una entidad esta dispare la creación de otra usando valores de la primera, a modo de ejemplo, al introducir un prepuesto, en el calendario se programe automáticamente una llamada, usando los valores del presupuesto, como pueda ser el contacto y la fecha. Por donde tengo que empezar para programar un comportamiento como este???

Print this item

  jqueryversion on github
Posted by: saidmsl - 11-23-2015, 04:25 AM - Forum: coreBOS - Replies (7)

Hi,

while surfing on github project, i notice there is a branch jqueryversion

what i understand is that it remove all scriptaculous and prototype librairies and clean the javscript librairies

do you plan to merge it to master branch? 

when could  it be usable?

Rgds

Print this item

  A simple way to check if all sales orders are invoiced
Posted by: Guido1982 - 11-18-2015, 02:41 PM - Forum: Modules/Extension Support - Replies (6)

I wrote a small file that does only one simple thing: Check if the sum of all invoices related to a sales order is at least equal to the sales order total. I other words, you can check if you didn't forget to create invoices. It creates a very simple table. Take this code and place it in a NEW file called SO_Invoiced.php, in the modules/SalesOrder folder:

PHP Code:
<?php

// error_reporting(E_ALL);
// ini_set("display_errors", "on");

include_once('vtlib/Vtiger/Module.php');
global 
$adb;

// Set a new date object for the first of the year
$firstofyear = new DateTime();
// Set a new date object for the last of the year
// $lastofyear = new DateTime();
// Get the current year
$currentYear Date("Y");
// Get the first day of the current year
$firstofyear $firstofyear->modify("first day of january".$currentYear);
// Get the last day of the current year
// $lastofyear = $lastofyear->modify("last day of december".$currentYear);
// Format the firstofyear to match database formatting
$firstofyear $firstofyear->format('Y-m-d G:i:s');

// Create the master array
$SOArray = array();

// Get all the sales orders for the timeframe from the 'crmentity' table
$SOresult $adb->pquery('SELECT crmid, createdtime FROM vtiger_crmentity WHERE setype=? AND deleted=? AND createdtime > ?',array("SalesOrder",0,$firstofyear));

while(
$SalesOrderEntity=$adb->fetch_array($SOresult)) {
 
// Get the salesorders from the actual salesorders table
 
$SalesOrders $adb->pquery('SELECT salesorderid, subject, salesorder_no, total, accountid, sostatus FROM vtiger_salesorder WHERE salesorderid=?',array($SalesOrderEntity[crmid]));
 
// Loop these
 
while($SO=$adb->fetch_array($SalesOrders)) {
 
// Create array for this sales orders
 
$SalesOrder = array();
 
// Create empty slot for invoices
 
$SalesOrder["Invoices"] = array();
 
// Fill it with the order info
 
$SODate = new DateTime($SalesOrderEntity[createdtime]);
 
$SalesOrder["createdtime"] = $SODate->format('d-m-Y');
 
$SalesOrder["crmid"] = $SO[salesorderid];
 
$SalesOrder["SO_number"] = $SO[salesorder_no];
 
$SalesOrder["subject"] = $SO[subject];
 
$SalesOrder["total"] = $SO[total];
 
$SalesOrder["sostatus"] = $SO[sostatus];
 
// Get the associated account
 
$SOAccountResult $adb->pquery('SELECT accountname FROM vtiger_account WHERE accountid=?',array($SO[accountid]));
 
$SOAccount $adb->query_result_rowdata($SOAccountResult);
 
// Place it in the SalesOrder array
 
$SalesOrder["Accountname"] = $SOAccount[accountname];
 
$SOArray[$SO[salesorder_no]] = $SalesOrder;
 }
}

// Now loop the SOArray and look up all invoices for each Sales Order
foreach($SOArray as $ThisSO){
 
// Create an array for invoices
 
$Invoices = array();
 
// Search the database for Invoices
 
$InvoiceResult $adb->pquery('SELECT subject, invoicedate, total, invoice_no, invoicestatus FROM vtiger_invoice WHERE salesorderid=?',array($ThisSO["crmid"]));
 while (
$Invoice=$adb->fetch_array($InvoiceResult)) {
 
$ThisInvoice = array();
 
$ThisInvoice["subject"] = $Invoice["subject"];
 
$Invoicedate = new DateTime($Invoice["invoicedate"]);
 
$ThisInvoice["invoicedate"] = $Invoicedate->format('d-m-Y');
 
$ThisInvoice["total"] = $Invoice["total"];
 
$ThisInvoice["invoice_no"] = $Invoice["invoice_no"];
 
$ThisInvoice["status"] = $Invoice["invoicestatus"];
 
$Invoices[] = $ThisInvoice;
 }
 
// Append all found invoices to the master array
 
$SOArray[$ThisSO[SO_number]]["Invoices"] = $Invoices;
}

echo 
"<table cellpadding='5' border='1' style='width: 80%; margin-left: 10%; border-collapse: collapse'><tbody><tr><td>Orderno:<br>(Except cancelled)</td><td>SO subject line:</td><td>SO date</td><td>Klant</td><td>SO total incl. VAT</td><td>Sum of all invoices <br>(excluding invoices with negative amount)</td><td>Difference</td></tr>";
// Loop through the SO's

foreach ($SOArray as $SO) {
    // Loop through the invoices for this SO
    foreach ($SO["Invoices"] as $Invoice) {
        // Add each invoice amount to the last, creating a sum, but only if the invoice was not a credit invoice
        if ($Invoice["total"] > 0) {
            $Invoiceamount += $Invoice["total"];
        }
    }
    // Now create a line for each SO that was not fully invoiced
    if ($SO["total"] > $Invoiceamount && $SO["sostatus"] != "Cancelled") {
        echo "<tr>";
        echo "<td><a href='/index.php?module=SalesOrder&parenttab=Sales&action=DetailView&record=".$SO["crmid"]."' target='_blank'>".$SO["SO_number"]."</a></td><td>".$SO["subject"]."</td><td>".$SO["createdtime"]."</td><td>".$SO["Accountname"]."</td><td> &euro; ".number_format($SO["total"], 2',''.')."</td><td> &euro; ".number_format($Invoiceamount2',''.')."</td><td>&euro; ".number_format(($SO["total"] - $Invoiceamount), 2',''.')."</td>";
        echo "</tr>";
        // Create a sum of ALL SO amounts by adding the current
        // Total to the last ones
        $totallySold += $SO["total"];
        // This value is not reset at the end of the loop and so is a total of all invoiced amount in the table
        $totallyInvoiced += $Invoiceamount;
    }
    // Reset the sum to zero for the next SO
    $Invoiceamount 0;
}
echo 
"</tbody></table>";

echo 
"Total Amount of SO's:<b>&euro; ".number_format($totallySold2',''.')."</b><br>";
echo 
"Total Amount of Invoices:<b>&euro; ".number_format($totallyInvoiced2',''.')."</b><br>";
echo 
"Difference:<b>&euro; ".number_format(($totallySold $totallyInvoiced), 2',''.')."</b><br><br><br><br><br><br>";

?>

No point your browser to
Code:
http://{your-crm-url}/index.php?module=SalesOrder&action=SalesOrderAjax&file=SO_Invoiced

If you used a different filename, change the last part of the URL (after 'file=') to your file name.

Print this item

  Calendar location field automatically links to google maps
Posted by: Guido1982 - 11-17-2015, 05:53 PM - Forum: Administrator Support - No Replies

I have altered the function 'transferForAddIntoTitle' in the CalendarUtils.php file a little:

PHP Code:
function transferForAddIntoTitle($type$row$CD) {
 if (
$CD["uitype"] == "66"
 
$Col_Field = array($CD["fieldname"]=> $row["parent_id"]);
 else
 
$Col_Field = array($CD["fieldname"]=> $row[$CD["columnname"]]);

 if (
$CD["fieldname"] == "duration_hours"
 
$Col_Field["duration_minutes"] = $row["duration_minutes"];

 if (
$CD["fieldname"] == "contact_id") {
 
$Col_Field["contact_id"] = getAssignedContactsForEvent($row["crmid"]);
 
$CD["uitype"] = "1"  
 
}
 
$Cal_Data getDetailViewOutputHtml($CD["uitype"], $CD["fieldname"], $CD["fieldlabel"], $Col_Field"2"$calendar_tabid"Calendar");

 if (
$CD["uitype"] == "15")
 
$value getTranslatedString($Cal_Data[1],'Calendar');
 else
 
$value $Cal_Data[1];
 if (
$CD["fieldname"] == "location" {
 
$value "<a href='https://www.google.nl/maps/place/".$row['location']."' target='_blank'>".$row['location']."</a>";
 }
 if (
$type == "1")
 return 
$Cal_Data[1];
 else
 return 
'<br><b>'.$Cal_Data[0].'</b>: <span onmouseover="vtlib_listview.trigger(\'cell.onmouseover\', $(this))" onmouseout="vtlib_listview.trigger(\'cell.onmouseout\', $(this))">'.$value.'</span>';
 
// return '<table><tr><th>'.$Cal_Data[0].':</th><td onmouseover="vtlib_listview.trigger(\'cell.onmouseover\', $(this))" onmouseout="vtlib_listview.trigger(\'cell.onmouseout\', $(this))">'.$value.'</td></tr></table>';


Now, when you add a location the event will automatically create a link to google maps with that address or location pre-filled out.

If you adopt my account-selection autocomplete, the address for the appointment will automatically fill the location. To do so, change the 'select' in the autocomplete call to:

PHP Code:
         select: function( eventui) {
             
 // Add crmentity id to hidden input
             
 jQuery('input[name=parent_id]').attr('value',ui.item.value);
             
 // Also update the activity name with the activity type and account name
             
 jQuery('input[name=subject]').val(jQuery('#activitytype option:selected').text() + " " ui.item.label);
             
 // Overwrite the input field with the account name in stead of the crmentity
             
 jQuery('#account_autocomplete').val(ui.item.label);
             
 // Update the address automatically
             
 jQuery('input[name=location]').val(ui.item.street " " ui.item.city);
             
 return false;
         
 }, 

Print this item

  Adding a related sales order to the calendar event
Posted by: Guido1982 - 11-17-2015, 11:37 AM - Forum: Administrator Support - Replies (10)

I am in the process of relating activities directly to sales orders. I created a table that relates them and made a query in 'SaveEvent.php' that saves it, so far so good. Now I want every event to show that sales order as other related modules do. I saw that the Events.php file creates a JSON of all events, that I guess the 'fullcalendar.js' file uses to build the calendar. But now for the moment I am stumped on how to implement my query here and use it in the calendar. I think I should also edit 'CalendarView.tpl' (the jQuery to be exact), so that the JSON is expanded and the jQuery call uses this to build the calendar items. Does anyone have more detailled info?

Print this item