Pages

Monday, 20 February 2012

Sharepoint 2010 Date Column Validation with [Today] Date

with new SP 2010 Column validation . 1st thought that came to my mind is date field validation with respect to today's date. then quickly create a date column TestDate and  and add the validation formula as below .
=[ TestDate ]>=[TODAY]

Then it will give you a error.
after some hit and trial I found actual expression should be
=[ TestDate ]>=TODAY()


Yapee......

Tuesday, 14 February 2012

WP e-Commerce digital product Download link on google checkout

When you are working with WP e-Commerce plugin for word press linked with Google Checkout for payment .and your shop is for  Digital Product and you feel you need more from this plugin then you are in right place . I have many issues  while configuring this plugin for one of my shop
1. Unable to display download link for digital products  after checkout .
2. No links to download digital product after Google checkout .
3  WP e-Commerce  add multiple  entries to  for single transaction
 4.Google checkout send Pending for shipping mail to user which in confusing .

Solution:
the problem is plugin is not sending google information about the product . it just sends its pricing details.  to fix this go ahead and modify  phugins PHP files

Step 1 Go to Location "..\wp-e-commerce\wpsc-merchants"
Step2 . Open    GoogleCheckout-XML.php
Step 3. Go to Line number  182  ( just above   $cart->AddItem($cart_item); )
Step 4.Add below code to it just before  line $cart->AddItem($cart_item);
  
//Extra code  send media download url to google checkout  
   $siteurl = get_option('siteurl');
   $previous_download_ids = array(0);
   $product_id = wpsc_cart_item_product_id();
   $link = "";
   //$product_data = $wpdb->get_row("SELECT * FROM `".WPSC_TABLE_PRODUCT_LIST."` WHERE `id`='{$product_id}' LIMIT 1", ARRAY_A) ;
   $wpdb->query("UPDATE `".WPSC_TABLE_DOWNLOAD_STATUS."` SET `active`='1' WHERE `product_id` = '$product_id' AND `purchid` = '{$purchase_log[0]['id']}'");
   
   $download_data = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_DOWNLOAD_STATUS."`
       WHERE `".WPSC_TABLE_DOWNLOAD_STATUS."`.`active`='1'
       AND `".WPSC_TABLE_DOWNLOAD_STATUS."`.`purchid`='".$purchase_log[0]['id']."'
       AND `".WPSC_TABLE_DOWNLOAD_STATUS."`.`product_id` ='".$product_id."'
       AND `".WPSC_TABLE_DOWNLOAD_STATUS."`.`id` NOT IN ('".implode("','",$previous_download_ids)."')",ARRAY_A);
     
     $link=array();
     if(sizeof($download_data) != 0) {
      foreach($download_data as $single_download){
       if($single_download['uniqueid'] == null){// if the uniqueid is not equal to null, its "valid", regardless of what it is
        $link[] = array("url"=>$siteurl."?downloadid=".$single_download['id'], "name" =>$single_download["filename"]); 
       } else {
        $link[] = array("url"=>$siteurl."?downloadid=".$single_download['uniqueid'], "name" =>$single_download["filename"]);
       }
      }
     }
   foreach($link as $single_link)
   {
    // $product_list .= "\n\r ".$single_link["name"].": ".$single_link["url"]."\n\r";
    $cart_item->SetURLDigitalContent($single_link["url"], null, wpsc_cart_item_name());
    break;
   }
      //End of extra code  Vijay
Step 4. Now you are done .

What the above line of code will do ?
1. Create entry in WPSC_TABLE_DOWNLOAD_STATUS table unique id for download url .
2. Activate the URL
3. Send download URL information to Google to be displayed in Google checkout page after transaction complete. user really dont have to come back to your site to get the download link
4. Along with download URL Google will treat this product as digital digital product so no shipping issue  .
5. on top of all these this download  url information will be there in Google checkout mail send to buyer .

I hope wp-ecommerce will add this oprion to there code .


Friday, 5 March 2010

Updating site the site content type failed. Infopath 2007

Suddenly one day while publishing an InfoPath form with 40+ fields promoted as column to a SharePoint library I found it started throwing error msg “Updating site the site content type failed”.
After doing some research on it I found basically this issue is due to inc in number of column promoted to library .

1. when we publish InfoPath forms with more than 30+ column some time it take more than 30 sec(time taken for .xsn file to get copied into sharepoint site not the entire publish wizard) . and problem is here in infopath client process time out is hard-coded for 30 sec . this is why we get this error.

Solution for this :
1. MS have fixed this 30 sec hardcoded issue in SP2 of MS Office clients ((MS Office SP2 Download))


2. If By any chance you cannot upgrade to SP2 then only solution for Is remove few promoted column till it publish successfully. or check for network speed if it is slow enough to increase the publish time more than 30 sec, switch to higher network speed.

Tuesday, 13 January 2009

MOSS 2007 'Hello world' WebPart

In order to develop moss 2007 webpart you will need

1. Visual Studio 2005/2008 or later.


2. You will also need network access to a Windows 2003/2008 server with SharePoint 2007 (WSS or MOSS) . One can also install Visual Studio 2005/8 on the development server.


3. Administration rights on your SharePoint server and also administration rights on SharePoint web application.




Step 1: Create a Class Library project in vs 2005


2. Add a reference to System.Web




3. create a simple Web Part that will print "Hello World!" . bellow class will inherits from the WebPart class in System.Web.UI.WebControls.WebParts. In order to render the Web Part we need to overrides the Render method. A HtmlTextWriter instance is passed into the Render method and can then be used to write markup to the page output.

Code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
namespace HelloWorld_Webpart
{
public class HelloWorld :WebPart
{
//test Hello world webpart
protected override void Render(HtmlTextWriter writer)
{
// base.Render(writer);
writer.Write("Hello World from Vijay");
}
}
}

4. Attach ur class library with a strong name key
5. Add the statements
using System.Security;
and
[assembly: AllowPartiallyTrustedCallers] to AssemblyInfo.cs file.

6. builds the project and copy the dll( HelloWorld Webpart.dll ) to C:\Inetpub\wwwroot\wss\VirtualDirectories\37459(Port no of web application)\bin
7. Add the webpart detail as safe control entry in webconfig file as
Reflector tool(free download)





Wednesday, 20 August 2008

How to send multi value parameter to oracle store procedure

Hi all ,

From past 1 week i am goggling how to send multi value parameter to oracle store procedure from SSRS 2005.

As we can't send delimiter separated multiple values to oracle store procedure IN CLAUSE. We are left with two option

1st option : use a user define split function which Take a comma delimited list of values in a single string and return it as a table of values to IN clause of ur store procedure

step 1. define the result type to be a TABLE type of the largest possible string.

create or replace type split_tbl as table of varchar2(32767);/show errors;
step 2. Create a function split

create or replace function split( p_list varchar2, p_del varchar2 := ',') return split_tbl pipelinedis l_idx pls_integer; l_list varchar2(32767) := p_list;AA l_value varchar2(32767);begin loop l_idx := instr(l_list,p_del); if l_idx > 0 then pipe row(substr(l_list,1,l_idx-1)); l_list := substr(l_list,l_idx+length(p_del)); else pipe row(l_list); exit; end if; end loop; return;end split;/show errors;
Step 3. use this split( ) in ur store procedure
CREATE OR REPLACE PROCEDURE PR_RANKING_SSRS( multivaluestring IN VARCHAR2,
PO_RANKING OUT SYS_REFCURSOR) IS

BEGIN
OPEN PO_RANKING FOR
SELECT col_namr FROM tbl_name
WHERE (any_Col_name IN ( select * from table(split(( multivaluestring )) ));
END PR_RANKING_SSRS;



2nd option if u don’t have to create table privilege on database then use dynamic SQL query.


Step1: create a store procedure as bellow . and send ur multi value parameter as comma separated string from SSRS 2005

CREATE OR REPLACE PROCEDURE PR_RANKING_SSRS( multivalue_parameter IN VARCHAR2,
PO_RANKING OUT SYS_REFCURSOR) IS
query_str VARCHAR2(1000);
BEGIN
query_str := 'SELECT Col_name
FROM Table_name
WHERE (BRAND_NM IN (' multivalue_parameter '))
GROUP BY XYZ_col_Name
ORDER BY XYZ_xyz_col_name;

OPEN PO_RANKING FOR query_str;
END PR_RANKING_SSRS;



Note : ur parameter string should be like = 'abc’,’def’,’geh’,’ddd'
Not like abc,def,geh,ddd or like abc’,’def’,’geh’,’ddd