Jump to content

Recommended Posts

Posted

Sirbendy: I did think that it was an InnoDB issue; but thought it wouldn't have imported the .sql file (which specifies the tables should be InnoDB) in the first place if it wasn't there. I guess it just defaulted to MyISAM :)

 

gumbygaz: Thanks. Hopefully the existing code is easy enough to make sense of so you can add your feature.

 

plexer: I'll look at that too. This is where SNMP would be very useful! Shame it's such an awful protocol to work with at the developer level ;)

  • 3 weeks later...
Posted

Hello Everyone,

 

First off my thanks to webman for such a useful tool. I've had a word with my NM and she would like to use it however we do need to keep track of costs before we can do so. (We currently use an excell sheet)

 

So here's my 2p's worth

 

First of create a 'costs' table with an ID, cost, consumable_id and Effective_from fields (with consumable_id and a forgien key)

CREATE TABLE IF NOT EXISTS `costs` (
 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `cost` decimal(10,2) unsigned NOT NULL DEFAULT '0' COMMENT 'Cost of consumable',
 `consumable_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Quantity of consumable in stock',
 `effective_from` datetime NOT NULL COMMENT 'Time of Cost',
 PRIMARY KEY (`id`),
 KEY `consumables` (`consumable_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Details about the cost of consumables at a given time' AUTO_INCREMENT=0 ;

ALTER TABLE `costs`
 ADD CONSTRAINT  FOREIGN KEY (`consumable_id`) REFERENCES `consumables` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION;

 

Change the `events` table to include a cost_id field

CREATE TABLE IF NOT EXISTS `events` (
 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `printer_id` int(10) unsigned NOT NULL COMMENT 'Printer ID installed in to',
 `consumable_id` int(10) unsigned NOT NULL COMMENT 'Consumable ID installed',
 `date` datetime NOT NULL,
 `cost_id` int(10) unsigned NOT NULL COMMENT 'ID of the Cost',
 PRIMARY KEY (`id`),
 KEY `printerhistory` (`printer_id`),
 KEY `consumablehistory` (`consumable_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Audit history of consumable installation into printers' AUTO_INCREMENT=0 ;

ALTER TABLE `events`
 ADD CONSTRAINT  FOREIGN KEY (`cost_id`) REFERENCES `costs` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION;

 

now when ever you 'install' a cartridge you would have to run the following to work out what cost to use

SELECT `id` FROM `costs` WHERE `consumable_id` = '1' AND effective_from < NOW() ORDER BY `effective_from` DESC LIMIT 1;

 

and of course you would have to add a costs field to the add\edit consumable screens and update the `costs` table each time.

 

now the catch, I know nothing what so ever about PHP so i can only test this from the cmd line, but what do you think?

Posted

sorry fokes i think i've missed one line of code in this file since im now getting;

 

Fatal error: Call to a member function addOneOrMoreRule() on a non-object in D:\Program Files\xampp\xampp\htdocs\printmastertest\consumables.php on line 150

 

when adding a drum... grrrrrr i had this dam thing working, i love coding :p

Posted

OK here is the corrected version, amazing how one line can drive you nuts!

 

AddDrumsandLightCarts.zip

 

There is a know fault, once you mark a consumable as one of the new types (drum or light cartridge) you cant remove it as such without editing the table. Cant track down why either. :(

Posted (edited)

Many thanks for this, seems to work great.

 

Just another request to be able to put in a price for Toners, this would allow us to create a report on how much we spend.

Edited by zag
Posted

hi zag,

 

As per my post #52 the implementation on the backend isn't too bad, but i'm a php novice (a whole 48 hours :p) so I might have a better look at it over half term

Posted

Just set this up here. Been hacking a login page together and requiring login before being able to access the page, took me a little while but got there now.

Just noticed a few niggles in Firefox though.... when you click to install a consumable, it shifts the printers down (in line with the bottom of the consumables that appear). also the colour 'dots' on the "add a consumable" page are shown as 'n'?

Only little things but wondered if they were easy fixes?

Absolutely loving this though, it's exactly what we needed and saved me trying to hack something together! :) Thanks!

  • Thanks 1
Posted

bmdixon: Thanks for letting me know about that. It's a simple fix in the web/css/printmaster.css file. Look for 'div#buttoncontainer input' and change display: block to display: inline.

 

The 'n' is because it uses Wingdings for the circle symbol instead of the HTML character entity • on other pages. I've now fixed this and the updated code is on Github (for both fixes). Download the zip file again, and extract the web/ and views/ folders, overwriting your own.

Posted
Hi there. I would like some advice on installing this along with its software requirments. I have Mysql, php and apache installed but I don't know where to go from here or whether I have them all set up correctly. I was looking for a print consumable database and came across this which from what I've read is great. Thanks in advance.
Posted

jonathon28: Have you used an existing distribution package that has everything (such as Xampp or WAMP), or have you installed everything separately? Is this on Windows or Linux?

 

On the database, you will need to create a new username, a new database, and give access to that database for that user. This can be done easily through a management tool - phpMyAdmin (web-based) and HeidiSQL (Windows) are two good options to choose from.

 

Once you have the ability to do that, you should be able to carry out the instructions without any problems:

 

  1. Create directory on webserver to store files (configure as virtual host or subdir)
  2. Copy all Print Master files to the folder you just created
  3. Create a new directory called session where you extracted the files and make it writeable
  4. Create a new username and database in MySQL
  5. Import the printmaster.sql file into the new database
  6. Edit the $db line in inc/init.php to reflect your database details
  7. Invent your own security (.htaccess, integrated Windows authentication...)

Posted
I have installed them seperately on xp but thinking about it I could probably run it on xampp on one of my linux boxes. I know nothing when it comes to this sort of thing but am always trying to learn. I'll have a play and get back to you.
Posted

webman:

 

right, on a xp machine, I have sucessfully got as far as navigating to the directory of the print manager through the web browser via http://localhost/.

 

have also installed heidisql and created a session called session.

 

Dont know if this is correct, but have clicked Import at the top > load sql file .... where do i go from here?

 

Many thanks.

Posted
have also installed heidisql and created a session called session.

 

These are separate. You need to create a folder called 'session' in the same folder where you extracted the ZIP file to.

 

Dont know if this is correct, but have clicked Import at the top > load sql file

 

You need to create a username and a database first. In HeidiSQL:

 

  1. Tools > Create database. Then...
  2. Tools > User Manager. Add user tab: Enter a username and password. On the right, highlight the database you just created. Click Add User button. Remember this information.
  3. Choose the database from the list on the left of the main window. Then you can go to Import > Load SQL file. Browse to the printmaster.sql, and click OK or Open. It will load into the window - execute the query by clicking the "Play" icon or press F9.

 

Where you extracted the files to, you need to edit the inc/init.php file in a text editor. Change the entries in the line starting with $db. This is the format (replace with your own details):

 

$db = new fDatabase('mysql', 'database-name', 'username', 'password', 'localhost');

Posted

Thanks for your help. done that... still only getting the index of / localhost with craigrodway-printmaster-af9843d.

 

what should i put in the browser to navigate to printmaster?

Posted

Is there going to be an "official" update to include costs, or should I try the mod posted earlier?

 

I only really want to use this to track how much we spend on toners.

 

Its working great so far so would rather do it in a way that can be supported in the future.

Posted (edited)

Hello Zag,

 

I've done some work on this over half term, which i will post but its NOT complete and still has quite a few errors.

 

PrintMasterTest.zip but you should be able to see where i'm going with it.

 

The issue seams to be in the Consumable.php class file around lines 220 - 235

Edited by fawkers
Posted

Sorry for such a stupid question here

 

How can I move the database to a new server I have setup for this?

 

Can I just copy the data files in the sql folder located here (C:\ProgramData\MySQL\MySQL Server 5.1\data\ictink)

 

Or do I have to use phpmyadmin and export it that way?

If that is the case, what options do I need to set for the export

 

 

Thanks!

Posted
You can just go to phpmyadmin, click on the printmaster database, then on the export tab. If your using XAMPP the defult settings should give you a .sql file. Once your've set up your new database you can just go the SQL tab in phpmyadmin and copy paste the .sql file in and runit. That should move everything over for you.
Posted

ok have just done something a bit different that I found

 

I have used the mysql workbench

 

Exported the database

 

Install sql workbench on the new server, imported the sql file, but have problems when I lanch the site, this is what im getting

 

 

 

Context

-------

 

$_SERVER: Array

(

[PROCESSOR_ARCHITEW6432] => AMD64

[_FCGI_X_PIPE_] => \\.\pipe\IISFCGI-585ec0dd-ee0d-448e-b1fe-8bca0cef6d4a

[php_FCGI_MAX_REQUESTS] => 10000

[phpRC] => C:\Program Files (x86)\PHP\

[ALLUSERSPROFILE] => C:\ProgramData

[APPDATA] => C:\Windows\system32\config\systemprofile\AppData\Roaming

[APP_POOL_CONFIG] => C:\inetpub\temp\apppools\DefaultAppPool.config

[APP_POOL_ID] => DefaultAppPool

[CommonProgramFiles] => C:\Program Files (x86)\Common Files

[CommonProgramFiles(x86)] => C:\Program Files (x86)\Common Files

[CommonProgramW6432] => C:\Program Files\Common Files

[COMPUTERNAME] => WEBSERVER

[ComSpec] => C:\Windows\system32\cmd.exe

[FP_NO_HOST_CHECK] => NO

[LOCALAPPDATA] => C:\Windows\system32\config\systemprofile\AppData\Local

[NUMBER_OF_PROCESSORS] => 1

[OS] => Windows_NT

[Path] => C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;

[PATHEXT] => .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

[PROCESSOR_ARCHITECTURE] => x86

[PROCESSOR_IDENTIFIER] => Intel64 Family 6 Model 23 Stepping 6, GenuineIntel

[PROCESSOR_LEVEL] => 6

[PROCESSOR_REVISION] => 1706

[ProgramData] => C:\ProgramData

[ProgramFiles] => C:\Program Files (x86)

[ProgramFiles(x86)] => C:\Program Files (x86)

[ProgramW6432] => C:\Program Files

[PSModulePath] => C:\Windows\system32\WindowsPowerShell\v1.0\Modules\

[PUBLIC] => C:\Users\Public

[systemDrive] => C:

[systemRoot] => C:\Windows

[TEMP] => C:\Windows\TEMP

[TMP] => C:\Windows\TEMP

[uSERDOMAIN] => OCKENDON

[uSERNAME] => WEBSERVER$

[uSERPROFILE] => C:\Windows\system32\config\systemprofile

[windir] => C:\Windows

[FCGI_ROLE] => RESPONDER

[HTTP_CONNECTION] => Keep-Alive

[HTTP_CONTENT_LENGTH] => 0

[HTTP_ACCEPT] => */*

[HTTP_ACCEPT_ENCODING] => gzip, deflate

[HTTP_ACCEPT_LANGUAGE] => en-GB

[HTTP_HOST] => localhost

[HTTP_USER_AGENT] => Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET4.0C; .NET4.0E; .NET CLR 3.5.30729; .NET CLR 3.0.30729)

[iIS_UrlRewriteModule] => 7.1.0871.0

[APPL_MD_PATH] => /LM/W3SVC/1/ROOT

[APPL_PHYSICAL_PATH] => C:\inetpub\wwwroot\

[AUTH_TYPE] => {empty_string}

[AUTH_PASSWORD] => {empty_string}

[AUTH_USER] => {empty_string}

[CERT_COOKIE] => {empty_string}

[CERT_FLAGS] => {empty_string}

[CERT_ISSUER] => {empty_string}

[CERT_SERIALNUMBER] => {empty_string}

[CERT_SUBJECT] => {empty_string}

[CONTENT_LENGTH] => 0

[CONTENT_TYPE] => {empty_string}

[DOCUMENT_ROOT] => C:\inetpub\wwwroot

[GATEWAY_INTERFACE] => CGI/1.1

[HTTPS] => off

[HTTPS_KEYSIZE] => {empty_string}

[HTTPS_SECRETKEYSIZE] => {empty_string}

[HTTPS_SERVER_ISSUER] => {empty_string}

[HTTPS_SERVER_SUBJECT] => {empty_string}

[iNSTANCE_ID] => 1

[iNSTANCE_NAME] => DEFAULT WEB SITE

[iNSTANCE_META_PATH] => /LM/W3SVC/1

[LOCAL_ADDR] => ::1

[LOGON_USER] => {empty_string}

[PATH_TRANSLATED] => C:\inetpub\wwwroot\ictink\index.php

[QUERY_STRING] => {empty_string}

[REMOTE_ADDR] => ::1

[REMOTE_HOST] => ::1

[REMOTE_PORT] => 49490

[REMOTE_USER] => {empty_string}

[REQUEST_METHOD] => GET

[REQUEST_URI] => /ictink/

[sCRIPT_FILENAME] => C:\inetpub\wwwroot\ictink\index.php

[sCRIPT_NAME] => /ictink/index.php

[sERVER_NAME] => localhost

[sERVER_PORT] => 80

[sERVER_PORT_SECURE] => 0

[sERVER_PROTOCOL] => HTTP/1.1

[sERVER_SOFTWARE] => Microsoft-IIS/7.5

=> /ictink/index.php

[ORIG_PATH_INFO] => /ictink/index.php

[php_SELF] => /ictink/index.php

[REQUEST_TIME] => 1288700024

 

)

 

$_POST: Array

(

)

 

$_GET: Array

(

)

 

$_FILES: Array

(

)

 

$_SESSION: Array

(

)

 

$_COOKIE: Array

(

)

Warning-------{doc_root}\ICTInk\index.php(22): include_once('C:\inetpub\wwwr...'){doc_root}\ICTInk\inc\init.php(17): fSession::open(){doc_root}\ICTInk\inc\flourish\fSession.php(306): session_start()[internal function]session_start(): open(C:\inetpub\wwwroot\ICTInk\session\\sess_fp335ju0kg3murcl1peuk92367, O_RDWR) failed: Permission denied (13)Warning-------{doc_root}\ICTInk\index.php(22): include_once('C:\inetpub\wwwr...'){doc_root}\ICTInk\inc\init.php(17): fSession::open(){doc_root}\ICTInk\inc\flourish\fSession.php(306): session_start()[internal function]session_start(): Cannot send session cookie - headers already sent by (output started at C:\inetpub\wwwroot\ICTInk\inc\flourish\fCore.php:740)Warning-------{doc_root}\ICTInk\index.php(22): include_once('C:\inetpub\wwwr...'){doc_root}\ICTInk\inc\init.php(17): fSession::open(){doc_root}\ICTInk\inc\flourish\fSession.php(306): session_start()[internal function]session_start(): Cannot send session cache limiter - headers already sent (output started at C:\inetpub\wwwroot\ICTInk\inc\flourish\fCore.php:740)

 

 

 

after the error message it brings up part of the site, after that more errors

 

 

 

 

 

 

 

Warning-------[internal function]Unknown: open(C:\inetpub\wwwroot\ICTInk\session\\sess_fp335ju0kg3murcl1peuk92367, O_RDWR) failed: Permission denied (13)Warning-------[internal function]Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (C:\inetpub\wwwroot\ICTInk\session\)

Posted (edited)

p-dave: Ensure the session folder is created and writeable by the webserver.

 

Others: Re: costs. At the moment, I'm not looking at developing the costs feature due to higher priorities (private work, Classroombookings). I agree it would be a good feature to have, and probably one day I'll do it; just not right now :)

Edited by webman
Posted (edited)

session folder should be writable

 

I have even enabled iis_users and iss_wpg on the www root folder just in case

 

And have tried even now exporting and importing the database using phpmyadmin

 

Any other ideas?

 

 

I should note, that this is the first site im trying on the new server, php seems to work, so Im assume php is working

 

Is there any certain php extensions you use for printmaster?

 

I know phpmyadmin comes up about missing mcrupt extension

Edited by pritchardavid

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...