Reports /QR Code


We recently installed the Reports plugin. We can generate html reports without issue but the QR Code PDF just fails with the message error. I am not sure where it is logging so I am hoping someone can help with what is actually failing. Here are the details of our install:

Omeka 2.2.2
PHP 5.5.9-1ubuntu4.9 (apache2handler)
OS Linux 3.13.0-53-generic x86_64
MySQL Server 5.5.43
MySQL Client 5.5.43
Apache Apache/2.4.7 (Ubuntu)



I ended up fixing this myself. This issue was caused because the plugin doesn't work through a proxy. Here is what I did to get it working should anyone else run into this particular configuration:

The QR Code portion requires a call to the Google Chart API. It uses the Zend Http_Client function to make that call. The problem is that even with system wide proxy use configured on the system, Zend has to be configured to use it. The Report plugin code out of the box uses the generic socket.php rather than the proxy.php which extends the functionality to allow for proxy connections.

1) Open in the editor of your choice with root privileges this file: /var/www/plugins/Reports/models/Reports/Generator/PdfQrCode/GoogleCharts.php
2) Make the code look like this:

public function generate($data)
$temp = tempnam($this->_tempDir, self::TEMP_FILE_PREFIX);
// Zend_Pdf_Image dies if lacking the correct file extension.
$tempPng = $temp . ".png";
rename($temp, $tempPng);
$temp = $tempPng;
$url = $this->_qrCodeUri($data);
$config = array(
'adapter' => 'Zend_Http_Client_Adapter_Proxy',
'proxy_host' => '<Your Proxy IP>',
'proxy_port' => <Your Proxy Port>,
'proxy_user' => '',
'proxy_pass' => ''

// Instantiate a client object
$client = new Zend_Http_Client($url, $config);
// $client = new Omeka_Http_Client($url);
// $client->setMaxRetries(10);
$response = $client->request('GET');
if ($response->isSuccessful()) {
file_put_contents($temp, $response->getBody());
$image = Zend_Pdf_Image::imageWithPath($temp);
return $image;
} else {
throw new Zend_Http_Client_Exception(
"Could not retrieve QR chart from Google."

3) The change should take effect immediately and the QR Codes should now generate through the proxy.