Jul 15 2019
Jul 15

When sending email from your application, using queuing process can reduce the application response time and increase speed.

By sending the message to queue instead of sending directly at the end of server response, you may achieve better user experience. Once messages are in queue, you just need a scheduled cron task to initiate scheduled email sending.

How ?

Queuing is simple in Drupal 8

Feb 08 2019
Feb 08

Web monetization service is a browser API which allow creation of (micro) payments between the reader (user agent) and the content provider (website).

This is one way of getting paid for valuable content.

Today Coil is providing web monetization service using Interledger protocol (ILP).

We have built a simple module to integrate coil monetization with Drupal website:

Simple settings to add payment pointer is demonstrated in this video:

Your browser does not support the video tag.

Jan 03 2019
Jan 03

Context

EK application has a module that store personal documents for user. When user account is deleted, those documents may be transferred to another account.

To achieve that, we need to alter the user account cancel form when building the form, validating and submitting it.

Let's review the 3 steps.

BUILD

The form before altering it looks like this

cancel user account before hook

We need to add a field to select another user account to which the document of the canceled account will be moved to.

To achieve that we Implements hook_form_alter() in MyModule.module:

function MyModule_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
    
  if ($form_id == 'user_multiple_cancel_confirm') {
    
    $form['move_uid_documents'] = [
      '#type' => 'textfield',
      '#title' => t('Move uer documents'),
      '#autocomplete_route_name' => 'MyModule.user_autocomplete',
      '#description' => t('Select to whom to transfer personal documents'),
    ];
    $form['#validate'][] = 'MyModule_form_user_delete_validate';
    $form['#submit'][] = 'MyModule_form_user_delete_submit';
    
     return $form;
      
  }
}

What we can notice here is:

  • We alter selected form defined by form ID. In this case : "user_multiple_cancel_confirm";
  • We create the required field by returning $form['move_uid_documents'] ;
  • We add 2 new actions for validation, $form['#validate'][], and submit, $form['#submit'][],  for the next steps.

After altering the form will look like this:

cancel user account after hook

We have a new field to select user. In our case, we also have an autocomplete function that helps selecting existing user. However, we need to ensure that the value entered in the field is really an existing user. This is the part handled by the validation.

 

VALIDATE

The validation is defined in MyModule_form_alter by adding validate callback named MyModule_form_user_delete_validate. Therefore, we need to create the function with thah particular name in MyModule.module.

function MyModule_form_user_delete_validate(&$form, \Drupal\Core\Form\FormStateInterface $form_state) {   if ($form['#form_id'] == 'user_multiple_cancel_confirm') {
        if ($form_state->getValue('move_uid_documents') <> '') {
            
            $query = "SELECT uid FROM {users_field_data} WHERE name = :n";
            $data = db_query($query, [':n' => $form_state->getValue('move_uid_documents')])
                    ->fetchField();
            if ($data) {
                $form_state->setValue('move_uid_documents', $data);
            } else {
                $form_state->setErrorByName('move_uid_documents', t('Unknown user to move documents'));
            }
            
 
        }
    
     return $form;
      
  }

Here the function will check against user_field_data table that the id is valid.

If not an error message will be displayed:

cancel user account validation error

However, if valid, we store the value to be used in the next step which is the submission.

SUBMISSION

As for validation, the submission is defined in MyModule_form_alter by adding validate callback named MyModule_form_user_delete_submit.

function MyModule_form_user_delete_submit(&$form, \Drupal\Core\Form\FormStateInterface $form_state) {
    
  if ($form['#form_id'] == 'user_multiple_cancel_confirm') {
    if($form_state->getValue('move_uid_documents')){
        foreach($form_state->getValue('accounts') as $key => $id) {               \Drupal::database()->update('MyModule_table')
                      ->fields(['uid' => $form_state->getValue('move_uid_documents'), 'folder' => t('Moved from user @u', ['@u' => $id])])
                      ->condition('uid', $id)->execute();
            }
    }
     \Drupal::messenger()->addStatus(t('Documents moved to user @u', ['@u' => $form_state->getValue('move_uid_documents')]));
     return $form;
      
  }
}

In the function above, we pick the id of each user account that is canceled and change to new user id in the document table.

The function also display a message to confirm actions: both cancellation and the submit hook have been executed.

cancel user submit alert

Please feel free to comment or suggest improvements.

Thank you.

Oct 05 2018
Oct 05

Our back-office management solution is running on latest version of Drupal (8.6.x). An online demo is updated with the latest version that showcase the application features. It was initially developed in-house as acustom PHP application for our startup in early 2000.

We move the project to Drupal 8 when it was still under alpha stage. And there is still plenty of work to do, but it was also a move to make it available for other small businesses.

An installation code is available for those familiar with Drupal. The installation process is partially covered in this article.Thus if any of Drupalists are enthusiastic about business process solutions and would like to contribute, they are welcome.

This covers many simple but useful back office functionalities like address book, products and services database, sales documents (invoices, purchases), projects, HR, logistics documents, cost tracking, journal records and others collaborative tools. It is still a young project that will certainly need more integration provided by Drupal 8 capabilities as it grows. Some of Drupal 8 features like multilingual support and tour guide are also very useful in the business environment we operate.

The solution is adopted by small businesses and start-ups. We provide paid support, comprehensive cloud solution and management expertise service for those who do not want to manage infrastructure. It is a very good solution for small business that need to organize their back office and data management.

On one hand, it gives us tremendous information and feedback about all necessary improvements we need to implement  and fixes to apply. On the other hand, Drupal 8 has proven to be very stable and efficient in running this solution, and we are still to explore plenty of value added features that are of high value in data processing like RESTful Web Services for instance or plugins developments

We encourage anyone to explore this solution, provide feedback, and even contribute to the project.

Jul 25 2017
Jul 25

This is an example of anti-virus implementation with an Ubuntu server.

Our back office management solution allows users to upload files in various sections of the application for storage or file sharing. For this reason, checking of files for virus is an important advantage.

We use the ClamAV module integration from Drupal 8.

1) Install ClamAV on Ubuntu

Installation on Ubuntu server is straight forward.  However, it is better to install with clamav-daemon clamav-freshclam options for later settings

You can test with clamscan -r /home for instance

For further options you may refer to ClamAV website.

2) Install and set-up Drupal module

Module installation on Drupal 8 has no specific requirements.

As indicated on the module page, "Daemon mode" is preferred when executing the scan.

In the settings page (/admin/config/media/clamav), select Daemon mode (over Unix socket) in scan mechanism

You need to indicate the path for the socket pointing file; it can be found in the configuration file  : /etc/clamav/clamd.conf.

Input the file path into next setting:

3) Test

When uploading a file on the server via any upload interface, the file is scanned and validated. Scanning process is logged:

The Eicar test virus file is filtered when uploaded:

If you have implemented ClamAV with Drupal and have further comments, please feel free input your own.

Thank you.

Jan 15 2017
Jan 15
Custom view

This video tutorial was made for our customer in order to demonstrate how to build a custom view to extract the data they need.

Here we are building a view to extract sales data per project where each project is classified into a category. We link invoice table with project table and add filter to be able to view data by year and category of project.

The tables and data sources used in this view are custom tables from our back office management solution built on Drupal 8. However, the principles of building a view are applicable to any other data source and this tutorial can be used to learn simple view building with tables relationships and filter.

Your browser doesn't support HTML5 video tag.

May 08 2016
May 08

Hello,

Our back-office management solution is now running on version Drupal 8.2.3. The live demo is updated with the latest version.

It has been a long run since the project was initiated while Drupal 8 was still under alpha stage. And there is still plenty of work to do.

One objective is to make a full distribution package including most of the current functionalities available in the demo version. Our main issue with this target is the lack of resources and time. Thus if any of Drupalists are enthusiastic about business process solutions and would like to contribute, they are welcome.

We focus first on moving an old in-house php application into Drupal 8 modules. This covers many simple but useful back office functionalities like address book, products and services database, sales documents (invoices, purchases), projects, HR, logistics documents, cost tracking, journal records and others collaborative tools. Thus it is still a very young project that will certainly need better integration with Drupal 8 capabilities as it grows. Some of Drupal 8 features like multilingual support and tour guide are already very useful in the business environment we operate.

The solution is run by small businesses and start-ups. We provide paid support, comprehensive cloud solution and management expertise service as well. On one hand, it gives us tremendous information and feedback about all necessary improvements we need to implement  and fixes to apply. On the other hand, Drupal 8 has proven to be very stable and efficient in running this solution, and we are still to explore plenty of value added features that are of high value in data processing like RESTful Web Services for instance or plugins developments

We encourage anyone to explore this solution, provide feedback, and even contribute to the project.

Jan 05 2016
Jan 05

Sometime in April 2014, we started an ambitious project to "translate" into Drupal 8 modules an in-house developed back-office management solution.

This back-office system, EK, was initiated in 2006 for internal needs. It was developed in PHP with mysql data storage. The initial idea was to have a tool that could help a new company to run its business as efficiently as possible with few constraints that are always critical in a good organization: central and unique data references (share unique information accross offices); simple to use with minimum training or learning curve (no resource for that!); flexible and cost effective; access control and security.

This system was used later in different business environments: trading, distribution and services. Along the way it was extended to new functions and capabilities based on the requirements of the users including multilingual needs as it was used in various countries with different working languages. Thus from simple invoicing and projects follow-up tool it soon covered various back-office and collaborative modules like documents management, accounting journal, cash management, internal claims and invoices, budget and reporting, duty roster to name only a few.

documents

The key point was that it always tried to be as user friendly as possible and as standardized as possible, always identifying best practices in back-office management that could benefit any organisation. In few words EK is based on hands-on experience in managing and optimising companies workflow.

But the initial framework developped for this in-house solution became more and more difficult to extend and maintain as it grew.

Therefore Drupal 8 became an obvious solution for a migration. The main reasons are:

  • The modular structure of Drupal fits perfectly with original back-office tools;
  • Drupal 8 offers a new and professional development framework;
  • There is a large community for support and further development ;
  • There is no distribution in Drupal (8) that provides a comprehensive back-office management.

The last point is also good answer to the common question that may arise about why proposing a new back-office management solution while there are so many players (from small to extra large) with open source or subscription scheme available? EK offers different alternatives to companies and vendors in a Drupal environment.

sales dashboard

EK as Drupal 8 modules as been used for almost 1 year to run real businesses with companies using it for their daily management tasks, cost racking and collaborative tools from sales, payroll, accounting to projects management. Thus we can say it is today a genuine solution that runs extremely well with Drupal 8, is easy to maintain and extend.

But there is still plenty of work and improvement as necessarily it is a young and highly perfectible project.

The modules are proposed as a sandbox project with the ambition to turn it into a real distribution that could apply to multiple back-office requirements for small and medium companies. It is also an opportunity to contribute and share experience with Drupal community.

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web