Date Stamps

ArchivistaBox 2017/III: Inbox fully automated

Egg, March 2017: With version 2017/III the postmarking of incoming mail is available. If the date of the incoming mail was previously entered in the’ Date’ field, an automated sticky note can now be entered, which is automatically attached to the document. Whether it’s scanned documents or digital files, with the new stamp functions, incoming documents can be beautifully automated.

Postmark in three steps

Customers and prospective customers are sometimes amazed at how simple and elegant new functions can be implemented. This is no different with the new postmark.

Step 1: Create script

Thanks to the fully integrated scripting capability of ArchivistaDMS, all you need is a small script to apply input stamps:

#!/usr/bin/perl
use strict;
use lib qw(/home/cvs/archivista/jobs);
use AVJobs;
my $host=shift;
my $db=shift;
my $user=shift;
my $pw=shift;
my $doc=shift;
my $note="3;92;141;521;432;0;0;1;1;255;16777215;2;6;0;18;1;0;0;0;".
  "imgx;imgy;300;300;Arial;Eingang";
my $date=DateStamp(time());
my $year=substr($date,8,2);
my $dbh=MySQLOpen();
if ($dbh) {
  if (!HostIsSlave($dbh)) {
    $dbh->do("use $db");
    my $nr=($doc*1000)+1;
    my $sql = "select count(Seite) from archivbilder where Seite=$nr";
    my @row = $dbh->selectrow_array($sql);
    if ($row[0]>0) {
      $sql = "select Notes from archivseiten where Seite=$nr";
      my @row = $dbh->selectrow_array($sql);
      if ($row[0] eq "") {
        $sql = "select BildInput from archivbilder where Seite=$nr";
        @row = $dbh->selectrow_array($sql);
        if (length($row[0])>0) {
          my $imgo = ExactImage::newImage();
          ExactImage::decodeImage($imgo,$row[0]);
          my $width = ExactImage::imageWidth($imgo);
          my $height = ExactImage::imageHeight($imgo);
          if ($width>0 && $height>0) {
            $note =~ s/imgx/$width/g;
            $note =~ s/imgy/$height/g;
            $sql = "show tables like 'stamp$year'";
            @row = $dbh->selectrow_array($sql);
            if ($row[0] eq "") {
              $sql = "create table stamp$year ".
                "(id int(11) primary key auto_increment,Laufnummer int(11))";
              $dbh->do($sql);
            }
            $sql = "insert into stamp$year set Laufnummer=$doc";
            $dbh->do($sql);
            $sql = "select id from stamp$year where Laufnummer=$doc";
            @row = $dbh->selectrow_array($sql);
            my $count = $row[0];
            if ($count>0 && $count<=9999) {
              my $countnew = ($year*10000)+$count;
              my $note1 = $note." ".DateStamp(time())." ".$countnew;
              my $seite = ($doc*1000)+1;
              $sql = "update archivseiten set Notes='$note1' where ".
                "Seite=$seite";
              $dbh->do($sql);
              $sql = "update archiv set intRechnungNr='$countnew',".
                "DokTyp='Eingangsrechnung' where Laufnummer=$doc";
              $dbh->do($sql);
} }  }  }  }  }  }

Step 2: Capture Script in WebAdmin

Now we add this script in WebAdmin under’ Administer jobs’ and the following screen:

Note that scripts can only be stored after’ /home/data/archivista/cust/autofields’. In addition, a valid username and password must be specified so that the script can be copied to the desired folder. The option’ Update activated’ as well as a valid user name and the corresponding password must also be entered in the same way as above.

Now you have to enter the script in WebAdmin under’ Scan’ in the desired scan definitions under’ Default fields’, this time of course without the path (concretely only’ stamp. pl’).

Step 3: Process files

As soon as a file or scanned pages with the desired scan definition are processed, the script is automatically executed in the background every time.

As a result, the desired stamp is applied to the document:

This activates the automatic stamp on inbox. In contrast to normal sticky notes, the stamp can be moved, but not deleted.

Conclusion: Automation made easy

The stamping solution presented here has been in use by customers for several months. In this case, the sticky notes had to be extended in such a way that sticky notes cannot be deleted automatically. This means that the ArchivistaBox 2017/I is absolutely essential.

The present solution is also a good example of how easy (and elegant) the ArchivistaBox can be extended. This doesn’t have to be done with Perl (as above) because the ArchivistaBox offers not only Perl but also the scripting languages PHP and Python.

It goes without saying that no one has to’ scripts’ themselves (but may, of course), a contact and an appointment is sufficient for the solution to be realized for you.

Finally, a tip: The stamps will also appear on the exported PDF files, but not if you click on’ PIC’ or’ IMG’ in the table view, in the latter two options the rasterized original data will be provided, i. e. the processed archive data will not be’ damaged’ by the stamps. In contrast, the stamps in PDF files are’ rasterized’ into the image data, i. e. in PDF files the stamps cannot be changed (even moved).