Hello!

Will QR Codes be available for Drupal 7?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

IncrediblyKenzi’s picture

Absolutely! I'll be working on a port of the module between now and DrupalCon Chicago.

IncrediblyKenzi’s picture

FileSize
12.08 KB

Here's a first pass at a d7 module. Ran through coder upgrade, shifted to the new hook paradigm (e.g. no $op parameter) and did some general cleanup to support public:// file saves, among other things.

Note that I've only tested against the google graph api, would love it if someone with qrencode installed could take a gander at that.

Magenta-dupe’s picture

Some problems:
1)<?php print theme('qr_codes', 'www.testpage.com', 150, 150); ?> doesn't show any result in drupal 7. In Drupal 6 this works and prints out a qr code.

2) Activating the QR Codes block results in the following error
Recoverable fatal error: Argument 2 passed to token_replace() must be an array, string given, called in /home/xxx/www.xxx.de/sites/all/modules/qr_codes/qr_codes.block.inc on line 84 and defined in token_replace() (line 77 of /home/xxx/www.xxx.de/includes/token.inc).

3) I can not find a configuration page for qr codes in drupal 7

System:
fresh installed drupal 7
QR Codes + QR Codes - Google Chart API from #2 above
Debian Linux

IncrediblyKenzi’s picture

Assigned: Unassigned » IncrediblyKenzi

Well, that's why it's a first pass. :) Great feedback. Will have a look.

IncrediblyKenzi’s picture

Quick Q: Shouldn't the theme call in Drupal be:

theme('qr_codes', array('data' => 'www.testpage.com', 'width' => 150, 'height' => 150));
Magenta-dupe’s picture

<?php print theme('qr_codes', array('data' => 'www.testpage.com', 'width' => 150, 'height' => 150)); ?> does work perfectly. Thanks!

IncrediblyKenzi’s picture

Glad to hear. Are you seeing the problem enabling the block still? I'm seeing it fine, though I'm not yet using token support.

https://skitch.com/aaronstewart/rpssu/welcome-to-qr.local-qr.local

Magenta-dupe’s picture

FileSize
14.16 KB

Yes, that problem is still there: I activate the block, close the admin-overlay-pages and see the attached error.
I have activated the following modules (perhaps there is a conflict with one of them):
- Chaos tool suite 7.x-1.0-alpha2
- Views 7.x-3.x-dev (2011-Feb-07)
- Token 7.x-1.0-beta1
- qr_codes 7.x-1.x-dev
- Pathauto 7.x-1.0-beta1
- Field group 7.x-1.0-rc1
- Colorbox 7.x-1.0-beta2

But that is no problem for me because I do not need the block at the moment (I only wanted to test it). I only use a qr code inserted through my theme and that works fine so far.

Thanks for your efforts and for the module, by the way ;)

IncrediblyKenzi’s picture

Category: support » feature
Status: Active » Needs work

Sounds like an issue with token integration.. this isn't surprising given that Token has changed a bit from 6.x to 7.x. I'll take a look.

IncrediblyKenzi’s picture

Status: Needs work » Needs review

I just committed the code to the DRUPAL-7--1 branch that should fix this issue.. can you give that a go?

(also, an aside, noticed a bug setting width of qr_codes image when passing in an imagecache preset.. that's next on the list).

sparetimedesign’s picture

I experienced this error when I tried to configure the module:

Fatal error: Call to undefined function file_directory_path() in xxxx\qr_codes.admin.inc on line 96

I'm no PHP coder so forgive me if I speak out of turn(!), I fixed my issue by substituting file_directory_path() with file_default_scheme() as per http://api.drupal.org/api/drupal/includes--file.inc/function/file_direct.... Hope this hasn't been covered elsewhere!

sanduhrs’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Category: feature » task
FileSize
24.76 KB

Had some isues with the latest version from the repo.
Attached is a patch that tries to fix all the issues I found:

* Fixing hook_uninstall()
* hook_install() really should be hook_update_N() for upgrade
* Added needed files to .info
* Updated some docs
* Moved admin/settings/qr_codes to admin/config/qr_codes
* Simplified theme_qr_codes()
* Added template_preprocess_qr_codes()
* Using image_style_options() in _qr_codes_block_configure_form()
* Fixed split up hook calls in google_chart and qrencode modules
* Added list of files to .info
* Fixed qr_codes_google_chart_qr_codes_generate() with url() for propper encoding
* Prevent storage of image when request failed
* Switched from file_save_data() to file_unmanaged_save_data()
* Switched from file_delete() to file_unmanaged_delete()
* Fixed cached files count
* Fixed storage of qr_codes_block_image_style in case of
* Changed default size from 150 to 168 for the perfect fit into bartik sidebar
* Switched from time() to REQUEST_TIME
* Switched to file_build_uri() for path generation to respect site settings (public/private)
* Updated token support

Please review.

joeyabbs’s picture

Subscribing!

gloomcheng’s picture

Subscribing!

cmcintosh’s picture

First off want to say great module, looking forward to having it updated to d7 so i can finish my game site: http://catchthecode.com i will probably be implmenting it also as part of my bigger project, wembassy.com ill try to review this sometime soon, but it will probably be after the 15th of this month before i can tackle it.

Deciphered’s picture

I want to disclaim this with a quick statement; I'm neither Trolling or Flame baiting, but simply requesting a joint effort.

Mobile Codes has just released a stable 7.x release that brings the majority of the 6.x-2.x functionality, key points being that it now has 100% user-definable Mobile Code Providers, with built in support for the PHP QR Code library, and is 100% CTools/Features exportable. I think for the benefit of the community and the sanity of two project developers a collaboration effort is the right way to go, merging the two projects together and having two project maintainers.

I would be happy to go either way, but the one reason that I would think it would make more sense to go QR -> MC is that MC supports any form of Mobile Code as long as there is a URL based API, be it QR, DM or even Microsoft Tag (although I have yet to find a URL API, but hypothetically).

I hope this is considered.

Cheers,
Deciphered.

joachim’s picture

Merging two similar projects is pretty much always a good thing :)

int_ua’s picture

Subscribing

lathan’s picture

sub

mgifford’s picture

Nothing wrong with competition. Just good to show links to related projects and possibly describe how they are different.

Great that there's a patch to bring this to D7. What would need to be done to make this a full release? Who can step up to the plate to move it ahead? Good that it was run through Coder early on.

It's really only a question of if there is energy by the core team for this module to maintain it. Two half maintained modules aren't going to be as good as one really well maintained module.

Thanks @Deciphered for putting out the comparison!

sandboxpleeb’s picture

i'm still rather new to web develop, et al...

was just wondering if i need to go through and make every change in the code as listed through this thread, or if one of the latest patches will fix the 7.x release above.

by the way, what is the best way to install a patch? i am on a hosted environment, and will be updating via ftp.

thanks

lathan’s picture

Title: Drupal 7 » Port QR Codes to Drupal 7

Changing title for better tracking.

segovia94’s picture

subscribe

rplescia’s picture

Subscribing

clemens.tolboom’s picture

@acstewart I'm puzzled ... why provide for patches in this issue when you have commit rights to the project?

The question of @sandboxpleeb in #21 is quite legit.

Could you please update the 7.x-1.x-dev if necessary and publish the 7.x-1.x-dev branch. This way we can start testing the easy way ;)

Thanks for the efforts :)

Carnix’s picture

@mgifford: When it comes to Drupal, competing modules is almost always detrimental to the community. It causes diffused efforts and results in confusion for everyone trying to decide what module to use. If one module does everything another module does already and is further advanced, it's usually a good idea to merge the projects so the person/people working on them can put their efforts together. As it stands, there is no stable release for this on D7 and there is one for Mobile Codes (http://drupal.org/project/mobile_codes). I second the suggestion that these projects be merged and that acstewart co-maintain MC. Deciphered is seeking a co-maintainer -- I strongly suggest acstewart consider the offer.

mgifford’s picture

One well maintained initiative is going to be better than two semi-maintained projects for sure. Unfortunately that's just not the reality. I agree that it would be great for @Deciphered & @levelos cooperated & worked on the D7 version that was the furthest ahead. But maybe QR Codes has a smaller code base and is easier to maintain. Whatever the reason, I'd suggest this is a new issue. At the very least Mobile Codes & QR Codes should link to each other (and other related modules) and I will be creating an issue about that..

konsumer’s picture

Component: Miscellaneous » Code
FileSize
7.4 KB

I added working qrencode sub-module (it was breaking the google sub-module admin as well, for me) and made cache clear work properly. This module works 100% for me, in drupal 7, now.

mgifford’s picture

Did you build it from the git repository? Also, did you run it through Coder?

levelos’s picture

Great, thanks @konsumer. Do you, or anyone else on this thread, want co-maintainership of the module? We don't currently have the bandwidth to give it the attention it needs and deserves.

joachim’s picture

I may need this for a D7 project but it's not certain yet.

In any case, how much does this module overlap with http://drupal.org/project/mobile_codes, which does have a D7 release?

Deciphered’s picture

As I've said, I'm happy to do the merge, we just need to make sure that all the functionality from both sides is still possible (where it makes sense) and that there's an upgrade path.

I also only have a small amount of time to maintain my module, but it would be easier to maintain one module rather than two modules.

mgifford’s picture

Can we get something on the Project page to point folks to the Mobile Codes project until there is a D7 version of this module? Totally understand not having time to put up a D7 port and maintain it, just trying to direct folks the right way.

Deciphered’s picture

If need be, assuming this project is dead, someone could follow the abandoned project process to claim maintainer-ship to either take on this module, or help to determine the best way for the two modules to collaborate, or just close down this module and point to Mobile Codes (which I would be happy to implement an upgrade path for this module if that where to happen).

Just my 2cents, it's probably best if I'm not the person to do so as I believe that would be a conflict of interest, as is somewhat me making this suggestion.

nerdcore’s picture

Issue summary: View changes

@Deciphered I don't see how an upgrade path is even possible given that this module:

1. Does not have a stable release for any Drupal version (not even 6.x!)
2. Does not work in Drupal 7.x even with the 7.x-1.x git branch (It has old D6 API calls which don't exist in D7+)
3. Has not had a commit in many years (5 years since the last patch submitted to this issue, never committed to git)

The fact is this module DOES NOT WORK in Drupal 7.x, so a path to move from it to mobile_codes or any other module is moot/impossible.

I am contacting the maintainers to request shutting this module down.

cmcintosh’s picture

Seems like there have been changes in the technology space since last i messed with this. Google shuttered it's api, and the Chart version of it does not seem to work either. However there are PHP based libs for getting this task accomplished. One such lib is, http://phpqrcode.sourceforge.net/ (not associated with it).

I think the path forward if we want this module in 7 & 8 would be to start with a clean build. Maybe something in Drupal 8, and then work our way back to fixing Drupal 7. As far as Drupal 6 is concerned since it is no longer officially supported, i think its safe to leave be.

cmcintosh’s picture

There was someone that took the above and converted the library for support via Symfony / composer, that lib is endroid/qrcode. We could use that to include a single library to provide functionality we are looking for.

So to kick things off I think some feature set im looking for is as such:

- a QR code entity that contains the textual / fid values for the QR code and that can be cached.
- a simple field api definition that allows me to generate a new QR code for the current entity and/or based on entered text (maybe token support)
- a field formatter for the Entity Reference field type, that generates a QR code to the URL of the referenced entity.
- a theme function to load / render the QR code based on the provided text and / or ID of the QR code.
- a placeable block that renders a QR code for the current url that can be cached.

I will probably work on this stuff part time, not looking to take over as maintainer of the module, but would like to get this functionality into Drupal 8.

sanduhrs’s picture

For a D8 QRCode / Barcode solution you might want to have a look at http://drupal.org/project/barcodes
It has a D7 Version in the works, too.

cmcintosh’s picture

Thats another way to go as well sanduhrs. I think one thing to keep in mind then if we "mark" the QR module as obsolete and move with the barcode module which seems like it is going along the path of a single feature set.

Looks like both your module and the Mobile Codes module aim to do the same / similar thing. Maybe a merger of the three would be good. In addition to just a field formatter again would like to aim for having the ability to have a block with such things rendered on the page.

Additionally, I think we should look into adding validation to the barcodes module to provide some end-user handling.

sanduhrs’s picture

Barcodes module has a field formatter and a block, it supports token replacement and has a D7 version ready now.

nerdcore’s picture

mgifford’s picture

Title: Port QR Codes to Drupal 7 » Port QR Codes to Drupal 7/8