Wednesday 27 June 2012

using mysql count makes me only return 1 row

take a look at this code

   $query_user="select count(id) as total,id,firstname,middlename,lastname,cb_addressline1,cb_addressline2,cb_addressline3,cb_addressline4,cb_postcode,cb_telephone from #__comprofiler where id LIKE'%$find%' or  firstname LIKE'%$find%' or lastname LIKE'%$find%' or cb_telephone LIKE'%$find%' or cb_addressline1 LIKE'%$find%' or cb_addressline2 LIKE'%$find%' or cb_addressline3 LIKE'%$find%' or cb_addressline4 LIKE'%$find%'";
                                 $db->setQuery($query_user);
                               
                                $listdata  = $db->loadObjectList();
                                 //print_r($listdata);
                                 if($listdata[0]->total==0)
                                         {



you'll notice that  'count(id) as total ' is being used to count the results .  However using count() in this way was makiing my results only return 1 row.   Take a look at this post http://stackoverflow.com/questions/4082713/mysql-returns-only-one-row-when-using-count 

So I've now replaced the query for

[code]

  $query_user="select id,firstname,middlename,lastname,cb_addressline1,cb_addressline2,cb_addressline3,cb_addressline4,cb_postcode,cb_telephone, (select count(*) FROM #__comprofiler WHERE id LIKE'%$find%' or  firstname LIKE'%$find%' or lastname LIKE'%$find%' or cb_telephone LIKE'%$find%' or cb_addressline1 LIKE'%$find%' or cb_addressline2 LIKE'%$find%' or cb_addressline3 LIKE'%$find%' or cb_addressline4 LIKE'%$find%') as total from #__comprofiler where id LIKE'%$find%' or  firstname LIKE'%$find%' or lastname LIKE'%$find%' or cb_telephone LIKE'%$find%' or cb_addressline1 LIKE'%$find%' or cb_addressline2 LIKE'%$find%' or cb_addressline3 LIKE'%$find%' or cb_addressline4 LIKE'%$find%'";
                               

[/code]

I then got an error with $listdata[0]->total==0 

after testing the object  $listdata   - as I noticed if the search was empty then I changed the line.

f($listdata[0]->total==0 ) 

to

if($listdata == NULL )


So we don't need to use SELECT count(*) as total - at all .  is it enough just to test the search to see if its NULL.



Which is much simplier

Add / Delete Fields for View Timesheet Section

This is my Joomla Payroll System once again.   To add you will need to set up the field in the Community Builder Component first.   And you will also need then to find out what field in mysql that has created.   I will write more on this when I need to add a field from scratch myself.

Here's the details on how to delete.

OPEN component/com_comprofiler/comprofiler.html.php

REMOVE

the table row for Resume entry

and REMOVED on line 884

$edit_resume=JRequest::getVar('edit_resume', '', 'POST');

AND REMOVE

cb_resume='$edit_resume',

FROM query1 on line 890

Monday 25 June 2012

How to Change the Date Format in DatePicker on JQuery UI

I was scratching my head over the call to DatePicker Function in JQuery UI - to change the date format.

the call to the function was this

[code]$(function() {
   
        $( ".datepicker" ).datepicker();
       
    });[/code]




 Change to

[code]

    $(function() {

$( ".datepicker" ).datepicker({ dateFormat: 'dd/mm/yy' });    });


[/code]


Thursday 21 June 2012

Joomla Payroll System - Changing the 'add timesheets' page to submit to it's own page.

The following was an update for Joomla Payroll System to make the 'add timesheet' form go back to its own page.

in components/com_projectfork/views/add_timesheet/view.html.php  

 this is the code that was editing out.

###############################



/*           
            $user_id = JRequest::getVar('staff_id', '', 'POST');
            $project_id = JRequest::getVar('venue_id', '', 'POST');
           $start_time = JRequest::getVar('start_time', '', 'POST');
            $end_time = JRequest::getVar('end_time', '', 'POST');
            $hourly_rate = JRequest::getVar('hourly_rate', '', 'POST');
            $invoice_rate = JRequest::getVar('invoice_rate', '', 'POST');
            $shift_time = JRequest::getVar('timelog', '', 'POST');
            $cdate = JRequest::getVar('cdate', '', 'POST');
            $shift_pd = JRequest::getVar('post_date_entry', '0', 'POST');
           
             $start_hours = JRequest::getVar('start_hours', '', 'POST');
             $start_minutes = JRequest::getVar('start_minutes', '', 'POST');
             $end_hours = JRequest::getVar('end_hours', '', 'POST');
             $end_minutes = JRequest::getVar('end_minutes', '', 'POST');
          
           $task_id = JRequest::getVar('task_id', '', 'POST');


            $this->assign('st_sel', $user_id);
            $this->assign('tsk_sel', $task_id);
            $this->assign('vn_sel', $project_id);
            $this->assign('start_time', $start_time);
            $this->assign('start_time', $start_time);
            $this->assign('hourly_rate', $hourly_rate);
            $this->assign('invoice_rate', $invoice_rate);
            $this->assign('timelog', $shift_time);
            $this->assign('cdate', $cdate);

            $this->assign('post_date_entry', $shift_pd);
            $this->assign('start_hours',$start_hours);
            $this->assign('start_minutes',$start_minutes);
            $this->assign('start_hours',$end_hours);
            $this->assign('start_minutes',$end_minutes);*/
          
########################

and replaced with

      $user_id = JRequest::getVar('staff_id', '', 'POST');
            $project_id = JRequest::getVar('venue_id', '', 'POST');
            $hourly_rate = JRequest::getVar('hourly_rate', '', 'POST');
            $invoice_rate = JRequest::getVar('invoice_rate', '', 'POST');
            $shift_time = JRequest::getVar('timelog', '', 'POST');
          $task_id = JRequest::getVar('task_id', '', 'POST');
       

            //$start_time = JRequest::getVar('start_time', '', 'POST').":00";
            //$end_time = JRequest::getVar('start_time', '', 'POST').":00";
            $shift_time_arr = explode(':',$shift_time);
            @$timelog = intval($shift_time_arr[0])*60 + intval($shift_time_arr[1]);
         //   $cdate = strtotime(JRequest::getVar('cdate', '', 'POST'));
             $cdate1 =  JRequest::getVar('cdate', '', 'POST') ;
            $cdate2 = str_replace("/","-",$cdate1);
             $cdate=strtotime($cdate2);
            $shift_pd = JRequest::getVar('post_date_entry', '0', 'POST');
            $shift_pd = ($shift_pd=='on')?1:0;
           
           
           
             $start_hours = JRequest::getVar('start_hours', '', 'POST');
             $start_minutes = JRequest::getVar('start_minutes', '', 'POST');
              $end_hours = JRequest::getVar('end_hours', '', 'POST');
             $end_minutes = JRequest::getVar('end_minutes', '', 'POST');
          
              $start_time=$start_hours.":".$start_minutes;
              $end_time=$end_hours.":".$end_minutes;
             if($user_id && $project_id && $hourly_rate && $invoice_rate && $cdate){
               
                $db = & JFactory::getDBO();
                $query = "INSERT INTO #__pf_time_tracking (`task_id`, `project_id`, `user_id`, `content`, `cdate`, `timelog`, `hourly_rate`, `invoice_rate`, `post_date_entry`,`start_time`,`end_time`)"
                              ." VALUES ($task_id, $project_id, $user_id, '', $cdate, $timelog, $hourly_rate, $invoice_rate, $shift_pd,'".$start_time."','".$end_time."')";
                $db->setQuery($query);
                $db->query();
                $id = $db->insertid();

                if(!$id) {
                    $this->AddError($db->getErrorMsg());
                    return false;
                }
                else
                {
                     echo   "Thank you for entering a Timesheet Feel free to add more. ";
                 $this->assign('st_sel', 0);
            $this->assign('tsk_sel', 0);
            $this->assign('vn_sel', 0);
            $this->assign('hourly_rate', '0.00');
            $this->assign('invoice_rate', '0.00');
           
                   
            $this->assign('cdate',date("d/m/Y"));
           
           
           // $this->assign('cdate', 'DD-MM-YYYY');
            //$this->assign('timelog', 'HH:MM');
            $this->assign('start_time', 'HH:MM');
            $this->assign('end_time', 'HH:MM');
            $this->assign('start_hours', '00');
            $this->assign('start_minutes', '00');
            $this->assign('end_hours', '00');
            $this->assign('end_minutes', '00');
             
                }
                   
                    // $mainframe->redirect('index.php?option=com_projectfork&view=timesheets');
       
            // $mainframe = &JFactory::getApplication();
             //  $mainframe->redirect('index.php?option=com_projectfork&view=add_timesheet&Itemid=555');
           
            }
           
           
           
            






Joomla 1.5 Register message - 'in order to use Cookie Consent

I've installed 'Cookie Consent' on a Joomla 1.5 installation and am getting this message when a user clicks on register.

Developer: Caution! In order to use Cookie Consent, you need to use jQuery 1.4.4 or higher.

I found the solution was to install this component

JQuery Easy

Infact I've also got JQuery issues on other parts of my websites, so will try this plugin there also as it may be a fix for other Joomla issues I'm having.


Wednesday 20 June 2012

Transferring over a Domain Name to your Heart Internet Dedicated server.

I've written these Heart help files as in my circumstance the order of which things need to be done is different.  As I buy my domains through another provider, which means my domain will not be on the manage>express dns list.

 From your Heart Internet Customer Area, go to 'Manage>Dedicated Servers' from the right-hand menu.
- Scroll down to 'Domain References for Dedicated Servers'.
- Enter your domain into the text field and hit 'Create Reference', do not include any subdomains (e.g. www/ftp/mail).


.....


- From your Heart Internet Customer Area, go to 'Manage>Dedicated Servers' from the right-hand menu.
- Scroll down to 'Express DNS for Dedicated Servers'.
- Select your dedicated server from the drop-down list.
- Select your domain from the second drop-down list.
- Click 'Set DNS'.
- This will automatically point the domain at the primary IP address of your dedicated server, the following services are included (www, ftp, *, @), mail is excluded.
- More granular controls are also available, look for the text: 'The following DNS settings will be created for yourdomain.com , please click here for more advanced settings.'



Checking Products and Google Shopping Performance

I'll shortly be writing a piece on comparing some stores which are doing well and others that are struggling for sales,  WHY?

anyway this isn't that blog, just some notes on the Womens Clothing store that I do some work for. 

Inga Blouse
__________


https://www.google.co.uk/search?source=ig&hl=en&rlz=&=&q=Inga+Blouse#q=Inga+Blouse&hl=en&prmd=imvns&source=lnms&tbm=shop&sa=X&ei=xJLhT-idIYjh8AOM4tHxAw&ved=0CEsQ_AUoBQ&bav=on.2,or.r_gc.r_pw.r_cp.r_qf.,cf.osb&fp=3d2c054e028a098b&biw=1347&bih=657

£14 more expensive - however different style

Thilda Coat
___________

https://www.google.co.uk/search?source=ig&hl=en&rlz=&=&q=thilda+coat#q=thilda+coat&hl=en&prmd=imvns&source=lnms&tbm=shop&sa=X&ei=o5PhT_m0FsiI8gPqyuj-Aw&ved=0CE0Q_AUoBQ&bav=on.2,or.r_gc.r_pw.r_cp.r_qf.,cf.osb&fp=3d2c054e028a098b&biw=1347&bih=657

only jacket there - picture could be better.


NYDJ Petite Modern Straight Jean
_______________________

https://www.google.co.uk/search?source=ig&hl=en&rlz=&=&q=NYDJ+Petite+Modern+Straight+Jean#q=NYDJ+Petite+Modern+Straight+Jean&hl=en&prmd=imvns&source=lnms&tbm=shop&sa=X&ei=WZThT4mHFM_e8QPapuGYBA&ved=0CHMQ_AUoBQ&bav=on.2,or.r_gc.r_pw.r_cp.r_qf.,cf.osb&fp=3d2c054e028a098b&biw=1347&bih=657

Camille Flannel Tab Skirt
_______________________

https://www.google.co.uk/search?source=ig&hl=en&rlz=&=&q=back+to+basic+top#hl=en&gs_nf=1&ds=sh&pq=back%20to%20basic%20top&cp=25&gs_id=y&xhr=t&q=Camille%20Flannel%20Tab%20Skirt&pf=p&tbm=shop&sclient=psy-ab&oq=Camille+Flannel+Tab+Skirt&aq=f&aqi=&aql=&gs_l=&pbx=1&bav=on.2,or.r_gc.r_pw.r_cp.r_qf.,cf.osb&fp=3d2c054e028a098b&biw=1359&bih=657

Hadas Tunic
_______________

https://www.google.co.uk/search?source=ig&hl=en&rlz=&=&q=Hadas+Tunic#q=Hadas+Tunic&hl=en&prmd=imvns&source=lnms&tbm=shop&sa=X&ei=4ZXhT4DhH8eV8QO-wqHuAw&ved=0CEoQ_AUoBQ&bav=on.2,or.r_gc.r_pw.r_cp.r_qf.,cf.osb&fp=3d2c054e028a098b&biw=1359&bih=657

Monday 18 June 2012

Having problem setting up Facebook Autorisation in Joomla Autotweet

If you're having a problem with 1st Movers Autotweet and more importantly the authorization then try a different browser !  Because for me soon as I tried Chrome instead on Mozilla it worked.

Friday 15 June 2012

How to set up a new email address in Heart Internet - and on Outlook


To get a new mail address



> login to the control panel
> Find an click on 'Mail Boxes' which is the second group of icons down under 'Email

> enter the name you want before the '@whateverdomain.com'
> and click on 'create'



Setting up email in Outlook 2010

1. Start Outlook.
2. On the File menu, click Account Settings.
3. Click New.
4. Click E-mail Account
5. In the Auto Account Setup dialog box, click to select the Manually configure server settings or additional server types check box, and then click Next.
6. Click Internet E-Mail, and then click Next.
7. Fill out the required settings as following:

Your Name: Your name exactly as you want it to appear to recipients when they receive email from you
Email Address: your full email address - eg jsmith@my-domain.com

Account Type: IMAP (recommended)
Incoming mail server: mail. - replace with your domain name, so for example mail.my-domain.com
Outgoing mail server (SMTP): mail. - same as the Incoming mail server

Username: your full email address once again
Password: your mail box password

Ensure that 'Require logon using Secure Password Authentication (SPA) remains unchecked. This is important as you may experience difficulty sending email with this enabled.

8. Click "More Settings..." in the bottom right of the window
9. Click "Outgoing Server" tab at the top.
10. Tick the box labelled "My outgoing server (SMTP) requires authentication"
11. Click "Advanced" tab at the top
12. In the Outgoing mail (SMTP) box, type 25. *Note, if you have trouble sending e-mail, please try changing this to port 587.
13. Ensure that 'This server requires an encrypted connection (SSL) is unchecked
14. The 'Use the following type of encrypted connection:' option should be set to None
15. Click "Ok" to close the window.
16. Click Next after you have completed entering this configuration information, and then click Finish

Thursday 14 June 2012

Joomla 2.5 Payroll System

If you're looking for a Payroll System for Joomla 2.5 then we have been developing one here. Although it's very much in Beta version .


The payroll system is designed as separate system to sit on intranet and has a frontpage admin system that you can


* Add location
* Add/edit Employees
* Staff Invoices
* Company Invoices
* Add Timesheet
* Timesheet alteration
* Post date Invoicing
* BACS reporting
* Alterations


If you're interested in this then please contact me as the project now needs funding to get it out of Beta and into a proper release.  

Contact Little Ripples


Wednesday 13 June 2012

How to limit the search of Latest Timesheets in Joomla Payroll system

Change in com_projectfork/latest_timesheets/

put a limit on SELECT * FROM vfvi7_pf_time_tracking 


OPEN com_projectfork/views/latest_timesheets/view.html.php


change line 107 to

  $query = "SELECT * FROM #__pf_time_tracking  order by id DESC limit 20";

Tuesday 12 June 2012

Adding the Location to the Venue information in Joomla Payroll Component

OPEN

components/com_projectfork/views/add_timesheet/view.html.php


Line 68 has been changed to the following

        //get venues
        $query = "SELECT id,title,location FROM #__pf_projects order by title ";
        $db->setQuery($query);
        $rows = $db->loadObjectList();





        foreach($rows as $row){
            $venues[$row->id] = $row->title.' - '.$row->location;
        }
        $this->assign('venues', $venues);
       


Thursday 7 June 2012

how do I reverse the BACS check to run a report for a second time in Joomla Payrollsystem


In Joomla Payrollsystem how is the check for 'BACS of This Date Are Already Generated'  done .

Open components/com_projectfork/models/bacs.php

at line 25 examine this code.


[code]
 $lstdate = "SELECT last_end_date FROM #__time_diff LIMIT 1";
 $db->setQuery($lstdate);
$l_date = $db->loadResult();



if(($startTime<=$l_date)and($endTime<$l_date))

[/code]


basically if does a search in __time_diff the last set of results and then from here on you can run a BACS report.


So if I delete all results in __time_diff I will be able to re run the BACS again.

This system doesn't seem ideal but will work as long as BACS runs are always done in the order they should be.

Wednesday 6 June 2012

How to set up Multiple Accounts on a Heart Internet Dedicated server


Setting up a Dedicated Server on Heart Internet.

I've never had that much to do with setting up servers so once we got our Dedicated server things .   The first thing I realised is this

* the basic dedicated server set up does not have a WHM / Cpanel installed - this service will cost you an extra £20 a month.  This may effect your decision whether to use a dedicated server or not.

Once you have WHM then you need to  set up you CPANEL accounts for the multiple domains your going to have on your server.

take a look at the WHM documentation to see how to do this

http://docs.cpanel.net/twiki/bin/view/AllDocumentation/WHMDocs/WebHome

How to set up multiple domain on my server using WHM ?

WHM how to set up a new account ?

WHM where to start with setting up sites ?

take a look at this post http://forums.cpanel.net/f354/whm-where-start-setting-up-sites-150661.html
The big clue here that I needed to stumble upon is that before setting up  a new account I need to create a package.


After you make a Package then you need to make an account. 

To do this click on 'Account Functions'

and then on the next screen you'll have a 'create new account' option.


Here's a couple of questions I had while setting things up

should I enable DKIM on my DNS settings ?

DKIM stands for Domain Keys Identified Mail (DKIM) and is a layer of security , so I will be added by it.

http://en.wikipedia.org/wiki/DomainKeys_Identified_Mail


and should I enable SPF on my DNS settings

Sender Policy Framework  - http://en.wikipedia.org/wiki/Sender_Policy_Framework 


again a security layer. -> http://en.wikipedia.org/wiki/Sender_Policy_Framework



After click on 'adding the new account'   I got this message

Account Creation Status: failed
Your system has run out of available ip addresses, or you do not have permission to use any more ip addresses. (Unable to find an ip address.)


this because in the package set up i needed to have 'Dedicated IP' unticked.

After this you get sent the account details for your new account and will need to login to that in a new browser window.