Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Calendar - Monday start

  1. #1
    alex3232 is offline Senior Member
    Join Date
    May 2009
    Posts
    73

    Default Calendar, Quote Module

    Hi,

    I'm new to PHP (I use ASP) , please few questions about Sugar CE 5.2 :

    - how to make the Calendar starting from Monday (not Sunday..)
    - how to create a layout for a quotation and print it (OpenSales - Quote do not work properly, cannot add a product, and caused my Sugar CE to crash while uninstalling it..)

    many thanks
    Last edited by alex3232; 2009-11-25 at 11:24 AM.

  2. #2
    mikesolomon is offline Sugar Community Member
    Join Date
    Feb 2008
    Location
    UK
    Posts
    1,467

    Default Re: Calendar - Monday start

    To change the start day to monday change

    modules/Calendar/Calendar.php

    about line 186

    $first_day_of_month = $this->date_time->get_day_by_index_this_month(-1);

    line 202
    for($i=1;$i<$days_in_week+1;$i++)

    modules/Calendar/DateTimeUtil.php

    line 536
    if ( $day_index < 0 || $day_index > 7 )

    These changes are not upgrade safe
    Mike Solomon
    Development Manager
    Ivy Ltd
    www.ivy.ltd.uk]www.ivy.ltd.uk

    php version 5.2.6
    MySql 5.1.59

  3. #3
    vjatsjeslav is offline Junior Member
    Join Date
    Apr 2010
    Posts
    1

    Default Re: Calendar - Monday start

    Goed tip, tnx

  4. #4
    knoop is offline Sugar Community Member
    Join Date
    Aug 2010
    Posts
    79

    Default Re: Calendar - Monday start

    This works for me in 6.0.

    Can someone tell me how to change the colors of the weekend in another color? Now monday and sunday are dark, the rest is white. I want saturday and sunday dark.

  5. #5
    knoop is offline Sugar Community Member
    Join Date
    Aug 2010
    Posts
    79

    Default Re: Calendar - Monday start

    Like I said, in calenderview it works allright. There's only a problem by clicking de date-dropdown at all pages. This drop-down won't load --> Weekend is undefined (include/javascript/sugar_grp1.js

    Does someone knows what to change in this file? This is te code I think:
    Code:
    this.firstDayOfWeek=firstDayOfWeek;this.date=new Date(date);var month=date.getMonth();var mday=date.getDate();var no_days=date.getMonthDays();date.setDate(1);var day1=(date.getDay()-this.firstDayOfWeek)%7;if(day1<0)
    day1+=7;date.setDate(-day1);date.setDate(date.getDate()+1);var row=this.tbody.firstChild;var MN=Calendar._SMN[month];var ar_days=new Array();var weekend=Calendar._TT["WEEKEND"];for(var i=0;i<6;++i,row=row.nextSibling){var cell=row.firstChild;if(this.weekNumbers){cell.className="day wn";cell.firstChild.data=date.getWeekNumber();cell=cell.nextSibling;}
    row.className="daysrow";var hasdays=false;for(var j=0;j<7;++j,cell=cell.nextSibling,date.setDate(date.getDate()+1)){var iday=date.getDate();var wday=date.getDay();cell.className="day";var current_month=(date.getMonth()==month);if(!current_month){if(this.showsOtherMonths){cell.className+=" othermonth";cell.otherMonth=true;}else{cell.className="emptycell";cell.innerHTML="&nbsp;";cell.disabled=true;continue;}}else{cell.otherMonth=false;hasdays=true;}

  6. #6
    ivit is offline Sugar Community Member
    Join Date
    Mar 2008
    Posts
    187

    Default Re: Calendar - Monday start

    Put the following code in calendar-en.js after "short day names" definition:

    // First day of the week. "0" means display Sunday first, "1" means display
    // Monday first, etc.
    Calendar._FD = 1;

  7. #7
    knoop is offline Sugar Community Member
    Join Date
    Aug 2010
    Posts
    79

    Default Re: Calendar - Monday start

    First of all, thanks for your reply.

    Some questions:

    - I don't have the "short day names" definition in calendar-en.js. (../jscalendar/lang ?)

    - Do I have to undo the changes I made before in modules/Calendar/Calendar.php ?

    - Is an modification like this upgrade safe?

    Thanks for your help!

  8. #8
    ivit is offline Sugar Community Member
    Join Date
    Mar 2008
    Posts
    187

    Default Re: Calendar - Monday start

    Quote Originally Posted by knoop View Post
    First of all, thanks for your reply.

    Some questions:

    - I don't have the "short day names" definition in calendar-en.js. (../jscalendar/lang ?)

    - Do I have to undo the changes I made before in modules/Calendar/Calendar.php ?

    - Is an modification like this upgrade safe?

    Thanks for your help!
    The change I have proposed is for javascript calendar used for date fields.
    I am using it on various 5.x versions, but I don't know is there any changes introduced in ver. 6
    I think you can put
    Calendar._FD = 1;
    anywhere in calendar-en.js, however I have put it just after short name definition.
    Short name definition is something like
    Calendar._SDN = new Array
    ("Sun",
    "Mon",
    "Tue",
    "Wed",
    "Thu",
    "Fri",
    "Sat",
    "Sun");

    After applying mentioned change for javascript calendar, do not forget to clear cache in your browser.
    I guess it is upgrade-safe (but not sure). I have updated many times many instances of sugarcrm and I have never seen sugar patch to introduce new jscalendar.

  9. #9
    knoop is offline Sugar Community Member
    Join Date
    Aug 2010
    Posts
    79

    Default Re: Calendar - Monday start

    To change the start day to monday change

    modules/Calendar/Calendar.php

    about line 186

    $first_day_of_month = $this->date_time->get_day_by_index_this_month(-1);

    line 202
    for($i=1;$i<$days_in_week+1;$i++)

    modules/Calendar/DateTimeUtil.php

    line 536
    if ( $day_index < 0 || $day_index > 7 )
    Do I have to undo these changes I made before?

  10. #10
    knoop is offline Sugar Community Member
    Join Date
    Aug 2010
    Posts
    79

    Default Re: Calendar - Monday start

    I replaced de languagefile of jscalendar with the original. Modified that one with Calendar._FD = 1;

    Now it's working well!

    Thanks!


    edit: if you want to change the backgroundcolor of the weekend in calendarview, edit the file templates_calendar.php with this code

    <td <?php if($j==5 || $j==6) { ?>class="weekEnd"<?php } ?>><?php template_cal_day_slice($args); ?></td>

    The numbers are the days you want to view as weekend.
    Last edited by knoop; 2010-11-25 at 10:17 AM.

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Calendar First day Monday
    By petecorbs in forum Developer Help
    Replies: 2
    Last Post: 2009-05-25, 12:46 PM
  2. It looks like Monday
    By kbrill in forum Musings, Mullings, and Mutterings
    Replies: 7
    Last Post: 2007-03-15, 08:45 AM
  3. Calendar that starts on Monday
    By kbrill in forum Developer Help
    Replies: 12
    Last Post: 2007-02-25, 03:12 AM
  4. Gimme monday! :)
    By t0p0m0rt0 in forum Help
    Replies: 4
    Last Post: 2006-07-07, 06:23 PM
  5. First Weekday monday
    By eturi in forum Help
    Replies: 11
    Last Post: 2005-10-19, 09:45 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •