Extension talk:DocumentApproval

Multiple approvals not working
I had to make some changes to get multiple approvals to work. Below is the diff to show what I changed.

214a215 > 303,304c304 <              $req_userid = 0; < --- > 306,307c306,307 <                $sql =  "SELECT description FROM ". $dbr->tableName('approval_request'); <                $sql .= " WHERE page_id = ". $pageid. " AND user_id = ". $userid; --- >                $sql =  "SELECT user_id, description FROM ". $dbr->tableName('approval_request'); >                $sql .= " WHERE page_id = ". $pageid; 313,314c313,314 <                    $req_userid = $userid; <                    $req_description = $row[0]; --- >                    $req_userid = $row[0]; >                    $req_description = $row[1]; 563d562 < ?>

Hope that helps. It's a good extension. --Paul 01:27, 12 February 2008 (UTC)

Question about roles
How do I set the roles? And does it work that any user with that role can sign a document or does the user have to be defined as well as the role?

Issue with linefeeds (/n)
I modified the function fnDocumentApproval and moved the assignment of $function inside the if check for $login because when $requests was assigned from splitting $inputs on "\n" the first and last value in the array is blank and thus there is no value for $function = $request[1].

.. FROM .. function fnDocumentApproval( $input, $argv, &$parser ) {

daTableCheck; $requests=split("\n",$input); .. ..  foreach($requests as $request) {       $request=split(";",trim($request)); $login = $request[0]; $function = $request[1]; if ($login != "") {           $counter++; // Gets userid $userid = getUserIDFromUserText($login);

.. TO .. function fnDocumentApproval( $input, $argv, &$parser ) {

daTableCheck; $requests=split("\n",$input); .. ..  foreach($requests as $request) {       $request=split(";",trim($request)); $login = $request[0]; if ($login != "") {           $function = $request[1]; $counter++; // Gets userid $userid = getUserIDFromUserText($login);